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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c8a00e43e4bb841c02d91a225bb985ff08c7ac56
| 22,404
|
py
|
Python
|
nova/tests/unit/scheduler/filters/test_numa_topology_filters.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | null | null | null |
nova/tests/unit/scheduler/filters/test_numa_topology_filters.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | null | null | null |
nova/tests/unit/scheduler/filters/test_numa_topology_filters.py
|
bopopescu/nova-token
|
ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2
|
[
"Apache-2.0"
] | 2
|
2017-07-20T17:31:34.000Z
|
2020-07-24T02:42:19.000Z
|
begin_unit
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'# License for the specific language governing permissions and limitations'
nl|'\n'
comment|'# under the License.'
nl|'\n'
nl|'\n'
name|'import'
name|'itertools'
newline|'\n'
name|'import'
name|'uuid'
newline|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'objects'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'objects'
name|'import'
name|'fields'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'scheduler'
op|'.'
name|'filters'
name|'import'
name|'numa_topology_filter'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'test'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'tests'
op|'.'
name|'unit'
op|'.'
name|'scheduler'
name|'import'
name|'fakes'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|TestNUMATopologyFilter
name|'class'
name|'TestNUMATopologyFilter'
op|'('
name|'test'
op|'.'
name|'NoDBTestCase'
op|')'
op|':'
newline|'\n'
nl|'\n'
DECL|member|setUp
indent|' '
name|'def'
name|'setUp'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'super'
op|'('
name|'TestNUMATopologyFilter'
op|','
name|'self'
op|')'
op|'.'
name|'setUp'
op|'('
op|')'
newline|'\n'
name|'self'
op|'.'
name|'filt_cls'
op|'='
name|'numa_topology_filter'
op|'.'
name|'NUMATopologyFilter'
op|'('
op|')'
newline|'\n'
nl|'\n'
DECL|member|_get_spec_obj
dedent|''
name|'def'
name|'_get_spec_obj'
op|'('
name|'self'
op|','
name|'numa_topology'
op|')'
op|':'
newline|'\n'
indent|' '
name|'image_meta'
op|'='
name|'objects'
op|'.'
name|'ImageMeta'
op|'('
name|'properties'
op|'='
name|'objects'
op|'.'
name|'ImageMetaProps'
op|'('
op|')'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
name|'numa_topology'
op|'='
name|'numa_topology'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'None'
op|','
nl|'\n'
name|'instance_uuid'
op|'='
name|'str'
op|'('
name|'uuid'
op|'.'
name|'uuid4'
op|'('
op|')'
op|')'
op|','
nl|'\n'
name|'flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'extra_specs'
op|'='
op|'{'
op|'}'
op|')'
op|','
nl|'\n'
name|'image'
op|'='
name|'image_meta'
op|')'
newline|'\n'
name|'return'
name|'spec_obj'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_pass
dedent|''
name|'def'
name|'test_numa_topology_filter_pass'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'16.0'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_numa_instance_no_numa_host_fail
dedent|''
name|'def'
name|'test_numa_topology_filter_numa_instance_no_numa_host_fail'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
nl|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
op|'{'
string|"'pci_stats'"
op|':'
name|'None'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_numa_host_no_numa_instance_pass
dedent|''
name|'def'
name|'test_numa_topology_filter_numa_host_no_numa_instance_pass'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'None'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_fail_fit
dedent|''
name|'def'
name|'test_numa_topology_filter_fail_fit'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'2'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'2'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'16.0'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_fail_memory
dedent|''
name|'def'
name|'test_numa_topology_filter_fail_memory'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'1024'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'16.0'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_fail_cpu
dedent|''
name|'def'
name|'test_numa_topology_filter_fail_cpu'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|','
number|'4'
op|','
number|'5'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'512'
op|')'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'1'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_pass_set_limit
dedent|''
name|'def'
name|'test_numa_topology_filter_pass_set_limit'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'21'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.3'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
name|'limits'
op|'='
name|'host'
op|'.'
name|'limits'
op|'['
string|"'numa_topology'"
op|']'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'limits'
op|'.'
name|'cpu_allocation_ratio'
op|','
number|'21'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertEqual'
op|'('
name|'limits'
op|'.'
name|'ram_allocation_ratio'
op|','
number|'1.3'
op|')'
newline|'\n'
nl|'\n'
DECL|member|_do_test_numa_topology_filter_cpu_policy
dedent|''
name|'def'
name|'_do_test_numa_topology_filter_cpu_policy'
op|'('
nl|'\n'
name|'self'
op|','
name|'numa_topology'
op|','
name|'cpu_policy'
op|','
name|'cpu_thread_policy'
op|','
name|'passes'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
name|'memory'
op|'='
number|'512'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'objects'
op|'.'
name|'RequestSpec'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|','
nl|'\n'
name|'pci_requests'
op|'='
name|'None'
op|','
nl|'\n'
name|'instance_uuid'
op|'='
name|'str'
op|'('
name|'uuid'
op|'.'
name|'uuid4'
op|'('
op|')'
op|')'
op|')'
newline|'\n'
nl|'\n'
name|'extra_specs'
op|'='
op|'['
nl|'\n'
op|'{'
op|'}'
op|','
nl|'\n'
op|'{'
nl|'\n'
string|"'hw:cpu_policy'"
op|':'
name|'cpu_policy'
op|','
nl|'\n'
string|"'hw:cpu_thread_policy'"
op|':'
name|'cpu_thread_policy'
op|','
nl|'\n'
op|'}'
nl|'\n'
op|']'
newline|'\n'
name|'image_props'
op|'='
op|'['
nl|'\n'
op|'{'
op|'}'
op|','
nl|'\n'
op|'{'
nl|'\n'
string|"'hw_cpu_policy'"
op|':'
name|'cpu_policy'
op|','
nl|'\n'
string|"'hw_cpu_thread_policy'"
op|':'
name|'cpu_thread_policy'
op|','
nl|'\n'
op|'}'
nl|'\n'
op|']'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
op|'{'
nl|'\n'
string|"'numa_topology'"
op|':'
name|'numa_topology'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'1'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'assertion'
op|'='
name|'self'
op|'.'
name|'assertTrue'
name|'if'
name|'passes'
name|'else'
name|'self'
op|'.'
name|'assertFalse'
newline|'\n'
nl|'\n'
comment|'# test combinations of image properties and extra specs'
nl|'\n'
name|'for'
name|'specs'
op|','
name|'props'
name|'in'
name|'itertools'
op|'.'
name|'product'
op|'('
name|'extra_specs'
op|','
name|'image_props'
op|')'
op|':'
newline|'\n'
comment|'# ...except for the one where no policy is specified'
nl|'\n'
indent|' '
name|'if'
name|'specs'
op|'=='
name|'props'
op|'=='
op|'{'
op|'}'
op|':'
newline|'\n'
indent|' '
name|'continue'
newline|'\n'
nl|'\n'
dedent|''
name|'fake_flavor'
op|'='
name|'objects'
op|'.'
name|'Flavor'
op|'('
name|'memory_mb'
op|'='
number|'1024'
op|','
name|'extra_specs'
op|'='
name|'specs'
op|')'
newline|'\n'
name|'fake_image_props'
op|'='
name|'objects'
op|'.'
name|'ImageMetaProps'
op|'('
op|'**'
name|'props'
op|')'
newline|'\n'
name|'fake_image'
op|'='
name|'objects'
op|'.'
name|'ImageMeta'
op|'('
name|'properties'
op|'='
name|'fake_image_props'
op|')'
newline|'\n'
nl|'\n'
name|'spec_obj'
op|'.'
name|'image'
op|'='
name|'fake_image'
newline|'\n'
name|'spec_obj'
op|'.'
name|'flavor'
op|'='
name|'fake_flavor'
newline|'\n'
nl|'\n'
name|'assertion'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_fail_cpu_thread_policy_require
dedent|''
dedent|''
name|'def'
name|'test_numa_topology_filter_fail_cpu_thread_policy_require'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'cpu_policy'
op|'='
name|'fields'
op|'.'
name|'CPUAllocationPolicy'
op|'.'
name|'DEDICATED'
newline|'\n'
name|'cpu_thread_policy'
op|'='
name|'fields'
op|'.'
name|'CPUThreadAllocationPolicy'
op|'.'
name|'REQUIRE'
newline|'\n'
name|'numa_topology'
op|'='
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_do_test_numa_topology_filter_cpu_policy'
op|'('
nl|'\n'
name|'numa_topology'
op|','
name|'cpu_policy'
op|','
name|'cpu_thread_policy'
op|','
name|'False'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_pass_cpu_thread_policy_require
dedent|''
name|'def'
name|'test_numa_topology_filter_pass_cpu_thread_policy_require'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'cpu_policy'
op|'='
name|'fields'
op|'.'
name|'CPUAllocationPolicy'
op|'.'
name|'DEDICATED'
newline|'\n'
name|'cpu_thread_policy'
op|'='
name|'fields'
op|'.'
name|'CPUThreadAllocationPolicy'
op|'.'
name|'REQUIRE'
newline|'\n'
name|'numa_topology'
op|'='
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY_W_HT'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'_do_test_numa_topology_filter_cpu_policy'
op|'('
nl|'\n'
name|'numa_topology'
op|','
name|'cpu_policy'
op|','
name|'cpu_thread_policy'
op|','
name|'True'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_pass_cpu_thread_policy_others
dedent|''
name|'def'
name|'test_numa_topology_filter_pass_cpu_thread_policy_others'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'cpu_policy'
op|'='
name|'fields'
op|'.'
name|'CPUAllocationPolicy'
op|'.'
name|'DEDICATED'
newline|'\n'
name|'cpu_thread_policy'
op|'='
name|'fields'
op|'.'
name|'CPUThreadAllocationPolicy'
op|'.'
name|'PREFER'
newline|'\n'
name|'numa_topology'
op|'='
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
newline|'\n'
nl|'\n'
name|'for'
name|'cpu_thread_policy'
name|'in'
op|'['
nl|'\n'
name|'fields'
op|'.'
name|'CPUThreadAllocationPolicy'
op|'.'
name|'PREFER'
op|','
nl|'\n'
name|'fields'
op|'.'
name|'CPUThreadAllocationPolicy'
op|'.'
name|'ISOLATE'
op|']'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'_do_test_numa_topology_filter_cpu_policy'
op|'('
nl|'\n'
name|'numa_topology'
op|','
name|'cpu_policy'
op|','
name|'cpu_thread_policy'
op|','
name|'True'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_pass_mempages
dedent|''
dedent|''
name|'def'
name|'test_numa_topology_filter_pass_mempages'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'128'
op|','
name|'pagesize'
op|'='
number|'4'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'128'
op|','
name|'pagesize'
op|'='
number|'16'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'16.0'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertTrue'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|test_numa_topology_filter_fail_mempages
dedent|''
name|'def'
name|'test_numa_topology_filter_fail_mempages'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'instance_topology'
op|'='
name|'objects'
op|'.'
name|'InstanceNUMATopology'
op|'('
nl|'\n'
name|'cells'
op|'='
op|'['
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'0'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'3'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'128'
op|','
name|'pagesize'
op|'='
number|'8'
op|')'
op|','
nl|'\n'
name|'objects'
op|'.'
name|'InstanceNUMACell'
op|'('
name|'id'
op|'='
number|'1'
op|','
name|'cpuset'
op|'='
name|'set'
op|'('
op|'['
number|'1'
op|']'
op|')'
op|','
nl|'\n'
name|'memory'
op|'='
number|'128'
op|','
name|'pagesize'
op|'='
number|'16'
op|')'
nl|'\n'
op|']'
op|')'
newline|'\n'
name|'spec_obj'
op|'='
name|'self'
op|'.'
name|'_get_spec_obj'
op|'('
name|'numa_topology'
op|'='
name|'instance_topology'
op|')'
newline|'\n'
name|'host'
op|'='
name|'fakes'
op|'.'
name|'FakeHostState'
op|'('
string|"'host1'"
op|','
string|"'node1'"
op|','
nl|'\n'
op|'{'
string|"'numa_topology'"
op|':'
name|'fakes'
op|'.'
name|'NUMA_TOPOLOGY'
op|','
nl|'\n'
string|"'pci_stats'"
op|':'
name|'None'
op|','
nl|'\n'
string|"'cpu_allocation_ratio'"
op|':'
number|'16.0'
op|','
nl|'\n'
string|"'ram_allocation_ratio'"
op|':'
number|'1.5'
op|'}'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'assertFalse'
op|'('
name|'self'
op|'.'
name|'filt_cls'
op|'.'
name|'host_passes'
op|'('
name|'host'
op|','
name|'spec_obj'
op|')'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
| 12.256018
| 88
| 0.607258
| 3,335
| 22,404
| 3.948126
| 0.055172
| 0.179995
| 0.034176
| 0.047391
| 0.893522
| 0.874611
| 0.856991
| 0.84089
| 0.80922
| 0.771626
| 0
| 0.008479
| 0.094537
| 22,404
| 1,827
| 89
| 12.262726
| 0.64059
| 0
| 0
| 0.963875
| 0
| 0
| 0.370961
| 0.056195
| 0
| 0
| 0
| 0
| 0.00821
| 0
| null | null | 0.013136
| 0.003831
| 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
|
c8ac8f340434d048517144c7f77162a47163c7f5
| 66
|
py
|
Python
|
02/01/isdigit.py
|
pylangstudy/201708
|
126b1af96a1d1f57522d5a1d435b58597bea2e57
|
[
"CC0-1.0"
] | null | null | null |
02/01/isdigit.py
|
pylangstudy/201708
|
126b1af96a1d1f57522d5a1d435b58597bea2e57
|
[
"CC0-1.0"
] | 39
|
2017-07-31T22:54:01.000Z
|
2017-08-31T00:19:03.000Z
|
02/01/isdigit.py
|
pylangstudy/201708
|
126b1af96a1d1f57522d5a1d435b58597bea2e57
|
[
"CC0-1.0"
] | null | null | null |
print('aAzZ'.isdigit())
print('1'.isdigit())
print('①'.isdigit())
| 16.5
| 23
| 0.636364
| 9
| 66
| 4.666667
| 0.444444
| 0.571429
| 0.619048
| 0.952381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031746
| 0.045455
| 66
| 3
| 24
| 22
| 0.634921
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 0
| 0
| 0
| 1
|
0
| 7
|
cdfdbf53e0133d402fbe4f4e39c3d6a6b0060d7f
| 4,614
|
py
|
Python
|
test/test_lmdb_lsh.py
|
williballenthin/datasketch-lmdb
|
2ed3ecfb765bc495cff3c9afb65e95bfa0f091c4
|
[
"Apache-2.0"
] | 1
|
2018-05-02T13:09:56.000Z
|
2018-05-02T13:09:56.000Z
|
test/test_lmdb_lsh.py
|
williballenthin/datasketch-lmdb
|
2ed3ecfb765bc495cff3c9afb65e95bfa0f091c4
|
[
"Apache-2.0"
] | null | null | null |
test/test_lmdb_lsh.py
|
williballenthin/datasketch-lmdb
|
2ed3ecfb765bc495cff3c9afb65e95bfa0f091c4
|
[
"Apache-2.0"
] | null | null | null |
import shutil
import unittest
import contextlib
from hashlib import sha1
import numpy as np
from datasketch_lmdb import LMDBMinHashLSH
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
class TestLMDBMinHashLSH(unittest.TestCase):
def tearDown(self):
shutil.rmtree('lsh-test.bin')
def test_init(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.8)) as lsh:
self.assertTrue(lsh.is_empty())
b1, r1 = lsh.b, lsh.r
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.8, weights=(0.2,0.8))) as lsh:
b2, r2 = lsh.b, lsh.r
self.assertTrue(b1 < b2)
self.assertTrue(r1 > r2)
def test_insert(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=16)) as lsh:
m1 = MinHash(16)
m1.update("a".encode("utf8"))
m2 = MinHash(16)
m2.update("b".encode("utf8"))
lsh.insert("a", m1)
lsh.insert("b", m2)
self.assertTrue("a" in lsh)
self.assertTrue("b" in lsh)
m3 = MinHash(18)
self.assertRaises(ValueError, lsh.insert, "c", m3)
def test_query(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=16)) as lsh:
m1 = MinHash(16)
m1.update("a".encode("utf8"))
m2 = MinHash(16)
m2.update("b".encode("utf8"))
lsh.insert("a", m1)
lsh.insert("b", m2)
result = lsh.query(m1)
self.assertTrue("a" in result)
result = lsh.query(m2)
self.assertTrue("b" in result)
m3 = MinHash(18)
self.assertRaises(ValueError, lsh.query, m3)
def test_remove(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=16)) as lsh:
m1 = MinHash(16)
m1.update("a".encode("utf8"))
m2 = MinHash(16)
m2.update("b".encode("utf8"))
lsh.insert("a", m1)
lsh.insert("b", m2)
lsh.remove("a")
self.assertRaises(ValueError, lsh.remove, "c")
class TestWeightedLMDBMinHashLSH(unittest.TestCase):
def tearDown(self):
shutil.rmtree('lsh-test.bin')
def test_init(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.8)) as lsh:
self.assertTrue(lsh.is_empty())
b1, r1 = lsh.b, lsh.r
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.8, weights=(0.2,0.8))) as lsh:
b2, r2 = lsh.b, lsh.r
self.assertTrue(b1 < b2)
self.assertTrue(r1 > r2)
def test_insert(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=4)) as lsh:
mg = WeightedMinHashGenerator(10, 4)
m1 = mg.minhash(np.random.uniform(1, 10, 10))
m2 = mg.minhash(np.random.uniform(1, 10, 10))
lsh.insert("a", m1)
lsh.insert("b", m2)
self.assertTrue("a" in lsh)
self.assertTrue("b" in lsh)
mg = WeightedMinHashGenerator(10, 5)
m3 = mg.minhash(np.random.uniform(1, 10, 10))
self.assertRaises(ValueError, lsh.insert, "c", m3)
def test_query(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=4)) as lsh:
mg = WeightedMinHashGenerator(10, 4)
m1 = mg.minhash(np.random.uniform(1, 10, 10))
m2 = mg.minhash(np.random.uniform(1, 10, 10))
lsh.insert("a", m1)
lsh.insert("b", m2)
result = lsh.query(m1)
self.assertTrue("a" in result)
result = lsh.query(m2)
self.assertTrue("b" in result)
mg = WeightedMinHashGenerator(10, 5)
m3 = mg.minhash(np.random.uniform(1, 10, 10))
self.assertRaises(ValueError, lsh.query, m3)
def test_remove(self):
with contextlib.closing(LMDBMinHashLSH(path='lsh-test.bin', threshold=0.5, num_perm=4)) as lsh:
mg = WeightedMinHashGenerator(10, 4)
m1 = mg.minhash(np.random.uniform(1, 10, 10))
m2 = mg.minhash(np.random.uniform(1, 10, 10))
lsh.insert("a", m1)
lsh.insert("b", m2)
lsh.remove("a")
self.assertRaises(ValueError, lsh.remove, "c")
if __name__ == "__main__":
unittest.main()
| 34.954545
| 110
| 0.574989
| 593
| 4,614
| 4.430017
| 0.124789
| 0.07461
| 0.045679
| 0.133232
| 0.891511
| 0.891511
| 0.891511
| 0.883137
| 0.883137
| 0.883137
| 0
| 0.052472
| 0.285436
| 4,614
| 131
| 111
| 35.221374
| 0.744313
| 0
| 0
| 0.883495
| 0
| 0
| 0.04508
| 0
| 0
| 0
| 0
| 0
| 0.194175
| 1
| 0.097087
| false
| 0
| 0.07767
| 0
| 0.194175
| 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
|
a802c2125818ff8be9e8dc28a7879ef1ae5b1f5f
| 275
|
py
|
Python
|
gui/uis/windows/analysis_window/__init__.py
|
almogze/PSI
|
142e9c71e74cf9882edfb2525d955a1c20bcb448
|
[
"MIT"
] | null | null | null |
gui/uis/windows/analysis_window/__init__.py
|
almogze/PSI
|
142e9c71e74cf9882edfb2525d955a1c20bcb448
|
[
"MIT"
] | null | null | null |
gui/uis/windows/analysis_window/__init__.py
|
almogze/PSI
|
142e9c71e74cf9882edfb2525d955a1c20bcb448
|
[
"MIT"
] | null | null | null |
# ANALYSIS WINDOW
# ///////////////////////////////////////////////////////////////
from . ui_analysis import UI_AnalysisWindow
# SETUP ANALYSIS WINDOW
# ///////////////////////////////////////////////////////////////
from . setup_analysis_window import SetupAnalysisWindow
| 34.375
| 65
| 0.44
| 17
| 275
| 6.882353
| 0.470588
| 0.358974
| 0.307692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.08
| 275
| 7
| 66
| 39.285714
| 0.462451
| 0.6
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
a8336ddb2112358a7264582a42c430992f78f00d
| 11,348
|
py
|
Python
|
rlkit/samplers/util.py
|
hammer-wang/FOCAL-ICLR
|
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
|
[
"MIT"
] | 24
|
2021-03-24T07:14:52.000Z
|
2022-03-17T08:15:44.000Z
|
rlkit/samplers/util.py
|
hammer-wang/FOCAL-ICLR
|
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
|
[
"MIT"
] | 4
|
2021-06-18T16:38:38.000Z
|
2022-03-18T11:04:45.000Z
|
rlkit/samplers/util.py
|
hammer-wang/FOCAL-ICLR
|
4d19149f86acc1d6b987c93cdd3a9d957535c5e3
|
[
"MIT"
] | 6
|
2021-04-12T18:49:47.000Z
|
2021-09-07T05:33:22.000Z
|
import numpy as np
import logging
def offline_rollout(env, agent, buffer, max_path_length=np.inf, accum_context=True, animated=False, save_frames=False):
# perform online rollout as in rollout()
# If accum_context=True, aggregate offline context
batch_dict = buffer.task_buffers[env._goal_idx].random_batch(max_path_length)
# observations = batch_dict['observations']
# actions = batch_dict['actions']
# rewards = batch_dict['rewards']
# terminals = batch_dict['terminals']
# next_observations = batch_dict['next_observations']
observations = []
actions = []
rewards = []
terminals = []
next_observations = []
agent_infos = [{} for _ in actions]
env_infos = [{} for _ in actions]
path_length = 0
if callable(getattr(env, "sparsify_rewards", None)):
env_infos = [{'sparse_reward': env.sparsify_rewards(r)} for r in rewards]
# batch_dict = dict(
# observations=self._observations[indices],
# actions=self._actions[indices],
# rewards=self._rewards[indices],
# terminals=self._terminals[indices],
# next_observations=self._next_obs[indices],
# sparse_rewards=self._sparse_rewards[indices],
# )
idx = 0
if accum_context:
# update the agent's current context
# while idx < max_path_length:
# o = batch_dict['observations'][idx]
# a = batch_dict['actions'][idx]
# r = batch_dict['rewards'][idx]
# t = batch_dict['terminals'][idx]
# next_o = batch_dict['next_observations'][idx]
# if callable(getattr(env, "sparsify_rewards", None)):
# env_info = {'sparse_reward': env.sparsify_rewards(r)}
# else:
# env_info = {}
# print(o, a, r, o.shape, a.shape, r.shape)
# agent.update_context([o, a, r, next_o, t, env_info])
# idx += 1
agent.update_context_dict(batch_dict=batch_dict, env=env)
agent.infer_posterior(agent.context, task_indices=env._goal_idx)
o = env.reset()
# perform online evaluation
while path_length < max_path_length:
logging.info('task_indices:')
logging.info(agent.task_indices)
logging.info('z')
logging.info(agent.z)
logging.info('o:')
logging.info(o)
a, agent_info = agent.get_action(o)
next_o, r, d, env_info = env.step(a)
logging.info('next_o:')
logging.info(next_o)
logging.info('a')
logging.info(a)
logging.info('r')
logging.info(r)
observations.append(o)
rewards.append(r)
terminals.append(d)
actions.append(a)
agent_infos.append(agent_info)
path_length += 1
o = next_o
if animated:
env.render()
if save_frames:
from PIL import Image
image = Image.fromarray(np.flipud(env.get_image()))
env_info['frame'] = image
env_infos.append(env_info)
if d:
break
actions = np.array(actions)
if len(actions.shape) == 1:
actions = np.expand_dims(actions, 1)
observations = np.array(observations)
if len(observations.shape) == 1:
observations = np.expand_dims(observations, 1)
next_observations = np.array(next_observations)
if len(next_observations.shape) == 1:
next_observations = np.expand_dims(next_observations, 1)
return dict(
observations=observations,
actions=actions,
rewards=np.array(rewards).reshape(-1, 1),
next_observations=next_observations,
terminals=np.array(terminals).reshape(-1, 1),
agent_infos=agent_infos,
env_infos=env_infos,
)
def offline_sample(env, agent, buffer, max_path_length=np.inf, accum_context=True):
"""
The following value for the following keys will be a 2D array, with the
first dimension corresponding to the time dimension.
- observations
- actions
- rewards
- next_observations
- terminals
The next two elements will be lists of dictionaries, with the index into
the list being the index into the time
- agent_infos
- env_infos
:param env:
:param agent:
:param max_path_length:
:param accum_context: if True, accumulate the collected context
:param animated:
:param save_frames: if True, save video of rollout
:return:
"""
# observations = []
# actions = []
# rewards = []
# terminals = []
# o = env.reset()
# goal_idx = env.goal_idx
# next_o = None
# path_length = 0
batch_dict = buffer.task_buffers[env._goal_idx].random_batch(max_path_length)
observations = batch_dict['observations']
actions = batch_dict['actions']
rewards = batch_dict['rewards']
terminals = batch_dict['terminals']
next_observations = batch_dict['next_observations']
agent_infos = [{} for _ in actions]
env_infos = [{} for _ in actions]
if callable(getattr(env, "sparsify_rewards", None)):
env_infos = [{'sparse_reward': env.sparsify_rewards(r)} for r in rewards]
# batch_dict = dict(
# observations=self._observations[indices],
# actions=self._actions[indices],
# rewards=self._rewards[indices],
# terminals=self._terminals[indices],
# next_observations=self._next_obs[indices],
# sparse_rewards=self._sparse_rewards[indices],
# )
idx = 0
if accum_context:
# while idx < max_path_length:
# o = batch_dict['observations'][idx]
# a = batch_dict['actions'][idx]
# r = batch_dict['rewards'][idx]
# t = batch_dict['terminals'][idx]
# next_o = batch_dict['next_observations'][idx]
# if callable(getattr(env, "sparsify_rewards", None)):
# env_info = {'sparse_reward': env.sparsify_rewards(r)}
# print(o, a, r, o.shape, a.shape, r.shape)
# agent.update_context([o, a, r, next_o, t, env_info])
# idx += 1
agent.update_context_dict(batch_dict=batch_dict, env=env)
# agent.infer_posterior(agent.context, task_indices=np.array([env._goal_idx]))
actions = np.array(actions)
if len(actions.shape) == 1:
actions = np.expand_dims(actions, 1)
observations = np.array(observations)
if len(observations.shape) == 1:
observations = np.expand_dims(observations, 1)
next_observations = np.array(next_observations)
if len(next_observations.shape) == 1:
next_observations = np.expand_dims(next_observations, 1)
return dict(
observations=observations,
actions=actions,
rewards=np.array(rewards).reshape(-1, 1),
next_observations=next_observations,
terminals=np.array(terminals).reshape(-1, 1),
agent_infos=agent_infos,
env_infos=env_infos,
)
def rollout(env, agent, max_path_length=np.inf, accum_context=True, animated=False, save_frames=False):
"""
The following value for the following keys will be a 2D array, with the
first dimension corresponding to the time dimension.
- observations
- actions
- rewards
- next_observations
- terminals
The next two elements will be lists of dictionaries, with the index into
the list being the index into the time
- agent_infos
- env_infos
:param env:
:param agent:
:param max_path_length:
:param accum_context: if True, accumulate the collected context
:param animated:
:param save_frames: if True, save video of rollout
:return:
"""
observations = []
actions = []
rewards = []
terminals = []
agent_infos = []
env_infos = []
o = env.reset()
next_o = None
path_length = 0
if animated:
env.render()
while path_length < max_path_length:
logging.info('task_indices:')
logging.info(agent.task_indices)
logging.info('z')
logging.info(agent.z)
logging.info('o:')
logging.info(o)
a, agent_info = agent.get_action(o)
next_o, r, d, env_info = env.step(a)
logging.info('next_o:')
logging.info(next_o)
logging.info('a')
logging.info(a)
logging.info('r')
logging.info(r)
# update the agent's current context
if accum_context:
agent.update_context([o, a, r, next_o, d, env_info])
observations.append(o)
rewards.append(r)
terminals.append(d)
actions.append(a)
agent_infos.append(agent_info)
path_length += 1
o = next_o
if animated:
env.render()
if save_frames:
from PIL import Image
image = Image.fromarray(np.flipud(env.get_image()))
env_info['frame'] = image
env_infos.append(env_info)
if d:
break
actions = np.array(actions)
if len(actions.shape) == 1:
actions = np.expand_dims(actions, 1)
observations = np.array(observations)
if len(observations.shape) == 1:
observations = np.expand_dims(observations, 1)
next_o = np.array([next_o])
next_observations = np.vstack(
(
observations[1:, :],
np.expand_dims(next_o, 0)
)
)
return dict(
observations=observations,
actions=actions,
rewards=np.array(rewards).reshape(-1, 1),
next_observations=next_observations,
terminals=np.array(terminals).reshape(-1, 1),
agent_infos=agent_infos,
env_infos=env_infos,
)
def split_paths(paths):
"""
Stack multiples obs/actions/etc. from different paths
:param paths: List of paths, where one path is something returned from
the rollout functino above.
:return: Tuple. Every element will have shape batch_size X DIM, including
the rewards and terminal flags.
"""
rewards = [path["rewards"].reshape(-1, 1) for path in paths]
terminals = [path["terminals"].reshape(-1, 1) for path in paths]
actions = [path["actions"] for path in paths]
obs = [path["observations"] for path in paths]
next_obs = [path["next_observations"] for path in paths]
rewards = np.vstack(rewards)
terminals = np.vstack(terminals)
obs = np.vstack(obs)
actions = np.vstack(actions)
next_obs = np.vstack(next_obs)
assert len(rewards.shape) == 2
assert len(terminals.shape) == 2
assert len(obs.shape) == 2
assert len(actions.shape) == 2
assert len(next_obs.shape) == 2
return rewards, terminals, obs, actions, next_obs
def split_paths_to_dict(paths):
rewards, terminals, obs, actions, next_obs = split_paths(paths)
return dict(
rewards=rewards,
terminals=terminals,
observations=obs,
actions=actions,
next_observations=next_obs,
)
def get_stat_in_paths(paths, dict_name, scalar_name):
if len(paths) == 0:
return np.array([[]])
if type(paths[0][dict_name]) == dict:
# Support rllab interface
return [path[dict_name][scalar_name] for path in paths]
return [
[info[scalar_name] for info in path[dict_name]]
for path in paths
]
| 32.797688
| 119
| 0.61914
| 1,399
| 11,348
| 4.832738
| 0.106505
| 0.070995
| 0.021151
| 0.014495
| 0.813193
| 0.800177
| 0.776956
| 0.770152
| 0.766307
| 0.766307
| 0
| 0.006273
| 0.269475
| 11,348
| 345
| 120
| 32.892754
| 0.809288
| 0.30252
| 0
| 0.707921
| 0
| 0
| 0.029207
| 0
| 0
| 0
| 0
| 0
| 0.024752
| 1
| 0.029703
| false
| 0
| 0.019802
| 0
| 0.089109
| 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
|
b55970d09e28ed00b424a339812a793e66eba71b
| 94,015
|
py
|
Python
|
src/lib/board_support/scripts/Generate_TestBench.py
|
GaloisInc/BESSPIN-BSC
|
21a0a8cba9e643ef5afcb87eac164cc33ea83e94
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | 1
|
2022-02-11T01:52:42.000Z
|
2022-02-11T01:52:42.000Z
|
src/lib/board_support/scripts/Generate_TestBench.py
|
GaloisInc/BESSPIN-BSC
|
21a0a8cba9e643ef5afcb87eac164cc33ea83e94
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null |
src/lib/board_support/scripts/Generate_TestBench.py
|
GaloisInc/BESSPIN-BSC
|
21a0a8cba9e643ef5afcb87eac164cc33ea83e94
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/python
# Copyright (c) 2105 Bluespec, Inc. All Rights Reserved
# Author: J Schwartz
# ================================================================
# Usage: Generate_TestBench.py pin_file emu_scripts_dir cpp_src_dir [usertb]
# XXX ...
# ================================================================
# Standard Python lib imports
import sys
import os
# ================================================================
# Project imports
from ParsePin import * # The parser for .pin files
# ================================================================
# Generate TclTb.cpp
def genTclTb (output_dir, dut_ifc, new_module_name, usertb):
TclTb_filename = os.path.join (output_dir, "TclTb.cpp")
try:
f_TclTb = open (TclTb_filename, "w")
except:
print "Error opening file: ", TclTb_filename
return 1
print "Generating file: ", TclTb_filename
genTclTbFile (f_TclTb, dut_ifc, new_module_name, usertb)
f_TclTb.close()
return 0
def genTclTbFile (f_out, dut_ifc, new_module_name, usertb):
f_out.write ("// Copyright Bluespec Inc. 2010-2011\n")
f_out.write ("// By: GenTestbench tool\n\n")
f_out.write ("#include <iostream>\n")
f_out.write ("#include <stdexcept>\n")
f_out.write ("#include <string>\n")
f_out.write ("#include <cstdlib>\n")
f_out.write ("#include <cstring>\n\n")
f_out.write ("#include <pthread.h>\n\n")
f_out.write ("// Bluespec's version -- $BLUESPECDIR/tcllib/include\n")
f_out.write ("#include \"tcl.h\"\n\n")
f_out.write ("#include \"%sXactor.h\"\n" % new_module_name)
f_out.write ("#include \"SceMiHeaders.h\"\n\n")
f_out.write ("// Bluespec common code\n")
f_out.write ("#include \"bsdebug_common.h\"\n")
f_out.write ("#include \"designtcl.h\"\n\n")
f_out.write ("// TBXactor\n")
f_out.write ("#include \"TBXactor.h\"\n\n")
f_out.write ("using namespace std;\n\n")
f_out.write ("// the package name and namespace for this extension\n")
f_out.write ("#define PKG_NAME \"BSDebug\"\n")
f_out.write ("#define NS \"bsdebug\"\n")
f_out.write ("#define PKG_VERSION \"1.0\"\n\n")
f_out.write ("extern std::ofstream *rdback_log_file;\n")
if (usertb):
f_out.write ("extern int test_usertb();\n")
f_out.write ("extern int reset_usertb();\n")
f_out.write ("extern void destroy_usertb();\n")
f_out.write ("static unsigned int cmdlog = 0;\n\n")
f_out.write ("// static extension global data\n")
f_out.write ("class SceMiGlobalData {\n")
f_out.write ("public:\n")
f_out.write (" bool m_initialized;\n")
f_out.write (" %sXactor *m_dutXactor;\n" % new_module_name)
f_out.write (" TBXactor *m_tbXactor;\n")
f_out.write (" SceMiServiceThread * m_serviceThread;\n")
f_out.write (" RdBack::SimulationControl * m_simControl;\n")
f_out.write (" SimulationControl * m_tbsimControl;\n")
f_out.write (" ProbesXactor * m_probeControl;\n")
f_out.write (" Design * m_design;\n")
f_out.write (" VCDWriter * m_vcdWriter;\n")
f_out.write ("\n")
f_out.write (" // Simple initializer invoked when the extension is loaded\n")
f_out.write (" SceMiGlobalData()\n")
f_out.write (" : m_dutXactor(0)\n")
f_out.write (" , m_tbXactor(0)\n")
f_out.write (" , m_serviceThread(0)\n")
f_out.write (" , m_simControl(0)\n")
f_out.write (" , m_tbsimControl(0)\n")
f_out.write (" , m_design(0)\n")
f_out.write (" , m_vcdWriter(0)\n")
f_out.write (" {}\n")
f_out.write ("\n")
f_out.write (" ~SceMiGlobalData ()\n")
f_out.write (" {\n")
f_out.write (" if (m_initialized) {\n")
f_out.write (" destroy();\n")
f_out.write (" }\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // Initialization -- call from bsdebug::scemi init <param>\n")
f_out.write (" void init (const char *paramfile)\n")
f_out.write (" {\n")
f_out.write (" // Instantiate TestBench Xactor\n")
f_out.write (" m_tbXactor = TBXactor::getOrCreate();\n")
f_out.write ("\n")
f_out.write (" // Start all the services\n")
f_out.write (" m_tbXactor->startAllServices(paramfile);\n")
f_out.write (" m_simControl = m_tbXactor->getSimulationControl();\n")
f_out.write (" m_tbsimControl = m_tbXactor->getTbSimulationControl();\n")
f_out.write (" m_probeControl = m_tbXactor->getProbeControl();\n")
f_out.write (" m_design = m_tbXactor->getDesign();\n\n")
f_out.write (" // Create the transactor for the dut\n")
f_out.write (" m_dutXactor = %sXactor::init(m_tbXactor->getSceMi());\n" % new_module_name)
f_out.write (" m_initialized = true;\n\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // Destruction -- called from bsdebug::scemi delete\n")
f_out.write (" void destroy () {\n")
f_out.write ("\n")
f_out.write (" m_initialized = false;\n\n")
if (usertb):
f_out.write (" destroy_usertb();\n\n")
f_out.write (" // Stop the simulation side\n")
f_out.write (" if (m_dutXactor) m_dutXactor->shutdown();\n\n")
f_out.write (" if (m_dutXactor) m_dutXactor->destroy();\n")
f_out.write (" if (m_tbXactor) m_tbXactor->destroy();\n")
f_out.write (" fflush(stdout);\n")
f_out.write (" }\n")
f_out.write ("} SceMiGlobal;\n")
f_out.write ("\n\n")
f_out.write ("// forward declarations of C functions which are called by tcl\n")
f_out.write ("extern \"C\" {\n")
f_out.write ("\n")
f_out.write (" // Package intialization and cleanup\n")
f_out.write (" extern int Bsdebug_Init (Tcl_Interp * interp);\n")
f_out.write (" extern int Bsdebug_Unload (Tcl_Interp * interp, int flags);\n")
f_out.write (" extern void Bsdebug_ExitHandler (ClientData clientData);\n")
f_out.write ("\n")
f_out.write (" static int SceMi_Cmd(ClientData clientData,\n")
f_out.write (" Tcl_Interp *interp,\n")
f_out.write (" int objc,\n")
f_out.write (" Tcl_Obj *const objv[]);\n")
f_out.write (" static void SceMi_Cmd_Delete(ClientData clientData);\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write (" static int Dut_Cmd(ClientData clientData,\n")
f_out.write (" Tcl_Interp *interp,\n")
f_out.write (" int objc,\n")
f_out.write (" Tcl_Obj *const objv[]);\n")
f_out.write (" static void Dut_Cmd_Delete(ClientData clientData);\n")
f_out.write ("\n")
f_out.write ("} // extern \"C\"\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write ("// Function called if/when the dynamic library is unloaded\n")
f_out.write ("// Function name must match package library name\n")
f_out.write ("int Bsdebug_Unload (Tcl_Interp * interp, int flags)\n")
f_out.write ("{\n")
f_out.write (" if (flags & TCL_UNLOAD_DETACH_FROM_PROCESS) {\n")
f_out.write (" SceMiGlobalData *pglobal = & SceMiGlobal;\n")
f_out.write (" pglobal->destroy();\n")
f_out.write (" Tcl_DeleteExitHandler ( Bsdebug_ExitHandler, &SceMiGlobal);\n")
f_out.write (" }\n")
f_out.write (" return TCL_OK;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("// Exit handler called during exit.\n")
f_out.write ("void Bsdebug_ExitHandler (ClientData clientData)\n")
f_out.write ("{\n")
f_out.write (" SceMiGlobalData *pglobal = (SceMiGlobalData *) clientData;\n")
f_out.write (" pglobal->destroy();\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("// Package initialization function -- called during package load/require\n")
f_out.write ("// function name must match package library name\n")
f_out.write ("int Bsdebug_Init(Tcl_Interp *interp)\n")
f_out.write ("{\n")
f_out.write (" Tcl_Namespace* nsptr = NULL;\n")
f_out.write ("\n")
f_out.write (" try {\n")
f_out.write (" // Dynmaic binding of this extension to tcl\n")
f_out.write (" // (This must be called before any other 'Tcl_*' function.)\n")
f_out.write (" if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // register the exit handler\n")
f_out.write (" Tcl_CreateExitHandler( Bsdebug_ExitHandler, &SceMiGlobal);\n")
f_out.write ("\n")
f_out.write (" // Create a namespace NS\n")
f_out.write (" nsptr = (Tcl_Namespace*) Tcl_CreateNamespace(interp, NS, NULL, NULL);\n")
f_out.write (" if (nsptr == NULL) {\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // Provide the tcl package\n")
f_out.write (" if (Tcl_PkgProvide(interp, PKG_NAME, PKG_VERSION) != TCL_OK) {\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // Register commands to this tcl extension\n")
f_out.write (" // A top-level tcl bsdebug::scemi command -- application specific boilerplate\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::scemi\",\n")
f_out.write (" (Tcl_ObjCmdProc *) SceMi_Cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal),\n")
f_out.write (" (Tcl_CmdDeleteProc *) SceMi_Cmd_Delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"scemi\", 0);\n")
f_out.write ("\n")
f_out.write (" // A top-level tcl dut command -- application specific\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::dut\",\n")
f_out.write (" (Tcl_ObjCmdProc *) Dut_Cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal.m_dutXactor),\n")
f_out.write (" (Tcl_CmdDeleteProc *) Dut_Cmd_Delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"dut\", 0);\n")
f_out.write ("\n")
f_out.write (" // Bluespec emulation control command\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::emu\",\n")
f_out.write (" (Tcl_ObjCmdProc *) Emu_Cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal.m_tbsimControl),\n")
f_out.write (" (Tcl_CmdDeleteProc *) Emu_Cmd_Delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"emu\", 0);\n")
f_out.write ("\n")
f_out.write (" // Bluespec emulation control command with readback\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::rdbk\",\n")
f_out.write (" (Tcl_ObjCmdProc *) RdBk_Cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal.m_simControl),\n")
f_out.write (" (Tcl_CmdDeleteProc *) RdBk_Cmd_Delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"rdbk\", 0);\n")
f_out.write ("\n")
f_out.write (" // Bluespec probe capture command\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::probe\",\n")
f_out.write (" (Tcl_ObjCmdProc *) Capture_Cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal.m_probeControl),\n")
f_out.write (" (Tcl_CmdDeleteProc *) Capture_Cmd_Delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"probe\", 0);\n")
f_out.write ("\n")
f_out.write (" // Bluespec probe netlist command\n")
f_out.write (" Tcl_CreateObjCommand(interp,\n")
f_out.write (" NS \"::netlist\",\n")
f_out.write (" (Tcl_ObjCmdProc *) llbits_netlist_cmd,\n")
f_out.write (" (ClientData) &(SceMiGlobal.m_design),\n")
f_out.write (" (Tcl_CmdDeleteProc *) llbits_netlist_cmd_delete);\n")
f_out.write (" Tcl_Export(interp, nsptr, \"netlist\", 0);\n")
f_out.write ("\n")
f_out.write (" // Other command can go here\n")
f_out.write ("\n")
f_out.write (" } catch (const exception & error) {\n")
f_out.write (" Tcl_AppendResult(interp, error.what()\n")
f_out.write (" ,\"\\nCould not initialize bsdebug tcl package\"\n")
f_out.write (" ,(char *) NULL);\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write (" return TCL_OK;\n")
f_out.write ("}\n")
f_out.write ("\n\n")
f_out.write ("// implementation of the scemi command ensemble\n")
f_out.write ("// at the tcl level, the command will be\n")
f_out.write ("// bsdebug::scemi init <params file>\n")
f_out.write ("// bsdebug::scemi delete\n")
f_out.write ("static int SceMi_Cmd(ClientData clientData, // &(GlobalXactor),\n")
f_out.write (" Tcl_Interp *interp, // Current interpreter\n")
f_out.write (" int objc, // Number of arguments\n")
f_out.write (" Tcl_Obj *const objv[] // Argument strings\n")
f_out.write (" )\n")
f_out.write ("{\n")
f_out.write (" // Command table\n")
f_out.write (" enum ScemiCmds { scemi_init, scemi_delete };\n")
f_out.write (" static const cmd_struct cmds_str[] = {\n")
f_out.write (" {\"init\", scemi_init, \"<params file>\"}\n")
f_out.write (" ,{\"delete\", scemi_delete, \"\"}\n")
f_out.write (" ,{0} // MUST BE LAST\n")
f_out.write (" };\n")
f_out.write ("\n")
f_out.write (" // Cast client data to proper type\n")
f_out.write (" SceMiGlobalData *pglobal = (SceMiGlobalData *) clientData;\n")
f_out.write ("\n")
f_out.write (" // Extract sub command\n")
f_out.write (" ScemiCmds command;\n")
f_out.write (" int index;\n")
f_out.write (" if (objc == 1) goto wrongArgs;\n")
f_out.write (" if (TCL_OK != Tcl_GetIndexFromObjStruct (interp, objv[1], cmds_str, sizeof(cmd_struct),\n")
f_out.write (" \"command\", 0, &index ) ) {\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write (" command = (enum ScemiCmds) cmds_str[index].enumcode;\n")
f_out.write (" switch (command) {\n")
f_out.write (" case scemi_init:\n")
f_out.write (" {\n")
f_out.write (" if (objc != 3) goto wrongArgs;\n")
f_out.write (" char *paramfile = Tcl_GetString(objv[2]);\n")
f_out.write (" try {\n")
f_out.write (" pglobal->init(paramfile);\n")
f_out.write (" } catch (const exception & error) {\n")
f_out.write (" Tcl_AppendResult(interp, error.what()\n")
f_out.write (" ,\"\\nCould not initialize emulation\"\n")
f_out.write (" ,(char *) NULL);\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write (" break;\n")
f_out.write (" }\n")
f_out.write (" case scemi_delete:\n")
f_out.write (" pglobal->destroy();\n")
f_out.write (" break;\n")
f_out.write (" }\n")
f_out.write (" return TCL_OK;\n")
f_out.write ("\n")
f_out.write ("wrongArgs:\n")
f_out.write (" dumpArguments (interp, cmds_str, Tcl_GetString(objv[0]));\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("static void SceMi_Cmd_Delete(ClientData clientData)\n")
f_out.write ("{\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write ("// implementation of the Dut command ensemble\n")
f_out.write ("// dut request <int>\n")
f_out.write ("// dut response\n")
f_out.write ("static int Dut_Cmd(ClientData clientData, // &(GlobalXactor.m_dutXactor)\n")
f_out.write (" Tcl_Interp *interp, // Current interpreter\n")
f_out.write (" int objc, // Number of arguments\n")
f_out.write (" Tcl_Obj *const objv[] // Argument strings\n")
f_out.write (" )\n")
f_out.write ("{\n")
# Declare the types
# BitT<16> request_put_bits;
# BitT<32> response_get_bits;
# BitT<8> cin_c_bits;
# BitT<8> dout_bits;
input_counts = 0
output_counts = 0
enable_counts = 0
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
input_counts += 1
f_out.write (" BitT<%d> %s_bits;\n" % (xactor.field_width, xactor_name))
elif isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
output_counts += 1
f_out.write (" BitT<%d> %s_bits;\n" % (xactor.field_width, xactor_name))
elif isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
enable_counts += 1
for j in range (len (xactor.verilog_names)):
f_out.write (" BitT<%d> %s_bits;\n" % (xactor.field_widths [j], xactor.verilog_names [j]))
elif isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
enable_counts += 1
for j in range (len (xactor.verilog_names)):
f_out.write (" BitT<%d> %s_bits;\n" % (xactor.field_widths [j], xactor.verilog_names [j]))
# Memories are not connected to the test bench
f_out.write ("\n")
f_out.write (" // Command table\n")
f_out.write (" enum DutCmds {")
# whether this is the first enum (and doesn't need a preceeding comma)
first = 1
# enums for Get/Put
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("Dut_Response_%s" % xactor_name)
elif isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("Dut_Request_%s" % xactor_name)
# enum for inputs
if (input_counts > 0):
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("Dut_Request")
# enum for outputs
if (output_counts > 0):
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("Dut_Response")
# user testbench
if (usertb):
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("Dut_Test, Dut_Reset")
# other commands
if (first == 0):
f_out.write (", ")
f_out.write ("Dut_CmdLog};\n")
f_out.write (" static const cmd_struct cmds_str[] = {\n")
first = 1
# command entries for Get/Put
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
if (first == 0):
f_out.write (" ,")
else:
f_out.write (" ")
first = 0
f_out.write ("{\"response_%s\", Dut_Response_%s, \"\"}\n" % (xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
if (first == 0):
f_out.write (" ,")
else:
f_out.write (" ")
first = 0
f_out.write ("{\"request_%s\", Dut_Request_%s, \"" % (xactor_name, xactor_name))
for j in range (len (xactor.verilog_names)):
if (j > 0):
f_out.write (", ")
f_out.write ("int")
f_out.write ("\"}\n")
# command entry for inputs
if (input_counts > 0):
if (first == 0):
f_out.write (" ,")
else:
f_out.write (" ")
first = 0
f_out.write ("{\"request\", Dut_Request, \"")
for j in range (input_counts):
if (j > 0):
f_out.write (", ")
f_out.write ("int")
f_out.write ("\"}\n")
# command entry for outputs
if (output_counts > 0):
if (first == 0):
f_out.write (" ,")
else:
f_out.write (" ")
first = 0
f_out.write ("{\"response\", Dut_Response, \"\"}\n")
# command entry for user testbench
if (usertb):
if (first == 0):
f_out.write (" ,")
else:
f_out.write (" ")
first = 0
f_out.write ("{\"test\", Dut_Test, \"\"}\n")
f_out.write (" ,{\"reset\", Dut_Reset, \"\"}\n")
# command entry for other commands
if (first == 0):
f_out.write (" ,")
f_out.write ("{\"cmdlog\", Dut_CmdLog, \"val\"}\n")
f_out.write (" ,{0} // MUST BE LAST\n")
f_out.write (" };\n")
f_out.write ("\n")
f_out.write (" // Check that client data has been set\n")
f_out.write (" %sXactor *dutx = *(%sXactor **) clientData;\n" % (new_module_name, new_module_name))
f_out.write (" if (dutx == 0) {\n")
f_out.write (" Tcl_SetResult (interp, (char *) \"Cannot use dut command before emulation initialization\", TCL_STATIC );\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" // Extract sub command\n")
f_out.write (" DutCmds command;\n")
f_out.write (" int index;\n")
f_out.write (" if (objc == 1) goto wrongArgs;\n")
f_out.write (" if (TCL_OK != Tcl_GetIndexFromObjStruct (interp, objv[1], cmds_str, sizeof(cmd_struct),\n")
f_out.write (" \"command\", 0, &index ) ) {\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write (" command = (enum DutCmds) cmds_str[index].enumcode;\n")
f_out.write ("\n")
# variables to hold Put data
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
enable_counts += 1
for j in range (len (xactor.verilog_names)):
f_out.write (" long %s;\n" % xactor.verilog_names [j])
# variables to hold input/output data
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write (" long %s;\n" % xactor_name)
elif isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
f_out.write (" long %s;\n" % xactor_name)
f_out.write (" unsigned int off;\n")
f_out.write (" bool sent;\n")
f_out.write ("\n")
f_out.write (" switch (command) {\n")
# case arms for Get/Put
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write (" case Dut_Response_%s:\n" % xactor_name)
f_out.write (" {\n")
f_out.write (" Tcl_Obj *r, *res;\n")
f_out.write (" if (objc != 2) goto wrongArgs;\n")
f_out.write (" bool gotit;\n")
f_out.write ("\n")
f_out.write (" gotit = dutx->get_%s(" % xactor_name)
first = 1
for verilog_name in xactor.verilog_names:
if (first == 0):
f_out.write (", ")
first = 0
f_out.write ("%s_bits" % verilog_name)
f_out.write (");\n\n")
f_out.write (" if (gotit) {\n")
f_out.write (" // Convert result to a object and return\n")
first = 1
for verilog_name in xactor.verilog_names:
if (first == 1):
f_out.write (" long %s;\n" % verilog_name)
f_out.write (" r = Tcl_NewIntObj(1);\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n\n")
f_out.write (" %s = %s_bits;\n" % (verilog_name, verilog_name))
f_out.write (" res = Tcl_NewLongObj(%s);\n" % verilog_name)
f_out.write (" Tcl_ListObjAppendElement(interp, r, res);\n\n")
first = 0
else:
f_out.write (" long %s;\n" % verilog_name)
f_out.write (" %s = %s_bits;\n" % (verilog_name, verilog_name))
f_out.write (" res = Tcl_NewLongObj(%s);\n" % verilog_name)
f_out.write (" Tcl_ListObjAppendElement(interp, r, res);\n\n")
f_out.write (" } else {\n")
f_out.write (" r = Tcl_NewIntObj(0);\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n")
f_out.write (" }\n\n")
f_out.write (" // Log this function call\n")
f_out.write (" if (cmdlog)\n")
f_out.write (" {\n")
f_out.write (" (*rdback_log_file) << \"waitForResponse \\\"bsdebug::dut response_%s\\\" 100\" << std::endl;\n" % xactor_name)
f_out.write (" }\n")
f_out.write (" break;\n")
f_out.write (" }\n")
elif isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write (" case Dut_Request_%s:\n" % xactor_name)
f_out.write (" {\n")
f_out.write (" if (objc != %d) goto wrongArgs;\n\n" % (len(xactor.verilog_names) + 2))
i = 2
first = 1
params = ""
for verilog_name in xactor.verilog_names:
f_out.write (" if (Tcl_GetLongFromObj(interp, objv[%d], &%s) != TCL_OK) {\n" % (i,verilog_name))
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write (" %s_bits = %s;\n\n" % (verilog_name, verilog_name))
if (first):
params = " << "
first = 0
else:
params += " << \" \" << "
params += verilog_name
i += 1
f_out.write ("\n")
f_out.write (" sent = dutx->put_%s(" % xactor_name)
first_vname = 1
for verilog_name in xactor.verilog_names:
if first_vname:
first_vname = 0
else:
f_out.write (", ")
f_out.write ("%s_bits" % verilog_name)
f_out.write (");\n\n")
f_out.write (" Tcl_Obj *r = Tcl_NewBooleanObj( sent );\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n\n")
f_out.write (" // Log this function call\n")
f_out.write (" if (cmdlog)\n")
f_out.write (" {\n")
f_out.write (" (*rdback_log_file) << \"bsdebug::dut request_%s \"%s << std::endl;\n" % (xactor_name, params))
f_out.write (" }\n")
f_out.write (" break;\n")
f_out.write (" }\n")
# case arms for inputs
if (input_counts > 0):
f_out.write (" case Dut_Request:\n")
f_out.write (" {\n")
f_out.write (" if (objc != %d) goto wrongArgs;\n\n" % (input_counts + 2))
i = 2
first = 1
params = ""
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write (" if (Tcl_GetLongFromObj(interp, objv[%d], &%s) != TCL_OK) {\n" % (i, xactor_name))
f_out.write (" return TCL_ERROR;\n")
f_out.write (" }\n")
f_out.write (" %s_bits = %s;\n" % (xactor_name, xactor_name))
if (first == 1):
params = " << "
first = 0
else:
params += " << \\\" \\\" << "
params += xactor_name
f_out.write ("\n")
i += 1
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
if (first == 1):
f_out.write (" sent = dutx->send_%s(" % xactor_name)
f_out.write ("%s_bits);\n" % xactor_name)
first = 0
else:
f_out.write (" sent &= dutx->send_%s(" % xactor_name)
f_out.write ("%s_bits);\n" % xactor_name)
first = 0
f_out.write (" Tcl_Obj *r = Tcl_NewBooleanObj( sent );\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n")
f_out.write (" // Log this function call\n")
f_out.write (" if (cmdlog)\n")
f_out.write (" {\n")
f_out.write (" (*rdback_log_file) << \"bsdebug::dut request %s\" << std::endl;\n" % params)
f_out.write (" }\n")
f_out.write (" break;\n")
f_out.write (" }\n")
# case arms for outputs
if (output_counts > 0):
f_out.write (" case Dut_Response:\n")
f_out.write (" {\n")
f_out.write (" Tcl_Obj *r, *res;\n")
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
if (first == 1):
f_out.write (" long %s" % xactor_name)
first = 0
else:
f_out.write (", %s" % xactor_name)
if (first == 0):
f_out.write (";\n")
f_out.write (" if (objc != 2) goto wrongArgs;\n")
f_out.write (" bool gotit;\n")
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
if (first == 1):
f_out.write (" gotit = dutx->receive_%s(" % xactor_name)
first = 0
else:
f_out.write (" gotit |= dutx->receive_%s(" % xactor_name)
f_out.write ("%s_bits);\n" % xactor_name)
f_out.write (" if (gotit) {\n")
f_out.write (" // Convert result to a object and return\n")
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
if (first == 1):
f_out.write (" r = Tcl_NewIntObj(1);\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n\n")
f_out.write (" %s = %s_bits;\n" % (xactor_name, xactor_name))
f_out.write (" res = Tcl_NewLongObj(%s);\n" % xactor_name)
f_out.write (" Tcl_ListObjAppendElement(interp, r, res);\n")
first = 0
else:
f_out.write (" %s = %s_bits;\n" % (xactor_name, xactor_name))
f_out.write (" res = Tcl_NewLongObj(%s);\n" % xactor_name)
f_out.write (" Tcl_ListObjAppendElement(interp, r, res);\n")
f_out.write (" } else {\n")
f_out.write (" r = Tcl_NewIntObj(0);\n")
f_out.write (" Tcl_SetObjResult(interp, r );\n")
f_out.write (" }\n\n")
f_out.write (" // Log this function call\n")
f_out.write (" if (cmdlog)\n")
f_out.write (" {\n")
f_out.write (" (*rdback_log_file) << \"waitForResponse \\\"bsdebug::dut response\\\" 100\" << std::endl;\n")
f_out.write (" }\n")
f_out.write (" break;\n")
f_out.write (" }\n")
# case arms for user testbench
if (usertb):
f_out.write (" case Dut_Test:\n")
f_out.write (" {\n")
f_out.write (" //if (objc != 2) goto wrongArgs;\n\n")
f_out.write (" // **Example how you receive a parameter from the caller below**\n")
f_out.write (" //std::string filename;\n")
f_out.write (" //filename = Tcl_GetString(objv[2]);\n\n")
f_out.write (" // Redirect cout to our stringstream buffer or any other ostream\n")
f_out.write (" setvbuf(stdout, NULL, _IONBF, 0);\n")
f_out.write (" std::stringstream buffer;\n")
f_out.write (" std::streambuf *sbuf = std::cout.rdbuf();\n")
f_out.write (" test_usertb(); // ** This is where the call to customed function is made.**\n")
f_out.write (" // When done redirect cout to its old self\n")
f_out.write (" std::cout.rdbuf(sbuf);\n\n")
f_out.write (" Tcl_Obj *r = Tcl_NewStringObj(buffer.str().c_str(), buffer.str().size());\n")
f_out.write (" Tcl_SetObjResult(interp, r);\n")
f_out.write (" break;\n")
f_out.write (" }\n")
f_out.write (" case Dut_Reset:\n")
f_out.write (" {\n")
f_out.write (" //if (objc != 2) goto wrongArgs;\n\n")
f_out.write (" // **Example how you receive a parameter from the caller below**\n")
f_out.write (" //std::string filename;\n")
f_out.write (" //filename = Tcl_GetString(objv[2]);\n\n")
f_out.write (" // Redirect cout to our stringstream buffer or any other ostream\n")
f_out.write (" setvbuf(stdout, NULL, _IONBF, 0);\n")
f_out.write (" std::stringstream buffer;\n")
f_out.write (" std::streambuf *sbuf = std::cout.rdbuf();\n")
f_out.write (" reset_usertb(); // ** This is where the call to customed function is made.**\n")
f_out.write (" // When done redirect cout to its old self\n")
f_out.write (" std::cout.rdbuf(sbuf);\n\n")
f_out.write (" Tcl_Obj *r = Tcl_NewStringObj(buffer.str().c_str(), buffer.str().size());\n")
f_out.write (" Tcl_SetObjResult(interp, r);\n")
f_out.write (" break;\n")
f_out.write (" }\n")
# case arms for other commands
f_out.write (" case Dut_CmdLog:\n")
f_out.write (" {\n")
f_out.write (" std::string val;\n")
f_out.write (" if (objc >= 3)\n")
f_out.write (" {\n")
f_out.write (" val = Tcl_GetString(objv[2]);\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" if (val == \"on\")\n")
f_out.write (" cmdlog = 1;\n")
f_out.write (" }\n")
f_out.write (" }\n")
f_out.write (" return TCL_OK;\n")
f_out.write ("\n")
f_out.write ("wrongArgs:\n")
f_out.write (" dumpArguments (interp, cmds_str, Tcl_GetString(objv[0]));\n")
f_out.write (" return TCL_ERROR;\n")
f_out.write ("}\n")
f_out.write ("static void Dut_Cmd_Delete(ClientData clientData)\n")
f_out.write ("{\n")
f_out.write ("}\n")
# ================================================================
# Generate Bsv<DUT>Xactor.{h,cpp}, capi.h
def genDutXactor (output_dir, dut_ifc, new_module_name):
if genDutXactorHeader (output_dir, dut_ifc, new_module_name):
return 1
if genDutXactorImpl (output_dir, dut_ifc, new_module_name):
return 1
if genDutXactorCAPI (output_dir, dut_ifc, new_module_name):
return 1
return 0
def generatePutSendHeaders (f_out, prefix, xactor_name, xactor):
params = ""
pipeparams = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
else:
params += ", "
pipeparams += ", "
params += "BitT<%d> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
pipeparams += "std::vector<BitT<%d> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
f_out.write (" bool %sput_%s(" % (prefix, xactor_name))
f_out.write (params)
f_out.write (");\n")
f_out.write (" bool %sputB_%s(" % (prefix, xactor_name))
f_out.write (params)
f_out.write (");\n")
if isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write (" bool %svector_put_%s(" % (prefix, xactor_name))
f_out.write (pipeparams)
f_out.write (");\n")
f_out.write (" bool %svector_putB_%s(" % (prefix, xactor_name))
f_out.write (pipeparams)
f_out.write (");\n")
f_out.write (" bool %svector_putAck_%s(" % (prefix, xactor_name))
f_out.write (pipeparams)
f_out.write (");\n")
f_out.write ("\n")
def generateInputSendHeaders (f_out, prefix, emu_type, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write (" bool %ssend_%s(" % (prefix, xactor_name))
f_out.write ("%s &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
f_out.write (" bool %ssendB_%s(" % (prefix, xactor_name))
f_out.write ("%s &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
f_out.write (" bool %ssendBAck_%s(" % (prefix, xactor_name))
f_out.write ("%s &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
if isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write (" bool %svector_send_%s(std::vector<" % (prefix, xactor_name))
f_out.write ("%s > &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
f_out.write (" bool %svector_sendB_%s(std::vector<" % (prefix, xactor_name))
f_out.write ("%s > &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
f_out.write (" bool %svector_sendAck_%s(std::vector<" % (prefix, xactor_name))
f_out.write ("%s > &%s" % (typ, xactor_name))
f_out.write ("_data);\n")
if (emu_type == 1):
emu_param = "EmulationPortType t"
else:
emu_param = "BitT<1> &t"
f_out.write (" bool %sset_emulation_type_%s(%s);\n" % (prefix, xactor_name, emu_param))
f_out.write ("\n")
def generateGetRecvHeaders (f_out, prefix, xactor_name, xactor):
params = ""
pipeparams = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
else:
params += ", "
pipeparams += ", "
params += "BitT<%d> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
pipeparams += "std::vector<BitT<%d> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
f_out.write (" bool %sget_%s(" % (prefix, xactor_name))
f_out.write (params)
f_out.write (");\n")
f_out.write (" bool %sgetB_%s(" % (prefix, xactor_name))
f_out.write (params)
f_out.write (");\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write (" unsigned %svector_get_%s(" % (prefix, xactor_name))
f_out.write (pipeparams)
f_out.write (", unsigned minReturned=0, unsigned maxReturned=0);\n")
f_out.write ("\n")
def generateOutputRecvHeaders (f_out, prefix, emu_type, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write (" bool %sreceive_%s(" % (prefix, xactor_name))
f_out.write ("%s &%s_data" % (typ, xactor_name))
f_out.write (");\n")
f_out.write (" bool %sreceiveB_%s(" % (prefix, xactor_name))
f_out.write ("%s &%s_data" % (typ, xactor_name))
f_out.write (");\n")
if isinstance (xactor, Xactor_PIPE_OUT_IFC):
f_out.write (" unsigned %svector_receive_%s(std::vector<" % (prefix, xactor_name))
f_out.write ("%s > &%s_data, unsigned minReturned=0, unsigned maxReturned=0" % (typ, xactor_name))
f_out.write (");\n")
if (emu_type == 1):
emu_param = "EmulationPortType t"
else:
emu_param = "BitT<1> &t"
f_out.write (" bool %sset_emulation_type_%s(%s);\n" % (prefix, xactor_name, emu_param))
f_out.write ("\n")
def genDutXactorHeader (output_dir, dut_ifc, new_module_name):
header_filename = os.path.join (output_dir, "%sXactor.h" % new_module_name)
try:
f_header = open (header_filename, "w")
except:
print "Error opening file: ", header_filename
return 1
print "Generating file: ", header_filename
genDutXactorHeaderFile (f_header, dut_ifc, new_module_name)
f_header.close()
return 0
def genDutXactorHeaderFile (f_out, dut_ifc, new_module_name):
f_out.write ("// Copyright Bluespec Inc. 2012-2013\n")
f_out.write ("// By: GenTestbench tool\n\n")
f_out.write ("#pragma once\n")
f_out.write ("\n")
f_out.write ("// Include Bluespec's SceMi C++ api\n")
f_out.write ("#include \"DutXactor.h\"\n")
f_out.write ("#include \"SceMiHeaders.h\"\n")
f_out.write ("\n")
# ******************
# typedef StampedT<>
# ******************
# Get/Put
# for xactor_name in dut_ifc.xactors:
# xactor = dut_ifc.xactors [xactor_name]
# if (isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC) or
# isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC)):
# f_out.write ("typedef StampedT<%s_%s> S%s_%s;\n" % (new_module_name, xactor_name, new_module_name, xactor_name))
# outputs
# for xactor_name in dut_ifc.xactors:
# xactor = dut_ifc.xactors [xactor_name]
# if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
# f_out.write ("typedef StampedT<%s_%s> S%s_%s;\n" % (new_module_name, xactor_name, new_module_name, xactor_name))
# f_out.write ("\n")
# ********************
# class Bsv<mod>Xactor
# ********************
f_out.write ("// Define a class for the top-level transactor\n")
f_out.write ("class %sXactor : public DutXactor {\n\n" % new_module_name)
f_out.write (" protected:\n\n")
f_out.write (" static %sXactor *m_xactor;\n\n" % new_module_name)
f_out.write (" // Data members include transactors contained in the model\n")
f_out.write (" // Data Xactors\n")
# *******
# proxies
# *******
# Get/Put
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write (" OutProxyT < %s_%s > m_%s;\n" % (new_module_name, xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write (" InProxyT < %s_%s > m_%s;\n" % (new_module_name, xactor_name, xactor_name))
# inputs
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write (" InProxyT < %s_%s > m_%s;\n" % (new_module_name, xactor_name, xactor_name))
f_out.write (" InProxyT < BitT<1> > m_%s_ctrl;\n" % xactor_name)
# outputs
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
f_out.write (" OutProxyT < %s_%s > m_%s;\n" % (new_module_name, xactor_name, xactor_name))
f_out.write (" InProxyT < BitT<1> > m_%s_ctrl;\n" % xactor_name)
f_out.write ("\n")
f_out.write (" // Constructor\n")
f_out.write (" %sXactor (SceMi *scemi);\n" % new_module_name)
f_out.write ("\n")
f_out.write (" // Destructor\n")
f_out.write (" ~%sXactor();\n\n" % new_module_name)
f_out.write (" public:\n")
f_out.write ("\n")
f_out.write (" // Initialize transactor\n")
f_out.write (" static %sXactor *init(SceMi *scemi);\n" % new_module_name)
f_out.write (" static %sXactor *get() { return m_xactor; }\n\n" % new_module_name)
f_out.write (" // Destroy transactor\n")
f_out.write (" void destroy();\n\n")
f_out.write (" // Public interface .....\n")
# *******************
# bool sendB and send
# *******************
f_out.write (" // Put/Send\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
generatePutSendHeaders (f_out, "", xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
generateInputSendHeaders(f_out, "", 0, xactor_name, xactor)
# *****************
# bool getB and get
# *****************
f_out.write (" // Get/Receive\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
generateGetRecvHeaders (f_out, "", xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
generateOutputRecvHeaders(f_out, "", 0, xactor_name, xactor)
f_out.write ("};\n")
def generatePutSendMethods (f_out, prefix, new_module_name, xactor_name, xactor):
params = ""
pipeparams = ""
firstvector = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
firstvector = xactor.verilog_names[j]
else:
params += ", "
pipeparams += ", "
params += "BitT<%d> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
pipeparams += "std::vector<BitT<%d> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
f_out.write ("bool %sXactor::%sput_%s(%s)\n" % (new_module_name, prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
for verilog_name in xactor.verilog_names:
f_out.write (" data.m_field_%s = %s;\n" % (verilog_name, verilog_name))
f_out.write ("\n")
f_out.write (" bool sent = m_%s.sendNB(data);\n" % xactor_name)
f_out.write (" return sent;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sputB_%s(%s)\n" % (new_module_name, prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
for verilog_name in xactor.verilog_names:
f_out.write (" data.m_field_%s = %s;\n" % (verilog_name, verilog_name))
f_out.write ("\n")
f_out.write (" m_%s.send(data);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write ("bool %sXactor::%svector_put_%s(%s)\n" % (new_module_name, prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" std::vector<%s_%s> data;\n\n" % (new_module_name, xactor_name))
f_out.write (" data.resize(%s.size());\n" % firstvector)
f_out.write (" for (int i=0; i<%s.size(); i++) {\n" % firstvector)
for verilog_name in xactor.verilog_names:
f_out.write (" data[i].m_field_%s = %s[i];\n" % (verilog_name, verilog_name))
f_out.write (" };\n")
f_out.write ("\n")
f_out.write (" return m_%s.sendNB(data);\n" % xactor_name)
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%svector_putB_%s(%s)\n" % (new_module_name, prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" std::vector<%s_%s> data;\n\n" % (new_module_name, xactor_name))
f_out.write (" data.resize(%s.size());\n" % firstvector)
f_out.write (" for (int i=0; i<%s.size(); i++) {\n" % firstvector)
for verilog_name in xactor.verilog_names:
f_out.write (" data[i].m_field_%s = %s[i];\n" % (verilog_name, verilog_name))
f_out.write (" };\n")
f_out.write ("\n")
f_out.write (" m_%s.send(data);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%svector_putAck_%s(%s)\n" % (new_module_name, prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" std::vector<%s_%s> data;\n\n" % (new_module_name, xactor_name))
f_out.write (" data.resize(%s.size());\n" % firstvector)
f_out.write (" for (int i=0; i<%s.size(); i++) {\n" % firstvector)
for verilog_name in xactor.verilog_names:
f_out.write (" data[i].m_field_%s = %s[i];\n" % (verilog_name, verilog_name))
f_out.write (" };\n")
f_out.write ("\n")
f_out.write (" m_%s.sendAcknowledge(data);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
def generateInputSendMethods (f_out, prefix, emu_type, new_module_name, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write ("bool %sXactor::%ssend_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" bool sent = m_%s.sendNB(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return sent;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%ssendB_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s.send(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%ssendBAck_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s.sendAcknowledge(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write ("bool %sXactor::%svector_send_%s(std::vector<%s > &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return m_%s.sendNB(%s_data);\n" % (xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%svector_sendB_%s(std::vector<%s > &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s.send(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%svector_sendAck_%s(std::vector<%s > &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s.sendAcknowledge(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
if (emu_type == 1):
emu_param = "EmulationPortType t"
else:
emu_param = "BitT<1> &t"
f_out.write ("bool %sXactor::%sset_emulation_type_%s(%s)\n" % (new_module_name, prefix, xactor_name, emu_param))
f_out.write ("{\n")
f_out.write (" m_%s_ctrl.sendAcknowledge(t);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
# This handles both PIPE and non-PIPE
def generateGetRecvMethods (f_out, prefix, new_module_name, xactor_name, xactor):
params = ""
pipeparams = ""
resizeparams = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
else:
params += ", "
pipeparams += ", "
params += "BitT<%s> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
pipeparams += "std::vector<BitT<%s> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
resizeparams += " %s.resize(nitems);\n" % xactor.verilog_names[j]
f_out.write ("bool %sXactor::%sget_%s(%s)\n" % (new_module_name, prefix, xactor_name, params))
f_out.write ("{\n")
if isinstance (xactor, Xactor_GET_IFC):
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
f_out.write (" bool gotone = m_%s.receiveNB(data);\n" % xactor_name)
f_out.write (" if (gotone) {\n")
for verilog_name in xactor.verilog_names:
f_out.write (" %s = data.m_field_%s;\n" % (verilog_name, verilog_name))
f_out.write (" }\n")
else:
# PIPEGET
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
f_out.write (" bool gotone = m_%s.receiveNB(data);\n" % xactor_name)
for verilog_name in xactor.verilog_names:
f_out.write (" %s = data.m_field_%s;\n" % (verilog_name, verilog_name))
f_out.write (" return gotone;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sgetB_%s(%s)\n" % (new_module_name, prefix, xactor_name, params))
f_out.write ("{\n")
if isinstance (xactor, Xactor_GET_IFC):
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
f_out.write (" m_%s.receive(data);\n" % xactor_name)
for verilog_name in xactor.verilog_names:
f_out.write (" %s = data.m_field_%s;\n" % (verilog_name, verilog_name))
else:
# PIPEGET
f_out.write (" %s_%s data;\n\n" % (new_module_name, xactor_name))
f_out.write (" m_%s.receive(data);\n" % xactor_name)
for verilog_name in xactor.verilog_names:
f_out.write (" %s = data.m_field_%s;\n" % (verilog_name, verilog_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write ("unsigned %sXactor::%svector_get_%s(%s" % (new_module_name, prefix, xactor_name, pipeparams))
f_out.write (", unsigned minReturned, unsigned maxReturned)\n")
f_out.write ("{\n")
f_out.write (" unsigned nitems;\n")
f_out.write (" std::vector<%s_%s> data;\n\n" % (new_module_name, xactor_name))
f_out.write (" nitems = m_%s.receive(data, minReturned, maxReturned);\n" % xactor_name)
f_out.write (" if (nitems == 0)\n")
f_out.write (" return nitems;\n\n")
f_out.write ("%s\n" % resizeparams)
f_out.write (" for (int i=0; i<nitems; i++) {\n")
for verilog_name in xactor.verilog_names:
f_out.write (" %s[i] = data[i].m_field_%s;\n" % (verilog_name, verilog_name))
f_out.write (" }\n")
f_out.write (" return nitems;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("\n")
def generateOutputRecvMethods(f_out, prefix, emu_type, new_module_name, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write ("bool %sXactor::%sreceive_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" %s_%s data;\n" % (new_module_name, xactor_name))
f_out.write (" bool gotone = m_%s.receiveNB(data);\n" % xactor_name)
f_out.write (" if (gotone) {\n")
f_out.write (" %s_data = data;\n" % xactor_name)
f_out.write (" }\n")
f_out.write (" return gotone;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sreceiveB_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" %s_%s data;\n" % (new_module_name, xactor_name))
f_out.write (" m_%s.receive(data);\n" % xactor_name)
f_out.write (" %s_data = data;\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sset_emulation_type_%s(BitT<1> &t)\n" % (new_module_name, prefix, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s_ctrl.sendAcknowledge(" << "t);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
def generateOutputPipeRecvMethods(f_out, prefix, emu_type, new_module_name, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write ("bool %sXactor::%sreceive_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" bool gotone = m_%s.receiveNB(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return gotone;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sreceiveB_%s(%s &%s_data)\n" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s.receive(%s_data);\n" % (xactor_name, xactor_name))
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("unsigned %sXactor::%svector_receive_%s(std::vector<%s > &%s_data" % (new_module_name, prefix, xactor_name, typ, xactor_name))
f_out.write (", unsigned minReturned, unsigned maxReturned)\n")
f_out.write ("{\n")
f_out.write (" unsigned nitems = m_%s.receive(%s_data, minReturned, maxReturned);\n" % (xactor_name, xactor_name))
f_out.write (" return nitems;\n")
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("bool %sXactor::%sset_emulation_type_%s(BitT<1> &t)\n" % (new_module_name, prefix, xactor_name))
f_out.write ("{\n")
f_out.write (" m_%s_ctrl.sendAcknowledge(t);\n" % xactor_name)
f_out.write (" return true;\n")
f_out.write ("}\n")
f_out.write ("\n")
def genDutXactorImpl (output_dir, dut_ifc, new_module_name):
impl_filename = os.path.join (output_dir, "%sXactor.cpp" % new_module_name)
try:
f_impl = open (impl_filename, "w")
except:
print "Error opening file: ", impl_filename
return 1
print "Generating file: ", impl_filename
genDutXactorImplFile (f_impl, dut_ifc, new_module_name)
f_impl.close()
return 0
def genDutXactorImplFile (f_out, dut_ifc, new_module_name):
f_out.write ("// Copyright Bluespec Inc. 2012-2013\n")
f_out.write ("// By: GenTestbench tool\n\n")
f_out.write ("#include <iostream>\n")
f_out.write ("#include \"%sXactor.h\"\n" % new_module_name)
f_out.write ("\n")
f_out.write ("using namespace std;\n")
f_out.write ("\n")
f_out.write ("%sXactor *%sXactor::m_xactor = NULL;\n\n" % (new_module_name, new_module_name))
f_out.write ("%sXactor *%sXactor::init(SceMi *scemi)\n" % (new_module_name, new_module_name))
f_out.write ("{\n")
f_out.write (" if (m_xactor != NULL)\n")
f_out.write (" return m_xactor;\n\n")
f_out.write (" m_xactor = new %sXactor(scemi);\n\n" % new_module_name)
f_out.write (" return m_xactor;\n")
f_out.write ("}\n\n")
f_out.write ("void %sXactor::destroy()\n" % new_module_name)
f_out.write ("{\n")
f_out.write (" delete m_xactor;\n")
f_out.write (" m_xactor = NULL;\n")
f_out.write ("}\n\n")
f_out.write ("%sXactor::%sXactor(SceMi *scemi)\n" % (new_module_name, new_module_name))
f_out.write (" : DutXactor(scemi)\n")
# **************************
# Contructor initialization
# **************************
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC):
f_out.write (" , m_%s (\"\", \"scemi_put_%s_inport\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write (" , m_%s (\"\", \"scemi_put_%s_inpipe\", XactorAdapter::InPipe)\n" % (xactor_name, xactor_name))
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC):
f_out.write (" , m_%s (\"\", \"scemi_get_%s_outport\", XactorAdapter::OutPort)\n" % (xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write (" , m_%s (\"\", \"scemi_get_%s_outpipe\", XactorAdapter::OutPipe)\n" % (xactor_name, xactor_name))
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC):
f_out.write (" , m_%s (\"\", \"scemi_put_%s_inport\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
f_out.write (" , m_%s_ctrl (\"\", \"scemi_put_%s_ctrl_in\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write (" , m_%s (\"\", \"scemi_put_%s_inpipe\", XactorAdapter::InPipe)\n" % (xactor_name, xactor_name))
f_out.write (" , m_%s_ctrl (\"\", \"scemi_put_%s_ctrl_in\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC):
f_out.write (" , m_%s (\"\", \"scemi_get_%s_outport\", XactorAdapter::OutPort)\n" % (xactor_name, xactor_name))
f_out.write (" , m_%s_ctrl (\"\", \"scemi_get_%s_ctrl_in\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
elif isinstance (xactor, Xactor_PIPE_OUT_IFC):
f_out.write (" , m_%s (\"\", \"scemi_get_%s_outpipe\", XactorAdapter::OutPipe)\n" % (xactor_name, xactor_name))
f_out.write (" , m_%s_ctrl (\"\", \"scemi_get_%s_ctrl_in\", XactorAdapter::InPort)\n" % (xactor_name, xactor_name))
f_out.write ("{\n")
f_out.write ("}\n")
f_out.write ("\n")
# **************************
# Destructor
# **************************
f_out.write ("%sXactor::~%sXactor()\n" % (new_module_name, new_module_name))
f_out.write ("{\n")
f_out.write ("}\n")
f_out.write ("\n")
# ******
# send
# ******
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
generatePutSendMethods (f_out, "", new_module_name, xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
generateInputSendMethods(f_out, "", 0, new_module_name, xactor_name, xactor)
# *****
# get
# *****
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
generateGetRecvMethods (f_out, "", new_module_name, xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC):
generateOutputRecvMethods(f_out, "", 0, new_module_name, xactor_name, xactor)
elif isinstance (xactor, Xactor_PIPE_OUT_IFC):
generateOutputPipeRecvMethods(f_out, "", 0, new_module_name, xactor_name, xactor)
def generateInlinePutSend (f_out, prefix, new_module_name, xactor_name, xactor):
params = ""
params2 = ""
pipeparams = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
firstvector = xactor.verilog_names[j]
else:
params += ", "
params2 += ", "
pipeparams += ", "
params += "BitT<%d> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
params2 += xactor.verilog_names[j]
pipeparams += "std::vector<BitT<%d> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
f_out.write ("inline bool %sput_%s(%s)\n" % (prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->put_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %sputB_%s(%s)\n" % (prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->putB_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPEPUT_IFC):
f_out.write ("inline bool %svector_put_%s(%s)\n" % (prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_put_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %svector_putB_%s(%s)\n" % (prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_putB_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %svector_putAck_%s(%s)\n" % (prefix, xactor_name, pipeparams))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_putAck_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
def generateInlineInputSend (f_out, prefix, new_module_name, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write ("inline bool %ssend_%s(%s &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->send_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %ssendB_%s(%s &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->sendB_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %ssendBAck_%s(%s &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->sendBAck_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPE_IN_IFC):
f_out.write ("inline bool %svector_send_%s(std::vector<%s > &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_send_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %svector_sendB_%s(std::vector<%s > &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_sendB_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %svector_sendAck_%s(std::vector<%s > &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_sendAck_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %sset_emulation_type_%s(EmulationPortType t)\n" % (prefix, xactor_name))
f_out.write ("{\n")
f_out.write (" BitT<1> data = t;\n")
f_out.write (" return %sXactor::get()->set_emulation_type_%s(data);\n" % (new_module_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
def generateInlineGetRecv (f_out, prefix, new_module_name, xactor_name, xactor):
params = ""
params2 = ""
pipeparams = ""
first = 1
for j in range (len (xactor.verilog_names)):
if (first == 1):
first = 0
else:
params += ", "
params2 += ", "
pipeparams += ", "
params += "BitT<%s> &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
params2 += xactor.verilog_names[j]
pipeparams += "std::vector<BitT<%s> > &%s" % (xactor.field_widths[j], xactor.verilog_names[j])
f_out.write ("inline bool %sget_%s(%s)\n" % (prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->get_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %sgetB_%s(%s)\n" % (prefix, xactor_name, params))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->getB_%s(%s);\n" % (new_module_name, xactor_name, params2))
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPEGET_IFC):
f_out.write ("inline unsigned %svector_get_%s(%s" % (prefix, xactor_name, pipeparams))
f_out.write (", unsigned minReturned, unsigned maxReturned)\n")
f_out.write ("{\n")
f_out.write (" unsigned nitems;\n\n")
f_out.write (" nitems = %sXactor::get()->vector_get_%s(%s, minReturned, maxReturned);\n" % (new_module_name, xactor_name, params2))
f_out.write (" return nitems;\n")
f_out.write ("}\n")
f_out.write ("\n")
def generateInlineOutputRecv (f_out, prefix, new_module_name, xactor_name, xactor):
typ = "BitT<%d>" % xactor.field_width
f_out.write ("inline bool %sreceive_%s(%s &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->receive_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %sreceiveB_%s(%s &%s_data)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->receiveB_%s(%s_data);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
if isinstance (xactor, Xactor_PIPE_OUT_IFC):
f_out.write ("inline unsigned %svector_receive_%s(std::vector<%s > &%s_data, unsigned minReturned, unsigned maxReturned)\n" % (prefix, xactor_name, typ, xactor_name))
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->vector_receive_%s(%s_data, minReturned, maxReturned);\n" % (new_module_name, xactor_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
f_out.write ("inline bool %sset_emulation_type_%s(EmulationPortType t)\n" % (prefix, xactor_name))
f_out.write ("{\n")
f_out.write (" BitT<1> data = t;\n")
f_out.write (" return %sXactor::get()->set_emulation_type_%s(data);\n" % (new_module_name, xactor_name))
f_out.write ("}\n")
f_out.write ("\n")
def genDutXactorCAPI (output_dir, dut_ifc, new_module_name):
capi_filename = os.path.join (output_dir, "capi.h")
try:
f_capi = open (capi_filename, "w")
except:
print "Error opening file: ", capi_filename
return 1
print "Generating file: ", capi_filename
genDutXactorCAPIFile (f_capi, dut_ifc, new_module_name)
f_capi.close()
return 0
def genDutXactorCAPIFile (f_out, dut_ifc, new_module_name):
f_out.write ("// Copyright Bluespec Inc. 2012-2013\n")
f_out.write ("// By: GenTestbench tool\n\n")
f_out.write ("#pragma once\n")
f_out.write ("\n")
f_out.write ("#include \"semu_capi.h\"\n")
f_out.write ("#include \"%sXactor.h\"\n\n" % new_module_name)
f_out.write ("using namespace std;\n")
f_out.write ("//\n")
f_out.write ("// This is Bluespec C API for communicating with the DUT\n")
f_out.write ("//\n\n")
f_out.write ("#ifdef __cplusplus\n")
f_out.write ("extern \"C\" {\n")
f_out.write ("#endif\n\n")
f_out.write ("// Below is capi for interfacing with scemi controlled clocks\n")
f_out.write ("// All functions return 1 - success, 0 - failed.\n\n")
f_out.write ("/*\n")
f_out.write ("// This is how you advance controlled clock 1 cycle\n")
f_out.write ("if (semu_advance_controlled_clock(1)) do_something();\n\n")
f_out.write ("// Same as above, except the call is blocked until the number of cycles are done\n")
f_out.write ("if (semu_advance_controlled_clockB(cycles)) do_something();\n\n")
f_out.write ("// This is how you start free-running controlled clock\n")
f_out.write ("if (semu_start_controlled_clock()) do_something;\n\n")
f_out.write ("// This is how you stop controlled clock\n")
f_out.write ("if (semu_stop_controlled_clock()) do_something();\n\n")
f_out.write ("// This is how you get current cycle of the controlled clock\n")
f_out.write ("SceMiU64 clock_cycles;\n")
f_out.write ("if (semu_get_current_controlled_clock_cycle(clock_cycles)) do_something();\n\n")
f_out.write ("// This is how you assert controlled reset for 8 cycles\n")
f_out.write ("int number_of_cycles = 8;\n")
f_out.write ("if (semu_assert_reset(number_of_cycles)) do_something();\n\n")
f_out.write ("*/\n\n")
f_out.write (" // Reset\n")
f_out.write (" bool semu_assert_reset(unsigned short number_of_cycles, const char *reset_name=NULL);\n\n")
# *******************
# bool sendB and send
# *******************
f_out.write (" // Below is capi for interfacing with the DUT\n")
f_out.write (" // The calls with 'B' denotes blocking calls\n\n")
f_out.write (" // send/put (non-blocking) and sendB/putB (blocking) to the DUT\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
generatePutSendHeaders (f_out, "semu_", xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
generateInputSendHeaders(f_out, "semu_", 1, xactor_name, xactor)
f_out.write ("\n")
# *****************
# bool getB and get
# *****************
f_out.write (" // receive/get (non-blocking) and receiveB/getB (blocking) from the DUT\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
generateGetRecvHeaders (f_out, "semu_", xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
generateOutputRecvHeaders(f_out, "semu_", 1, xactor_name, xactor)
f_out.write ("#ifdef __cplusplus\n")
f_out.write ("};\n")
f_out.write ("#endif\n\n")
# **********************
# Inline send implementations
# **********************
f_out.write ("// send/put\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
generateInlinePutSend(f_out, "semu_", new_module_name, xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
generateInlineInputSend(f_out, "semu_", new_module_name, xactor_name, xactor)
# **********************
# Inline get implementations
# **********************
f_out.write ("// receive/get\n")
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
generateInlineGetRecv(f_out, "semu_", new_module_name, xactor_name, xactor)
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
generateInlineOutputRecv(f_out, "semu_", new_module_name, xactor_name, xactor)
f_out.write ("inline bool semu_assert_reset(unsigned short number_of_cycles, const char *reset_name)\n")
f_out.write ("{\n")
f_out.write (" return %sXactor::get()->assertReset(number_of_cycles);\n" % new_module_name)
f_out.write ("}\n")
# ================================================================
# Generate gui_dut.tcl, gui_tb.tcl, gui_top.tcl
def genTclGui (output_dir, dut_ifc, new_module_name, usertb):
if generateGuiDutTcl(output_dir, dut_ifc, new_module_name, usertb):
return 1
# The remaining files are for 'manualtb', so skip them if 'usertb'
if usertb:
return 0
if generateGuiTbTcl(output_dir):
return 1
if generateGuiTopTcl(output_dir):
return 1
# XXX should this go in 'output_dir'?
if generatePkgIndexTcl(""):
return 1
return 0
def generateGuiDutTcl (output_dir, dut_ifc, new_module_name, usertb):
gui_dut_filename = os.path.join (output_dir, "gui_dut.tcl")
try:
f_gui_dut = open (gui_dut_filename, "w")
except:
print "Error opening file: ", gui_dut_filename
return 1
print "Generating file: ", gui_dut_filename
generateGuiDutTclFile(f_gui_dut, dut_ifc, new_module_name, usertb)
f_gui_dut.close()
return 0
def generateGuiDutTclFile (f_out, dut_ifc, new_module_name, usertb):
f_out.write ("package require Tk\n")
f_out.write ("namespace import bsdebug::dut\n")
f_out.write ("\n")
f_out.write ("namespace eval GuiDut {\n")
f_out.write (" variable dut\n")
# Generate variables "e<n>" for ports
# Start with the Get/Put ports
#
start_rei_port_index = 1
i = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if (isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC) or
isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC)):
for j in range (len (xactor.verilog_names)):
f_out.write (" variable e%d 0\n" % i)
i += 1
# Follow with the Input/Output ports
#
start_reg_port_index = i
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if (isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC) or
isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC)):
f_out.write (" variable e%d 0\n" % i)
i += 1
f_out.write (" variable updatetime 500\n")
f_out.write ("\n")
if (usertb):
f_out.write (" # Below is a sample code (commented out) for the generated manually input testbench\n")
def tbcomment_open():
if (usertb):
f_out.write (" if {0} {\n")
def tbcomment_close():
if (usertb):
f_out.write (" }\n")
f_out.write (" proc mkDutControl { frame } {\n")
f_out.write (" variable top\n")
tbcomment_open()
f_out.write (" variable putbut\n")
f_out.write (" variable getbut\n")
tbcomment_close()
f_out.write ("\n")
f_out.write (" set top $frame\n")
f_out.write ("\n")
tbcomment_open()
f_out.write (" ## Button Frame\n")
f_out.write (" set button_frame [ttk::frame $top.button_frame]\n")
f_out.write (" set inputs_label [ttk::labelframe $top.button_frame.label]\n")
f_out.write (" set inputs_text [ttk::label $top.blabel -justify center -text \"Inputs/Outputs\"]\n")
f_out.write (" pack $inputs_text\n")
f_out.write (" grid $inputs_label -row 1 -column 0\n")
tbcomment_close()
# Loop over the Get/Put ports again
#
i = start_rei_port_index
row = 2
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
tbcomment_open()
col = 1
for j in range (len (xactor.verilog_names)):
buf = i
i += 1
if ((col % 7) == 0):
row += 1
col = 1
pn = xactor_name.lower()
f_out.write (" set %s_text [ttk::label $button_frame.%s_text -text %s -justify left -width 0 -anchor e]\n" % (pn, pn, pn))
f_out.write (" set e%d [ttk::entry $button_frame.%s_entry -textvariable GuiDut::e%d -width 8 -validate key -validatecommand \"GuiDut::chk_num %%P\"]\n" % (buf, pn, buf))
f_out.write (" grid $%s_text -pady 5 -padx 5 -row %d -column %d\n" % (pn, row, col))
col += 1
f_out.write (" grid $e%d -pady 5 -padx 5 -row %d -column %d\n\n" % (buf, row, col))
col += 1
# XXX what if there are not ports? buf won't be set
f_out.write (" set putbut%d [ttk::button $button_frame.put%d -text \"Put\" -command \"GuiDut::do_put_%s\"]\n" % (buf, buf, xactor_name))
f_out.write (" grid $putbut%d -pady 5 -padx 5 -row %d -column %d\n\n" % (buf, row, col))
#col += 1
row += 1
tbcomment_close()
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
tbcomment_open()
col = 1
for j in range (len (xactor.verilog_names)):
buf = i
i += 1
if ((col % 7) == 0):
row += 1
col = 1
pn = xactor_name.lower()
f_out.write (" set %s_text [ttk::label $button_frame.%s_text -text %s -justify left -width 0 -anchor e]\n" % (pn, pn, pn))
f_out.write (" set e%d [ttk::entry $button_frame.%s_entry -textvariable GuiDut::e%d -width 8 -validate key -validatecommand \"GuiDut::chk_num %%P\" -state disabled]\n" % (buf, pn, buf))
f_out.write (" grid $%s_text -pady 5 -padx 5 -row %d -column %d\n" % (pn, row, col))
col += 1
f_out.write (" grid $e%d -pady 5 -padx 5 -row %d -column %d\n\n" % (buf, row, col))
col += 1
# XXX what if there are not ports? buf won't be set
f_out.write (" set getbut%d [ttk::button $button_frame.get%d -text \"Get\" -command \"GuiDut::do_get_%s\"]\n" % (buf, buf, xactor_name))
f_out.write (" grid $getbut%d -pady 5 -padx 5 -row %d -column %d\n\n" % (buf, row, col))
row += 1
tbcomment_close()
first = 1
col = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
tbcomment_open()
if ((col % 7) == 0):
row += 1
col = 1
pn = xactor_name.lower()
first = 0
f_out.write (" set %s_text [ttk::label $button_frame.%s_text -text %s -justify left -width 0 -anchor e]\n" % (pn, pn, pn))
f_out.write (" set e%d [ttk::entry $button_frame.%s_entry -textvariable GuiDut::e%d -width 8 -validate key -validatecommand \"GuiDut::chk_num %%P\"]\n" % (i, pn, i))
f_out.write (" grid $%s_text -pady 5 -padx 5 -row %d -column %d\n" % (pn, row, col))
col += 1
f_out.write (" grid $e%d -pady 5 -padx 5 -row %d -column %d\n\n" % (i, row, col))
col += 1
i += 1
tbcomment_close()
if (first == 0):
tbcomment_open()
f_out.write (" set putbut [ttk::button $button_frame.put -text \"Send\" -command \"GuiDut::do_send\"]\n")
f_out.write (" grid $putbut -pady 5 -padx 5 -row %d -column %d\n\n" % (row, col))
tbcomment_close()
col = 1
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
tbcomment_open()
if ((col % 7) == 0):
row += 1
col = 1
if (first) :
row += 1
first = 0
pn = xactor_name.lower()
f_out.write (" set %s_text [ttk::label $button_frame.%s_text -text %s -justify left -width 0 -anchor e]\n" % (pn, pn, pn))
f_out.write (" set e%d [ttk::entry $button_frame.%s_entry -textvariable GuiDut::e%d -width 8 -validate key -validatecommand \"GuiDut::chk_num %%P\" -state disabled]\n" % (i, pn, i))
f_out.write (" grid $%s_text -pady 5 -padx 5 -row %d -column %d\n" % (pn, row, col))
col += 1
f_out.write (" grid $e%d -pady 5 -padx 5 -row %d -column %d\n\n" % (i, row, col))
col += 1
i += 1
tbcomment_close()
if (first == 0):
tbcomment_open()
f_out.write (" set getbut [ttk::button $button_frame.get -text \"Receive \" -command \"GuiDut::do_get\"]\n")
f_out.write (" grid $getbut -pady 5 -padx 5 -row %d -column %d\n" % (row, col))
tbcomment_close()
f_out.write ("\n")
tbcomment_open()
f_out.write (" pack $button_frame -anchor n -side top\n")
tbcomment_close()
f_out.write ("\n")
f_out.write (" return $top\n")
f_out.write (" }\n")
f_out.write ("\n")
# Put send
#
i = start_rei_port_index
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_PUT_IFC) or isinstance (xactor, Xactor_PIPEPUT_IFC):
params = ""
f_out.write (" proc do_put_%s {} {\n" % xactor_name)
for j in range (len (xactor.verilog_names)):
f_out.write (" variable e%d;\n" % i)
params += " $e%d" % i
i += 1
f_out.write (" set msg \"Blocked\"\n")
f_out.write ("\n")
f_out.write (" set sent [dut request_%s%s]\n" % (xactor_name, params))
f_out.write (" if {$sent} {\n")
f_out.write (" set msg \"sending: %s\"\n" % params)
f_out.write (" } else {\n")
f_out.write (" set msg \"sending failed.\"\n")
f_out.write (" }\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" }\n\n")
# Get recv
#
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_GET_IFC) or isinstance (xactor, Xactor_PIPEGET_IFC):
params = ""
f_out.write (" proc do_get_%s {} {\n" % xactor_name)
f_out.write (" set res [dut response_%s]\n" % xactor_name)
f_out.write (" set found [lindex $res 0]\n")
f_out.write (" if {$found != 0} {\n")
start_rei_outport_index = i
for j in range (len (xactor.verilog_names)):
f_out.write (" set GuiDut::e%d [lindex $res %d]\n" % (i, j + 1))
i += 1
i = start_rei_outport_index
for j in range (len (xactor.verilog_names)):
if (j == 0):
f_out.write (" set hex [format 0x%%x $GuiDut::e%d]\n" % i)
f_out.write (" set msg \"Response: %s = $GuiDut::e%d (hex: $hex)\n" % (xactor.verilog_names[j], i))
else:
f_out.write (" %s = $GuiDut::e%d" % (xactor.verilog_names[j], i))
i += 1
f_out.write ("\"\n")
f_out.write (" } else {\n")
f_out.write (" set msg \"No response received.\"\n")
f_out.write (" }\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" }\n\n")
# Input sends
#
i = start_reg_port_index
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_In_IFC) or isinstance (xactor, Xactor_PIPE_IN_IFC):
if (first == 1):
params = ""
f_out.write (" proc do_send {} {\n")
f_out.write (" variable e%d;\n" % i)
params += " $e%d" % i
first = 0
else:
f_out.write (" variable e%d;\n" % i)
params += " $e%d" % i
i += 1
if (first == 0):
f_out.write (" set msg \"Blocked\"\n")
f_out.write ("\n")
f_out.write (" set sent [dut request%s]\n" % params)
f_out.write (" if {$sent} {\n")
f_out.write (" set msg \"sending: %s\"\n" % params)
f_out.write (" } else {\n")
f_out.write (" set msg \"sending failed.\"\n")
f_out.write (" }\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" }\n\n")
# Output recvs
#
j = 1
start_reg_outport_index = i
first = 1
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
if (first == 1):
f_out.write (" proc do_get {} {\n")
f_out.write ("\n")
f_out.write (" set res [dut response]\n")
f_out.write (" set found [lindex $res 0]\n")
f_out.write (" if { $found != 0 } {\n")
f_out.write (" set GuiDut::e%d [lindex $res %d]\n" % (i, j))
j += 1
first = 0
else:
f_out.write (" set GuiDut::e%d [lindex $res %d]\n" % (i, j))
j += 1
i += 1
j = 1
i = start_reg_outport_index
for xactor_name in dut_ifc.xactors:
xactor = dut_ifc.xactors [xactor_name]
if isinstance (xactor, Xactor_Raw_Out_IFC) or isinstance (xactor, Xactor_PIPE_OUT_IFC):
if (j == 1):
f_out.write (" set msg \"Response: %s = $GuiDut::e%d" % (xactor_name, i))
j = 0
else:
f_out.write (" %s = $GuiDut::e%d" % (xactor_name, i))
i += 1
if (first == 0):
f_out.write ("\"\n")
f_out.write (" } else {\n")
f_out.write (" set msg \"No response received.\"\n")
f_out.write (" }\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" }\n\n")
# continue
f_out.write (" proc getLoop {} {\n")
f_out.write (" if { [catch getLoopInternal err] } {\n")
f_out.write (" puts stderr \"Status loop failed, interface will not respond\"\n")
f_out.write (" puts stderr $err\n")
f_out.write (" }\n")
f_out.write (" }\n\n")
f_out.write (" # Loop watching status\n")
f_out.write (" proc getLoopInternal {} {\n")
f_out.write (" variable updatetime\n")
f_out.write ("\n")
f_out.write (" set res [dut response]\n")
f_out.write (" while { $res != \"\" } {\n")
f_out.write (" puts \"$res\"\n")
f_out.write (" set res [dut response]\n")
f_out.write (" }\n")
f_out.write (" after $updatetime GuiDut::getLoop\n")
f_out.write (" update\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write ("# ======\n")
f_out.write ("\n")
f_out.write (" proc chk_num {s} {\n")
f_out.write (" #string is integer $s\n")
f_out.write (" return true;\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write (" proc do_test {} {\n")
if (usertb):
f_out.write (" set msg \"Blocked\"\n")
f_out.write (" set sent [dut test]\n")
f_out.write (" if {$sent != \"\"} {\n")
f_out.write (" set msg \"start testing...\"\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" puts \"$sent\"\n")
f_out.write (" }\n")
f_out.write (" }\n")
f_out.write (" proc do_reset {} {\n")
if (usertb):
f_out.write (" set msg \"Blocked\"\n")
f_out.write (" set sent [dut reset]\n")
f_out.write (" if {$sent != \"\"} {\n")
f_out.write (" set msg \"reset testbench...\"\n")
f_out.write (" puts \"$msg\"\n")
f_out.write (" puts \"$sent\"\n")
f_out.write (" }\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write ("}\n")
def generateGuiTbTcl (output_dir):
gui_tb_filename = os.path.join (output_dir, "gui_tb.tcl")
try:
f_gui_tb = open (gui_tb_filename, "w")
except:
print "Error opening file: ", gui_tb_filename
return 1
print "Generating file: ", gui_tb_filename
generateGuiTbTclFile(f_gui_tb)
f_gui_tb.close()
return 0
def generateGuiTbTclFile (f_out):
f_out.write ("package require Tk\n")
f_out.write ("namespace import bsdebug::dut\n")
f_out.write ("\n")
f_out.write ("namespace eval GuiDut {\n")
f_out.write (" variable updatetime 500\n\n")
f_out.write (" #If you are going to build a DUT UI put it in this proc\n")
f_out.write (" #Build the window frame in top\n")
f_out.write (" proc mkDutControl { frame } {\n")
f_out.write (" variable top\n\n")
f_out.write (" set top $frame\n")
f_out.write (" # set button_frame [ttk::frame $top.button_frame]\n")
f_out.write (" return $top\n")
f_out.write (" }\n")
f_out.write (" proc getLoop {} {\n")
f_out.write (" if { [catch getLoopInternal err] } {\n")
f_out.write (" puts stderr \"Status loop failed, interface will not respond\"\n")
f_out.write (" puts stderr $err\n")
f_out.write (" }\n")
f_out.write (" }\n")
f_out.write (" proc getLoop {} {\n")
f_out.write (" if { [catch getLoopInternal err] } {\n")
f_out.write (" puts stderr \"Status loop failed, interface will not respond\"\n")
f_out.write (" puts stderr $err\n")
f_out.write (" }\n")
f_out.write (" }\n\n")
f_out.write (" # Loop watching status\n")
f_out.write (" proc getLoopInternal {} {\n")
f_out.write (" variable updatetime\n")
f_out.write ("\n")
f_out.write (" set res [dut response]\n")
f_out.write (" while { $res != \"\" } {\n")
f_out.write (" puts \"$res\"\n")
f_out.write (" set res [dut response]\n")
f_out.write (" }\n")
f_out.write (" after $updatetime GuiDut::getLoop\n")
f_out.write (" update\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write ("# ======\n")
f_out.write ("\n")
f_out.write (" proc chk_num {s} {\n")
f_out.write (" #string is integer $s\n")
f_out.write (" return true\n")
f_out.write (" }\n")
f_out.write ("\n")
f_out.write ("}\n")
def generateGuiTopTcl (output_dir):
gui_top_filename = os.path.join (output_dir, "gui_top.tcl")
try:
f_gui_top = open (gui_top_filename, "w")
except:
print "Error opening file: ", gui_top_filename
return 1
print "Generating file: ", gui_top_filename
generateGuiTopTclFile(f_gui_top)
f_gui_top.close()
return 0
def generateGuiTopTclFile (f_out):
f_out.write ("lappend auto_path .\n")
f_out.write ("package require BSDebug\n")
f_out.write ("#package require ReadBackGui\n")
f_out.write ("#package require ProbeGui\n")
f_out.write ("\n")
f_out.write ("fonts::set_colours\n")
f_out.write ("fonts::initialize\n")
f_out.write ("\n")
f_out.write ("# Display the window\n")
f_out.write ("\n")
f_out.write ("proc buildEmulationWin { {win .emu} top} {\n")
f_out.write (" if { $win != \".\" } {\n")
f_out.write (" toplevel $win\n")
f_out.write (" }\n")
f_out.write (" wm title $win \"Bluespec Emulation\"\n")
f_out.write (" set paned [ttk::panedwindow $win.paned -orient vertical]\n")
f_out.write (" pack $paned -side top -expand yes -fill both -pady 5 -padx 2\n")
f_out.write ("\n")
f_out.write (" set c [ReadBackGui::mkEmulationControlPanels $win true $top]\n")
f_out.write (" $paned add $c -weight 0\n")
f_out.write ("\n")
f_out.write ("\n")
f_out.write (" set d [GuiDut::mkDutControl $win]\n")
f_out.write (" $paned add $d -weight 1\n")
f_out.write ("\n")
f_out.write ("# set p [ProbeGui::mkProbePanel $win \"scemi_test.vcd\"]\n")
f_out.write ("# $paned add $p -weight 1\n")
f_out.write ("\n")
f_out.write (" # start the status loop here\n")
f_out.write (" after 500 ReadBackGui::statusLoop\n")
f_out.write ("# after 500 ProbeGui::statusLoop\n")
f_out.write (" #after 500 GuiDut::getLoop\n")
f_out.write ("}\n")
def generatePkgIndexTcl (output_dir):
pkgIndex_filename = os.path.join (output_dir, "pkgIndex.tcl")
try:
f_pkgIndex = open (pkgIndex_filename, "w")
except:
print "Error opening file: ", pkgIndex_filename
return 1
print "Generating file: ", pkgIndex_filename
generatePkgIndexTclFile(f_pkgIndex)
f_pkgIndex.close()
return 0
def generatePkgIndexTclFile (f_out):
f_out.write (" # pkgIndex.tcl -- tells Tcl how to load my package.\n")
f_out.write (" package ifneeded \"BSDebug\" 1.0 \\\n")
f_out.write (" [list load [file join $dir libbsdebug.so]]\n")
# ================================================================
# Main program when executed from the cmd line
def main (argv = None):
if ((len (sys.argv) < 4) or (len (sys.argv) > 5)):
print "Usage: %s <pin_file_name> <emu_scripts_dir> <cpp_src_dir> [<usertb>]" % os.path.basename(sys.argv [0])
return 1
pin_filename = sys.argv [1]
emu_scripts_dir = sys.argv [2]
cpp_src_dir = sys.argv [3]
usertb = False
if (len (sys.argv) > 4):
usertb = (sys.argv [4]).lower() in ("yes", "true", "t", "1")
if not os.path.exists(cpp_src_dir):
os.makedirs(cpp_src_dir)
if not os.path.exists(emu_scripts_dir):
os.makedirs(emu_scripts_dir)
(dut_name, ext) = os.path.splitext (os.path.basename (pin_filename))
BsvDUT = "Bsv" + dut_name
try:
f_pin = open (pin_filename, "r")
except:
print "Error opening pin file: ", pin_filename
return 1
dut_ifc = parse_pin_file (f_pin, pin_filename)
#if isinstance (dut_ifc, DUT_IFC):
# dut_ifc.show (" ")
if genTclTb (cpp_src_dir, dut_ifc, BsvDUT, usertb):
# error message will have been displayed
return 1
if genDutXactor (cpp_src_dir, dut_ifc, BsvDUT):
# error message will have been displayed
return 1
if genTclGui(emu_scripts_dir, dut_ifc, BsvDUT, usertb):
# error message will have been displayed
return 1
return 0
# ================================================================
# For non-interactive invocations, call main() and use its return value
# as the exit code.
if __name__ == '__main__':
sys.exit (main ())
| 39.652046
| 194
| 0.60802
| 13,950
| 94,015
| 3.851326
| 0.049032
| 0.094479
| 0.206213
| 0.154674
| 0.858374
| 0.82649
| 0.775807
| 0.744872
| 0.715817
| 0.685962
| 0
| 0.005534
| 0.213859
| 94,015
| 2,370
| 195
| 39.668776
| 0.721387
| 0.039228
| 0
| 0.674882
| 1
| 0.009439
| 0.355496
| 0.062995
| 0
| 0
| 0
| 0
| 0.002622
| 0
| null | null | 0
| 0.002622
| null | null | 0.009439
| 0
| 0
| 0
| null | 0
| 1
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
8d3c65a595811d148011229c9b03ea0ada0d6e3a
| 3,261
|
py
|
Python
|
tests/test_order_change_requests.py
|
duffelhq/duffel-api-python
|
583703f34e345ac8fa185ca26441f9168d1b0dac
|
[
"MIT"
] | 2
|
2022-02-26T22:14:48.000Z
|
2022-03-10T10:04:11.000Z
|
tests/test_order_change_requests.py
|
duffelhq/duffel-api-python
|
583703f34e345ac8fa185ca26441f9168d1b0dac
|
[
"MIT"
] | 29
|
2022-01-04T12:40:54.000Z
|
2022-03-31T23:26:54.000Z
|
tests/test_order_change_requests.py
|
duffelhq/duffel-api-python
|
583703f34e345ac8fa185ca26441f9168d1b0dac
|
[
"MIT"
] | null | null | null |
from datetime import datetime, date
from .fixtures import fixture
def test_create_order_change_request(requests_mock):
url = "air/order_change_requests"
with fixture("create-order-change-request", url, requests_mock.post, 201) as client:
slices = {
"add": [
{
"cabin_class": "economy",
"departure_date": "2020-04-24",
"destination": "JFK",
"origin": "LHR",
}
],
"remove": [{"slice_id": "sli_00009htYpSCXrwaB9Dn123"}],
}
creation = client.order_change_requests.create("order-id").slices(slices)
change_request = creation.execute()
assert change_request.created_at == datetime(2020, 1, 17, 10, 12, 14, 545000)
assert change_request.id == "ocr_0000A3bQP9RLVfNUcdpLpw"
assert change_request.live_mode is True
assert change_request.order_id == "ord_0000A3bQ8FJIQoEfuC07n6"
assert isinstance(change_request.slices.add, type([]))
assert change_request.slices.add[0].cabin_class == "economy"
assert change_request.slices.add[0].departure_date == date(2020, 4, 24)
assert change_request.slices.add[0].destination == "JFK"
assert change_request.slices.add[0].origin == "LHR"
assert isinstance(change_request.slices.remove, type([]))
assert change_request.slices.remove[0].slice_id == "sli_00009htYpSCXrwaB9Dn123"
assert change_request.updated_at == datetime(2020, 1, 17, 10, 12, 14, 545000)
def test_get_order_change_request(requests_mock):
url = "air/order_change_requests/order-id"
with fixture(
"get-order-change-request-by-id", url, requests_mock.get, 200
) as client:
change_request = client.order_change_requests.get("order-id")
assert change_request.created_at == datetime(2020, 1, 17, 10, 12, 11, 634000)
assert change_request.id == "ocr_0000A3bQP9RLVfNUcdpLpw"
assert change_request.live_mode is True
assert change_request.order_id == "ord_0000A3bQ8FJIQoEfuC07n6"
assert isinstance(change_request.order_change_offers, type([]))
assert (
change_request.order_change_offers[0].slices.add[0].id
== "sli_00009htYpSCXrwaB9Dn123"
)
assert isinstance(change_request.order_change_offers[0].slices.remove, type([]))
assert (
change_request.order_change_offers[0].slices.remove[0].id
== "sli_00009htYpSCXrwaB9Dn123"
)
assert change_request.order_change_offers[0].updated_at == datetime(
2020, 1, 17, 10, 12, 14, 545000
)
assert isinstance(change_request.slices.add, type([]))
assert change_request.slices.add[0].cabin_class == "economy"
assert change_request.slices.add[0].departure_date == date(2020, 4, 24)
assert change_request.slices.add[0].destination == "JFK"
assert change_request.slices.add[0].origin == "LHR"
assert isinstance(change_request.slices.remove, type([]))
assert change_request.slices.remove[0].slice_id == "sli_00009htYpSCXrwaB9Dn123"
assert change_request.updated_at == datetime(2020, 1, 17, 10, 12, 11, 634000)
| 47.955882
| 88
| 0.6544
| 383
| 3,261
| 5.342037
| 0.180157
| 0.222385
| 0.213587
| 0.107527
| 0.775171
| 0.760997
| 0.747801
| 0.713587
| 0.689638
| 0.635875
| 0
| 0.085293
| 0.230604
| 3,261
| 67
| 89
| 48.671642
| 0.730171
| 0
| 0
| 0.393443
| 0
| 0
| 0.145354
| 0.107329
| 0
| 0
| 0
| 0
| 0.47541
| 1
| 0.032787
| false
| 0
| 0.032787
| 0
| 0.065574
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
8d5459e888ce3f8e57a767e9f743136cf79a5e95
| 8,267
|
py
|
Python
|
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[en_CA-2016] 1.py
|
gour/holidata
|
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
|
[
"MIT"
] | 32
|
2019-04-12T08:01:34.000Z
|
2022-02-28T04:41:50.000Z
|
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[en_CA-2016] 1.py
|
gour/holidata
|
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
|
[
"MIT"
] | 74
|
2019-07-09T16:35:20.000Z
|
2022-03-09T16:41:34.000Z
|
tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[en_CA-2016] 1.py
|
gour/holidata
|
89c7323f9c5345a3ecbf5cd5a835b0e08cfebc13
|
[
"MIT"
] | 20
|
2019-01-28T07:41:02.000Z
|
2022-02-16T02:38:57.000Z
|
[
{
'date': '2016-01-01',
'description': "New Year's Day",
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2016-02-15',
'description': 'Family Day',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'V'
},
{
'date': '2016-02-15',
'description': 'Family Day',
'locale': 'en-CA',
'notes': '',
'region': 'ON',
'type': 'V'
},
{
'date': '2016-02-15',
'description': 'Family Day',
'locale': 'en-CA',
'notes': '',
'region': 'SK',
'type': 'V'
},
{
'date': '2016-02-15',
'description': 'Family Day',
'locale': 'en-CA',
'notes': '',
'region': 'NB',
'type': 'V'
},
{
'date': '2016-02-15',
'description': 'Louis Riel Day',
'locale': 'en-CA',
'notes': '',
'region': 'MB',
'type': 'V'
},
{
'date': '2016-02-15',
'description': 'Islander Day',
'locale': 'en-CA',
'notes': '',
'region': 'PE',
'type': 'V'
},
{
'date': '2016-03-25',
'description': 'Good Friday',
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2016-03-28',
'description': 'Easter Monday',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'RV'
},
{
'date': '2016-03-28',
'description': 'Easter Monday',
'locale': 'en-CA',
'notes': '',
'region': 'PE',
'type': 'RV'
},
{
'date': '2016-03-28',
'description': 'Easter Monday',
'locale': 'en-CA',
'notes': '',
'region': 'QC',
'type': 'RV'
},
{
'date': '2016-05-23',
'description': "National Patriots' Day",
'locale': 'en-CA',
'notes': '',
'region': 'QC',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'BC',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'MB',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'NS',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'ON',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'SK',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'NT',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'NU',
'type': 'V'
},
{
'date': '2016-05-23',
'description': 'Victoria Day',
'locale': 'en-CA',
'notes': '',
'region': 'YT',
'type': 'V'
},
{
'date': '2016-06-24',
'description': 'National Holiday',
'locale': 'en-CA',
'notes': '',
'region': 'QC',
'type': 'F'
},
{
'date': '2016-07-01',
'description': 'Canada Day',
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2016-08-01',
'description': 'August Civic Holiday',
'locale': 'en-CA',
'notes': '',
'region': 'NT',
'type': 'V'
},
{
'date': '2016-08-01',
'description': 'August Civic Holiday',
'locale': 'en-CA',
'notes': '',
'region': 'NU',
'type': 'V'
},
{
'date': '2016-08-01',
'description': 'Saskatchewan Day',
'locale': 'en-CA',
'notes': '',
'region': 'SK',
'type': 'V'
},
{
'date': '2016-08-01',
'description': 'Heritage Day',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'V'
},
{
'date': '2016-08-01',
'description': 'Heritage Day',
'locale': 'en-CA',
'notes': '',
'region': 'NS',
'type': 'V'
},
{
'date': '2016-08-01',
'description': 'New Brunswick Day',
'locale': 'en-CA',
'notes': '',
'region': 'NB',
'type': 'V'
},
{
'date': '2016-09-05',
'description': 'Labour Day',
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NV'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'BC',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'MB',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'NL',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'ON',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'QC',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'SK',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'NT',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'NU',
'type': 'V'
},
{
'date': '2016-10-10',
'description': 'Thanksgiving Day',
'locale': 'en-CA',
'notes': '',
'region': 'YT',
'type': 'V'
},
{
'date': '2016-11-11',
'description': 'Remembrance Day',
'locale': 'en-CA',
'notes': '',
'region': 'AB',
'type': 'F'
},
{
'date': '2016-11-11',
'description': 'Remembrance Day',
'locale': 'en-CA',
'notes': '',
'region': 'BC',
'type': 'F'
},
{
'date': '2016-11-11',
'description': 'Remembrance Day',
'locale': 'en-CA',
'notes': '',
'region': 'NB',
'type': 'F'
},
{
'date': '2016-11-11',
'description': 'Remembrance Day',
'locale': 'en-CA',
'notes': '',
'region': 'NL',
'type': 'F'
},
{
'date': '2016-11-11',
'description': 'Remembrance Day',
'locale': 'en-CA',
'notes': '',
'region': 'NT',
'type': 'F'
},
{
'date': '2016-12-25',
'description': 'Christmas Day',
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2016-12-26',
'description': 'Boxing Day',
'locale': 'en-CA',
'notes': '',
'region': '',
'type': 'NRF'
}
]
| 21.87037
| 48
| 0.362042
| 706
| 8,267
| 4.239377
| 0.103399
| 0.125626
| 0.157033
| 0.23555
| 0.91146
| 0.903775
| 0.892082
| 0.841296
| 0.815236
| 0.815236
| 0
| 0.076376
| 0.4045
| 8,267
| 378
| 49
| 21.87037
| 0.531586
| 0
| 0
| 0.690476
| 0
| 0
| 0.385704
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
8d9db5bddec1f19be3b0ee0e4f6da031ebce650a
| 2,847
|
py
|
Python
|
python/snpx/snpx_mxnet/arch/snpx_net.py
|
ahmedezzat85/SNPX_ML
|
7316b0d46d39d2335b3095527a3ac81be208928d
|
[
"Apache-2.0"
] | null | null | null |
python/snpx/snpx_mxnet/arch/snpx_net.py
|
ahmedezzat85/SNPX_ML
|
7316b0d46d39d2335b3095527a3ac81be208928d
|
[
"Apache-2.0"
] | null | null | null |
python/snpx/snpx_mxnet/arch/snpx_net.py
|
ahmedezzat85/SNPX_ML
|
7316b0d46d39d2335b3095527a3ac81be208928d
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import
import mxnet as mx
import numpy as np
from .mx_net import MxNet
def model_A(net):
net.convolution(16, (3,3), stride=(1,1), name='Conv0')
net.conv_dw(16 , (3,3), stride=(1,1), add_bn=True, name='Conv1')
net.conv_dw(32 , (3,3), stride=(2,2), add_bn=True, name='Conv2')
net.conv_dw(32 , (3,3), stride=(1,1), add_bn=True, name='Conv3')
net.conv_dw(32 , (3,3), stride=(1,1), add_bn=True, name='Conv4')
net.conv_dw(64 , (3,3), stride=(2,2), add_bn=True, name='Conv5')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv6')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv7')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv8')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv9')
net.conv_dw(128, (3,3), stride=(2,2), add_bn=True, name='Conv10')
net.pooling('avg', (4,4), name="global_pool")
return net
def model_B(net):
net.convolution(16, (3,3), stride=(1,1), name='Conv0')
net.conv_dw(16 , (3,3), stride=(1,1), add_bn=True, name='Conv1')
net.conv_dw(32 , (3,3), stride=(2,2), add_bn=True, name='Conv2')
net.conv_dw(32 , (3,3), stride=(1,1), add_bn=True, name='Conv3')
net.conv_dw(32 , (3,3), stride=(1,1), add_bn=True, name='Conv4')
net.conv_dw(64 , (3,3), stride=(2,2), add_bn=True, name='Conv5')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv6')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv7')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv8')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv9')
net.pooling('avg', (8,8), name="global_pool")
return net
def model_C(net):
net.convolution(32, (3,3), stride=(1,1), name='Conv0')
net.conv_dw(32 , (3,3), stride=(1,1), add_bn=True, name='Conv1')
net.conv_dw(64 , (3,3), stride=(2,2), add_bn=True, name='Conv2')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv3')
net.conv_dw(64 , (3,3), stride=(1,1), add_bn=True, name='Conv4')
net.conv_dw(128 , (3,3), stride=(2,2), add_bn=True, name='Conv5')
net.conv_dw(128 , (3,3), stride=(1,1), add_bn=True, name='Conv6')
net.conv_dw(128 , (3,3), stride=(1,1), add_bn=True, name='Conv7')
net.conv_dw(128 , (3,3), stride=(1,1), add_bn=True, name='Conv8')
net.conv_dw(128 , (3,3), stride=(1,1), add_bn=True, name='Conv9')
net.pooling('avg', (8,8), name="global_pool")
return net
def snpx_net_create(num_classes,
dtype=np.float32,
is_training=True,
use_bn=True):
""" """
net = MxNet(dtype, is_training)
net = model_C(net)
net.convolution(num_classes, (1,1), pad='valid', act_fn='', name='Conv_Softmax')
net.flatten()
net.Softmax(num_classes)
return net.mx_sym
| 47.45
| 84
| 0.600632
| 529
| 2,847
| 3.081285
| 0.120983
| 0.038037
| 0.152147
| 0.223313
| 0.827607
| 0.802454
| 0.801227
| 0.779141
| 0.779141
| 0.779141
| 0
| 0.099153
| 0.171057
| 2,847
| 60
| 85
| 47.45
| 0.591525
| 0
| 0
| 0.462963
| 0
| 0
| 0.075678
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.074074
| false
| 0
| 0.074074
| 0
| 0.222222
| 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
|
a5e08d0f54f25ed763bde9e4a82b1f9eac77aa34
| 2,497
|
py
|
Python
|
tests/test_helper_node_to_html.py
|
contentstack/contentstack-utils-python
|
3c7bb445dc77e5a2ab18ceac6f87a35d37b52186
|
[
"MIT"
] | null | null | null |
tests/test_helper_node_to_html.py
|
contentstack/contentstack-utils-python
|
3c7bb445dc77e5a2ab18ceac6f87a35d37b52186
|
[
"MIT"
] | null | null | null |
tests/test_helper_node_to_html.py
|
contentstack/contentstack-utils-python
|
3c7bb445dc77e5a2ab18ceac6f87a35d37b52186
|
[
"MIT"
] | null | null | null |
import unittest
from contentstack_utils.helper.node_to_html import NodeToHtml
from contentstack_utils.render.options import Options
class TestHelperNodeToHtml(unittest.TestCase):
node_dict = {
"text": "Lorem ipsum dolor sit amet"
}
def setUp(self):
print("Test Helper Class Node To Html")
def test_test_helper_node_superscript(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_subscript(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_inline_code(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_strikethrough(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_underline(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_italic(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_bold(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
def test_test_helper_node_undefined(self):
option = Options()
what_does_it_returns = NodeToHtml.text_node_to_html(self.node_dict, option)
print(what_does_it_returns)
self.assertEqual("Lorem ipsum dolor sit amet", what_does_it_returns)
| 40.274194
| 83
| 0.732078
| 345
| 2,497
| 4.886957
| 0.121739
| 0.113879
| 0.142349
| 0.241993
| 0.833926
| 0.808422
| 0.808422
| 0.808422
| 0.808422
| 0.808422
| 0
| 0
| 0.194634
| 2,497
| 61
| 84
| 40.934426
| 0.838389
| 0
| 0
| 0.653061
| 0
| 0
| 0.107329
| 0
| 0
| 0
| 0
| 0
| 0.163265
| 1
| 0.183673
| false
| 0
| 0.061224
| 0
| 0.285714
| 0.183673
| 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
|
57561f4add10c6233141229500230b15f9bfd129
| 374
|
py
|
Python
|
ex-mundo3/ex108/teste.py
|
PedroPegado/ex-cursoemvideo
|
46751a7238e6a142b639c4cc3acf1759411732d7
|
[
"MIT"
] | null | null | null |
ex-mundo3/ex108/teste.py
|
PedroPegado/ex-cursoemvideo
|
46751a7238e6a142b639c4cc3acf1759411732d7
|
[
"MIT"
] | null | null | null |
ex-mundo3/ex108/teste.py
|
PedroPegado/ex-cursoemvideo
|
46751a7238e6a142b639c4cc3acf1759411732d7
|
[
"MIT"
] | null | null | null |
import moeda
d = float(input('Digite o preço: R$'))
print(f'A metade de {moeda.moeda(d)} é {moeda.moeda(moeda.metade(d))}.')
print(f'O dobro de {moeda.moeda(d)} é {moeda.moeda(moeda.dobro(d))}.')
print(f'O aumento de 10% de {moeda.moeda(d)} é {moeda.moeda(moeda.aumentar(d, 10))}.')
print(f'A diminuição de 10% de {moeda.moeda(d)} é {moeda.moeda(moeda.diminuir(d, 10))}.')
| 46.75
| 89
| 0.668449
| 71
| 374
| 3.521127
| 0.295775
| 0.48
| 0.192
| 0.208
| 0.496
| 0.496
| 0.496
| 0.496
| 0.264
| 0.264
| 0
| 0.023881
| 0.104278
| 374
| 7
| 90
| 53.428571
| 0.722388
| 0
| 0
| 0
| 0
| 0.666667
| 0.78877
| 0.323529
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 0.166667
| 0.666667
| 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
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 7
|
93ad0db10a5f7821f245475ac89298979b75fd59
| 2,745
|
py
|
Python
|
prediction/apis/worker_uber.py
|
ecosystemai/ecosystem-notebooks
|
7282f22fbe7ab7a43b2b0c06c74b3f176defaca4
|
[
"MIT"
] | 2
|
2020-08-30T12:50:47.000Z
|
2020-11-24T12:59:43.000Z
|
prediction/apis/worker_uber.py
|
ecosystemai/ecosystem-notebooks
|
7282f22fbe7ab7a43b2b0c06c74b3f176defaca4
|
[
"MIT"
] | null | null | null |
prediction/apis/worker_uber.py
|
ecosystemai/ecosystem-notebooks
|
7282f22fbe7ab7a43b2b0c06c74b3f176defaca4
|
[
"MIT"
] | 2
|
2020-09-02T16:54:25.000Z
|
2021-06-20T20:30:11.000Z
|
from prediction.endpoints import worker_uber as endpoints
from prediction import request_utils
def build_model_ludwig(auth, model_name, model_definition):
ep = endpoints.BUILD_MODEL_LUDWIG
param_dict = {
"model_name": model_name,
"model_definition": model_definition
}
resp = request_utils.create(auth, ep, params=param_dict)
meta = resp.json()
return meta
def build_orbit_btvc(auth, input_database, input_collection, output_database, output_collection, response_column, date_column, seasonality, seed, find, params):
ep = endpoints.BUILD_ORBIT_BTVC
param_dict = {
"input_database": input_database,
"input_collection": input_collection,
"output_database": output_database,
"output_collection": output_collection,
"response_column": response_column,
"date_column": date_column,
"seasonality": seasonality,
"seed": seed,
"find": find,
"params": params
}
resp = request_utils.create(auth, ep, params=param_dict)
meta = resp.json()
return meta
def build_orbit_dlt(auth, input_database, input_collection, output_database, output_collection, response_column, date_column, seasonality, seed, find, params):
ep = endpoints.BUILD_ORBIT_DLT
param_dict = {
"input_database": input_database,
"input_collection": input_collection,
"output_database": output_database,
"output_collection": output_collection,
"response_column": response_column,
"date_column": date_column,
"seasonality": seasonality,
"seed": seed,
"find": find,
"params": params
}
resp = request_utils.create(auth, ep, params=param_dict)
meta = resp.json()
return meta
def build_orbit_ets(auth, input_database, input_collection, output_database, output_collection, response_column, date_column, seasonality, seed, find):
ep = endpoints.BUILD_ORBIT_ETS
param_dict = {
"input_database": input_database,
"input_collection": input_collection,
"output_database": output_database,
"output_collection": output_collection,
"response_column": response_column,
"date_column": date_column,
"seasonality": seasonality,
"seed": seed,
"find": find
}
resp = request_utils.create(auth, ep, params=param_dict)
meta = resp.json()
return meta
def build_orbit_lgt(auth, input_database, input_collection, output_database, output_collection, response_column, date_column, seasonality, seed, find):
ep = endpoints.BUILD_ORBIT_LGT
param_dict = {
"input_database": input_database,
"input_collection": input_collection,
"output_database": output_database,
"output_collection": output_collection,
"response_column": response_column,
"date_column": date_column,
"seasonality": seasonality,
"seed": seed,
"find": find
}
resp = request_utils.create(auth, ep, params=param_dict)
meta = resp.json()
return meta
| 33.47561
| 160
| 0.770492
| 341
| 2,745
| 5.865103
| 0.117302
| 0.078
| 0.108
| 0.112
| 0.8805
| 0.8805
| 0.8805
| 0.8805
| 0.8805
| 0.8805
| 0
| 0
| 0.123497
| 2,745
| 82
| 161
| 33.47561
| 0.831255
| 0
| 0
| 0.753247
| 0
| 0
| 0.169701
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.064935
| false
| 0
| 0.025974
| 0
| 0.155844
| 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
|
f50ecf50cf52c3cea27eb6440cea3298199cfed6
| 430,646
|
py
|
Python
|
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_policy_repository_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_policy_repository_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_policy_repository_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
""" Cisco_IOS_XR_policy_repository_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR policy\-repository package operational data.
This module contains definitions
for the following management objects\:
routing\-policy\: Routing policy operational data
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
"""
import re
import collections
from enum import Enum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk.errors import YPYError, YPYModelError
class AddressFamilyEnum(Enum):
"""
AddressFamilyEnum
Address Family
.. data:: ipv4 = 0
IPv4 Address Family
.. data:: ipv6 = 1
IPv6 Address Family
.. data:: l2vpn = 2
L2VPN Address Family
.. data:: ls = 3
LINKSTATE Address Family
.. data:: af_none = 4
No Address Family
.. data:: af_unknown = 5
Unknown Address Family
"""
ipv4 = 0
ipv6 = 1
l2vpn = 2
ls = 3
af_none = 4
af_unknown = 5
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['AddressFamilyEnum']
class AttachPointDirectionEnum(Enum):
"""
AttachPointDirectionEnum
Attach Point Direction
.. data:: in_ = 0
Attach Point Direction IN
.. data:: out = 1
Attach Point Direction OUT
"""
in_ = 0
out = 1
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['AttachPointDirectionEnum']
class GroupEnum(Enum):
"""
GroupEnum
BGP Neighbor Group Type
.. data:: address_family_group = 0
Address Family Group
.. data:: session_group = 1
Session Group
.. data:: neighbor_group = 2
Neighbor Group
.. data:: neighbor = 3
Neighbor
.. data:: error_group = 4
Error Group
"""
address_family_group = 0
session_group = 1
neighbor_group = 2
neighbor = 3
error_group = 4
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['GroupEnum']
class ObjectStatusEnum(Enum):
"""
ObjectStatusEnum
Whether an RPL object is used/referenced
.. data:: active = 0
The object is in use
.. data:: inactive = 1
The object is referenced by another object, but
not used
.. data:: unused = 2
The object is not used or referenced
"""
active = 0
inactive = 1
unused = 2
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['ObjectStatusEnum']
class SubAddressFamilyEnum(Enum):
"""
SubAddressFamilyEnum
Sub Address Family
.. data:: unicast = 0
Unicast
.. data:: multicast = 1
Multicast
.. data:: label = 2
Label
.. data:: tunnel = 3
Tunnel
.. data:: vpn = 4
VPN
.. data:: mdt = 5
MDT
.. data:: vpls = 6
VPLS
.. data:: rt_constraint = 7
RTConstraint
.. data:: mvpn = 8
MVPN
.. data:: flow = 9
FLOW
.. data:: vpn_mcast = 10
VPN Multicast
.. data:: saf_none = 11
No SAFI
.. data:: saf_unknown = 12
Unknown
"""
unicast = 0
multicast = 1
label = 2
tunnel = 3
vpn = 4
mdt = 5
vpls = 6
rt_constraint = 7
mvpn = 8
flow = 9
vpn_mcast = 10
saf_none = 11
saf_unknown = 12
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['SubAddressFamilyEnum']
class RoutingPolicy(object):
"""
Routing policy operational data
.. attribute:: limits
Information about configured limits and the current values
**type**\: :py:class:`Limits <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Limits>`
.. attribute:: policies
Information about configured route policies
**type**\: :py:class:`Policies <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies>`
.. attribute:: sets
Information about configured sets
**type**\: :py:class:`Sets <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.limits = RoutingPolicy.Limits()
self.limits.parent = self
self.policies = RoutingPolicy.Policies()
self.policies.parent = self
self.sets = RoutingPolicy.Sets()
self.sets.parent = self
class Limits(object):
"""
Information about configured limits and the
current values
.. attribute:: compiled_policies_length
The total compiled length of all policies
**type**\: int
**range:** 0..4294967295
.. attribute:: current_lines_of_policy_limit
Number of lines of configuration for policies/sets currently allowed
**type**\: int
**range:** 0..4294967295
.. attribute:: current_lines_of_policy_used
Current number of lines configured for all policies and sets
**type**\: int
**range:** 0..4294967295
.. attribute:: current_number_of_policies_limit
Number of policies currently allowed
**type**\: int
**range:** 0..4294967295
.. attribute:: current_number_of_policies_used
Current number of policies configured
**type**\: int
**range:** 0..4294967295
.. attribute:: maximum_lines_of_policy
Maximum lines of configuration allowable for all policies and sets
**type**\: int
**range:** 0..4294967295
.. attribute:: maximum_number_of_policies
Maximum number of policies allowable
**type**\: int
**range:** 0..4294967295
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.compiled_policies_length = None
self.current_lines_of_policy_limit = None
self.current_lines_of_policy_used = None
self.current_number_of_policies_limit = None
self.current_number_of_policies_used = None
self.maximum_lines_of_policy = None
self.maximum_number_of_policies = None
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:limits'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.compiled_policies_length is not None:
return True
if self.current_lines_of_policy_limit is not None:
return True
if self.current_lines_of_policy_used is not None:
return True
if self.current_number_of_policies_limit is not None:
return True
if self.current_number_of_policies_used is not None:
return True
if self.maximum_lines_of_policy is not None:
return True
if self.maximum_number_of_policies is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Limits']['meta_info']
class Policies(object):
"""
Information about configured route policies
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.Inactive>`
.. attribute:: route_policies
Information about individual policies
**type**\: :py:class:`RoutePolicies <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Policies.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Policies.Inactive()
self.inactive.parent = self
self.route_policies = RoutingPolicy.Policies.RoutePolicies()
self.route_policies.parent = self
self.unused = RoutingPolicy.Policies.Unused()
self.unused.parent = self
class RoutePolicies(object):
"""
Information about individual policies
.. attribute:: route_policy
Information about an individual policy
**type**\: list of :py:class:`RoutePolicy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy = YList()
self.route_policy.parent = self
self.route_policy.name = 'route_policy'
class RoutePolicy(object):
"""
Information about an individual policy
.. attribute:: route_policy_name <key>
Route policy name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.Attached>`
.. attribute:: policy_uses
Information about which policies and sets this policy uses
**type**\: :py:class:`PolicyUses <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.attached = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.Attached()
self.attached.parent = self
self.policy_uses = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses()
self.policy_uses.parent = self
self.used_by = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.UsedBy()
self.used_by.parent = self
class PolicyUses(object):
"""
Information about which policies and sets
this policy uses
.. attribute:: all_used_policies
Policies used by this policy, or by policies that it uses
**type**\: :py:class:`AllUsedPolicies <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedPolicies>`
.. attribute:: all_used_sets
Sets used by this policy, or by policies that it uses
**type**\: :py:class:`AllUsedSets <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedSets>`
.. attribute:: directly_used_policies
Policies that this policy uses directly
**type**\: :py:class:`DirectlyUsedPolicies <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedPolicies>`
.. attribute:: directly_used_sets
Sets that this policy uses directly
**type**\: :py:class:`DirectlyUsedSets <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedSets>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.all_used_policies = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedPolicies()
self.all_used_policies.parent = self
self.all_used_sets = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedSets()
self.all_used_sets.parent = self
self.directly_used_policies = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedPolicies()
self.directly_used_policies.parent = self
self.directly_used_sets = RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedSets()
self.directly_used_sets.parent = self
class DirectlyUsedPolicies(object):
"""
Policies that this policy uses directly
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:directly-used-policies'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedPolicies']['meta_info']
class AllUsedSets(object):
"""
Sets used by this policy, or by policies
that it uses
.. attribute:: sets
List of sets in several domains
**type**\: list of :py:class:`Sets <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedSets.Sets>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.sets = YList()
self.sets.parent = self
self.sets.name = 'sets'
class Sets(object):
"""
List of sets in several domains
.. attribute:: set_domain
Domain of sets
**type**\: str
.. attribute:: set_name
Names of sets in this domain
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_domain = None
self.set_name = YLeafList()
self.set_name.parent = self
self.set_name.name = 'set_name'
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_domain is not None:
return True
if self.set_name is not None:
for child in self.set_name:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedSets.Sets']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:all-used-sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.sets is not None:
for child_ref in self.sets:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedSets']['meta_info']
class DirectlyUsedSets(object):
"""
Sets that this policy uses directly
.. attribute:: sets
List of sets in several domains
**type**\: list of :py:class:`Sets <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedSets.Sets>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.sets = YList()
self.sets.parent = self
self.sets.name = 'sets'
class Sets(object):
"""
List of sets in several domains
.. attribute:: set_domain
Domain of sets
**type**\: str
.. attribute:: set_name
Names of sets in this domain
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_domain = None
self.set_name = YLeafList()
self.set_name.parent = self
self.set_name.name = 'set_name'
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_domain is not None:
return True
if self.set_name is not None:
for child in self.set_name:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedSets.Sets']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:directly-used-sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.sets is not None:
for child_ref in self.sets:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.DirectlyUsedSets']['meta_info']
class AllUsedPolicies(object):
"""
Policies used by this policy, or by policies
that it uses
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:all-used-policies'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses.AllUsedPolicies']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:policy-uses'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.all_used_policies is not None and self.all_used_policies._has_data():
return True
if self.all_used_sets is not None and self.all_used_sets._has_data():
return True
if self.directly_used_policies is not None and self.directly_used_policies._has_data():
return True
if self.directly_used_sets is not None and self.directly_used_sets._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.PolicyUses']['meta_info']
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Policies.RoutePolicies.RoutePolicy.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy.Attached']['meta_info']
@property
def _common_path(self):
if self.route_policy_name is None:
raise YPYModelError('Key property route_policy_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies/Cisco-IOS-XR-policy-repository-oper:route-policies/Cisco-IOS-XR-policy-repository-oper:route-policy[Cisco-IOS-XR-policy-repository-oper:route-policy-name = ' + str(self.route_policy_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.policy_uses is not None and self.policy_uses._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies.RoutePolicy']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies/Cisco-IOS-XR-policy-repository-oper:route-policies'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy is not None:
for child_ref in self.route_policy:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.RoutePolicies']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:policies'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.route_policies is not None and self.route_policies._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Policies']['meta_info']
class Sets(object):
"""
Information about configured sets
.. attribute:: as_path
Information about AS Path sets
**type**\: :py:class:`AsPath <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath>`
.. attribute:: community
Information about Community sets
**type**\: :py:class:`Community <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community>`
.. attribute:: extended_community_bandwidth
Information about Extended Community Bandwidth sets
**type**\: :py:class:`ExtendedCommunityBandwidth <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth>`
.. attribute:: extended_community_cost
Information about Extended Community Cost sets
**type**\: :py:class:`ExtendedCommunityCost <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost>`
.. attribute:: extended_community_opaque
Information about Extended Community Opaque sets
**type**\: :py:class:`ExtendedCommunityOpaque <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque>`
.. attribute:: extended_community_rt
Information about Extended Community RT sets
**type**\: :py:class:`ExtendedCommunityRt <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt>`
.. attribute:: extended_community_seg_nh
Information about Extended Community SegNH sets
**type**\: :py:class:`ExtendedCommunitySegNh <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh>`
.. attribute:: extended_community_soo
Information about Extended Community SOO sets
**type**\: :py:class:`ExtendedCommunitySoo <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo>`
.. attribute:: ospf_area
Information about OSPF Area sets
**type**\: :py:class:`OspfArea <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea>`
.. attribute:: prefix
Information about AS Path sets
**type**\: :py:class:`Prefix <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix>`
.. attribute:: rd
Information about RD sets
**type**\: :py:class:`Rd <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd>`
.. attribute:: tag
Information about Tag sets
**type**\: :py:class:`Tag <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.as_path = RoutingPolicy.Sets.AsPath()
self.as_path.parent = self
self.community = RoutingPolicy.Sets.Community()
self.community.parent = self
self.extended_community_bandwidth = RoutingPolicy.Sets.ExtendedCommunityBandwidth()
self.extended_community_bandwidth.parent = self
self.extended_community_cost = RoutingPolicy.Sets.ExtendedCommunityCost()
self.extended_community_cost.parent = self
self.extended_community_opaque = RoutingPolicy.Sets.ExtendedCommunityOpaque()
self.extended_community_opaque.parent = self
self.extended_community_rt = RoutingPolicy.Sets.ExtendedCommunityRt()
self.extended_community_rt.parent = self
self.extended_community_seg_nh = RoutingPolicy.Sets.ExtendedCommunitySegNh()
self.extended_community_seg_nh.parent = self
self.extended_community_soo = RoutingPolicy.Sets.ExtendedCommunitySoo()
self.extended_community_soo.parent = self
self.ospf_area = RoutingPolicy.Sets.OspfArea()
self.ospf_area.parent = self
self.prefix = RoutingPolicy.Sets.Prefix()
self.prefix.parent = self
self.rd = RoutingPolicy.Sets.Rd()
self.rd.parent = self
self.tag = RoutingPolicy.Sets.Tag()
self.tag.parent = self
class OspfArea(object):
"""
Information about OSPF Area sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.OspfArea.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.OspfArea.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.OspfArea.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.OspfArea.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.OspfArea.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.OspfArea.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.OspfArea.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:ospf-area'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.OspfArea']['meta_info']
class ExtendedCommunityOpaque(object):
"""
Information about Extended Community Opaque
sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.ExtendedCommunityOpaque.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.ExtendedCommunityOpaque.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunityOpaque.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-opaque'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityOpaque']['meta_info']
class ExtendedCommunitySegNh(object):
"""
Information about Extended Community SegNH sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.ExtendedCommunitySegNh.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.ExtendedCommunitySegNh.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunitySegNh.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-seg-nh'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySegNh']['meta_info']
class ExtendedCommunitySoo(object):
"""
Information about Extended Community SOO sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.ExtendedCommunitySoo.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.ExtendedCommunitySoo.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunitySoo.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-soo'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunitySoo']['meta_info']
class Tag(object):
"""
Information about Tag sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.Tag.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.Tag.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.Tag.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.Tag.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.Tag.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.Tag.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Tag.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:tag'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Tag']['meta_info']
class Prefix(object):
"""
Information about AS Path sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.Prefix.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.Prefix.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.Prefix.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.Prefix.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.Prefix.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.Prefix.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Prefix.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:prefix'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Prefix']['meta_info']
class Community(object):
"""
Information about Community sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.Community.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.Community.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.Community.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.Community.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.Community.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.Community.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Community.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:community'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Community']['meta_info']
class AsPath(object):
"""
Information about AS Path sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.AsPath.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.AsPath.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.AsPath.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.AsPath.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.AsPath.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.AsPath.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.AsPath.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:as-path'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.AsPath']['meta_info']
class ExtendedCommunityBandwidth(object):
"""
Information about Extended Community Bandwidth
sets
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.inactive = RoutingPolicy.Sets.ExtendedCommunityBandwidth.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunityBandwidth.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-bandwidth/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-bandwidth/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-bandwidth/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-bandwidth/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth.Inactive']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-bandwidth'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityBandwidth']['meta_info']
class ExtendedCommunityRt(object):
"""
Information about Extended Community RT sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.ExtendedCommunityRt.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.ExtendedCommunityRt.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunityRt.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunityRt.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-rt'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityRt']['meta_info']
class Rd(object):
"""
Information about RD sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.Rd.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.Rd.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.Rd.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.Rd.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.Rd.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.Rd.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.Rd.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:rd'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.Rd']['meta_info']
class ExtendedCommunityCost(object):
"""
Information about Extended Community Cost sets
.. attribute:: active
All objects of a given type that are attached to a protocol
**type**\: :py:class:`Active <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Active>`
.. attribute:: inactive
All objects of a given type that are not attached to a protocol
**type**\: :py:class:`Inactive <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Inactive>`
.. attribute:: sets
Information about individual sets
**type**\: :py:class:`Sets_ <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_>`
.. attribute:: unused
All objects of a given type that are not referenced at all
**type**\: :py:class:`Unused <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Unused>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.active = RoutingPolicy.Sets.ExtendedCommunityCost.Active()
self.active.parent = self
self.inactive = RoutingPolicy.Sets.ExtendedCommunityCost.Inactive()
self.inactive.parent = self
self.sets = RoutingPolicy.Sets.ExtendedCommunityCost.Sets_()
self.sets.parent = self
self.unused = RoutingPolicy.Sets.ExtendedCommunityCost.Unused()
self.unused.parent = self
class Sets_(object):
"""
Information about individual sets
.. attribute:: set
Information about an individual set
**type**\: list of :py:class:`Set <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set = YList()
self.set.parent = self
self.set.name = 'set'
class Set(object):
"""
Information about an individual set
.. attribute:: set_name <key>
Set name
**type**\: str
**pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+
.. attribute:: attached
Information about where this policy or set is attached
**type**\: :py:class:`Attached <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.Attached>`
.. attribute:: used_by
Policies that use this object, directly or indirectly
**type**\: :py:class:`UsedBy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.UsedBy>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.set_name = None
self.attached = RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.Attached()
self.attached.parent = self
self.used_by = RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.UsedBy()
self.used_by.parent = self
class UsedBy(object):
"""
Policies that use this object, directly or
indirectly
.. attribute:: reference
Information about policies referring to this object
**type**\: list of :py:class:`Reference <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.UsedBy.Reference>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.reference = YList()
self.reference.parent = self
self.reference.name = 'reference'
class Reference(object):
"""
Information about policies referring to this
object
.. attribute:: route_policy_name
Name of policy
**type**\: str
.. attribute:: status
Active, Inactive, or Unused
**type**\: :py:class:`ObjectStatusEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.ObjectStatusEnum>`
.. attribute:: used_directly
Whether the policy uses this object directly or indirectly
**type**\: bool
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.route_policy_name = None
self.status = None
self.used_directly = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:reference'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.route_policy_name is not None:
return True
if self.status is not None:
return True
if self.used_directly is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.UsedBy.Reference']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:used-by'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.reference is not None:
for child_ref in self.reference:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.UsedBy']['meta_info']
class Attached(object):
"""
Information about where this policy or set is
attached
.. attribute:: binding
bindings list
**type**\: list of :py:class:`Binding <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.Attached.Binding>`
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.binding = YList()
self.binding.parent = self
self.binding.name = 'binding'
class Binding(object):
"""
bindings list
.. attribute:: af_name
Address Family Identifier
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: aggregate_network_address
Aggregate IP address or Network IP Address in IPv4 or IPv6 Format
**type**\: str
.. attribute:: area_id
OSPF Area ID in Decimal Integer Format
**type**\: str
.. attribute:: attach_point
Name of attach point where policy is attached
**type**\: str
.. attribute:: attached_policy
The attached policy that (maybe indirectly) uses the object in question
**type**\: str
.. attribute:: direction
Direction In or Out
**type**\: :py:class:`AttachPointDirectionEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AttachPointDirectionEnum>`
.. attribute:: group
Neighbor Group
**type**\: :py:class:`GroupEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.GroupEnum>`
.. attribute:: group_name
Neighbor Group Name
**type**\: str
.. attribute:: instance
Instance
**type**\: str
.. attribute:: interface_name
Interface Name
**type**\: str
.. attribute:: neighbor_address
Neighbor IP Address
**type**\: str
.. attribute:: neighbor_af_name
Neighbor IP Address Family
**type**\: :py:class:`AddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.AddressFamilyEnum>`
.. attribute:: propogate_from
ISIS Propogate From Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: propogate_to
ISIS Propogate To Level
**type**\: int
**range:** \-2147483648..2147483647
.. attribute:: proto_instance
Protocol instance
**type**\: str
.. attribute:: protocol
Protocol to which policy attached
**type**\: str
.. attribute:: route_policy_name
Policy that uses object in question
**type**\: str
.. attribute:: saf_name
Subsequent Address Family Identifier
**type**\: :py:class:`SubAddressFamilyEnum <ydk.models.cisco_ios_xr.Cisco_IOS_XR_policy_repository_oper.SubAddressFamilyEnum>`
.. attribute:: source_protocol
Source Protocol to redistribute, Source Protocol can be one of the following values {all, connected, local, static, bgp, rip, isis, ospf, ospfv3, eigrp, unknown }
**type**\: str
.. attribute:: vrf_name
VRF name
**type**\: str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.af_name = None
self.aggregate_network_address = None
self.area_id = None
self.attach_point = None
self.attached_policy = None
self.direction = None
self.group = None
self.group_name = None
self.instance = None
self.interface_name = None
self.neighbor_address = None
self.neighbor_af_name = None
self.propogate_from = None
self.propogate_to = None
self.proto_instance = None
self.protocol = None
self.route_policy_name = None
self.saf_name = None
self.source_protocol = None
self.vrf_name = None
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:binding'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.af_name is not None:
return True
if self.aggregate_network_address is not None:
return True
if self.area_id is not None:
return True
if self.attach_point is not None:
return True
if self.attached_policy is not None:
return True
if self.direction is not None:
return True
if self.group is not None:
return True
if self.group_name is not None:
return True
if self.instance is not None:
return True
if self.interface_name is not None:
return True
if self.neighbor_address is not None:
return True
if self.neighbor_af_name is not None:
return True
if self.propogate_from is not None:
return True
if self.propogate_to is not None:
return True
if self.proto_instance is not None:
return True
if self.protocol is not None:
return True
if self.route_policy_name is not None:
return True
if self.saf_name is not None:
return True
if self.source_protocol is not None:
return True
if self.vrf_name is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.Attached.Binding']['meta_info']
@property
def _common_path(self):
if self.parent is None:
raise YPYModelError('parent is not set . Cannot derive path.')
return self.parent._common_path +'/Cisco-IOS-XR-policy-repository-oper:attached'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.binding is not None:
for child_ref in self.binding:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set.Attached']['meta_info']
@property
def _common_path(self):
if self.set_name is None:
raise YPYModelError('Key property set_name is None')
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:set[Cisco-IOS-XR-policy-repository-oper:set-name = ' + str(self.set_name) + ']'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set_name is not None:
return True
if self.attached is not None and self.attached._has_data():
return True
if self.used_by is not None and self.used_by._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_.Set']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.set is not None:
for child_ref in self.set:
if child_ref._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Sets_']['meta_info']
class Unused(object):
"""
All objects of a given type that are not
referenced at all
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost/Cisco-IOS-XR-policy-repository-oper:unused'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Unused']['meta_info']
class Inactive(object):
"""
All objects of a given type that are not
attached to a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost/Cisco-IOS-XR-policy-repository-oper:inactive'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Inactive']['meta_info']
class Active(object):
"""
All objects of a given type that are attached to
a protocol
.. attribute:: object
Policy objects
**type**\: list of str
"""
_prefix = 'policy-repository-oper'
_revision = '2015-11-09'
def __init__(self):
self.parent = None
self.object = YLeafList()
self.object.parent = self
self.object.name = 'object'
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost/Cisco-IOS-XR-policy-repository-oper:active'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.object is not None:
for child in self.object:
if child is not None:
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost.Active']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets/Cisco-IOS-XR-policy-repository-oper:extended-community-cost'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.active is not None and self.active._has_data():
return True
if self.inactive is not None and self.inactive._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
if self.unused is not None and self.unused._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets.ExtendedCommunityCost']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy/Cisco-IOS-XR-policy-repository-oper:sets'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.as_path is not None and self.as_path._has_data():
return True
if self.community is not None and self.community._has_data():
return True
if self.extended_community_bandwidth is not None and self.extended_community_bandwidth._has_data():
return True
if self.extended_community_cost is not None and self.extended_community_cost._has_data():
return True
if self.extended_community_opaque is not None and self.extended_community_opaque._has_data():
return True
if self.extended_community_rt is not None and self.extended_community_rt._has_data():
return True
if self.extended_community_seg_nh is not None and self.extended_community_seg_nh._has_data():
return True
if self.extended_community_soo is not None and self.extended_community_soo._has_data():
return True
if self.ospf_area is not None and self.ospf_area._has_data():
return True
if self.prefix is not None and self.prefix._has_data():
return True
if self.rd is not None and self.rd._has_data():
return True
if self.tag is not None and self.tag._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy.Sets']['meta_info']
@property
def _common_path(self):
return '/Cisco-IOS-XR-policy-repository-oper:routing-policy'
def is_config(self):
''' Returns True if this instance represents config data else returns False '''
return False
def _has_data(self):
if not self.is_config():
return False
if self.limits is not None and self.limits._has_data():
return True
if self.policies is not None and self.policies._has_data():
return True
if self.sets is not None and self.sets._has_data():
return True
return False
@staticmethod
def _meta_info():
from ydk.models.cisco_ios_xr._meta import _Cisco_IOS_XR_policy_repository_oper as meta
return meta._meta_table['RoutingPolicy']['meta_info']
| 41.969204
| 346
| 0.428874
| 35,561
| 430,646
| 4.992801
| 0.007593
| 0.049609
| 0.062011
| 0.066776
| 0.967175
| 0.961132
| 0.952379
| 0.948324
| 0.943571
| 0.932334
| 0
| 0.008669
| 0.509546
| 430,646
| 10,260
| 347
| 41.973294
| 0.831951
| 0.216737
| 0
| 0.903365
| 0
| 0.017041
| 0.123933
| 0.101381
| 0
| 0
| 0
| 0
| 0
| 1
| 0.150992
| false
| 0
| 0.03214
| 0.014452
| 0.47994
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 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
| 8
|
f537453ad67c9657705cd02fd8ebfc375f070ccb
| 97
|
py
|
Python
|
instance/config.py
|
najma-amin/News-Highlights
|
caad6c5af7650c2cc8490f100d070573fe18f6a6
|
[
"MIT"
] | null | null | null |
instance/config.py
|
najma-amin/News-Highlights
|
caad6c5af7650c2cc8490f100d070573fe18f6a6
|
[
"MIT"
] | null | null | null |
instance/config.py
|
najma-amin/News-Highlights
|
caad6c5af7650c2cc8490f100d070573fe18f6a6
|
[
"MIT"
] | null | null | null |
NEWS_API_KEY = '2384a9abd086451dae6b139e39096672'
SECRET_KEY = '94f3f9056842ed841d50ccaf47d8e2e0'
| 48.5
| 49
| 0.886598
| 7
| 97
| 11.857143
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.467391
| 0.051546
| 97
| 2
| 50
| 48.5
| 0.434783
| 0
| 0
| 0
| 0
| 0
| 0.653061
| 0.653061
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f5467353037e8e57b0ed0ea273058447471af168
| 63
|
py
|
Python
|
towhee/pipelines/__init__.py
|
L-Net-1992/towhee
|
471de97bf9c5443efaf3b62fd440b3ebdb6d5903
|
[
"Apache-2.0"
] | null | null | null |
towhee/pipelines/__init__.py
|
L-Net-1992/towhee
|
471de97bf9c5443efaf3b62fd440b3ebdb6d5903
|
[
"Apache-2.0"
] | null | null | null |
towhee/pipelines/__init__.py
|
L-Net-1992/towhee
|
471de97bf9c5443efaf3b62fd440b3ebdb6d5903
|
[
"Apache-2.0"
] | null | null | null |
from .image_embedding_pipeline import image_embedding_pipeline
| 31.5
| 62
| 0.920635
| 8
| 63
| 6.75
| 0.625
| 0.518519
| 0.814815
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.063492
| 63
| 1
| 63
| 63
| 0.915254
| 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
|
f5585a41fae665acb2c82b37fa1e46dd91ca9170
| 3,153
|
py
|
Python
|
shakespearelang/tests/unit/test_numeric_input.py
|
btc1311/shakespearelang
|
5cdbd5023252f2ada124d1b2d2390c9d7e79e395
|
[
"MIT"
] | null | null | null |
shakespearelang/tests/unit/test_numeric_input.py
|
btc1311/shakespearelang
|
5cdbd5023252f2ada124d1b2d2390c9d7e79e395
|
[
"MIT"
] | null | null | null |
shakespearelang/tests/unit/test_numeric_input.py
|
btc1311/shakespearelang
|
5cdbd5023252f2ada124d1b2d2390c9d7e79e395
|
[
"MIT"
] | null | null | null |
from shakespearelang.shakespeare_interpreter import Shakespeare
from io import StringIO
import pytest
def test_correctly_parses_number(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', StringIO('4257'))
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert s._character_by_name('Romeo').value == 4257
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
def test_ignores_non_digits(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', StringIO('4257a123'))
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert s._character_by_name('Romeo').value == 4257
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
def test_consumes_trailing_newline(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', StringIO('4257\na'))
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert s._character_by_name('Romeo').value == 4257
assert s._input_buffer == ''
assert input() == 'a'
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
def test_errors_without_digits(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', StringIO('a123'))
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
with pytest.raises(Exception) as exc:
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert 'no numeric input' in str(exc.value).lower()
assert s._character_by_name('Romeo').value == 0
monkeypatch.setattr('sys.stdin', StringIO('a123'))
with pytest.raises(Exception) as exc:
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert 'no numeric input' in str(exc.value).lower()
assert s._character_by_name('Romeo').value == 0
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
def test_errors_on_eof(monkeypatch, capsys):
monkeypatch.setattr('sys.stdin', StringIO(''))
s = Shakespeare()
s.run_dramatis_persona('Juliet, a test.')
s.run_dramatis_persona('Romeo, a test.')
s.run_event('[Enter Romeo and Juliet]')
with pytest.raises(Exception) as exc:
s.run_sentence('Listen to your heart!', s._on_stage_character_by_name('Juliet'))
assert 'end of file' in str(exc.value).lower()
assert s._character_by_name('Romeo').value == 0
captured = capsys.readouterr()
assert captured.out == ''
assert captured.err == ''
| 40.948052
| 88
| 0.69648
| 427
| 3,153
| 4.915691
| 0.17096
| 0.040019
| 0.085755
| 0.090519
| 0.899
| 0.899
| 0.87899
| 0.854693
| 0.747975
| 0.747975
| 0
| 0.013631
| 0.162385
| 3,153
| 76
| 89
| 41.486842
| 0.781144
| 0
| 0
| 0.782609
| 0
| 0
| 0.184586
| 0
| 0
| 0
| 0
| 0
| 0.304348
| 1
| 0.072464
| false
| 0
| 0.043478
| 0
| 0.115942
| 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
|
f57c7918862d191365a0a2deae75640a2ee242fd
| 125
|
py
|
Python
|
tests/utils.py
|
kuchichan/QLligraphy
|
6a6a272618ab813a8fb49cf51625df81f300513f
|
[
"BSD-3-Clause"
] | 1
|
2022-03-17T08:27:18.000Z
|
2022-03-17T08:27:18.000Z
|
tests/utils.py
|
kuchichan/QLligraphy
|
6a6a272618ab813a8fb49cf51625df81f300513f
|
[
"BSD-3-Clause"
] | null | null | null |
tests/utils.py
|
kuchichan/QLligraphy
|
6a6a272618ab813a8fb49cf51625df81f300513f
|
[
"BSD-3-Clause"
] | null | null | null |
from textwrap import dedent
def shrink_python_source_code(source_code: str) -> str:
return dedent(source_code).strip()
| 20.833333
| 55
| 0.776
| 18
| 125
| 5.111111
| 0.666667
| 0.326087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136
| 125
| 5
| 56
| 25
| 0.851852
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 1
| 0
| 0
| null | 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
| 1
| 1
| 0
|
0
| 7
|
1927821a3ab68ca539c2ea63ba9a00202139da7a
| 1,581
|
py
|
Python
|
dataset.py
|
Jacqueline121/AudioVisual-MSNet
|
06ec595d448c00f76c7446a3180e5834bf1929bf
|
[
"MIT"
] | null | null | null |
dataset.py
|
Jacqueline121/AudioVisual-MSNet
|
06ec595d448c00f76c7446a3180e5834bf1929bf
|
[
"MIT"
] | null | null | null |
dataset.py
|
Jacqueline121/AudioVisual-MSNet
|
06ec595d448c00f76c7446a3180e5834bf1929bf
|
[
"MIT"
] | null | null | null |
from datasets.sum_db import sum_db
def get_training_set(opt, spatial_transform, temporal_transform,
target_transform):
assert opt.dataset in ['movie50', 'tvsum']
print('Creating training dataset: {}'.format(opt.dataset))
if opt.dataset == 'tvsum':
training_data = sum_db(
opt.video_path_tvsum,
opt.annotation_path_tvsum_train,
opt.gt_path_tvsum,
opt.audio_path_tvsum,
spatial_transform=spatial_transform,
temporal_transform=temporal_transform,
target_transform=target_transform)
elif opt.dataset == 'movie50':
training_data = sum_db(
opt.video_path_movie50,
opt.annotation_path_movie50_train,
opt.gt_path_movie50,
opt.audio_path_movie50,
spatial_transform=spatial_transform,
temporal_transform=temporal_transform,
target_transform=target_transform)
return training_data
def get_test_set(opt, spatial_transform, temporal_transform, target_transform):
assert opt.dataset in ['movie50', 'tvsum']
print('Creating testing dataset: {}'.format(opt.dataset))
if opt.dataset == 'tvsum':
test_data = sum_db(
opt.video_path_tvsum,
opt.annotation_path_tvsum_test,
opt.gt_path_tvsum,
opt.audio_path_tvsum,
spatial_transform,
temporal_transform,
target_transform,
exhaustive_sampling=True)
elif opt.dataset == 'movie50':
test_data = sum_db(
opt.video_path_movie50,
opt.annotation_path_movie50_test,
opt.gt_path_movie50,
opt.audio_path_movie50,
spatial_transform=spatial_transform,
temporal_transform=temporal_transform,
target_transform=target_transform)
return test_data
| 26.79661
| 79
| 0.776091
| 206
| 1,581
| 5.567961
| 0.179612
| 0.125545
| 0.20401
| 0.172624
| 0.852659
| 0.852659
| 0.82476
| 0.803836
| 0.734089
| 0.734089
| 0
| 0.017582
| 0.136622
| 1,581
| 58
| 80
| 27.258621
| 0.822711
| 0
| 0
| 0.659574
| 0
| 0
| 0.066414
| 0
| 0
| 0
| 0
| 0
| 0.042553
| 1
| 0.042553
| false
| 0
| 0.021277
| 0
| 0.106383
| 0.042553
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
1967228b4dd694e7c2cd505a3b38a933804e09af
| 84
|
py
|
Python
|
core/utils/__init__.py
|
taimaskhanov11/AsyncVkAccount
|
58c48886545aa581eb28a1071d52e0a60aa1b8ea
|
[
"MIT"
] | 1
|
2021-12-26T20:40:39.000Z
|
2021-12-26T20:40:39.000Z
|
core/utils/__init__.py
|
taimaskhanov11/AsyncVkAccount
|
58c48886545aa581eb28a1071d52e0a60aa1b8ea
|
[
"MIT"
] | 1
|
2021-12-03T18:38:38.000Z
|
2021-12-03T18:39:08.000Z
|
core/utils/__init__.py
|
taimaskhanov11/AsyncVkAccount
|
58c48886545aa581eb28a1071d52e0a60aa1b8ea
|
[
"MIT"
] | null | null | null |
from .find_most_city import find_most_city
from .search_answer import search_answer
| 28
| 42
| 0.880952
| 14
| 84
| 4.857143
| 0.5
| 0.235294
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095238
| 84
| 2
| 43
| 42
| 0.894737
| 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
|
27adb5b1fcb25962871bfc4d9cf9449a32bb0295
| 6,837
|
py
|
Python
|
resources.py
|
KRS-dev/PRW_Data_Opvrager
|
f067ddfa1973454fda5db6b81303581d9d1c4173
|
[
"MIT"
] | null | null | null |
resources.py
|
KRS-dev/PRW_Data_Opvrager
|
f067ddfa1973454fda5db6b81303581d9d1c4173
|
[
"MIT"
] | null | null | null |
resources.py
|
KRS-dev/PRW_Data_Opvrager
|
f067ddfa1973454fda5db6b81303581d9d1c4173
|
[
"MIT"
] | 1
|
2022-01-07T07:35:10.000Z
|
2022-01-07T07:35:10.000Z
|
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.11.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x04\xe5\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x18\x00\x00\x00\x18\x08\x03\x00\x00\x00\xd7\xa9\xcd\xca\
\x00\x00\x00\x01\x73\x52\x47\x42\x01\xd9\xc9\x2c\x7f\x00\x00\x00\
\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\
\x9c\x18\x00\x00\x02\x4f\x50\x4c\x54\x45\x00\xff\xff\x00\xff\xff\
\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\
\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\
\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\
\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\x40\x40\x00\x52\x52\x00\
\x6c\x6c\x00\xb7\xb7\x00\xf2\xf2\x00\xed\xed\x00\x74\x74\x00\x4c\
\x4c\x00\x64\x64\x00\x99\x99\x00\xde\xde\x00\x85\x85\x00\xa0\xa0\
\x00\xd8\xd8\x00\x65\x65\x00\x4d\x4d\x00\x95\x95\x00\xf0\xf0\x00\
\x6d\x6d\x00\x00\x00\x00\x12\x12\x00\x03\x03\x00\x7e\x7e\x00\xcf\
\xcf\x00\x46\x46\x00\x0c\x0c\x00\x09\x09\x00\x3d\x3d\x00\x96\x96\
\x00\x14\x14\x00\x76\x76\x00\xc6\xc6\x00\x22\x22\x00\x5c\x5c\x00\
\xe9\xe9\x00\x2d\x2d\x00\xe1\xe1\x00\x8b\x8b\x00\x16\x16\x00\x19\
\x19\x00\xab\xab\x00\x9a\x9a\x00\xbe\xbe\x00\x43\x43\x00\x06\x06\
\x00\x63\x63\x00\x7f\x7f\x00\x0b\x0b\x00\x66\x66\x00\x10\x10\x00\
\x13\x13\x00\x41\x41\x00\xe7\xe7\x00\xe4\xe4\x00\xc8\xc8\x00\x24\
\x24\x00\xa3\xa3\x00\xd6\xd6\x00\x58\x58\x00\x02\x02\x00\x93\x93\
\x00\x50\x50\x00\xae\xae\x00\x0d\x0d\x00\x2f\x2f\x00\x2c\x2c\x00\
\x01\x01\x00\xaa\xaa\x00\x77\x77\x00\x1d\x1d\x00\x91\x91\x00\xa2\
\xa2\x00\x94\x94\x00\x1b\x1b\x00\x5e\x5e\x00\x1e\x1e\x00\xb6\xb6\
\x00\x34\x34\x00\x04\x04\x00\x71\x71\x00\xca\xca\x00\x82\x82\x00\
\xaf\xaf\x00\x2e\x2e\x00\x6b\x6b\x00\x26\x26\x00\x88\x88\x00\x87\
\x87\x00\x05\x05\x00\x54\x54\x00\x39\x39\x00\xee\xee\x00\xe8\xe8\
\x00\x44\x44\x00\x83\x83\x00\xfa\xfa\x00\xbb\xbb\x00\x36\x36\x00\
\x45\x45\x00\xb5\xb5\x00\x0f\x0f\x00\x59\x59\x00\x07\x07\x00\xfd\
\xfd\x00\x8a\x8a\x00\x17\x17\x00\xc0\xc0\x00\x48\x48\x00\x55\x55\
\x00\xcc\xcc\x00\x2b\x2b\x00\x8f\x8f\x00\xca\xd6\x00\xee\xfd\x00\
\xf0\xff\x00\xda\xe8\x00\x42\x46\x00\x88\x90\x00\xb1\xbc\x00\x43\
\x47\x00\x1a\x1c\x00\x7e\x86\x00\xb8\xc4\x00\x57\x5c\x00\x11\x12\
\x00\x68\x6f\x00\xc7\xd4\x00\x0a\x0b\x00\xa5\xaf\x00\xb4\xd6\x00\
\xd5\xfd\x00\xd7\xff\x00\xc3\xe8\x00\x3b\x46\x00\x7a\x91\x00\xc2\
\xe7\x00\x6e\x83\x00\x14\x18\x00\x36\x41\x00\x84\x9c\x00\x5c\x6e\
\x00\x17\x1b\x00\x72\x88\x00\xb8\xda\x00\x2a\x32\x00\x0b\x0d\x00\
\xa8\xc7\x00\xb8\xff\x00\x95\xff\x00\x70\xff\x00\x4c\xff\x00\x2c\
\xff\x00\x2c\xff\x00\x2c\xff\x00\x12\xff\x00\x12\xff\x00\x12\xff\
\x00\x12\xff\x00\x12\xff\x00\x12\xff\x00\x12\xff\x00\x00\xff\x00\
\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\
\xff\x00\x00\xff\x00\x00\xff\x00\x00\xff\x00\x00\x00\x00\x00\xff\
\x00\x00\xff\x00\x00\xff\x00\x00\xff\x66\x3f\x32\x00\x00\x00\x00\
\xc5\x74\x52\x4e\x53\x00\x01\x58\xdd\xfd\xff\xf9\xc5\x25\x3d\xd9\
\xfc\xc8\x5e\x08\x61\xd1\xfb\xfe\xf0\x9f\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\
\xff\xff\xfe\xf5\x8f\xe5\xfd\xff\xfe\xf0\x8d\x01\x49\xe4\xfe\xff\
\xfd\xec\x9e\x2c\x03\x00\x73\xfa\xc9\x30\x7f\xe4\x12\x42\x00\x00\
\x01\x5e\x49\x44\x41\x54\x78\x9c\x63\x60\x60\x64\x62\x66\x61\x45\
\x01\x6c\xec\x1c\x8c\x0c\x0c\x8c\x9c\x5c\xdc\xac\x68\x80\x8d\x87\
\x97\x8f\x81\x5f\x40\x10\x5d\x9c\x95\x55\x48\x58\x84\x01\x53\x14\
\x02\xc8\x90\x10\x15\x15\x13\x97\x90\x94\x92\x16\x95\x91\x95\x93\
\x97\x57\x10\x53\x54\x52\x56\x51\x55\x53\x17\x65\xd0\xd0\xd0\xd4\
\xd2\xd0\xd6\xd1\xd5\xd0\xd3\xd7\x30\x30\x14\x37\x32\x36\x31\xd5\
\x33\x33\xb7\xd0\x00\x4a\x58\x5a\x59\xdb\xd8\xea\x6a\xd8\xd9\x3b\
\x38\x3a\x39\xbb\xb8\xda\xbb\xb9\x7b\x78\x5a\x83\x24\xbc\xbc\x7d\
\x34\x7c\x81\x12\x7e\xfe\x01\xea\x81\x5a\x41\xc1\x21\xa1\x61\x5e\
\xe1\x46\x20\x09\x55\x1b\xeb\x08\x5d\x0d\xf1\x48\xd3\xa8\xe8\x98\
\x10\xd1\xd8\xb8\xf8\x84\x44\xad\x24\xa0\x84\x75\xb2\x46\x4a\xaa\
\xae\x86\x86\x86\x7b\x9a\x64\xba\x69\x46\x66\x56\xb6\x75\x4e\x6e\
\x1e\x50\x22\xdf\xdf\xb7\xa0\x50\x57\x23\xbe\x28\xa4\xb8\xa4\xb4\
\x2c\xaa\x3c\xbf\xa2\xb2\xaa\x5a\x1a\x28\xe1\x57\xc3\xca\x0a\x94\
\xb0\xab\xad\x2b\xaf\x37\x69\xa8\xb4\x68\x6c\xaa\x6e\xd6\x6f\x01\
\x4a\xb4\xb6\xb5\xb7\x77\x74\x6a\x74\x75\xf7\xf4\xf6\xf5\x4f\xd0\
\x98\x38\x69\xb2\x91\xc6\x94\xa9\x40\x89\x69\xd3\x67\xcc\x98\x39\
\x4b\x63\xf6\x9c\xb9\xf3\xe6\x2f\x58\xa8\xb1\x68\xf1\x92\xa5\x1a\
\xcb\x96\x33\xac\xc0\x01\x18\x56\xe2\x00\x0c\xab\x70\x00\x86\xd5\
\x38\x00\xc3\x1a\xac\x60\xed\x3a\x86\xf5\x1b\x36\x6e\xc2\x00\x9b\
\xb7\x6c\x65\xd8\xb6\x7d\xc7\xce\x5d\xa8\x60\xf7\x9e\xbd\xfb\xf6\
\x33\x1c\xd8\x76\x70\xc7\x6e\x54\x89\x43\x87\x8f\x6c\x3b\x00\x00\
\x07\x53\xcf\x32\xff\x45\xdf\xc5\x00\x00\x00\x00\x49\x45\x4e\x44\
\xae\x42\x60\x82\
"
qt_resource_name = b"\
\x00\x07\
\x07\x3b\xe0\xb3\
\x00\x70\
\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\
\x00\x03\
\x00\x00\x55\x77\
\x00\x50\
\x00\x52\x00\x57\
\x00\x08\
\x0a\x61\x5a\xa7\
\x00\x69\
\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
"
qt_resource_struct_v1 = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x20\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
"
qt_resource_struct_v2 = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x20\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x71\xa0\xb4\x13\xda\
"
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
if qt_version < [5, 8, 0]:
rcc_version = 1
qt_resource_struct = qt_resource_struct_v1
else:
rcc_version = 2
qt_resource_struct = qt_resource_struct_v2
def qInitResources():
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
def qCleanupResources():
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
qInitResources()
| 47.811189
| 103
| 0.726196
| 1,572
| 6,837
| 3.134224
| 0.187023
| 0.209458
| 0.274
| 0.362898
| 0.297747
| 0.297138
| 0.28354
| 0.28354
| 0.27806
| 0.27806
| 0
| 0.294839
| 0.03364
| 6,837
| 142
| 104
| 48.147887
| 0.450885
| 0.022232
| 0
| 0.15873
| 0
| 0.698413
| 0.00015
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0.015873
| false
| 0
| 0.007937
| 0
| 0.02381
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
27e5104eb10853246227265e22131c3575780855
| 122
|
py
|
Python
|
crosslingual_coreference/test.py
|
dvsrepo/crosslingual-coreference
|
2b2d0e2ac0b02728b0134e5b3c5f7912a262532f
|
[
"MIT"
] | null | null | null |
crosslingual_coreference/test.py
|
dvsrepo/crosslingual-coreference
|
2b2d0e2ac0b02728b0134e5b3c5f7912a262532f
|
[
"MIT"
] | null | null | null |
crosslingual_coreference/test.py
|
dvsrepo/crosslingual-coreference
|
2b2d0e2ac0b02728b0134e5b3c5f7912a262532f
|
[
"MIT"
] | null | null | null |
def test_standalone():
from .examples import test_individual
def test_spacy():
from .examples import test_spacy
| 17.428571
| 41
| 0.754098
| 16
| 122
| 5.5
| 0.5
| 0.159091
| 0.409091
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180328
| 122
| 6
| 42
| 20.333333
| 0.88
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0.5
| 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
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
fdd025ceaba1cc39e48a8ad0f1c35ad3d40e792f
| 142
|
py
|
Python
|
generated-libraries/python/netapp/vserver/nis_domain.py
|
radekg/netapp-ontap-lib-get
|
6445ebb071ec147ea82a486fbe9f094c56c5c40d
|
[
"MIT"
] | 2
|
2017-03-28T15:31:26.000Z
|
2018-08-16T22:15:18.000Z
|
generated-libraries/python/netapp/vserver/nis_domain.py
|
radekg/netapp-ontap-lib-get
|
6445ebb071ec147ea82a486fbe9f094c56c5c40d
|
[
"MIT"
] | null | null | null |
generated-libraries/python/netapp/vserver/nis_domain.py
|
radekg/netapp-ontap-lib-get
|
6445ebb071ec147ea82a486fbe9f094c56c5c40d
|
[
"MIT"
] | null | null | null |
class NisDomain(basestring):
"""
NIS Domain
"""
@staticmethod
def get_api_name():
return "nis-domain"
| 14.2
| 29
| 0.528169
| 13
| 142
| 5.615385
| 0.846154
| 0.246575
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.359155
| 142
| 9
| 30
| 15.777778
| 0.802198
| 0.070423
| 0
| 0
| 0
| 0
| 0.086207
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0
| 0.25
| 0.75
| 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
|
e36c2e758fb825a413d0db237bb01b444ad57547
| 2,315
|
py
|
Python
|
deepface/VGGFace.py
|
Kichkun/deepface
|
ac103274ea1996db29e57774d11d5f124a57e09e
|
[
"MIT"
] | null | null | null |
deepface/VGGFace.py
|
Kichkun/deepface
|
ac103274ea1996db29e57774d11d5f124a57e09e
|
[
"MIT"
] | null | null | null |
deepface/VGGFace.py
|
Kichkun/deepface
|
ac103274ea1996db29e57774d11d5f124a57e09e
|
[
"MIT"
] | null | null | null |
import os
from keras.layers import Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dropout, Activation
from keras.models import Model, Sequential
def baseModel():
model = Sequential()
model.add(ZeroPadding2D((1, 1), input_shape=(224, 224, 3)))
model.add(Convolution2D(64, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(128, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(128, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1, 1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(MaxPooling2D((2, 2), strides=(2, 2)))
model.add(Convolution2D(4096, (7, 7), activation='relu'))
model.add(Dropout(0.5))
model.add(Convolution2D(4096, (1, 1), activation='relu'))
model.add(Dropout(0.5))
model.add(Convolution2D(2622, (1, 1)))
model.add(Flatten())
model.add(Activation('softmax'))
return model
def loadModel():
model = baseModel()
model.load_weights(os.path.join('deepface', 'models', 'vgg_face_weights.h5'))
vgg_face_descriptor = Model(inputs=model.layers[0].input, outputs=model.layers[-2].output)
return vgg_face_descriptor
| 37.33871
| 97
| 0.656587
| 311
| 2,315
| 4.861736
| 0.157556
| 0.201058
| 0.222222
| 0.218254
| 0.716931
| 0.70172
| 0.70172
| 0.70172
| 0.70172
| 0.70172
| 0
| 0.090172
| 0.1473
| 2,315
| 61
| 98
| 37.95082
| 0.675785
| 0
| 0
| 0.653061
| 0
| 0
| 0.043197
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.040816
| false
| 0
| 0.061224
| 0
| 0.142857
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
8b5eb4c10120d74502cd7aa767534b6368fe35dd
| 62,797
|
py
|
Python
|
payroll/views.py
|
masoodazhar/-school-management-system
|
6525b3d29d12f03e05d362d81b7c5855806f57d9
|
[
"Apache-2.0"
] | 1
|
2022-01-20T10:20:05.000Z
|
2022-01-20T10:20:05.000Z
|
payroll/views.py
|
masoodazhar/-school-management-system
|
6525b3d29d12f03e05d362d81b7c5855806f57d9
|
[
"Apache-2.0"
] | null | null | null |
payroll/views.py
|
masoodazhar/-school-management-system
|
6525b3d29d12f03e05d362d81b7c5855806f57d9
|
[
"Apache-2.0"
] | 1
|
2022-01-20T10:20:31.000Z
|
2022-01-20T10:20:31.000Z
|
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.views.generic import CreateView, UpdateView, DeleteView, ListView, TemplateView
# Create your views here.
from .forms import TeacherForm, SalaryForm, FeeDefSerchForm, SchedualForm
from .models import Teacher, Salary, Schedual, Position, Leave, EmployeeAttendance, AdvanceSalary
from django.db.models import Q, Sum
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from home.decorators import unuthenticated_user, allowed_users
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.auth.models import User, Permission, Group
from django.contrib.messages.views import SuccessMessageMixin
from django.utils import timezone
from django import forms
from datetime import datetime, time, date, timedelta
from calendar import monthrange
from fee.views import convert_month
from django.db.models.functions import Coalesce
from num2words import num2words
from django.contrib import messages
# Payroll section
class SearchDateForm(forms.Form):
seacher_date = forms.CharField(
widget = forms.TextInput(
attrs = {
'type': 'month',
'value': timezone.now().strftime('%Y-%m-%d')
}
)
)
def time_diff(time_str1, time_str2):
t1 = datetime.strptime(time_str1, '%H:%M')
t2 = datetime.strptime(time_str2, '%H:%M')
dt = abs(t2 - t1)
return time(dt.seconds // 3600, (dt.seconds // 60) % 60).strftime('%H:%M')
def get_all_says(year, month):
m = date(year, month, 1) # January 1st
m += timedelta(days = 6 - m.weekday()) # First Sunday
while m.month == month:
yield m
m += timedelta(days = 7)
def daterange(date1, date2):
for n in range(int ((date2 - date1).days)+1):
yield date1 + timedelta(n)
def convert_month_into_string(number):
if number is 1:
return 'Jan'
elif number is 2:
return 'Feb'
elif number is 3:
return 'Mar'
elif number is 4:
return 'Apr'
elif number is 5:
return 'May'
elif number is 6:
return 'Jun'
elif number is 7:
return 'Jul'
elif number is 8:
return 'Aug'
elif number is 9:
return 'Sep'
elif number is 10:
return 'Oct'
elif number is 11:
return 'Nov'
elif number is 12:
return 'Dec'
else:
return 'invalid'
class EmployeeAttednaceCreate(SuccessMessageMixin ,CreateView):
model = EmployeeAttendance
fields = ['employee_name', 'date', 'time_in', 'time_out',]
template_name = 'payroll/attendance_add.html'
success_message = 'Attendance has been marked'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
form = super(EmployeeAttednaceCreate, self).get_form(**kwargs)
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.fields['employee_name'].queryset = Teacher.objects.filter(module_holder=module_holder)
form.fields['date'].widget.attrs={'class': 'date', 'autocomplete': 'off'}
form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
return form
class EmployeeAttednaceUpdate(SuccessMessageMixin ,UpdateView):
model = EmployeeAttendance
fields = ['employee_name', 'date', 'time_in', 'time_out',]
template_name = 'payroll/attendance_add.html'
success_message = 'Attendance has been Updated'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
form = super(EmployeeAttednaceUpdate, self).get_form(**kwargs)
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.fields['employee_name'].queryset = Teacher.objects.filter(module_holder=module_holder)
form.fields['date'].widget.attrs={'class': 'date', 'autocomplete': 'off'}
form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
return form
def employee_induigual(request, pk):
module_holder = request.user.username
employee = Teacher.objects.get(module_holder=module_holder, pk=pk)
current_year = timezone.now().strftime('%Y')
current_month = timezone.now().strftime('%m')
current_day = timezone.now().strftime('%d')
if request.method=='POST':
print(request.POST,'==========sds=dasdasdasdasdsdd==')
current_year = request.POST.get('seacher_date')[:4]
searchdateform = SearchDateForm(request.POST)
else:
searchdateform = SearchDateForm()
heading = []
holidays = []
leaves = []
whole_year = []
for month in range(1, 13):
sundays = []
for sunday in get_all_says(int(current_year), int(month)):
sundays.append(sunday.day)
count_of_date_searched = int(current_year)+int(month)
atte_status = []
num_of_days = monthrange(int(current_year),int(month))[1]
for day in range(1, num_of_days+1):
try:
hds = Leave.objects.values('from_date','to_date').filter(employee=Teacher.objects.get(pk=pk), type='h')
for hd in hds:
startdate = hd['from_date']
enddate = hd['to_date']
for days in daterange(startdate, enddate):
holidays.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
holidays = []
try:
lvs = Leave.objects.values('from_date','to_date').filter(employee=Teacher.objects.get(pk=pk), type='l')
for lv in lvs:
startdate = lv['from_date']
enddate = lv['to_date']
for days in daterange(startdate, enddate):
leaves.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
leaves = []
heading = []
count_of_date_searched =count_of_date_searched+1
holiday_murging = str(current_year)+'-'+str(convert_month(month))+'-'+str(convert_month(day))
print(holiday_murging,'===============================holuddd')
sun_or_other_day = ''
if day in sundays:
sun_or_other_day = 's'
elif holiday_murging in holidays:
sun_or_other_day = 'h'
elif holiday_murging in leaves:
sun_or_other_day = 'l'
else:
if date(int(current_year), int(convert_month(month)), day) <= date(int(timezone.now().strftime('%Y')), int(convert_month(current_month)), int(current_day)):
att_got = EmployeeAttendance.objects.filter(
module_holder=module_holder,
employee_name=employee,
date=date(int(current_year), int(convert_month(month)), day)
)
if att_got:
sun_or_other_day = 'p'
else:
sun_or_other_day = 'a'
else:
sun_or_other_day='n'
heading.append({'day': day})
atte_status.append({'sun_or_other_day': sun_or_other_day, 'date': day})
# print(sun_or_other_day,'================',date(int(current_year), int(current_month), day))
whole_year.append({
'month': convert_month_into_string(month),
'employee': employee,
'atte_status':atte_status,
})
# print(whole_year,'======')
context = {
'heading': range(1,32),
'SearchDateForm': searchdateform,
'whole_years': whole_year
}
return render(request, 'payroll/attendance_ind.html', context)
# ATEENDANCE STARTS HERE
def employee_attendance(request):
module_holder = request.user.username
current_year = timezone.now().strftime('%Y')
current_month = timezone.now().strftime('%m')
current_day = timezone.now().strftime('%d')
sundays = []
for sunday in get_all_says(int(current_year), int(current_month)):
sundays.append(sunday.day)
emploies = Teacher.objects.filter(module_holder=module_holder)
all_emp_att = []
heading = []
for employee in emploies:
holidays = []
leaves = []
try:
# hd1 = hd['from_date']
hds = Leave.objects.values('from_date','to_date').filter(employee=employee, type='h')
for hd in hds:
print(hd,'====', employee)
startdate = hd['from_date']
enddate = hd['to_date']
for days in daterange(startdate, enddate):
holidays.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
holidays = []
try:
# hd1 = hd['from_date']
lvs = Leave.objects.values('from_date','to_date').filter(employee=employee, type='l')
for lv in lvs:
startdate = lv['from_date']
enddate = lv['to_date']
for days in daterange(startdate, enddate):
leaves.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
leaves = []
atte_status = []
heading = []
pk = 0
for day in range(1, monthrange(int(current_year),int(current_month))[1]+1):
holiday_murging = str(current_year)+'-'+str(current_month)+'-'+str(convert_month(day))
sun_or_other_day = ''
if day in sundays:
sun_or_other_day = 's'
elif holiday_murging in holidays:
sun_or_other_day = 'h'
elif holiday_murging in leaves:
sun_or_other_day = 'l'
else:
if date(int(current_year), int(current_month), day) <= date(int(timezone.now().strftime('%Y')), int(current_month), int(current_day)):
att_got = EmployeeAttendance.objects.filter(
module_holder=module_holder,
employee_name=employee,
date=date(int(current_year), int(current_month), day)
).first()
# print('commoing in else', date(int(current_year), int(current_month), day))
if att_got:
sun_or_other_day = 'p'
pk = att_got.pk
else:
sun_or_other_day = 'a'
else:
sun_or_other_day='n'
heading.append({'day': day, 'status': sun_or_other_day })
atte_status.append({'sun_or_other_day': sun_or_other_day,'pk':pk})
# print(sun_or_other_day,'================',date(int(current_year), int(current_month), day))
all_emp_att.append({
'employee': employee,
'atte_status':atte_status,
})
context = {
'all_emp_att':all_emp_att,
'heading': heading
}
return render(request, 'payroll/attendance.html', context)
# ATTENDANCE ENDS HERE
# POSTIONS STARTS HERE
class LeaveView(LoginRequiredMixin, ListView):
# permission_required = 'payroll.view_leave'
model = Leave
login_url = 'home:login'
template_name = 'payroll/leave.html'
success_message = 'leave has been created!'
def get_context_data(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
context = super(LeaveView, self).get_context_data(**kwargs)
context['leaves'] = Leave.objects.filter(module_holder=module_holder)
return context
class LeaveCreate(LoginRequiredMixin , SuccessMessageMixin ,CreateView):
# permission_required = 'academic.add_leave'
success_message = 'leave has been created!'
model = Leave
fields = [
'employee',
'date',
'type',
'is_paid',
'from_date',
'to_date',
'reasion',
'leave_message'
]
login_url = 'home:lgoin'
template_name = 'payroll/leave_add.html'
def post(self, request):
module_holder = request.user.username
for emp in request.POST.getlist('employee'):
save_leave = Leave(
employee = Teacher.objects.get(pk=emp),
date = request.POST.get('date'),
type = request.POST.get('type'),
from_date = request.POST.get('from_date'),
to_date = request.POST.get('to_date'),
reasion = request.POST.get('reasion'),
leave_message = request.POST.get('leave_message'),
module_holder = module_holder
)
leave = Leave.objects.filter(
employee = Teacher.objects.get(pk=emp),
date = request.POST.get('date'),
from_date = request.POST.get('from_date'),
to_date = request.POST.get('to_date'),
)
print(leave)
if leave:
print('data has been saved ==========================yes saved data')
else:
save_leave.save()
# print('data has been not saved ==========================no saved data')
return redirect('payroll:leave_view')
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form = super(LeaveCreate, self).get_form(**kwargs)
form.fields['date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['from_date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['to_date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['employee'].widget.attrs = {'class': 'basic-multiple', 'multiple': 'multiple'}
form.fields['is_paid'].widget.attrs = {'class': 'customSwitch1'}
form.fields['employee'].queryset = Teacher.objects.filter(module_holder=module_holder)
return form
class LeaveUpdate(LoginRequiredMixin, SuccessMessageMixin ,UpdateView):
# permission_required = 'academic.change_classes'
model = Leave
fields = [
'employee',
'date',
'type',
'is_paid',
'from_date',
'to_date',
'reasion',
'leave_message'
]
login_url = 'home:lgoin'
template_name = 'payroll/leave_add.html'
success_message = 'leave has been updated!'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form = super(LeaveUpdate, self).get_form(**kwargs)
form.fields['date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['from_date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['to_date'].widget = forms.TextInput(attrs={'class':'date'})
form.fields['employee'].queryset = Teacher.objects.filter(module_holder=module_holder)
return form
class LeaveDelete(LoginRequiredMixin, DeleteView):
login_url = 'home:lgoin'
# permission_required = 'academic.delete_classes'
model = Leave
success_url = reverse_lazy('payroll:leave_view')
# leave ENDS HERE
# SCHADUAL STARTS HRERE
# STRAT CLASSES HERE
class SchedualView(LoginRequiredMixin, ListView):
# permission_required = 'payroll.view_Schedual'
model = Schedual
login_url = 'home:login'
# context_object_name = 'classes'
template_name = 'payroll/schedual.html'
success_message = 'Time Schedual has been created!'
def get_context_data(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
context = super(SchedualView, self).get_context_data(**kwargs)
context['scheduals'] = Schedual.objects.filter(module_holder=module_holder)
return context
class SchedualCreate(LoginRequiredMixin , SuccessMessageMixin ,CreateView):
# permission_required = 'academic.add_Schedual'
success_message = 'Time Schedual has been created!'
model = Schedual
fields = [
'time_in',
'time_out'
]
login_url = 'home:lgoin'
template_name = 'payroll/schedual_add.html'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
form = super(SchedualCreate, self).get_form(**kwargs)
form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
return form
class SchedualUpdate(LoginRequiredMixin, SuccessMessageMixin ,UpdateView):
# permission_required = 'academic.change_classes'
model = Schedual
fields = [
'time_in',
'time_out'
]
login_url = 'home:lgoin'
template_name = 'payroll/schedual_add.html'
success_message = 'Time schedual has been updated!'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
resolver = super().form_valid(form)
if self.request.is_ajax():
schedual = Schedual.objects.filter(module_holder=module_holder).order_by('-id').first()
data = {
'pk': schedual.pk,
'name': schedual.time_in+''+schedual.time_out,
}
return JsonResponse(data)
else:
return resolver
def form_invalid(self, form):
response = super().form_invalid(form)
if self.request.is_ajax():
return JsonResponse({'status': 'already'})
return response
def get_form(self, **kwargs):
form = super(SchedualUpdate, self).get_form(**kwargs)
form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
return form
class SchedualDelete(LoginRequiredMixin, DeleteView):
login_url = 'home:lgoin'
# permission_required = 'academic.delete_classes'
model = Schedual
success_url = reverse_lazy('payroll:schedual_view')
# SCHADUAL ENDS HERE
# POSTIONS STARTS HERE
class PositionView(LoginRequiredMixin, ListView):
# permission_required = 'payroll.view_position'
model = Position
login_url = 'home:login'
template_name = 'payroll/position.html'
success_message = 'position has been created!'
def get_context_data(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
context = super(PositionView, self).get_context_data(**kwargs)
context['positions'] = Position.objects.filter(module_holder=module_holder)
return context
class PositionCreate(LoginRequiredMixin , SuccessMessageMixin ,CreateView):
# permission_required = 'academic.add_position'
success_message = 'Position has been created!'
model = Position
fields = [
'position_title',
'rate_per_hour'
]
login_url = 'home:lgoin'
template_name = 'payroll/position_add.html'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
# def get_form(self, **kwargs):
# form = super(PositionCreate, self).get_form(**kwargs)
# form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
# form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
# return form
class PositionUpdate(LoginRequiredMixin, SuccessMessageMixin ,UpdateView):
# permission_required = 'academic.change_classes'
model = Position
fields = [
'position_title',
'rate_per_hour'
]
login_url = 'home:lgoin'
template_name = 'payroll/position_add.html'
success_message = 'position has been updated!'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
# def get_form(self, **kwargs):
# form = super(positionUpdate, self).get_form(**kwargs)
# form.fields['time_in'].widget = forms.TextInput(attrs={'type':'time'})
# form.fields['time_out'].widget = forms.TextInput(attrs={'type':'time'})
# return form
class PositionDelete(LoginRequiredMixin, DeleteView):
login_url = 'home:lgoin'
# permission_required = 'academic.delete_classes'
model = Position
success_url = reverse_lazy('payroll:position_view')
# POSITION ENDS HERE
class TeacherView(PermissionRequiredMixin, SuccessMessageMixin, LoginRequiredMixin, ListView):
model = Teacher
login_url = 'home:lgoin'
template_name = 'payroll/teacher.html'
permission_required = 'payroll.view_teacher'
success_message = 'Teacher has been added!'
def get_context_data(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
context = super(TeacherView, self).get_context_data(**kwargs)
context['teachers'] = Teacher.objects.filter(module_holder=module_holder)
return context
class TeacherCreate(LoginRequiredMixin ,PermissionRequiredMixin, SuccessMessageMixin, CreateView):
model = Teacher
form_class = TeacherForm
login_url = 'home:lgoin'
template_name = 'payroll/teacher_add.html'
success_message = 'Teacher has been created successfully!'
permission_required = 'payroll.add_teacher'
# success_url = '/payroll/teacher/create/'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
# last_user = Teacher.objects.all('username').last()
self.group_got, self.created_got = Group.objects.get_or_create(name=self.request.POST.get('username'))
if self.created_got or self.group_got:
for perms in self.request.POST.getlist('perms'):
self.group_got.permissions.add(int(perms))
return super().form_valid(form)
def get_success_url(self):
lastUser = User.objects.latest('id')
url = self.object.get_absolute_url()
# print(lastUser,'===============last user ===== in get success============')
# print(self.objects,'=============================')
lastUser.groups.add(self.group_got)
return url
def get_form(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form = super(TeacherCreate, self).get_form(**kwargs)
form.fields['date_of_birth'].widget = forms.TextInput( attrs = {'type': 'date'})
form.fields['date_of_join'].widget = forms.TextInput( attrs = {'type': 'date'})
form.fields['time_schedual'].queryset = Schedual.objects.filter(module_holder=module_holder)
form.fields['position'].queryset = Position.objects.filter(module_holder=module_holder)
form.fields['time_schedual'].widget.attrs={'class': 'basic-multiple'}
form.fields['position'].widget.attrs={'class': 'basic-multiple'}
form.fields['gender'].widget = forms.RadioSelect()
return form
def get_context_data(self, **kwargs):
collect_without_dot = []
collect_murged_sorted = []
context = super(TeacherCreate, self).get_context_data(**kwargs)
all_user_perms = User.get_group_permissions(self.request.user)
for groups in all_user_perms:
collect_without_dot.append(groups.split('.')[1].split('_')[1])
collect_without_dot = sorted(collect_without_dot)
header_prevent_dup = set(collect_without_dot)
header_sorted = sorted(header_prevent_dup)
LIST_OF_CATEGORYS = ['add', 'change', 'view', 'delete']
for LIST_OF_CATEGORY in LIST_OF_CATEGORYS:
binded = []
for header_sort in header_sorted:
all_perms = Permission.objects.values('id', 'codename').filter(codename=LIST_OF_CATEGORY+'_'+header_sort)
val = all_perms[0]['codename'].split('_')[1]
binded.append({
'id': all_perms[0]['id'],
'codename': val
})
collect_murged_sorted.append({
'head': LIST_OF_CATEGORY,
'values': binded
})
# print(collect_murged_sorted,'================== after sorted')
context['all_school_user_perm_list'] = collect_murged_sorted
context['header_sorted']=header_sorted
context['teachercreateurl'] = '/payroll/teacher/create'
# context['category'] = LIST_OF_CATEGORY
return context
class TeacherUpdate(LoginRequiredMixin ,PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
model = Teacher
form_class = TeacherForm
template_name = 'payroll/teacher_add.html'
success_message = 'Teacher has been created successfully!'
permission_required = 'payroll.change_teacher'
login_url = 'home:lgoin'
success_message = 'Teacher has been Updated!'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
# last_user = Teacher.objects.all('username').last()
self.group_got, self.created_got = Group.objects.get_or_create(name=self.request.POST.get('username'))
if self.created_got or self.group_got:
for perms in self.request.POST.getlist('perms'):
self.group_got.permissions.add(int(perms))
return super().form_valid(form)
def get_success_url(self):
lastUser = User.objects.latest('id')
url = self.object.get_absolute_url()
# print(lastUser,'===============last user ===== in get success============')
# print(self.objects,'=============================')
lastUser.groups.add(self.group_got)
return url
def get_form(self, **kwargs):
form = super(TeacherUpdate, self).get_form(**kwargs)
form.fields['date_of_birth'].widget = forms.TextInput( attrs = {'type': 'date'})
form.fields['date_of_join'].widget = forms.TextInput( attrs = {'type': 'date'})
form.fields['gender'].widget = forms.RadioSelect()
return form
def get_context_data(self, **kwargs):
collect_without_dot = []
collect_murged_sorted = []
context = super(TeacherUpdate, self).get_context_data(**kwargs)
all_user_perms = User.get_group_permissions(self.request.user)
for groups in all_user_perms:
collect_without_dot.append(groups.split('.')[1].split('_')[1])
collect_without_dot = sorted(collect_without_dot)
header_prevent_dup = set(collect_without_dot)
header_sorted = sorted(header_prevent_dup)
LIST_OF_CATEGORYS = ['add', 'change', 'view', 'delete']
for LIST_OF_CATEGORY in LIST_OF_CATEGORYS:
binded = []
for header_sort in header_sorted:
all_perms = Permission.objects.values('id', 'codename').filter(codename=LIST_OF_CATEGORY+'_'+header_sort)
val = all_perms[0]['codename'].split('_')[1]
binded.append({
'id': all_perms[0]['id'],
'codename': val
})
collect_murged_sorted.append({
'head': LIST_OF_CATEGORY,
'values': binded
})
print(collect_murged_sorted,'================== after sorted')
context['all_school_user_perm_list'] = collect_murged_sorted
context['header_sorted']=header_sorted
context['teachercreateurl'] = '/payroll/payroll/teacher/'+str(self.kwargs.get('pk'))+'/update/'
# context['category'] = LIST_OF_CATEGORY
return context
class TeacherDelete(LoginRequiredMixin ,PermissionRequiredMixin, SuccessMessageMixin, DeleteView):
permission_required = 'payroll.delete_teacher'
success_message = 'Teacher has been deleted'
model = Teacher
success_url = reverse_lazy('payroll:teacher_view')
login_url = 'home:lgoin'
@login_required
@allowed_users('view_salary')
def manage_salary(request):
module_holder = request.user.username
current_year = timezone.now().strftime('%Y')
current_month = timezone.now().strftime('%m')
current_day = timezone.now().strftime('%d')
if request.method=='POST':
index = 0
for data in request.POST.getlist('yes_salary'):
salary_object = Salary.objects.filter(
employee_name=Teacher.objects.get(pk=request.POST.getlist('employee_name')[int(request.POST.getlist('yes_salary')[index])-1]),
Salary_date=request.POST.getlist('Salary_date')[int(request.POST.getlist('yes_salary')[index])-1]
)
if len(salary_object)>0:
Salary.objects.filter(
employee_name=Teacher.objects.get(pk=request.POST.getlist('employee_name')[int(request.POST.getlist('yes_salary')[index])-1]),
Salary_date=request.POST.getlist('Salary_date')[int(request.POST.getlist('yes_salary')[index])-1]
).update(
Salary_release_date=request.POST.getlist('Salary_release_date')[int(request.POST.getlist('yes_salary')[index])-1],
salary=request.POST.getlist('salary')[int(request.POST.getlist('yes_salary')[index])-1],
bonus=request.POST.getlist('bonus')[int(request.POST.getlist('yes_salary')[index])-1],
advance_detected=request.POST.getlist('advance_detected')[int(request.POST.getlist('yes_salary')[index])-1],
other=request.POST.getlist('other')[int(request.POST.getlist('yes_salary')[index])-1],
details=request.POST.getlist('details')[int(request.POST.getlist('yes_salary')[index])-1],
module_holder= module_holder
)
else:
Salary(
employee_name=Teacher.objects.get(pk=request.POST.getlist('employee_name')[int(request.POST.getlist('yes_salary')[index])-1]),
Salary_date=request.POST.getlist('Salary_date')[int(request.POST.getlist('yes_salary')[index])-1],
Salary_release_date=request.POST.getlist('Salary_release_date')[int(request.POST.getlist('yes_salary')[index])-1],
salary=request.POST.getlist('salary')[int(request.POST.getlist('yes_salary')[index])-1],
bonus=request.POST.getlist('bonus')[int(request.POST.getlist('yes_salary')[index])-1],
advance_detected=request.POST.getlist('advance_detected')[int(request.POST.getlist('yes_salary')[index])-1],
other=request.POST.getlist('other')[int(request.POST.getlist('yes_salary')[index])-1],
details=request.POST.getlist('details')[int(request.POST.getlist('yes_salary')[index])-1],
module_holder= module_holder
).save()
index = index+1
employee_form_data = []
module_holder = request.user.username
teachers = Teacher.objects.filter(module_holder=module_holder)
for teacher in teachers:
salary_object = Salary.objects.filter(
Q(employee_name=Teacher.objects.get(pk=teacher.pk),
Salary_date__startswith=timezone.now().strftime('%Y-%m'),
module_holder=module_holder
)
).first()
status = 0
if salary_object:
salary_pk = salary_object.pk
status = salary_object.salary
else:
salary_pk = 0
status = 0
advance_amount = AdvanceSalary.objects.values('advance_amount').filter(employee_name=teacher, module_holder=module_holder).aggregate(total_advance=Coalesce(Sum('advance_amount'), 0))
detected_amount = Salary.objects.filter(employee_name=teacher, module_holder=module_holder).aggregate(detected_amount=Coalesce(Sum('advance_detected'),0))
advance_taken = 0
advance_retured = 0
still_remaining = 0
if int(advance_amount['total_advance']) > int(detected_amount['detected_amount']):
advance_taken = advance_amount
advance_retured = detected_amount
still_remaining = int(advance_amount['total_advance'])-int(detected_amount['detected_amount'])
monthly_detection = AdvanceSalary.objects.values('monthly_detection').filter(employee_name=teacher, module_holder=module_holder).aggregate(monthly_detection=Coalesce(Sum('monthly_detection'), 0))
if still_remaining < int(monthly_detection['monthly_detection']):
monthly_detect = still_remaining
else:
monthly_detect = int(monthly_detection['monthly_detection'])
# START WORKING WITH SALARY
hourly_rate = Position.objects.get(pk=teacher.position_id, module_holder=module_holder)
present_days = []
sundays = []
for sunday in get_all_says(int(current_year), int(current_month)):
sundays.append(sunday.day)
count_of_date_searched = int(current_year)+int(current_month)
atte_status = []
holidays = []
leaves = []
num_of_days = monthrange(int(current_year),int(current_month))[1]
for day in range(1, num_of_days+1):
try:
hds = Leave.objects.values('from_date','to_date').filter(employee=teacher, type='h')
for hd in hds:
startdate = hd['from_date']
enddate = hd['to_date']
for days in daterange(startdate, enddate):
holidays.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
holidays = []
try:
lvs = Leave.objects.values('from_date','to_date').filter(employee=teacher, type='l')
for lv in lvs:
startdate = lv['from_date']
enddate = lv['to_date']
for days in daterange(startdate, enddate):
leaves.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
leaves = []
heading = []
count_of_date_searched =count_of_date_searched+1
holiday_murging = str(current_year)+'-'+str(current_month)+'-'+str(convert_month(day))
# print(holiday_murging,'===============================holuddd')
sun_or_other_day = ''
if day in sundays:
# hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
# t1 = datetime.strptime(hours.time_in, '%H:%M')
# t2 = datetime.strptime(hours.time_out, '%H:%M')
# t1 = datetime.strftime(t1, '%H:%M')
# t2 = datetime.strftime(t2, '%H:%M')
# hours = time_diff(t1, t2)
# present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
sun_or_other_day = 's'
elif holiday_murging in leaves:
hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
elif holiday_murging in holidays:
hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
else:
if date(int(current_year), int(current_month), day) <= date(int(timezone.now().strftime('%Y')), int(current_month), int(current_day)):
att_got = EmployeeAttendance.objects.filter(
module_holder=module_holder,
employee_name=teacher,
date=date(int(current_year), int(current_month), day)
)
if att_got:
hours = EmployeeAttendance.objects.get(module_holder=module_holder, employee_name=teacher,date=date(int(current_year), int(current_month), day) )
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
else:
sun_or_other_day = 'a'
else:
sun_or_other_day='n'
net_salary = []
for present_day in present_days:
h = present_day['hours'].split(':')[0]
m = present_day['hours'].split(':')[1]
# print(h,':',m,'=============', teacher, '===============', hourly_rate.rate_per_hour, '=======', int(hourly_rate.rate_per_hour)*int(h))
rate_per_minute = hourly_rate.rate_per_hour/60
time = (int(h)*60)+int(m)
print(teacher, time)
salary = rate_per_minute*time
net_salary.append(salary)
# print(len(present_days),'=================LENGTH')
# print('salary', sum(net_salary))
salary_bonus = 0
salary_other = 0
salary_details = 'No Details'
if salary_object:
salary_bonus = salary_object.bonus
salary_other = salary_object.other
salary_details = salary_object.details
employee_form_data.append(
{'salaryform':SalaryForm(initial={
'employee_name': Teacher.objects.get(pk=teacher.pk),
'Salary_date': timezone.now().strftime('%Y-%m-%d'),
'Salary_release_date': timezone.now().strftime('%Y-%m-%d'),
'salary': int(sum(net_salary)),
'advance_detected': monthly_detect,
'bonus': salary_bonus,
# 'payment_method': 'Cash',
'other': salary_other,
'details': salary_details,
}),
'status': status,
'pk': teacher.pk,
'salary_pk': salary_pk,
'employee_name': teacher.username,
'advance_taken': advance_taken,
'advance_retured': advance_retured,
'still_remaining': still_remaining
}
)
context = {
'current_month_redirect': timezone.now().strftime('%Y-%m-%d'),
'employee_form_data': employee_form_data
}
return render(request, 'payroll/pay_salary.html', context)
# START SALARY DETAIL OF MONTHLY OF ALL TEACHERS
@login_required
@allowed_users('view_salary')
def salary_monthly_detail(request, date):
search_form = FeeDefSerchForm()
module_holder = request.user.username
monthly_salary = []
# if request.method=='GET':
# monthly_salary = Salary.objects.filter(
# Q(
# module_holder='masood',
# Salary_date__startswith=date.split('-')[:2]
# )
# )
if request.method=='POST':
monthly_salary = Salary.objects.filter(
Q(
module_holder=module_holder,
Salary_date__startswith=request.POST.get('seacher_date')[:7]
)
)
else:
monthly_salary = Salary.objects.filter(
Q(
module_holder=module_holder,
Salary_date__startswith=date[:7]
)
)
print(monthly_salary)
context = {
'search_form': search_form,
'monthly_salary':monthly_salary
}
return render(request,'payroll/salary_detail.html', context)
@login_required
@allowed_users('view_salary')
def salary_detail_one(request, pk, teacher_name_id):
current_date_print = timezone.now().strftime('%B, %Y')
current_year = timezone.now().strftime('%Y')
current_month = timezone.now().strftime('%m')
current_day = timezone.now().strftime('%d')
module_holder = request.user.username
if request.method=='POST':
salary_object_base_id = Salary.objects.filter( #getting object base pk, from salary. slary saved before
pk=request.POST.get('salary_pk'),
employee_name=Teacher.objects.get(pk=request.POST.get('employee_name')),
Salary_date__startswith=request.POST.get('Salary_date')[:7],
module_holder=module_holder
)
salary_object = Salary.objects.filter( #getting object base pk, from salary. salary is saving from here
employee_name=Teacher.objects.get(pk=request.POST.get('employee_name')),
Salary_date__startswith=request.POST.get('Salary_date')[:7],
module_holder=module_holder
).first()
if len(salary_object_base_id): #getting object base pk, from salary. slary saved before
updated_id = Salary.objects.filter(
pk=request.POST.get('salary_pk'),
employee_name=Teacher.objects.get(pk=request.POST.get('employee_name')),
Salary_date__startswith=request.POST.get('Salary_date')[:7],
module_holder=module_holder
).update(
Salary_release_date=request.POST.get('Salary_release_date'),
salary=request.POST.get('salary'),
bonus=request.POST.get('bonus'),
other=request.POST.get('other'),
details=request.POST.get('details')
)
messages.success(request, 'it was submited before, Now it has been updated based ID!')
return redirect('payroll:salary_detail_one', pk=pk, teacher_name_id=teacher_name_id)
elif salary_object: #getting object base pk, from salary. salary is saving from here
updated_id = Salary.objects.filter(
employee_name=Teacher.objects.get(pk=request.POST.get('employee_name')),
Salary_date__startswith=request.POST.get('Salary_date')[:7],
module_holder=module_holder
).update(
Salary_release_date=request.POST.get('Salary_release_date'),
salary=request.POST.get('salary'),
bonus=request.POST.get('bonus'),
other=request.POST.get('other'),
details=request.POST.get('details'),
module_holder=module_holder
)
messages.success(request, 'it was submited before, Now it has been updated!')
return redirect('payroll:salary_detail_one', pk=salary_object.pk, teacher_name_id=teacher_name_id)
else:
Salary(
employee_name=Teacher.objects.get(pk=request.POST.get('employee_name')),
Salary_date=request.POST.get('Salary_date'),
Salary_release_date=request.POST.get('Salary_release_date'),
salary=request.POST.get('salary'),
bonus=request.POST.get('bonus'),
other=request.POST.get('other'),
details=request.POST.get('details'),
module_holder=module_holder
).save()
messages.success(request, 'Data has beed saved!')
saved_id = Salary.objects.values('pk').filter().latest('pk')
return redirect('payroll:salary_detail_one', pk=saved_id['pk'], teacher_name_id=teacher_name_id)
# Making salary start here
teacher = Teacher.objects.get(pk=teacher_name_id)
salary_object = Salary.objects.filter(
Q(employee_name=teacher,
Salary_date__startswith=timezone.now().strftime('%Y-%m'),
module_holder=module_holder
)
).first()
status = 0
if salary_object:
salary_pk = salary_object.pk
status = salary_object.salary
else:
salary_pk = 0
status = 0
advance_amount = AdvanceSalary.objects.values('advance_amount').filter(employee_name=teacher, module_holder=module_holder).aggregate(total_advance=Coalesce(Sum('advance_amount'), 0))
detected_amount = Salary.objects.filter(employee_name=teacher, module_holder=module_holder).aggregate(detected_amount=Coalesce(Sum('advance_detected'),0))
advance_taken = 0
advance_retured = 0
still_remaining = 0
if int(advance_amount['total_advance']) > int(detected_amount['detected_amount']):
advance_taken = advance_amount
advance_retured = detected_amount
still_remaining = int(advance_amount['total_advance'])-int(detected_amount['detected_amount'])
monthly_detection = AdvanceSalary.objects.values('monthly_detection').filter(employee_name=teacher, module_holder=module_holder).aggregate(monthly_detection=Coalesce(Sum('monthly_detection'), 0))
if still_remaining < int(monthly_detection['monthly_detection']):
monthly_detect = still_remaining
else:
monthly_detect = int(monthly_detection['monthly_detection'])
# START WORKING WITH SALARY
hourly_rate = Position.objects.get(pk=teacher.position_id, module_holder=module_holder)
present_days = []
sundays = []
for sunday in get_all_says(int(current_year), int(current_month)):
sundays.append(sunday.day)
count_of_date_searched = int(current_year)+int(current_month)
atte_status = []
holidays = []
leaves = []
num_of_days = monthrange(int(current_year),int(current_month))[1]
for day in range(1, num_of_days+1):
try:
hds = Leave.objects.values('from_date','to_date').filter(employee=teacher, type='h')
for hd in hds:
startdate = hd['from_date']
enddate = hd['to_date']
for days in daterange(startdate, enddate):
holidays.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
holidays = []
try:
lvs = Leave.objects.values('from_date','to_date').filter(employee=teacher, type='l')
for lv in lvs:
startdate = lv['from_date']
enddate = lv['to_date']
for days in daterange(startdate, enddate):
leaves.append(str(days.year)+'-'+str(convert_month(days.month))+'-'+str(convert_month(days.day)))
except Exception as ex:
leaves = []
heading = []
count_of_date_searched =count_of_date_searched+1
holiday_murging = str(current_year)+'-'+str(current_month)+'-'+str(convert_month(day))
# print(holiday_murging,'===============================holuddd')
sun_or_other_day = ''
if day in sundays:
# hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
# t1 = datetime.strptime(hours.time_in, '%H:%M')
# t2 = datetime.strptime(hours.time_out, '%H:%M')
# t1 = datetime.strftime(t1, '%H:%M')
# t2 = datetime.strftime(t2, '%H:%M')
# hours = time_diff(t1, t2)
# present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
sun_or_other_day = 's'
elif holiday_murging in leaves:
hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
elif holiday_murging in holidays:
hours = Schedual.objects.get(module_holder=module_holder, pk=teacher.time_schedual.pk)
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
else:
if date(int(current_year), int(current_month), day) <= date(int(timezone.now().strftime('%Y')), int(current_month), int(current_day)):
att_got = EmployeeAttendance.objects.filter(
module_holder=module_holder,
employee_name=teacher,
date=date(int(current_year), int(current_month), day)
)
if att_got:
hours = EmployeeAttendance.objects.get(module_holder=module_holder, employee_name=teacher,date=date(int(current_year), int(current_month), day) )
t1 = datetime.strptime(hours.time_in, '%H:%M')
t2 = datetime.strptime(hours.time_out, '%H:%M')
t1 = datetime.strftime(t1, '%H:%M')
t2 = datetime.strftime(t2, '%H:%M')
hours = time_diff(t1, t2)
present_days.append({'hours': hours, 'date': date(int(current_year), int(current_month), day), 'emp': teacher})
else:
sun_or_other_day = 'a'
else:
sun_or_other_day='n'
net_salary = []
for present_day in present_days:
h = present_day['hours'].split(':')[0]
m = present_day['hours'].split(':')[1]
# print(h,':',m,'=============', teacher, '===============', hourly_rate.rate_per_hour, '=======', int(hourly_rate.rate_per_hour)*int(h))
rate_per_minute = hourly_rate.rate_per_hour/60
time = (int(h)*60)+int(m)
salary = rate_per_minute*time
net_salary.append(salary)
# print(len(present_days),'=================LENGTH')
# print('salary', sum(net_salary))
salary_bonus = 0
salary_other = 0
salary_details = 'No Details'
if salary_object:
salary_bonus = salary_object.bonus
salary_other = salary_object.other
salary_details = salary_object.details
# making salary ends here
salary_detail = Salary.objects.filter(employee_name=teacher, Salary_date__startswith=current_year+'-'+current_month).first()
teacher_detail = Teacher.objects.get(username=teacher)
total_year_salary_detail = Salary.objects.filter(
Q(employee_name = teacher,
Salary_date__startswith=timezone.now().strftime('%Y'),
module_holder = module_holder
)
)
total_bonus_other_salary = 0
status = 0
if salary_detail is not None:
status = 1
salary_form = SalaryForm(instance=salary_detail)
total_bonus_other_salary = sum([salary_detail.salary, salary_detail.bonus, salary_detail.other])
else:
status = 0
print('its comming in none')
# salary_detail_values = False
salary_form = SalaryForm(initial={
'employee_name': teacher,
'Salary_date': timezone.now().strftime('%Y-%m-%d'),
'Salary_release_date': timezone.now().strftime('%Y-%m-%d'),
'salary': int(sum(net_salary)),
'bonus': salary_bonus,
# 'payment_method': 'Cash',
'other': salary_other,
'details': salary_details,
})
context = {
'salary_pk':pk,
'salary_form': salary_form,
'teacher_detail': teacher_detail,
'salary_detail': salary_detail,
'total_year_salary_detail': total_year_salary_detail,
'current_date_print':current_date_print,
'total_bonus_other_salary_in_word': num2words(total_bonus_other_salary),
'status': status
}
return render(request, 'payroll/salary_detail_one.html', context)
# STRAT ADVANCE SALARY HERE
class AdvanceSalaryView(LoginRequiredMixin, ListView):
# permission_required = 'academic.view_classes'
model = AdvanceSalary
login_url = 'home:login'
# context_object_name = 'classes'
template_name = 'payroll/advancesalary.html'
success_message = 'Advance Salary has been created!'
def get_context_data(self, **kwargs):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
context = super(AdvanceSalaryView, self).get_context_data(**kwargs)
context['advancesalarys'] = AdvanceSalary.objects.filter(module_holder=module_holder)
return context
class AdvanceSalaryCreate(LoginRequiredMixin , SuccessMessageMixin ,CreateView):
# permission_required = 'academic.add_classes'
success_message = 'Advance Salary has been created!'
model = AdvanceSalary
fields = [
'employee_name',
'advance_amount',
'payment_date',
'monthly_detection',
'detail'
]
login_url = 'home:lgoin'
template_name = 'payroll/advancesalary_add.html'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
def get_form(self, **kwargs):
form = super(AdvanceSalaryCreate, self).get_form(**kwargs)
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.fields['payment_date'].widget.attrs = {'class': 'date'}
form.fields['employee_name'].queryset = Teacher.objects.filter(module_holder=module_holder)
form.fields['employee_name'].widget.attrs = {'class': 'basic-multiple'}
return form
class AdvanceSalaryUpdate(LoginRequiredMixin, SuccessMessageMixin ,UpdateView):
# permission_required = 'academic.change_classes'
model = AdvanceSalary
fields = [
'employee_name',
'advance_amount',
'payment_date',
'monthly_detection',
'detail'
]
login_url = 'home:lgoin'
template_name = 'payroll/advancesalary_add.html'
success_message = 'Advance Salary has been updated!'
def form_valid(self, form):
if self.request.user.is_staff:
module_holder = self.request.user.username
else:
this_holder = Teacher.objects.get(user_ptr_id=self.request.user.id)
module_holder = this_holder.module_holder
form.instance.module_holder = module_holder
return super().form_valid(form)
class AdvanceSalaryDelete(LoginRequiredMixin ,DeleteView):
login_url = 'home:lgoin'
# permission_required = 'academic.delete_classes'
model = AdvanceSalary
success_url = reverse_lazy('payroll:advancesalary_view')
| 43.66968
| 204
| 0.594614
| 6,910
| 62,797
| 5.178726
| 0.057019
| 0.067403
| 0.042755
| 0.041582
| 0.833114
| 0.807629
| 0.776443
| 0.746207
| 0.731564
| 0.707308
| 0
| 0.00467
| 0.283979
| 62,797
| 1,438
| 205
| 43.66968
| 0.791189
| 0.072679
| 0
| 0.723719
| 0
| 0
| 0.100201
| 0.017021
| 0
| 0
| 0
| 0
| 0
| 1
| 0.035621
| false
| 0
| 0.017376
| 0
| 0.208514
| 0.009557
| 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
|
8bb7df96d617c004bed942be2dd89b2d18dc8431
| 187
|
py
|
Python
|
bayesiancoresets/__init__.py
|
dionman/beta-cores
|
d8b09a8f9ee2daf56aa5b7e7dc1ed3baf845117a
|
[
"MIT"
] | 2
|
2021-12-16T16:25:51.000Z
|
2021-12-16T22:43:06.000Z
|
bayesiancoresets/__init__.py
|
dionman/beta-cores
|
d8b09a8f9ee2daf56aa5b7e7dc1ed3baf845117a
|
[
"MIT"
] | 2
|
2021-03-20T13:53:25.000Z
|
2022-03-12T00:46:59.000Z
|
bayesiancoresets/__init__.py
|
dionman/beta-cores
|
d8b09a8f9ee2daf56aa5b7e7dc1ed3baf845117a
|
[
"MIT"
] | null | null | null |
from .coreset import HilbertCoreset, SparseVICoreset, BatchPSVICoreset, DiffPrivBatchPSVICoreset, BetaCoreset, UniformSamplingCoreset, BlackBoxProjector, Projector, BetaBlackBoxProjector
| 93.5
| 186
| 0.887701
| 12
| 187
| 13.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064171
| 187
| 1
| 187
| 187
| 0.948571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
8bc2b8b6b7b27ebe68daea2da86fedc0d0554798
| 274,516
|
py
|
Python
|
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_plat_chas_invmgr_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_plat_chas_invmgr_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_plat_chas_invmgr_oper.py
|
tkamata-test/ydk-py
|
b637e7853a8edbbd31fbc05afa3aa4110b31c5f9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST, REFERENCE_IDENTITY_CLASS, REFERENCE_ENUM_CLASS, REFERENCE_BITS, REFERENCE_UNION
from ydk.errors import YPYError, YPYModelError
from ydk.providers._importer import _yang_ns
_meta_table = {
'InvAdminStateEnum' : _MetaInfoEnum('InvAdminStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'admin-state-invalid':'admin_state_invalid',
'admin-up':'admin_up',
'admin-down':'admin_down',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'InvResetReasonEnum' : _MetaInfoEnum('InvResetReasonEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'module-reset-reason-unknown':'module_reset_reason_unknown',
'module-reset-reason-powerup':'module_reset_reason_powerup',
'module-reset-reason-user-shutdown':'module_reset_reason_user_shutdown',
'module-reset-reason-user-reload':'module_reset_reason_user_reload',
'module-reset-reason-auto-reload':'module_reset_reason_auto_reload',
'module-reset-reason-environment':'module_reset_reason_environment',
'module-reset-reason-user-unpower':'module_reset_reason_user_unpower',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'InvCardStateEnum' : _MetaInfoEnum('InvCardStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'inv-card-not-present':'inv_card_not_present',
'inv-card-present':'inv_card_present',
'inv-card-reset':'inv_card_reset',
'inv-card-booting':'inv_card_booting',
'inv-card-mbi-booting':'inv_card_mbi_booting',
'inv-card-running-mbi':'inv_card_running_mbi',
'inv-card-running-ena':'inv_card_running_ena',
'inv-card-bring-down':'inv_card_bring_down',
'inv-card-ena-failure':'inv_card_ena_failure',
'inv-card-f-diag-run':'inv_card_f_diag_run',
'inv-card-f-diag-failure':'inv_card_f_diag_failure',
'inv-card-powered':'inv_card_powered',
'inv-card-unpowered':'inv_card_unpowered',
'inv-card-mdr':'inv_card_mdr',
'inv-card-mdr-running-mbi':'inv_card_mdr_running_mbi',
'inv-card-main-t-mode':'inv_card_main_t_mode',
'inv-card-admin-down':'inv_card_admin_down',
'inv-card-no-mon':'inv_card_no_mon',
'inv-card-unknown':'inv_card_unknown',
'inv-card-failed':'inv_card_failed',
'inv-card-ok':'inv_card_ok',
'inv-card-missing':'inv_card_missing',
'inv-card-field-diag-downloading':'inv_card_field_diag_downloading',
'inv-card-field-diag-unmonitor':'inv_card_field_diag_unmonitor',
'inv-card-fabric-field-diag-unmonitor':'inv_card_fabric_field_diag_unmonitor',
'inv-card-field-diag-rp-launching':'inv_card_field_diag_rp_launching',
'inv-card-field-diag-running':'inv_card_field_diag_running',
'inv-card-field-diag-pass':'inv_card_field_diag_pass',
'inv-card-field-diag-fail':'inv_card_field_diag_fail',
'inv-card-field-diag-timeout':'inv_card_field_diag_timeout',
'inv-card-disabled':'inv_card_disabled',
'inv-card-spa-booting':'inv_card_spa_booting',
'inv-card-not-allowed-online':'inv_card_not_allowed_online',
'inv-card-stopped':'inv_card_stopped',
'inv-card-incompatible-fw-ver':'inv_card_incompatible_fw_ver',
'inv-card-fpd-hold':'inv_card_fpd_hold',
'inv-card-node-prep':'inv_card_node_prep',
'inv-card-updating-fpd':'inv_card_updating_fpd',
'inv-card-num-states':'inv_card_num_states',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'InvMonitorStateEnum' : _MetaInfoEnum('InvMonitorStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'unmonitored':'unmonitored',
'monitored':'monitored',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'NodeStateEnum' : _MetaInfoEnum('NodeStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'not-present':'not_present',
'present':'present',
'reset':'reset',
'rommon':'rommon',
'mbi-boot':'mbi_boot',
'mbi-run':'mbi_run',
'xr-run':'xr_run',
'bring-down':'bring_down',
'xr-fail':'xr_fail',
'fdiag-run':'fdiag_run',
'fdiag-fail':'fdiag_fail',
'power':'power',
'unpower':'unpower',
'mdr-warm-reload':'mdr_warm_reload',
'mdr-mbi-run':'mdr_mbi_run',
'maintenance-mode':'maintenance_mode',
'admin-down':'admin_down',
'not-monitor':'not_monitor',
'unknown-card':'unknown_card',
'failed':'failed',
'ok':'ok',
'missing':'missing',
'diag-download':'diag_download',
'diag-not-monitor':'diag_not_monitor',
'fabric-diag-not-monitor':'fabric_diag_not_monitor',
'diag-rp-launch':'diag_rp_launch',
'diag-run':'diag_run',
'diag-pass':'diag_pass',
'diag-fail':'diag_fail',
'diag-timeout':'diag_timeout',
'disable':'disable',
'spa-boot':'spa_boot',
'not-allowed-online':'not_allowed_online',
'stop':'stop',
'incomp-version':'incomp_version',
'fpd-hold':'fpd_hold',
'xr-preparation':'xr_preparation',
'sync-ready':'sync_ready',
'xr-isolate':'xr_isolate',
'ready':'ready',
'invalid':'invalid',
'operational':'operational',
'operational-lock':'operational_lock',
'going-down':'going_down',
'going-offline':'going_offline',
'going-online':'going_online',
'offline':'offline',
'up':'up',
'down':'down',
'max':'max',
'unknown':'unknown',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'CardRedundancyStateEnum' : _MetaInfoEnum('CardRedundancyStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'active':'active',
'standby':'standby',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'InvPowerAdminStateEnum' : _MetaInfoEnum('InvPowerAdminStateEnum', 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper',
{
'admin-power-invalid':'admin_power_invalid',
'admin-on':'admin_on',
'admin-off':'admin_off',
}, 'Cisco-IOS-XR-plat-chas-invmgr-oper', _yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper']),
'Platform.Racks.Rack.Slots.Slot.Instances.Instance.State' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot.Instances.Instance.State',
False,
[
_MetaInfoClassMember('admin-state', ATTRIBUTE, 'str' , None, None,
[], [],
''' Admin state
''',
'admin_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('card-redundancy-state', REFERENCE_ENUM_CLASS, 'CardRedundancyStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'CardRedundancyStateEnum',
[], [],
''' Redundancy state
''',
'card_redundancy_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('card-type', ATTRIBUTE, 'str' , None, None,
[], [],
''' Card type
''',
'card_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-monitored', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if power state is active
''',
'is_monitored',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-powered', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if monitor state is active
''',
'is_powered',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-shutdown', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if shutdown state is active
''',
'is_shutdown',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('plim', ATTRIBUTE, 'str' , None, None,
[], [],
''' PLIM
''',
'plim',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('state', REFERENCE_ENUM_CLASS, 'NodeStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'NodeStateEnum',
[], [],
''' State
''',
'state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'state',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots.Slot.Instances.Instance' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot.Instances.Instance',
False,
[
_MetaInfoClassMember('instance-name', ATTRIBUTE, 'str' , None, None,
[], [],
''' Instance name
''',
'instance_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('state', REFERENCE_CLASS, 'State' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot.Instances.Instance.State',
[], [],
''' State information
''',
'state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'instance',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots.Slot.Instances' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot.Instances',
False,
[
_MetaInfoClassMember('instance', REFERENCE_LIST, 'Instance' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot.Instances.Instance',
[], [],
''' Instance name
''',
'instance',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'instances',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots.Slot.Vm' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot.Vm',
False,
[
_MetaInfoClassMember('node-descriptiton', ATTRIBUTE, 'str' , None, None,
[], [],
''' Node Type
''',
'node_descriptiton',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('node-ip', ATTRIBUTE, 'str' , None, None,
[], [],
''' Node IP Address
''',
'node_ip',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('partner-name', ATTRIBUTE, 'str' , None, None,
[], [],
''' Partner Name
''',
'partner_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('red-role', ATTRIBUTE, 'str' , None, None,
[], [],
''' Node Redundency Role
''',
'red_role',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-status', ATTRIBUTE, 'str' , None, None,
[], [],
''' SW status
''',
'software_status',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'vm',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots.Slot.State' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot.State',
False,
[
_MetaInfoClassMember('admin-state', ATTRIBUTE, 'str' , None, None,
[], [],
''' Admin state
''',
'admin_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('card-redundancy-state', REFERENCE_ENUM_CLASS, 'CardRedundancyStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'CardRedundancyStateEnum',
[], [],
''' Redundancy state
''',
'card_redundancy_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('card-type', ATTRIBUTE, 'str' , None, None,
[], [],
''' Card type
''',
'card_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-monitored', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if power state is active
''',
'is_monitored',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-powered', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if monitor state is active
''',
'is_powered',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-shutdown', ATTRIBUTE, 'bool' , None, None,
[], [],
''' True if shutdown state is active
''',
'is_shutdown',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('plim', ATTRIBUTE, 'str' , None, None,
[], [],
''' PLIM
''',
'plim',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('state', REFERENCE_ENUM_CLASS, 'NodeStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'NodeStateEnum',
[], [],
''' State
''',
'state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'state',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots.Slot' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots.Slot',
False,
[
_MetaInfoClassMember('slot-name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Slot name
''',
'slot_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('instances', REFERENCE_CLASS, 'Instances' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot.Instances',
[], [],
''' Table of Instances
''',
'instances',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('state', REFERENCE_CLASS, 'State' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot.State',
[], [],
''' State information
''',
'state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vm', REFERENCE_CLASS, 'Vm' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot.Vm',
[], [],
''' VM information
''',
'vm',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'slot',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack.Slots' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack.Slots',
False,
[
_MetaInfoClassMember('slot', REFERENCE_LIST, 'Slot' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots.Slot',
[], [],
''' Slot name
''',
'slot',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'slots',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks.Rack' : {
'meta_info' : _MetaInfoClass('Platform.Racks.Rack',
False,
[
_MetaInfoClassMember('rack-name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Rack name
''',
'rack_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('slots', REFERENCE_CLASS, 'Slots' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack.Slots',
[], [],
''' Table of slots
''',
'slots',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'rack',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform.Racks' : {
'meta_info' : _MetaInfoClass('Platform.Racks',
False,
[
_MetaInfoClassMember('rack', REFERENCE_LIST, 'Rack' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks.Rack',
[], [],
''' Rack name
''',
'rack',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'racks',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'Platform' : {
'meta_info' : _MetaInfoClass('Platform',
False,
[
_MetaInfoClassMember('racks', REFERENCE_CLASS, 'Racks' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'Platform.Racks',
[], [],
''' Table of racks
''',
'racks',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'platform',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Port name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'ports',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses',
False,
[
_MetaInfoClassMember('ports', REFERENCE_LIST, 'Ports' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports',
[], [],
''' Port number
''',
'ports',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'portses',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.ProcessorInformation' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.ProcessorInformation',
False,
[
_MetaInfoClassMember('processor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Type e.g. 7457
''',
'processor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Revision. e.g 1.1
''',
'revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('speed', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Speed e.g. 1197Mhz
''',
'speed',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'processor-information',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Rom' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Rom',
False,
[
_MetaInfoClassMember('image-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Image name
''',
'image_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('major-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Major version
''',
'major_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('micro-image-version', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Micro image version
''',
'micro_image_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('minor-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Minor version
''',
'minor_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('platform-specific', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Platform specific text
''',
'platform_specific',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('release-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Release type
''',
'release_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'rom',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Bootflash' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Bootflash',
False,
[
_MetaInfoClassMember('bootflash-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Bootflash size in kilo-bytes
''',
'bootflash_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('bootflash-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Bootflash type e.g. SIMM
''',
'bootflash_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('image-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Image name
''',
'image_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('major-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Major version
''',
'major_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('micro-image-version', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Micro image version
''',
'micro_image_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('minor-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Minor version
''',
'minor_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('platform-specific', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Platform specific text
''',
'platform_specific',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('platform-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Platform Type
''',
'platform_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('release-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Release type
''',
'release_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sector-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Sector size in bytes
''',
'sector_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'bootflash',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Processor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Processor',
False,
[
_MetaInfoClassMember('processor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Type e.g. 7457
''',
'processor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Revision. e.g 1.1
''',
'revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('speed', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Speed e.g. 1197Mhz
''',
'speed',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'processor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation',
False,
[
_MetaInfoClassMember('bootflash', REFERENCE_CLASS, 'Bootflash' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Bootflash',
[], [],
''' Bootflash information
''',
'bootflash',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('main-memory-size', ATTRIBUTE, 'int' , None, None,
[('0', '18446744073709551615')], [],
''' Memory size in bytes
''',
'main_memory_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('nvram-size', ATTRIBUTE, 'int' , None, None,
[('0', '18446744073709551615')], [],
''' NVRAM size in bytes
''',
'nvram_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('processor', REFERENCE_CLASS, 'Processor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Processor',
[], [],
''' Processor information
''',
'processor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('rom', REFERENCE_CLASS, 'Rom' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Rom',
[], [],
''' ROM information
''',
'rom',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'motherboard-information',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.BootflashInformation' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.BootflashInformation',
False,
[
_MetaInfoClassMember('bootflash-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Bootflash size in kilo-bytes
''',
'bootflash_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('bootflash-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Bootflash type e.g. SIMM
''',
'bootflash_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('image-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Image name
''',
'image_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('major-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Major version
''',
'major_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('micro-image-version', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Micro image version
''',
'micro_image_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('minor-version', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Minor version
''',
'minor_version',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('platform-specific', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Platform specific text
''',
'platform_specific',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('platform-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Platform Type
''',
'platform_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('release-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Release type
''',
'release_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sector-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Sector size in bytes
''',
'sector_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'bootflash-information',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation.Disks' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation.Disks',
False,
[
_MetaInfoClassMember('disk-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' Disk name
''',
'disk_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('disk-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Disk size in mega-bytes
''',
'disk_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sector-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' Disk sector size in bytes
''',
'sector_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'disks',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation',
False,
[
_MetaInfoClassMember('disk-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' (Deprecated) Disk name
''',
'disk_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('disk-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' (Deprecated) Disk size in mega-bytes
''',
'disk_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('disks', REFERENCE_LIST, 'Disks' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation.Disks',
[], [],
''' Disk attributes
''',
'disks',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sector-size', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' (Deprecated) Disk sector size in bytes
''',
'sector_size',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'disk-information',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation',
False,
[
_MetaInfoClassMember('bootflash-information', REFERENCE_CLASS, 'BootflashInformation' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.BootflashInformation',
[], [],
''' BootflashInformation
''',
'bootflash_information',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('disk-information', REFERENCE_CLASS, 'DiskInformation' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation',
[], [],
''' DiskInformation
''',
'disk_information',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('motherboard-information', REFERENCE_CLASS, 'MotherboardInformation' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation',
[], [],
''' MotherboardInformation
''',
'motherboard_information',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('processor-information', REFERENCE_CLASS, 'ProcessorInformation' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.ProcessorInformation',
[], [],
''' ProcesorInformation
''',
'processor_information',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'hardware-information',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port',
False,
[
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Sensor name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors',
False,
[
_MetaInfoClassMember('sensor', REFERENCE_LIST, 'Sensor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor',
[], [],
''' Sensor number
''',
'sensor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensors',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Port slot name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('port', REFERENCE_CLASS, 'Port' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port',
[], [],
''' Port
''',
'port',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sensors', REFERENCE_CLASS, 'Sensors' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors',
[], [],
''' Table of sensors
''',
'sensors',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port-slot',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots',
False,
[
_MetaInfoClassMember('port-slot', REFERENCE_LIST, 'PortSlot' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot',
[], [],
''' Port slot number
''',
'port_slot',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port-slots',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Sensor name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors',
False,
[
_MetaInfoClassMember('sensor', REFERENCE_LIST, 'Sensor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor',
[], [],
''' Sensor number
''',
'sensor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensors',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module',
False,
[
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('port-slots', REFERENCE_CLASS, 'PortSlots' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots',
[], [],
''' Table of port slots
''',
'port_slots',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sensors', REFERENCE_CLASS, 'Sensors' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors',
[], [],
''' Table of sensors
''',
'sensors',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Subslot name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module', REFERENCE_CLASS, 'Module' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module',
[], [],
''' Module of a subslot
''',
'module',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sub-slot',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots',
False,
[
_MetaInfoClassMember('sub-slot', REFERENCE_LIST, 'SubSlot' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot',
[], [],
''' Subslot number
''',
'sub_slot',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sub-slots',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Sensor name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors',
False,
[
_MetaInfoClassMember('sensor', REFERENCE_LIST, 'Sensor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor',
[], [],
''' Sensor number
''',
'sensor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensors',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' HW component name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sensors', REFERENCE_CLASS, 'Sensors' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors',
[], [],
''' Table of sensors
''',
'sensors',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'hw-component',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents',
False,
[
_MetaInfoClassMember('hw-component', REFERENCE_LIST, 'HwComponent' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent',
[], [],
''' HW component number
''',
'hw_component',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'hw-components',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port',
False,
[
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Sensor name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors',
False,
[
_MetaInfoClassMember('sensor', REFERENCE_LIST, 'Sensor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor',
[], [],
''' Sensor number
''',
'sensor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensors',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Port slot name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('port', REFERENCE_CLASS, 'Port' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port',
[], [],
''' Port
''',
'port',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sensors', REFERENCE_CLASS, 'Sensors' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors',
[], [],
''' Table of sensors
''',
'sensors',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port-slot',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots',
False,
[
_MetaInfoClassMember('port-slot', REFERENCE_LIST, 'PortSlot' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot',
[], [],
''' Port slot number
''',
'port_slot',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'port-slots',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Sensor name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensor',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors',
False,
[
_MetaInfoClassMember('sensor', REFERENCE_LIST, 'Sensor' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor',
[], [],
''' Sensor number
''',
'sensor',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'sensors',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Card name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-information', REFERENCE_CLASS, 'HardwareInformation' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation',
[], [],
''' HardwareInformationDir
''',
'hardware_information',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hw-components', REFERENCE_CLASS, 'HwComponents' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents',
[], [],
''' Table of HW components
''',
'hw_components',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('port-slots', REFERENCE_CLASS, 'PortSlots' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots',
[], [],
''' Table of port slots
''',
'port_slots',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('portses', REFERENCE_CLASS, 'Portses' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses',
[], [],
''' Table of spirit port slots
''',
'portses',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sensors', REFERENCE_CLASS, 'Sensors' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors',
[], [],
''' Table of sensors
''',
'sensors',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('sub-slots', REFERENCE_CLASS, 'SubSlots' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots',
[], [],
''' Table of subslots
''',
'sub_slots',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'card',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Cards' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Cards',
False,
[
_MetaInfoClassMember('card', REFERENCE_LIST, 'Card' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card',
[], [],
''' Card number
''',
'card',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'cards',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots.Slot' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots.Slot',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Slot name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('cards', REFERENCE_CLASS, 'Cards' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot.Cards',
[], [],
''' Table of cards
''',
'cards',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'slot',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Slots' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Slots',
False,
[
_MetaInfoClassMember('slot', REFERENCE_LIST, 'Slot' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots.Slot',
[], [],
''' Slot name
''',
'slot',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'slots',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Attributes.BasicInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Attributes.BasicInfo',
False,
[
_MetaInfoClassMember('description', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' describes in user-readable terms
what the entity in question does
''',
'description',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('firmware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' firmware revision string
''',
'firmware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('hardware-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' hw revision string
''',
'hardware_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('is-field-replaceable-unit', ATTRIBUTE, 'bool' , None, None,
[], [],
''' 1 if Field Replaceable Unit 0, if not
''',
'is_field_replaceable_unit',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('model-name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' model name
''',
'model_name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' name string for the entity
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('serial-number', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' serial number
''',
'serial_number',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('software-revision', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' software revision string
''',
'software_revision',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('vendor-type', ATTRIBUTE, 'str' , None, None,
[(0, 255)], [],
''' maps to the vendor OID string
''',
'vendor_type',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'basic-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Attributes.FruInfo.LastOperationalStateChange' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Attributes.FruInfo.LastOperationalStateChange',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'last-operational-state-change',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Attributes.FruInfo.ModuleUpTime' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Attributes.FruInfo.ModuleUpTime',
False,
[
_MetaInfoClassMember('time-in-nano-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Nano-seconds
''',
'time_in_nano_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('time-in-seconds', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Time Value in Seconds
''',
'time_in_seconds',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'module-up-time',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Attributes.FruInfo' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Attributes.FruInfo',
False,
[
_MetaInfoClassMember('last-operational-state-change', REFERENCE_CLASS, 'LastOperationalStateChange' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Attributes.FruInfo.LastOperationalStateChange',
[], [],
''' Time operational state is last changed
''',
'last_operational_state_change',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-administrative-state', REFERENCE_ENUM_CLASS, 'InvAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvAdminStateEnum',
[], [],
''' Administrative state
''',
'module_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-monitor-state', REFERENCE_ENUM_CLASS, 'InvMonitorStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvMonitorStateEnum',
[], [],
''' Monitor state
''',
'module_monitor_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-operational-state', REFERENCE_ENUM_CLASS, 'InvCardStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvCardStateEnum',
[], [],
''' Operation state
''',
'module_operational_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-power-administrative-state', REFERENCE_ENUM_CLASS, 'InvPowerAdminStateEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvPowerAdminStateEnum',
[], [],
''' Power administrative state
''',
'module_power_administrative_state',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-reset-reason', REFERENCE_ENUM_CLASS, 'InvResetReasonEnum' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'InvResetReasonEnum',
[], [],
''' Reset reason
''',
'module_reset_reason',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('module-up-time', REFERENCE_CLASS, 'ModuleUpTime' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Attributes.FruInfo.ModuleUpTime',
[], [],
''' Module up time
''',
'module_up_time',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'fru-info',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack.Attributes' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack.Attributes',
False,
[
_MetaInfoClassMember('basic-info', REFERENCE_CLASS, 'BasicInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Attributes.BasicInfo',
[], [],
''' Entity attributes
''',
'basic_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('fru-info', REFERENCE_CLASS, 'FruInfo' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Attributes.FruInfo',
[], [],
''' Field Replaceable Unit (FRU) attributes
''',
'fru_info',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'attributes',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks.Rack' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks.Rack',
False,
[
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], ['[\\w\\-\\.:,_@#%$\\+=\\|;]+'],
''' Rack name
''',
'name',
'Cisco-IOS-XR-plat-chas-invmgr-oper', True),
_MetaInfoClassMember('attributes', REFERENCE_CLASS, 'Attributes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Attributes',
[], [],
''' Attributes
''',
'attributes',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
_MetaInfoClassMember('slots', REFERENCE_CLASS, 'Slots' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack.Slots',
[], [],
''' Table of slots
''',
'slots',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'rack',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory.Racks' : {
'meta_info' : _MetaInfoClass('PlatformInventory.Racks',
False,
[
_MetaInfoClassMember('rack', REFERENCE_LIST, 'Rack' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks.Rack',
[], [],
''' Rack name
''',
'rack',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'racks',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
'PlatformInventory' : {
'meta_info' : _MetaInfoClass('PlatformInventory',
False,
[
_MetaInfoClassMember('racks', REFERENCE_CLASS, 'Racks' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper', 'PlatformInventory.Racks',
[], [],
''' Table of racks
''',
'racks',
'Cisco-IOS-XR-plat-chas-invmgr-oper', False),
],
'Cisco-IOS-XR-plat-chas-invmgr-oper',
'platform-inventory',
_yang_ns._namespaces['Cisco-IOS-XR-plat-chas-invmgr-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_plat_chas_invmgr_oper'
),
},
}
_meta_table['Platform.Racks.Rack.Slots.Slot.Instances.Instance.State']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots.Slot.Instances.Instance']['meta_info']
_meta_table['Platform.Racks.Rack.Slots.Slot.Instances.Instance']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots.Slot.Instances']['meta_info']
_meta_table['Platform.Racks.Rack.Slots.Slot.Instances']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots.Slot']['meta_info']
_meta_table['Platform.Racks.Rack.Slots.Slot.Vm']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots.Slot']['meta_info']
_meta_table['Platform.Racks.Rack.Slots.Slot.State']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots.Slot']['meta_info']
_meta_table['Platform.Racks.Rack.Slots.Slot']['meta_info'].parent =_meta_table['Platform.Racks.Rack.Slots']['meta_info']
_meta_table['Platform.Racks.Rack.Slots']['meta_info'].parent =_meta_table['Platform.Racks.Rack']['meta_info']
_meta_table['Platform.Racks.Rack']['meta_info'].parent =_meta_table['Platform.Racks']['meta_info']
_meta_table['Platform.Racks']['meta_info'].parent =_meta_table['Platform']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses.Ports']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Rom']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Bootflash']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation.Processor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation.Disks']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.ProcessorInformation']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.MotherboardInformation']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.BootflashInformation']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation.DiskInformation']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors.Sensor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Port']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Sensors']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots.PortSlot']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors.Sensor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.PortSlots']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Sensors']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Module']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots.SubSlot']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors.Sensor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Sensors']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents.HwComponent']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors.Sensor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Port']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Sensors']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots.PortSlot']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors.Sensor']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Portses']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HardwareInformation']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.SubSlots']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.HwComponents']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.PortSlots']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Sensors']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards.Card']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Cards']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots.Slot']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots.Slot']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Slots']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Attributes.FruInfo.LastOperationalStateChange']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Attributes.FruInfo.ModuleUpTime']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Attributes.FruInfo']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Attributes.BasicInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Attributes.FruInfo']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack.Attributes']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Slots']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack']['meta_info']
_meta_table['PlatformInventory.Racks.Rack.Attributes']['meta_info'].parent =_meta_table['PlatformInventory.Racks.Rack']['meta_info']
_meta_table['PlatformInventory.Racks.Rack']['meta_info'].parent =_meta_table['PlatformInventory.Racks']['meta_info']
_meta_table['PlatformInventory.Racks']['meta_info'].parent =_meta_table['PlatformInventory']['meta_info']
| 58.909013
| 346
| 0.571883
| 26,538
| 274,516
| 5.693421
| 0.010513
| 0.077198
| 0.096498
| 0.102944
| 0.977841
| 0.974837
| 0.970799
| 0.964611
| 0.959363
| 0.951255
| 0
| 0.010988
| 0.291196
| 274,516
| 4,659
| 347
| 58.921657
| 0.765523
| 0
| 0
| 0.654681
| 0
| 0.079392
| 0.53371
| 0.440727
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.000483
| 0.001931
| 0
| 0.001931
| 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
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
4764d12f6c6a63aed8c71f822f0a2abfe637ab71
| 7,198
|
py
|
Python
|
forms/models.py
|
Kgermando/es-script
|
f1b10ecf2c805e8875a025e7033c724e236f6cd1
|
[
"Apache-2.0"
] | null | null | null |
forms/models.py
|
Kgermando/es-script
|
f1b10ecf2c805e8875a025e7033c724e236f6cd1
|
[
"Apache-2.0"
] | null | null | null |
forms/models.py
|
Kgermando/es-script
|
f1b10ecf2c805e8875a025e7033c724e236f6cd1
|
[
"Apache-2.0"
] | null | null | null |
from django.db import models
from django.contrib.auth.models import User
from forms.pays import PAYS
from forms.province import PROVINCES
from forms.statut import STATUTS
# Create your models here.
class Kyc(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
created_date = models.DateTimeField(auto_now_add=True)
questions1 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions2 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions3 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions4 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions5 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions6 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions7 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions8 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions9 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions10 = models.CharField(max_length=200, null=True, blank=True, default='-')
# questions11 = models.CharField(max_length=200, null=True, blank=True)
questions12 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions13 = models.CharField(max_length=200, null=True, blank=True, default='-')
# questions14 = models.CharField(max_length=200, null=True, blank=True)
questions15 = models.CharField(max_length=200, null=True, blank=True, default='-')
questions16 = models.CharField(max_length=200, null=True, blank=True, default='-')
# questions17 = models.CharField(max_length=200, null=True, blank=True)
# questions18 = models.CharField(max_length=200, null=True, blank=True)
Q19temps_a_contacter = models.CharField(max_length=200, null=True, blank=True, default='-')
montant_de_pret = models.CharField(max_length=100, null=True, blank=True, default='-')
duree_de_credit = models.CharField(max_length=100, null=True, blank=True, default='-')
montant_a_rembourser_chaque_mois = models.CharField(max_length=100, null=True, blank=True, default='-')
montant_des_ventes_bonne_journee = models.CharField(max_length=100, null=True, blank=True, default='-')
montant_des_ventes_mauvaise_journee = models.CharField(max_length=100, null=True, blank=True, default='-')
date_a_laquelle_recevoir_credit = models.CharField(max_length=100, null=True, blank=True, default='-')
Nom_du_garant = models.CharField(max_length=100, null=True, blank=True, default='-')
Activite = models.CharField(max_length=100, null=True, blank=True, default='-')
Nom_societe = models.CharField(max_length=200, null=True, blank=True, default='-', verbose_name="Nom de la société")
Nom = models.CharField(max_length=100, null=True, blank=True, default='-')
Post_Nom = models.CharField(max_length=100, null=True, blank=True, default='-')
Prenom = models.CharField(max_length=100, null=True, blank=True, default='-')
Numero = models.CharField(max_length=20, null=True, blank=True, default='-', verbose_name='N°')
Quartier = models.CharField(max_length=100, null=True, blank=True, default='-')
Commune = models.CharField(max_length=100, null=True, blank=True, default='-')
Province = models.CharField(max_length=20, choices=PROVINCES, null=True, blank=True, default='-')
Pays = models.CharField(max_length=100, choices=PAYS, null=True, blank=True, default='-')
Tel1 = models.CharField(max_length=13, null=True, blank=True, default='-', verbose_name="Téléphone 1")
Tel2 = models.CharField(max_length=13, null=True, blank=True, default='-', verbose_name="Téléphone 2")
Email = models.EmailField(null=True, blank=True, default='-')
Website = models.URLField(null=True, blank=True, default='-', verbose_name="Site Web")
Facebook = models.CharField(max_length=100, null=True, blank=True, default='-')
Instagram = models.CharField(max_length=100, null=True, blank=True, default='-')
Twitter = models.CharField(max_length=100, null=True, blank=True, default='-')
LinkedIn = models.CharField(max_length=100, null=True, blank=True, default='-')
Statut = models.CharField(max_length=30, choices=STATUTS, null=True, blank=True, default='-')
Remarque = models.TextField(null=True, blank=True, default='-')
Commentaire = models.TextField(null=True, blank=True, default='-')
Concurrent = models.TextField(null=True, blank=True, default='-')
CommentaireQ17 = models.TextField(null=True, blank=True, default='-')
# def __str__(self):
# return self.Nom_societe + ' ' + self.Nom + ' ' + self.Post_Nom + ' ' + self.Prenom
# class Contact(models.Model):
# user = models.ForeignKey(User, on_delete=models.CASCADE)
# created_date = models.DateTimeField(auto_now_add=True)
# Nom = models.CharField(max_length=100, null=True, blank=True, default='-')
# Post_Nom = models.CharField(max_length=100, null=True, blank=True, default='-')
# Prenom = models.CharField(max_length=100, null=True, blank=True, default='-')
# Numero = models.CharField(max_length=20, null=True, blank=True, default='-', verbose_name='N°')
# Rue = models.CharField(max_length=100, null=True, blank=True, default='-')
# Quartier = models.CharField(max_length=100, null=True, blank=True, default='-')
# Commune = models.CharField(max_length=100, null=True, blank=True, default='-')
# Ville = models.CharField(max_length=100, null=True, blank=True, default='-')
# Province = models.CharField(max_length=20, choices=PROVINCES, null=True, blank=True, default='-')
# # Pays = models.CharField(max_length=100, choices=PAYS, null=True, blank=True, default='-')
# Tel1 = models.CharField(max_length=13, null=True, blank=True, default='-', verbose_name="Téléphone 1")
# Tel2 = models.CharField(max_length=13, null=True, blank=True, default='-', verbose_name="Téléphone 2")
# Email = models.EmailField(null=True, blank=True, default='-')
# Website = models.URLField(null=True, blank=True, default='-', verbose_name="Site Web")
# Facebook = models.CharField(max_length=100, null=True, blank=True, default='-')
# Instagram = models.CharField(max_length=100, null=True, blank=True, default='-')
# Twitter = models.CharField(max_length=100, null=True, blank=True, default='-')
# LinkedIn = models.CharField(max_length=100, null=True, blank=True, default='-')
# Remarque = models.CharField(max_length=200, null=True, blank=True, default='-')
# def __str__(self):
# return self.Nom
| 79.098901
| 124
| 0.666018
| 886
| 7,198
| 5.284424
| 0.137698
| 0.11619
| 0.188808
| 0.246903
| 0.867578
| 0.867578
| 0.866083
| 0.826997
| 0.826997
| 0.789406
| 0
| 0.035879
| 0.186857
| 7,198
| 90
| 125
| 79.977778
| 0.763711
| 0.340789
| 0
| 0
| 0
| 0
| 0.019958
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.09434
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 9
|
477de1a59ed8d0dd9c0439a55594cc83933f51c3
| 40,630
|
py
|
Python
|
osuAlternative/bot.py
|
sverrier/osu-api-tools
|
e053a87ecf1d7429f64864d77b94e7da237ff466
|
[
"MIT"
] | 1
|
2021-03-19T20:55:22.000Z
|
2021-03-19T20:55:22.000Z
|
osuAlternative/bot.py
|
sverrier/osu-api-tools
|
e053a87ecf1d7429f64864d77b94e7da237ff466
|
[
"MIT"
] | null | null | null |
osuAlternative/bot.py
|
sverrier/osu-api-tools
|
e053a87ecf1d7429f64864d77b94e7da237ff466
|
[
"MIT"
] | null | null | null |
import discord
import datetime
import threading
import csv
import time
import asyncio
import psycopg2
import formatter
import controller
import documentation
from discord.ext import commands
client = commands.Bot(command_prefix = '!')
client.remove_command('help')
diffs = {}
diffs["easy"] = [0, 2]
diffs["normal"] = [2, 2.8]
diffs["hard"] = [2.8, 4]
diffs["insane"] = [4, 5.3]
diffs["extra"] = [5.3, 6.5]
diffs["extreme"] = [6.5, 20]
diffs["all"] = [0, 20]
starts = ["2021-01-01 00:00:00", "2021-01-08 00:00:00", "2021-01-15 00:00:00", "2021-01-22 00:00:00", "2021-01-29 00:00:00", "2021-02-05 00:00:00", "2021-02-12 00:00:00", "2021-02-19 00:00:00", "2021-02-26", "2021-03-05", "2021-03-12", "2021-03-19", "2021-03-26", "2021-04-02", "2021-04-09", "2021-04-16", "2021-04-23", "2021-04-30", "2021-05-07", "2021-05-14", "2021-05-21", "2021-05-28", "2021-06-04"]
conn = psycopg2.connect("dbname=osu user=bot password=root")
conn.set_session(autocommit=True)
cur = conn.cursor()
today = datetime.datetime.today().strftime('%Y-%m-%d')
lastmonth = (datetime.datetime.today() - datetime.timedelta(days=29)).strftime('%Y-%m-%d')
lastweek = (datetime.datetime.today() - datetime.timedelta(days=6)).strftime('%Y-%m-%d')
@client.event
async def on_ready():
print('Ready')
@client.event
async def on_member_join(member):
print(f'{member} just joined the server.')
def getArgs(arg=None):
args = []
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
return di
@client.command(pass_context=True)
async def help(ctx, arg=None):
await ctx.send(documentation.help(arg))
await updatelists()
async def updateweeklies(week):
channel = client.get_channel(792818934743040052)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\rankedscore_" + str(week) + ".csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if (str(week) + "/52 of project 2021") in str(fetchMessage[0].content):
await fetchMessage[0].edit(content = "**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
else:
await channel.send("**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
channel = client.get_channel(792819496829452290)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\fccount_" + str(week) + ".csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if (str(week) + "/52 of project 2021") in str(fetchMessage[0].content):
await fetchMessage[0].edit(content = "**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
else:
await channel.send("**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
channel = client.get_channel(792819520581664768)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\sscount_" + str(week) + ".csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if (str(week) + "/52 of project 2021") in str(fetchMessage[0].content):
await fetchMessage[0].edit(content = "**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
else:
await channel.send("**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
channel = client.get_channel(792819540567916574)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\clearcount_" + str(week) + ".csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if (str(week) + "/52 of project 2021") in str(fetchMessage[0].content):
await fetchMessage[0].edit(content = "**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
else:
await channel.send("**Week " + str(week) + "/52 of project 2021" + "**\n" + formatter.formatcsv(f, 50))
async def updateyearlies():
channel = client.get_channel(792863236705746954)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_score_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792863272860123156)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_fc_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792863301184913469)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_ss_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792863357563961364)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_clears_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(795159066133004308)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_pp_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
print("update complete")
channel = client.get_channel(795159261755736104)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_top1_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
print("update complete")
channel = client.get_channel(795159304024883230)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_top50_all.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
print("update complete")
async def updateplayers():
channel = client.get_channel(792875271782531102)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\totalhits.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792883515565146112)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\totalscore.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792883547559952415)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\playcount.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
channel = client.get_channel(792920423011844106)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\playtime.csv", newline='')
fetchMessage = await channel.history(limit = 1).flatten()
if len(fetchMessage) == 0:
await channel.send('hello')
fetchMessage = await channel.history(limit = 1).flatten()
await fetchMessage[0].edit(content = formatter.formatcsv(f, 50))
async def updatelists():
channel = client.get_channel(793570054008340511)
cur.execute("select * from newfcs")
li = cur.fetchall()
if len(li) > 0:
for entry in li:
beatmap = entry[0]
user = entry[1]
date = entry[2]
cur.execute("select artist, title, diffname, approved_date, set_id, stars, length, maxcombo, cs, ar, od, hp from beatmaps where beatmap_id = " + str(beatmap))
b = cur.fetchone()
approved_date = b[3]
minutes = b[6] // 60
seconds = b[6] % 60
differential = ((date.year * 365) + (date.month*31) + (date.day)) - ((approved_date.year * 365) + (approved_date.month*31) + (approved_date.day))
if(differential >= 7):
cur.execute("select username from users where user_id = " + str(user))
result = cur.fetchone()
username = user
if result is not None:
username = result[0]
embed = discord.Embed(title = 'A map has been FCed for the first time after ' + str(differential) + ' days!', colour=discord.Colour(0xE5E242))
s = ""
s += "**Player: **" + str(username) + "\n"
s += "**Map: **[" + b[0] + " - " + b[1] + " [" + b[2] + "]](https://osu.ppy.sh/beatmapsets/" + str(b[4]) + "#osu/" + str(beatmap) + ")\n"
s += "**Time of play: **" + str(date) + "\n"
s += "**Date ranked: **" + str(approved_date) + "\n\n"
s += "**Beatmap information**\n"
s += "CS **" + str(b[8])[0:3] + "** • AR **" + str(b[9])[0:3] + "** • OD **" + str(b[10])[0:3] + "** • HP **" + str(b[11])[0:3] + "** • **" + str(b[5])[0:4] + "★**" + "\n"
s += "**" + str(minutes) + "m" + str(seconds) + "s** • **" + str(b[7]) + " combo**\n"
embed.description = s
await channel.send(embed=embed)
cur.execute("delete from newfcs where beatmap_id = " + str(beatmap))
cur.execute("COMMIT;")
channel = client.get_channel(793594664262303814)
cur.execute("select * from newSSs")
li = cur.fetchall()
if len(li) > 0:
for entry in li:
beatmap = entry[0]
user = entry[1]
date = entry[2]
cur.execute("select artist, title, diffname, approved_date, set_id, stars, length, maxcombo, cs, ar, od, hp from beatmaps where beatmap_id = " + str(beatmap))
b = cur.fetchone()
approved_date = b[3]
minutes = b[6] // 60
seconds = b[6] % 60
differential = ((date.year * 365) + (date.month*31) + (date.day)) - ((approved_date.year * 365) + (approved_date.month*31) + (approved_date.day))
if(differential >= 30):
cur.execute("select username from users where user_id = " + str(user))
result = cur.fetchone()
username = user
if result is not None:
username = result[0]
embed = discord.Embed(title = 'A map has been SSed for the first time after ' + str(differential) + ' days!', colour=discord.Colour(0xE5E242))
s = ""
s += "**Player: **" + str(username) + "\n"
s += "**Map: **[" + b[0] + " - " + b[1] + " [" + b[2] + "]](https://osu.ppy.sh/beatmapsets/" + str(b[4]) + "#osu/" + str(beatmap) + ")\n"
s += "**Time of play: **" + str(date) + "\n"
s += "**Date ranked: **" + str(approved_date) + "\n\n"
s += "**Beatmap information**\n"
s += "CS **" + str(b[8])[0:3] + "** • AR **" + str(b[9])[0:3] + "** • OD **" + str(b[10])[0:3] + "** • HP **" + str(b[11])[0:3] + "** • **" + str(b[5])[0:4] + "★**" + "\n"
s += "**" + str(minutes) + "m" + str(seconds) + "s** • **" + str(b[7]) + " combo**\n"
embed.description = s
await channel.send(embed=embed)
cur.execute("delete from newSSs where beatmap_id = " + str(beatmap))
cur.execute("COMMIT;")
@client.command(pass_context=True)
async def update(ctx):
t = int(time.time())
for i in range(0, 52):
if (t > (1609459200 + (i * 7 * 24 * 60 * 60) + (24*60*60))):
week = i + 1
today = datetime.datetime.today().strftime('%Y-%m-%d')
lastmonth = (datetime.datetime.today() - datetime.timedelta(days=30)).strftime('%Y-%m-%d')
print(lastmonth)
await updateweeklies(week)
await updateyearlies()
await updateplayers()
await updatelists()
@client.command(pass_context=True)
async def register(ctx, arg):
arg = str(arg.replace("+", " "))
if not arg.isnumeric():
cur.execute("select user_id from users where LOWER(username) = '" + str(arg).lower() + "'")
user_id = cur.fetchone()[0]
else:
user_id = arg
print(user_id)
cur.execute("insert into priorityuser values (" + str(user_id) + ") ON CONFLICT DO NOTHING;")
cur.execute("COMMIT;")
await ctx.send("Registered!")
await update()
@client.command(pass_context=True)
async def queue(ctx, *, arg=None):
args = []
year = None
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if di.__contains__("-min") and di.__contains__("-max") and di.__contains__("-start") and di.__contains__("-end") and di.__contains__("-u") :
if not (di["-u"]).isnumeric():
cur.execute("select user_id from users where LOWER(username) = '" + str(di["-u"]).lower() + "'")
user_id = cur.fetchone()[0]
else:
user_id = di["-u"]
optimized = "1"
if di.__contains__("-optimized"):
optimized = str(di["-optimized"])
cur.execute("insert into queue values (" + str(user_id) + ", " + str(di['-min']) + ", " + str(di['-max']) + ", '" + str(di['-start']) + "', '" + str(di['-end']) + "', " + optimized + ")")
cur.execute("COMMIT;")
await ctx.send("Queued!")
else:
await ctx.send("Malformed command")
@client.command(pass_context=True)
async def scorequeue(ctx, *, arg=None):
args = []
year = None
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if not (di["-u"]).isnumeric():
cur.execute("select user_id from users where LOWER(username) = '" + str(di["-u"]).lower() + "'")
user_id = cur.fetchone()[0]
else:
user_id = di["-u"]
cur.execute("insert into scorequeue values (" + str(user_id) + ", " + str(di["-b"]) + ")")
cur.execute("COMMIT;")
await ctx.send("Queued!")
@client.command(pass_context=True)
async def getfile(ctx, *, arg=None):
args = []
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if di["-type"] == "neverbeenssed":
cur.execute("select set_id, beatmaps.beatmap_id, artist, title, diffname, round(stars, 2) as stars from neverbeenssed inner join beatmaps on neverbeenssed.beatmap_id = beatmaps.beatmap_id order by stars, artist")
elif di["-type"] == "neverbeenfced":
cur.execute("select set_id, beatmaps.beatmap_id, artist, title, diffname, round(stars, 2) as stars from neverbeenfced inner join beatmaps on neverbeenfced.beatmap_id = beatmaps.beatmap_id order by stars, artist")
elif di["-type"] == "registered":
cur.execute("select * from priorityuser")
s = formatter.tocsv(cur)
f = open("tmp.txt", "w", encoding="utf-8")
f.write(s)
f = open("tmp.txt", "r", encoding="utf-8")
with open("tmp.txt", "rb") as file:
await ctx.send("Your file is:", file=discord.File(file, str(di["-type"]) + ".csv"))
@client.command(pass_context=True)
async def firstmap(ctx, *, arg=None):
t = int(time.time())
for i in range(0, 52):
if (t > (1609459200 + (i * 7 * 24 * 60 * 60) + (24*3600))):
week = i + 1
args = []
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if di.__contains__("-w"):
week = di["-w"]
start = starts[int(week) - 1]
cur.execute("select artist, title, set_id from beatmaps where approved_date >= '" + str(start) + "' order by approved_date limit 1")
row = cur.fetchone()
s = "The first map for week " + str(week) + " is: https://osu.ppy.sh/beatmapsets/" + str(row[2])
await ctx.send(s)
await updatelists()
@client.command(pass_context=True)
async def projectXYZ(ctx, *, arg=None):
args = []
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if not di.__contains__("-v"):
await ctx.send("Please specify a value using -v")
if di.__contains__("-o"):
if di["-o"] in ["fc", "score", "clears", "ss"]:
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\" + di["-o"] + "_" + str(di["-v"]) + ".csv", newline='')
embed = discord.Embed(title = 'Result', colour=discord.Colour(0xE5E242))
s = formatter.formatcsv(f, 10)
if di.__contains__("-u"):
di["-u"] = str(di["-u"]).replace("+", " ")
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\" + di["-o"] + "_" + str(di["-v"]) + ".csv", newline='')
s = s[:-3] + formatter.finduser(f, di["-u"])
embed.description = s
await ctx.send(embed=embed)
else:
await ctx.send("Not implemented yet")
else:
await ctx.send("Please specify a leaderboard type using -o")
@client.command(pass_context=True)
async def beatmaps(ctx, *, arg=None):
di = getArgs(arg)
ans = controller.checkBeatmaps(cur, di)
await ctx.send(ans)
await updatelists()
@client.command(pass_context=True)
async def getscores(ctx, *, arg=None):
di = getArgs(arg)
if not (di["-u"]).isnumeric():
user = str(di["-u"]).replace("+", " ").lower()
cur.execute("select user_id from users where LOWER(username) = '" + user + "'")
user_id = cur.fetchone()[0]
else:
user_id = di["-u"]
di["-user"] = user_id
if di.__contains__("-o") and di["-o"] == "count":
query = "select status, count(*) from registered inner join beatmaps on registered.beatmap_id = beatmaps.beatmap_id"
query = query + controller.buildWhereClause(di)
query = query + " group by status order by status"
cur.execute(query)
s = ""
for row in cur.fetchall():
s = s + "status = " + str(row[0]) + ": " + str(row[1]) + "\n"
await ctx.send(s)
elif di.__contains__("-o") and di["-o"] == "unplayed":
di["-unplayed"] = "yes"
embed = controller.getBeatmapList(di, cur)
await ctx.send(embed=embed)
else:
embed = controller.getBeatmapList(di, cur, ["registered", "fc_count", "ss_count"])
await ctx.send(embed=embed)
@client.command(pass_context=True)
async def beatmapsets(ctx, *, arg=None):
args = []
year = None
if arg != None:
args = arg.split()
di = {}
for i in range(0,len(args)//2):
di.update({args[2*i]:args[2*i+1]})
if di.__contains__("-y"):
year = di["-y"]
query = "select count(*) from (select distinct set_id from beatmaps where mode = 0"
if year != None:
query = query + " and approved_date >= '" + year + "-01-01 00:00:00' and approved_date <= '" + year + "-12-31 23:59:59'"
query = query + ") as a"
cur.execute(query)
await ctx.send("There are currently " + str(cur.fetchone()[0]) + " ranked beatmap sets that match those parameters")
await updatelists()
@client.command(pass_context=True)
async def stats(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-u"):
await ctx.send("Please specify a user using -u")
return
if not di.__contains__("-o"):
await ctx.send("Please specify a leaderboard option using -o")
return
if di["-o"] == "score":
board = "rankedscore"
elif di["-o"] == "fc":
board = "fccount"
elif di["-o"] == "ss":
board = "sscount"
elif di["-o"] == "clears":
board = "clearcount"
elif di["-o"] == "plays":
board = "playcount"
else:
await ctx.send("Please specify a valid leaderboard type using -o")
return
user = str(di["-u"]).replace("+", " ")
s = "```\nStats for user " + user + "\n```"
t = int(time.time())
for i in range(0, 52):
if (t > (1609459200 + (i * 7 * 24 * 60 * 60))):
week = i + 1
for i in range(1, week + 1):
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\" + str(board) + "_" + str(i) + ".csv", newline='')
s = s[:-3] + "Week " + str(i) + ": " + formatter.finduser(f, user)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\2021_" + di["-o"] + "_all.csv", newline='')
s = s[:-3] + "\nYear to date: " + formatter.finduser(f, user)
await ctx.send(s)
await updatelists()
@client.command(pass_context=True)
async def maxscore(ctx, *, arg=None):
di = getArgs(arg)
param = "all"
if di.__contains__("-w"):
week = int(di["-w"])
start = starts[week - 1]
end = starts[week]
cur.execute("select sum(maxscore) from (select max(score) as maxscore from osualternative where beatmap_id in (select beatmap_id from beatmaps where approved_date between '" + start + "' and '" + end + "') group by beatmap_id) as a")
await ctx.send("The current max achievable score in week " + str(week) + " is " + str(f'{int(cur.fetchone()[0]):,}'))
else:
if di.__contains__("-filter"):
param = str(di["-filter"])
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\maxscore_" + param + ".csv", newline='')
with f as csvfile:
spamreader = csv.reader(csvfile, delimiter=',')
for index, row in enumerate(spamreader):
if index == 0:
continue
await ctx.send("Max score: " + str(f'{int(row[0]):,}'))
await updatelists()
@client.command(pass_context=True)
async def nomodscore(ctx, *, arg=None):
di = getArgs(arg)
param = "all"
if di.__contains__("-filter"):
param = di["-filter"]
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\nomodscore_" + param + ".csv", newline='')
with f as csvfile:
spamreader = csv.reader(csvfile, delimiter=',')
for index, row in enumerate(spamreader):
if index == 0:
continue
await ctx.send("Max nomod score: " + str(f'{int(row[0]):,}'))
await updatelists()
@client.command(pass_context=True)
async def weekly(ctx, *, arg=None):
t = int(time.time())
for i in range(0, 52):
if (t > (1609459200 + (i * 7 * 24 * 60 * 60) + (24*3600))):
week = i + 1
di = getArgs(arg)
if di.__contains__("-o"):
if di["-o"] == "score":
board = "rankedscore"
elif di["-o"] == "fc":
board = "fccount"
elif di["-o"] == "ss":
board = "sscount"
elif di["-o"] == "clears":
board = "clearcount"
elif di["-o"] == "plays":
board = "playcount"
else:
await ctx.send("Please specify a valid leaderboard type using -o")
return
if di.__contains__("-w"):
week = di["-w"]
embed = controller.checkfile(str(board) + "_" + str(week), di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a leaderboard type using -o")
await updatelists()
@client.command(pass_context=True)
async def yeartodate(ctx, *, arg=None):
di = getArgs(arg)
difficulty = "all"
if di.__contains__("-o"):
valid = ["score", "fc", "ss", "s", "clears", "plays", "pp", "top1", "top50", "silver_ss", "silver_s", "gold_ss", "gold_s", "a_ranks", "b_ranks", "c_ranks", "d_ranks"]
if di["-o"] not in valid:
await ctx.send("Please specify a valid leaderboard type using -o")
return
board = di["-o"]
if board == "d_ranks":
s = "HALL OF SHAME\n"
if di.__contains__("-d"):
difficulty = di["-d"]
embed = controller.checkfile("2021_" + str(board) + "_" + str(difficulty), di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a leaderboard type using -o")
await updatelists()
@client.command(pass_context=True)
async def neverbeenssed(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
embed = controller.getBeatmapList(di, cur, ["neverbeenssed"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def neverbeenfced(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastweek)
embed = controller.getBeatmapList(di, cur, ["neverbeenfced"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def query(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-o"):
if di["-o"] in ["fc", "ss", "clears", "score"]:
embed = controller.checkTables("sum(" + str(di["-o"]) + ")", str(di["-o"]) + "_by_sr", cur, di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a valid leaderboard type using -o")
@client.command(pass_context=True)
async def toprated(ctx, *, arg=None):
di = getArgs(arg)
di["-order"] = "rating"
di["-direction"] = "desc"
embed = controller.getBeatmapList(di, cur, None, True)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def totalhits(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkProfile("(count300 + count100 + count50)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def playtime(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkProfile("cast(playtime / 3600 as int)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def playcount(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkProfile("playcount", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def totalscore(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkProfile("total_score", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def rankedscore(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("rankedscore_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("ranked_score", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def clears(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("clears_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("(ssh_count + sh_count + ss_count + s_count + a_count)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def total_ss(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("totalss_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("(ssh_count + ss_count)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def total_s(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("totals_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("(sh_count + s_count)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def silver_s(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("sh_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("sh_count", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def silver_ss(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("ssh_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("ssh_count", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def gold_ss(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("gold_ss_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("ss_count", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def gold_s(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("gold_s_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("s_count", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def a_ranks(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("a-rank_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("a_count", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def pp(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("weightedpp_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
embed = controller.checkProfile("pp_raw", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def mapsranked(ctx, arg=None):
di = getArgs(arg)
embed = controller.checkMappers("beatmap_id", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def setsranked(ctx, arg=None):
di = getArgs(arg)
embed = controller.checkMappers("set_id", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def scoreperclear(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-score"):
di["-score"] = 1000000000
print(di["-score"])
embed = controller.checkProfile("cast(ranked_score / greatest((ssh_count + sh_count + s_count + ss_count + a_count), 1) as int)", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def scoreratio(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-score"):
di["-score"] = 1000000000
embed = controller.checkProfile("cast(ranked_score as float) / cast(GREATEST(total_score, 1) as float) * 1000", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def top50s(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("top50_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a filter")
await updatelists()
@client.command(pass_context=True)
async def top1s(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("top1_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a filter")
await updatelists()
@client.command(pass_context=True)
async def scorev0(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("scorev0", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def ppv1_unstable(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("ppv1true", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def ppv1_new(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("ppv1full", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def ppv1(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("ppv1truefull", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def weightedscore(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("weightedscore", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def scoresquared(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("scoresquared", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def fcscore(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("fcscore", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def ssscore(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile("ssscore", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def totalpp(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("totalpp_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a filter")
await updatelists()
@client.command(pass_context=True)
async def fc_count(ctx, *, arg=None):
di = getArgs(arg)
if di.__contains__("-filter"):
embed = controller.checkfile("fc_" + di["-filter"], di)
await ctx.send(embed=embed)
else:
await ctx.send("Please specify a filter")
await updatelists()
@client.command(pass_context=True)
async def first_fc(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-time"):
di["-time"] = 1
embed = controller.checkTables("count(*)", "first_fc", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def first_ss(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkTables("count(*)", "first_ss", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def unique_fc(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkTables("count(*)", "unique_fc", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def unique_ss(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkTables("count(*)", "unique_ss", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def ss_bounty(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkTables("sum(days)", "first_ss", cur, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def first_fc_list(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
embed = controller.getBeatmapList(di, cur, ["first_fc"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def first_ss_list(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
embed = controller.getBeatmapList(di, cur, ["first_ss"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def unique_fc_list(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastweek)
embed = controller.getBeatmapList(di, cur, ["unique_fc"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def unique_ss_list(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
embed = controller.getBeatmapList(di, cur, ["unique_ss"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def least_fced(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
if not di.__contains__("-order"):
di["-order"] = "fc_count, stars"
embed = controller.getBeatmapList(di, cur, ["fc_count"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def least_ssed(ctx, *, arg=None):
di = getArgs(arg)
if not di.__contains__("-end"):
di["-end"] = str(lastmonth)
if not di.__contains__("-order"):
di["-order"] = "ss_count, stars"
embed = controller.getBeatmapList(di, cur, ["ss_count"])
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def oldestnumberone(ctx, *, arg=None):
di = getArgs(arg)
limit = 10
page = 1
if di.__contains__("-l"):
limit = di["-l"]
if di.__contains__("-p"):
page = di["-p"]
offset = int(limit) * (int(page) - 1)
f = open("C:\\Users\\sensa\\Documents\\VSCode\\bot\\data\\oldestTop1s.csv", newline='')
embed = discord.Embed(title = 'Result', colour=discord.Colour(0xE5E242))
s = formatter.formatcsv(f, int(limit), int(offset))
embed.description = s
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def tragedy(ctx, *, arg=None):
di = getArgs(arg)
if di["-o"] == "x":
f = "onemiss"
else:
f = "1x" + di["-o"]
embed = controller.checkfile(f, di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def projecthitogata(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(str(di["-o"]) + "_%hitogata%ryuusei%", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def projectdemetori(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(str(di["-o"]) + "_%demetori%", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def projectdragonforce(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(str(di["-o"]) + "_%dragonforce%", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def projectsao(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(str(di["-o"]) + "_%dragonforce%", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def projecttouhou(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(str(di["-o"]) + "_%touhou%", di)
await ctx.send(embed=embed)
await updatelists()
@client.command(pass_context=True)
async def pp_fun(ctx, *, arg=None):
di = getArgs(arg)
embed = controller.checkfile(di["-o"], di)
await ctx.send(embed=embed)
await updatelists()
client.run(TOKEN)
| 37.516159
| 403
| 0.606252
| 5,289
| 40,630
| 4.567782
| 0.082057
| 0.032121
| 0.048181
| 0.068546
| 0.804172
| 0.783724
| 0.762987
| 0.742001
| 0.734509
| 0.676642
| 0
| 0.035718
| 0.22065
| 40,630
| 1,083
| 404
| 37.516159
| 0.726859
| 0
| 0
| 0.650692
| 0
| 0.00639
| 0.181561
| 0.035072
| 0.00639
| 0
| 0.000788
| 0
| 0
| 1
| 0.001065
| false
| 0.074547
| 0.011715
| 0
| 0.019169
| 0.00852
| 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
|
479c6fa86e0466c68b285ceb4e93efb2e5a99771
| 127
|
py
|
Python
|
Scripts/FortiGate/Objects/__init__.py
|
Rel1ct0/ASA2FortiGate
|
3145e4d56532d9b3ea81f16aa6914200779f34bd
|
[
"BSD-2-Clause"
] | null | null | null |
Scripts/FortiGate/Objects/__init__.py
|
Rel1ct0/ASA2FortiGate
|
3145e4d56532d9b3ea81f16aa6914200779f34bd
|
[
"BSD-2-Clause"
] | null | null | null |
Scripts/FortiGate/Objects/__init__.py
|
Rel1ct0/ASA2FortiGate
|
3145e4d56532d9b3ea81f16aa6914200779f34bd
|
[
"BSD-2-Clause"
] | null | null | null |
from Scripts.FortiGate.Objects.getaddresses import getaddresses
from Scripts.FortiGate.Objects.getservices import getservices
| 31.75
| 63
| 0.88189
| 14
| 127
| 8
| 0.5
| 0.196429
| 0.357143
| 0.482143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070866
| 127
| 3
| 64
| 42.333333
| 0.949153
| 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
|
47a83e7ca276c7498e16a5c1915da61a039f364c
| 166
|
py
|
Python
|
bebackup/Compatibility.py
|
valouugit/BeBackup
|
46c520135d660dec116c1b0ea0209a4042e2c67b
|
[
"MIT"
] | 4
|
2021-06-14T12:07:57.000Z
|
2021-10-01T10:56:40.000Z
|
bebackup/Compatibility.py
|
valouugit/BeBackup
|
46c520135d660dec116c1b0ea0209a4042e2c67b
|
[
"MIT"
] | null | null | null |
bebackup/Compatibility.py
|
valouugit/BeBackup
|
46c520135d660dec116c1b0ea0209a4042e2c67b
|
[
"MIT"
] | null | null | null |
class Compatibility():
def dir_ftp_to_windows(dir):
return dir.replace("/", "\\")
def dir_windows_to_ftp(dir):
return dir.replace("\\", "/")
| 23.714286
| 37
| 0.590361
| 20
| 166
| 4.6
| 0.45
| 0.130435
| 0.26087
| 0.413043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.222892
| 166
| 7
| 38
| 23.714286
| 0.713178
| 0
| 0
| 0
| 0
| 0
| 0.035928
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0.4
| 1
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
7bd7d8c6a00dee436a72f0a46e81163f08b7c61e
| 1,079
|
py
|
Python
|
scripts/python/uploadT.py/__init__.py
|
jeremiahmarks/dangerzone
|
fe2946b8463ed018d2136ca0eb178161ad370565
|
[
"MIT"
] | 1
|
2015-08-15T05:25:35.000Z
|
2015-08-15T05:25:35.000Z
|
scripts/python/uploadT.py/__init__.py
|
jeremiahmarks/dangerzone
|
fe2946b8463ed018d2136ca0eb178161ad370565
|
[
"MIT"
] | null | null | null |
scripts/python/uploadT.py/__init__.py
|
jeremiahmarks/dangerzone
|
fe2946b8463ed018d2136ca0eb178161ad370565
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Jeremiah Marks
# @Date: 2015-02-16 22:29:02
# @Last Modified 2015-02-16
# @Last Modified time: 2015-02-16 22:45:30
import my.pw
import MySQLdb
def main():
db = MySQLdb.connect(host=my.pw.DBPATH, user=my.pw.DBUSE, passwd=my.pw.DBPASSWORD, db=my.pw.DBTOUSE)
cur = db.cursor()
cur.execute("SELECT VERSION()")
for row in cur.fetchall() :
#data from rows
version = str(row[0])
#print
print "The MySQL version is " + version
# close the cursor
cur.close()
# close the connection
db.close ()
if __name__ == '__main__':
main()
# if __name__ == '__main__':
# db = MySQLdb.connect(host=my.pw.DBPATH, user=my.pw.DBUSE, passwd=my.pw.DBPASSWORD, db=my.pw.DBTOUSE)
# cur = db.cursor()
# cur.execute("SELECT VERSION()")
# for row in cur.fetchall() :
# #data from rows
# version = str(row[0])
# #print
# print "The MySQL version is " + version
# # close the cursor
# cur.close()
# # close the connection
# db.close ()
| 22.957447
| 104
| 0.606117
| 155
| 1,079
| 4.116129
| 0.374194
| 0.056426
| 0.037618
| 0.031348
| 0.752351
| 0.752351
| 0.752351
| 0.752351
| 0.752351
| 0.752351
| 0
| 0.047445
| 0.238184
| 1,079
| 46
| 105
| 23.456522
| 0.72871
| 0.580167
| 0
| 0
| 0
| 0
| 0.105634
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.076923
| 0.153846
| null | null | 0.076923
| 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
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 7
|
d0784a27dac64d781dc8c27fd17b1cf6d22b6d7d
| 537
|
py
|
Python
|
environments/mujoco/rand_param_envs/gym/envs/toy_text/__init__.py
|
NagisaZj/varibad
|
df7cda81588c62a2a3bee69e4173228701bd7000
|
[
"MIT"
] | 8
|
2021-06-08T14:29:26.000Z
|
2022-02-11T13:54:09.000Z
|
environments/mujoco/rand_param_envs/gym/envs/toy_text/__init__.py
|
NagisaZj/varibad
|
df7cda81588c62a2a3bee69e4173228701bd7000
|
[
"MIT"
] | 2
|
2021-01-13T14:58:50.000Z
|
2021-01-13T14:59:40.000Z
|
environments/mujoco/rand_param_envs/gym/envs/toy_text/__init__.py
|
NagisaZj/varibad
|
df7cda81588c62a2a3bee69e4173228701bd7000
|
[
"MIT"
] | 1
|
2021-12-09T21:43:08.000Z
|
2021-12-09T21:43:08.000Z
|
from environments.mujoco.rand_param_envs.gym.envs.toy_text.blackjack import BlackjackEnv
from environments.mujoco.rand_param_envs.gym.envs.toy_text.frozen_lake import FrozenLakeEnv
from environments.mujoco.rand_param_envs.gym.envs.toy_text.guessing_game import GuessingGame
from environments.mujoco.rand_param_envs.gym.envs.toy_text.hotter_colder import HotterColder
from environments.mujoco.rand_param_envs.gym.envs.toy_text.nchain import NChainEnv
from environments.mujoco.rand_param_envs.gym.envs.toy_text.roulette import RouletteEnv
| 76.714286
| 92
| 0.888268
| 81
| 537
| 5.62963
| 0.308642
| 0.210526
| 0.289474
| 0.342105
| 0.644737
| 0.644737
| 0.644737
| 0.644737
| 0.644737
| 0.644737
| 0
| 0
| 0.044693
| 537
| 6
| 93
| 89.5
| 0.888889
| 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
| 1
| 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
|
ef7972577b75c4804339a49449dec71878fee8e6
| 21,620
|
py
|
Python
|
Research_Projects/Delayed Mortality/Building_the_Model/GEE_Fire_Functions.py
|
kmcquil/Project-Southern-Appalachians-2018
|
7ff66e8028d060e0e3418e56e128652e839eb53f
|
[
"Apache-2.0"
] | null | null | null |
Research_Projects/Delayed Mortality/Building_the_Model/GEE_Fire_Functions.py
|
kmcquil/Project-Southern-Appalachians-2018
|
7ff66e8028d060e0e3418e56e128652e839eb53f
|
[
"Apache-2.0"
] | null | null | null |
Research_Projects/Delayed Mortality/Building_the_Model/GEE_Fire_Functions.py
|
kmcquil/Project-Southern-Appalachians-2018
|
7ff66e8028d060e0e3418e56e128652e839eb53f
|
[
"Apache-2.0"
] | 1
|
2021-09-09T12:34:51.000Z
|
2021-09-09T12:34:51.000Z
|
import ee
import pandas
import geopandas as gp
import folium
import geemap
import pandas as pd
import math
print(ee.__version__)
ee.Initialize()
###Process DRdNBR
def Cal_DRdNBR(MTBS_Row):
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
#bb_one=MTBS_Row.total_bounds
#AOI= ee.Geometry.Polygon(bb_one.tolist())
#Date=(pd.to_datetime())
#print(Date)
Month=str(int(MTBS_Row.StartMonth))
Year=int(MTBS_Row.Year)
### Setting up Date Framework
### If a fire happens after Jun we will take the that year (May-Fire) and the year previous as the baseline, if it happens before leaf
### out we will take the previous two years (Growing season only May 1 to Oct )
if(int(Month)>=10):
YearZeroEnd=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(10)+'-'+str(15))
YearZeroStart=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(5)+'-'+str(1))
YearSubOneEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year+1)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year+1)+'-'+str(5)+'-'+str(15))
YearTwoEnd=pd.to_datetime(str(Year+2)+'-'+str(10)+'-'+str(15))
YearTwoStart=pd.to_datetime(str(Year+2)+'-'+str(5)+'-'+str(15))
YearThreeEnd=pd.to_datetime(str(Year+3)+'-'+str(10)+'-'+str(15))
YearThreeStart=pd.to_datetime(str(Year+3)+'-'+str(5)+'-'+str(15))
if(int(Month)>6 and int(Month)<10):
YearZeroEnd=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
YearZeroStart=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(5)+'-'+str(1))
YearSubOneEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year)+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
YearTwoEnd=pd.to_datetime(str(Year+1)+'-'+str(10)+'-'+str(15))
YearTwoStart=pd.to_datetime(str(Year+1)+'-'+str(5)+'-'+str(15))
YearThreeEnd=pd.to_datetime(str(Year+2)+'-'+str(10)+'-'+str(15))
YearThreeStart=pd.to_datetime(str(Year+2)+'-'+str(5)+'-'+str(15))
if(int(Month)<=6):
YearSubOneEnd=pd.to_datetime(str(Year-2)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-2)+'-'+str(5)+'-'+str(1))
YearZeroEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearZeroStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year)+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
YearTwoEnd=pd.to_datetime(str(Year+2)+'-'+str(10)+'-'+str(15))
YearTwoStart=pd.to_datetime(str(Year+2)+'-'+str(5)+'-'+str(15))
YearThreeEnd=pd.to_datetime(str(Year+3)+'-'+str(10)+'-'+str(15))
YearThreeStart=pd.to_datetime(str(Year+3)+'-'+str(5)+'-'+str(15))
def maskL8sr(image):
# // Bits 3 and 5 are cloud shadow and cloud, respectively.
cloudShadowBitMask = 1 << 3;
cloudsBitMask = 1 << 5;
snowBitMask = 1 << 4;
#// Get the pixel QA band.
qa = image.select('pixel_qa');
#// All flags should be set to zero, indicating clear conditions.
mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)and(qa.bitwiseAnd(cloudsBitMask).eq(0))and(qa.bitwiseAnd(snowBitMask).eq(0));
##// Return the masked image, scaled to TOA reflectance, without the QA bands.
return image.updateMask(mask).select("B[0-9]*").copyProperties(image, ["system:time_start"]);
def getQABits(image, start, end, mascara):
# Compute the bits we need to extract.
pattern = 0
for i in range(start,end+1):
pattern += 2**i
# Return a single band image of the extracted QA bits, giving the band a new name.
return image.select([0], [mascara]).bitwiseAnd(pattern).rightShift(start)
#A function to mask out cloudy pixels.
def maskQuality(image):
# Select the QA band.
QA = image.select('pixel_qa')
# Get the internal_cloud_algorithm_flag bit.
sombra = getQABits(QA,3,3,'cloud_shadow')
nubes = getQABits(QA,5,5,'cloud')
# var cloud_confidence = getQABits(QA,6,7, 'cloud_confidence')
cirrus_detected = getQABits(QA,9,9,'cirrus_detected')
#var cirrus_detected2 = getQABits(QA,8,8, 'cirrus_detected2')
#Return an image masking out cloudy areas.
return image.updateMask(sombra.eq(0)).updateMask(nubes.eq(0).updateMask(cirrus_detected.eq(0)))
if Year >=2015:
Ls8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");
#def ProcessOut(Ls8)
### Pull first Prefire Image
prefireImCol1 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearZeroStart, YearZeroEnd)
#// Filter by location.
.filterBounds(AOI));
### Pull first Prefire Image
prefireImCol2 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearSubOneStart, YearSubOneEnd)
#// Filter by location.
.filterBounds(AOI));
PreFireImages = prefireImCol1.merge(prefireImCol2);
prefire_CM_ImCol=PreFireImages.map(maskQuality)
#prefire_CM_ImCol = PreFireImages.map(maskL8sr);
pre_cm_mos =prefire_CM_ImCol.median().clip(AOI);
#print(AOI.centroid())
#### Post Fire
postfireImCol1 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearOneStart, YearOneEnd)
#// Filter by location.
.filterBounds(AOI));
postfireImCol2 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearTwoStart, YearTwoEnd)
#// Filter by location.
.filterBounds(AOI));
#count = postfireImCol2.size();
#print('Count2: ', count);
postfireImCol3 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearThreeStart, YearThreeEnd)
#// Filter by location.
.filterBounds(AOI));
#count = postfireImCol3.size()
#print('Count3: ', count);
postfireImCol1=postfireImCol1.map(maskQuality).median().clip(AOI)
postfireImCol2=postfireImCol2.map(maskQuality).median().clip(AOI)
postfireImCol3=postfireImCol3.map(maskQuality).median().clip(AOI)
PostfireImages=ee.ImageCollection([postfireImCol1, postfireImCol2,postfireImCol3]);
### This mosaic needs to be fixed (it currently is best quality last to first), ## Needs to be median.
def mapNBR(image):
NBR=image.normalizedDifference(['B5', 'B7'])
return(NBR)
### This mosaic needs to be fixed (it currently is best quality last to first), ## Needs to be median.
postNBRcol =PostfireImages.map(mapNBR)
postNBR=postNBRcol.min().clip(AOI)
preNBR = pre_cm_mos.normalizedDifference(['B5', 'B7']);
#postNBR = post_cm_mos.normalizedDifference(['B5', 'B7']);
dNBR_unscaled = preNBR.subtract(postNBR)
RdNBR=dNBR_unscaled.divide(preNBR.sqrt()).multiply(1000)
else:
Ls7 = ee.ImageCollection("LANDSAT/LE07/C01/T1_SR")
#NBR is used to identify burned areas and provide a measure of burn severity. It is calculated as a ratio between the NIR and SWIR values in traditional fashion.
#(NIR - SWIR) / (NIR + SWIR)
#In Landsat 4-7, NBR = (Band 4 – Band 7) / (Band 4 + Band 7).
prefireImCol1 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearZeroStart, YearZeroEnd)
#// Filter by location.
.filterBounds(AOI));
### Pull first Prefire Image
prefireImCol2 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearSubOneStart, YearSubOneEnd)
#// Filter by location.
.filterBounds(AOI));
PreFireImages = prefireImCol1.merge(prefireImCol2);
prefire_CM_ImCol=PreFireImages.map(maskQuality)
#prefire_CM_ImCol = PreFireImages.map(maskL8sr);
pre_cm_mos =prefire_CM_ImCol.median().clip(AOI);
#print(AOI.centroid())
#### Post Fire
postfireImCol1 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearOneStart, YearOneEnd)
#// Filter by location.
.filterBounds(AOI));
postfireImCol2 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearTwoStart, YearTwoEnd)
#// Filter by location.
.filterBounds(AOI));
#count = postfireImCol2.size();
#print('Count2: ', count);
postfireImCol3 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearThreeStart, YearThreeEnd)
#// Filter by location.
.filterBounds(AOI));
#count = postfireImCol3.size()
#print('Count3: ', count);
postfireImCol1=postfireImCol1.map(maskQuality).median().clip(AOI)
postfireImCol2=postfireImCol2.map(maskQuality).median().clip(AOI)
postfireImCol3=postfireImCol3.map(maskQuality).median().clip(AOI)
PostfireImages=ee.ImageCollection([postfireImCol1, postfireImCol2,postfireImCol3]);
def mapNBR(image):
NBR=image.normalizedDifference(['B5', 'B7'])
return(NBR)
### This mosaic needs to be fixed (it currently is best quality last to first), ## Needs to be median.
postNBRcol =PostfireImages.map(mapNBR)
postNBR=postNBRcol.min().clip(AOI)
preNBR = pre_cm_mos.normalizedDifference(['B5', 'B7']);
#postNBR = post_cm_mos.normalizedDifference(['B5', 'B7']);
dNBR_unscaled = preNBR.subtract(postNBR)
RdNBR=dNBR_unscaled.divide(preNBR.sqrt()).multiply(1000)
return(preNBR,postNBR,RdNBR)
################ Calculating one year RDNBR
def Cal_1yrDRdNBR(MTBS_Row):
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
#bb_one=MTBS_Row.total_bounds
#AOI= ee.Geometry.Polygon(bb_one.tolist())
#Date=(pd.to_datetime())
#print(Date)
Month=str(int(MTBS_Row.StartMonth))
Year=int(MTBS_Row.Year)
### Setting up Date Framework
### If a fire happens after Jun we will take the that year (May-Fire) and the year previous as the baseline, if it happens before leaf
### out we will take the previous two years (Growing season only May 1 to Oct )
if(int(Month)>=10):
YearZeroEnd=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(10)+'-'+str(15))
YearZeroStart=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(5)+'-'+str(1))
YearSubOneEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year+1)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year+1)+'-'+str(5)+'-'+str(15))
if(int(Month)>6 and int(Month)<10):
YearZeroEnd=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
YearZeroStart=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(5)+'-'+str(1))
YearSubOneEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year)+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
if(int(Month)<=6):
YearSubOneEnd=pd.to_datetime(str(Year-2)+'-'+str(10)+'-'+str(15))
YearSubOneStart=pd.to_datetime(str(Year-2)+'-'+str(5)+'-'+str(1))
YearZeroEnd=pd.to_datetime(str(Year-1)+'-'+str(10)+'-'+str(15))
YearZeroStart=pd.to_datetime(str(Year-1)+'-'+str(5)+'-'+str(1))
YearOneEnd=pd.to_datetime(str(Year)+'-'+str(10)+'-'+str(15))
YearOneStart=pd.to_datetime(str(Year)+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
def maskL8sr(image):
# // Bits 3 and 5 are cloud shadow and cloud, respectively.
cloudShadowBitMask = 1 << 3;
cloudsBitMask = 1 << 5;
snowBitMask = 1 << 4;
#// Get the pixel QA band.
qa = image.select('pixel_qa');
#// All flags should be set to zero, indicating clear conditions.
mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)and(qa.bitwiseAnd(cloudsBitMask).eq(0))and(qa.bitwiseAnd(snowBitMask).eq(0));
##// Return the masked image, scaled to TOA reflectance, without the QA bands.
return image.updateMask(mask).select("B[0-9]*").copyProperties(image, ["system:time_start"]);
def getQABits(image, start, end, mascara):
# Compute the bits we need to extract.
pattern = 0
for i in range(start,end+1):
pattern += 2**i
# Return a single band image of the extracted QA bits, giving the band a new name.
return image.select([0], [mascara]).bitwiseAnd(pattern).rightShift(start)
#A function to mask out cloudy pixels.
def maskQuality(image):
# Select the QA band.
QA = image.select('pixel_qa')
# Get the internal_cloud_algorithm_flag bit.
sombra = getQABits(QA,3,3,'cloud_shadow')
nubes = getQABits(QA,5,5,'cloud')
# var cloud_confidence = getQABits(QA,6,7, 'cloud_confidence')
cirrus_detected = getQABits(QA,9,9,'cirrus_detected')
#var cirrus_detected2 = getQABits(QA,8,8, 'cirrus_detected2')
#Return an image masking out cloudy areas.
return image.updateMask(sombra.eq(0)).updateMask(nubes.eq(0).updateMask(cirrus_detected.eq(0)))
if Year >=2015:
Ls8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR");
#def ProcessOut(Ls8)
### Pull first Prefire Image
prefireImCol1 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearZeroStart, YearZeroEnd)
#// Filter by location.
.filterBounds(AOI));
### Pull first Prefire Image
prefireImCol2 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearSubOneStart, YearSubOneEnd)
#// Filter by location.
.filterBounds(AOI));
PreFireImages = prefireImCol1.merge(prefireImCol2);
prefire_CM_ImCol=PreFireImages.map(maskQuality)
#prefire_CM_ImCol = PreFireImages.map(maskL8sr);
pre_cm_mos =prefire_CM_ImCol.median().clip(AOI);
#print(AOI.centroid())
#### Post Fire
postfireImCol1 = ee.ImageCollection(Ls8
#// Filter by dates.
.filterDate(YearOneStart, YearOneEnd)
#// Filter by location.
.filterBounds(AOI));
#count = postfireImCol3.size()
#print('Count3: ', count);
postfireImCol1=postfireImCol1.map(maskQuality).median().clip(AOI)
PostfireImages=ee.ImageCollection([postfireImCol1]);
def mapNBR(image):
NBR=image.normalizedDifference(['B5', 'B7'])
return(NBR)
### This mosaic needs to be fixed (it currently is best quality last to first), ## Needs to be median.
postNBRcol =PostfireImages.map(mapNBR)
postNBR=postNBRcol.min().clip(AOI)
preNBR = pre_cm_mos.normalizedDifference(['B5', 'B7']);
#postNBR = post_cm_mos.normalizedDifference(['B5', 'B7']);
dNBR_unscaled = preNBR.subtract(postNBR)
RdNBR=dNBR_unscaled.divide(preNBR.sqrt()).multiply(1000)
else:
Ls7 = ee.ImageCollection("LANDSAT/LE07/C01/T1_SR")
#NBR is used to identify burned areas and provide a measure of burn severity. It is calculated as a ratio between the NIR and SWIR values in traditional fashion.
#(NIR - SWIR) / (NIR + SWIR)
#In Landsat 4-7, NBR = (Band 4 – Band 7) / (Band 4 + Band 7).
prefireImCol1 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearZeroStart, YearZeroEnd)
#// Filter by location.
.filterBounds(AOI));
### Pull first Prefire Image
prefireImCol2 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearSubOneStart, YearSubOneEnd)
#// Filter by location.
.filterBounds(AOI));
PreFireImages = prefireImCol1.merge(prefireImCol2);
prefire_CM_ImCol=PreFireImages.map(maskQuality)
#prefire_CM_ImCol = PreFireImages.map(maskL8sr);
pre_cm_mos =prefire_CM_ImCol.median().clip(AOI);
#print(AOI.centroid())
#### Post Fire
postfireImCol1 = ee.ImageCollection(Ls7
#// Filter by dates.
.filterDate(YearOneStart, YearOneEnd)
#// Filter by location.
.filterBounds(AOI));
postfireImCol1=postfireImCol1.map(maskQuality).median().clip(AOI)
PostfireImages=ee.ImageCollection([postfireImCol1]);
def mapNBR(image):
NBR=image.normalizedDifference(['B5', 'B7'])
return(NBR)
### This mosaic needs to be fixed (it currently is best quality last to first), ## Needs to be median.
postNBRcol =PostfireImages.map(mapNBR)
postNBR=postNBRcol.min().clip(AOI)
preNBR = pre_cm_mos.normalizedDifference(['B5', 'B7']);
#postNBR = post_cm_mos.normalizedDifference(['B5', 'B7']);
dNBR_unscaled = preNBR.subtract(postNBR)
RdNBR=dNBR_unscaled.divide(preNBR.sqrt()).multiply(1000)
return(preNBR,postNBR,RdNBR)
##################### variable Processes
def MODIS16(MTBS_Row):
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
#bb_one=MTBS_Row.total_bounds
#AOI= ee.Geometry.Polygon(bb_one.tolist())
#Date=(pd.to_datetime())
#print(Date)
Month=str(int(MTBS_Row.StartMonth))
Year=int(MTBS_Row.Year)
PullDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
PullDate2=PullDate - pd.DateOffset(years=1)
Mod16A2 = ee.ImageCollection("MODIS/006/MOD16A2");
ModisShort = Mod16A2.filterDate(PullDate2, PullDate);
ETShort = ModisShort.select('ET')
ModisAnnualET = ETShort.sum()
ModisAnnualET=ModisAnnualET.toDouble()
ModisAnnualET= ModisAnnualET.clip(AOI)
PETShort = ModisShort.select('PET')
ModisAnnualPET = PETShort.sum()
ModisAnnualPET=ModisAnnualPET.toDouble()
ModisAnnualPET= ModisAnnualPET.clip(AOI)
return(ModisAnnualET,ModisAnnualPET)
def RWS (MTBS_Row):
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
StartDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
EndDate=StartDate + pd.DateOffset(days=3)
Gridmet= ee.ImageCollection("IDAHO_EPSCOR/GRIDMET").filterDate(StartDate, EndDate)
###Degrees Clockwise from north
WindDir=Gridmet.select('th').mean().toDouble().clip(AOI)
### Velocity at 10m
WindSpd=Gridmet.select('vs').max().toDouble().clip(AOI)
srtm = ee.Image('USGS/NED')
slope = ee.Terrain.slope(srtm).clip(AOI)
aspect=ee.Terrain.aspect(srtm).clip(AOI)
Radians=slope.divide(ee.Number(180.0)).multiply(ee.Number(math.pi))
RelativeWindDirection=WindDir.subtract(aspect).divide(ee.Number(180.0)).multiply(ee.Number(math.pi))
combustionBuoyancy=10
UaUb = WindSpd.divide(10)
### Set combustion bouyancy to 10 as it is unkwon
UaUb2=UaUb.multiply(UaUb)
#2(UA/Ub)sinRadians*cos(slope)*Sin(relativeWindDirection)
Secondterm=UaUb.multiply(2).multiply(Radians.sin()).multiply(RelativeWindDirection.cos())
#Sin(slopeRadian)*2
Thirdterm=Radians.sin().pow(2)
EffWSPD=UaUb2.add(Secondterm.add(Thirdterm)).pow(.5)
EffWSPD=EffWSPD.multiply(combustionBuoyancy).toDouble()
EffWSPD_res=EffWSPD.reduceResolution(**{'reducer': ee.Reducer.mean()})
return(EffWSPD,aspect,slope)
def GRIDMET(MTBS_Row,Variable,lagm=0):
TerraClimate=ee.ImageCollection("GRIDMET/DROUGHT")
####
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
if lagm>0:
EndDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
StartDate=EndDate + pd.DateOffset(months=- lagm-1)
Short = TerraClimate.filterDate(StartDate, EndDate).select(Variable).sum()
OutputVar=Short.toDouble()
OutputVar= OutputVar.clip(AOI)
else:
StartDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
#print(pd.DateOffset(month=5))
EndDate=StartDate + pd.DateOffset(days=2)
#print(StartDate,EndDate)
Short = TerraClimate.filterDate(StartDate, EndDate).select(Variable).mean()
OutputVar=Short.toDouble()
OutputVar= Short.clip(AOI).toDouble()
return(OutputVar)
def TerraClimate(MTBS_Row,Variable,lagm=0):
TerraClimate=ee.ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")
####
shapefile =MTBS_Row
features = []
for i in range(shapefile.shape[0]):
geom = shapefile.iloc[i:i+1,:]
jsonDict = eval(geom.to_json())
geojsonDict = jsonDict['features'][0]
features.append(ee.Feature(geojsonDict))
AOI = ee.FeatureCollection(features)
if lagm>0:
EndDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
StartDate=EndDate + pd.DateOffset(months=- lagm-1)
Short = TerraClimate.filterDate(StartDate, EndDate).select(Variable).sum()
OutputVar=Short.toDouble()
OutputVar= OutputVar.clip(AOI)
else:
StartDate=pd.to_datetime(str(int(MTBS_Row.Year))+'-'+str(int(MTBS_Row.StartMonth))+'-'+str(int(MTBS_Row.StartDay)))
#print(pd.DateOffset(month=5))
EndDate=StartDate + pd.DateOffset(days=2)
#print(StartDate,EndDate)
Short = TerraClimate.filterDate(StartDate, EndDate).select(Variable).mean()
OutputVar=Short.toDouble()
OutputVar= Short.clip(AOI)
return(OutputVar)
| 40.639098
| 164
| 0.691952
| 2,854
| 21,620
| 5.162579
| 0.117379
| 0.02803
| 0.046423
| 0.054975
| 0.90152
| 0.899348
| 0.899348
| 0.898534
| 0.891883
| 0.891883
| 0
| 0.025975
| 0.141721
| 21,620
| 532
| 165
| 40.639098
| 0.767946
| 0.229972
| 0
| 0.825826
| 0
| 0
| 0.032813
| 0.007117
| 0
| 0
| 0
| 0
| 0
| 1
| 0.048048
| false
| 0
| 0.021021
| 0
| 0.087087
| 0.003003
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
efa057cf156409bbd7823ff663319f09aa24633c
| 2,674
|
py
|
Python
|
test/pyaz/postgres/flexible_server/migration/__init__.py
|
bigdatamoore/py-az-cli
|
54383a4ee7cc77556f6183e74e992eec95b28e01
|
[
"MIT"
] | null | null | null |
test/pyaz/postgres/flexible_server/migration/__init__.py
|
bigdatamoore/py-az-cli
|
54383a4ee7cc77556f6183e74e992eec95b28e01
|
[
"MIT"
] | 9
|
2021-09-24T16:37:24.000Z
|
2021-12-24T00:39:19.000Z
|
test/pyaz/postgres/flexible_server/migration/__init__.py
|
bigdatamoore/py-az-cli
|
54383a4ee7cc77556f6183e74e992eec95b28e01
|
[
"MIT"
] | null | null | null |
import json, subprocess
from .... pyaz_utils import get_cli_name, get_params
def create(resource_group, name, properties, migration_name=None):
params = get_params(locals())
command = "az postgres flexible-server migration create " + params
print(command)
output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = output.stdout.decode("utf-8")
stderr = output.stderr.decode("utf-8")
if stdout:
return json.loads(stdout)
print(stdout)
else:
raise Exception(stderr)
print(stderr)
def show(resource_group, name, migration_name, level=None):
params = get_params(locals())
command = "az postgres flexible-server migration show " + params
print(command)
output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = output.stdout.decode("utf-8")
stderr = output.stderr.decode("utf-8")
if stdout:
return json.loads(stdout)
print(stdout)
else:
raise Exception(stderr)
print(stderr)
def list(resource_group, name, filter=None):
params = get_params(locals())
command = "az postgres flexible-server migration list " + params
print(command)
output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = output.stdout.decode("utf-8")
stderr = output.stderr.decode("utf-8")
if stdout:
return json.loads(stdout)
print(stdout)
else:
raise Exception(stderr)
print(stderr)
def update(resource_group, name, migration_name, setup_replication=None, db_names=None, overwrite_dbs=None, cutover=None):
params = get_params(locals())
command = "az postgres flexible-server migration update " + params
print(command)
output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = output.stdout.decode("utf-8")
stderr = output.stderr.decode("utf-8")
if stdout:
return json.loads(stdout)
print(stdout)
else:
raise Exception(stderr)
print(stderr)
def delete(resource_group, name, migration_name, yes=None):
params = get_params(locals())
command = "az postgres flexible-server migration delete " + params
print(command)
output = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = output.stdout.decode("utf-8")
stderr = output.stderr.decode("utf-8")
if stdout:
return json.loads(stdout)
print(stdout)
else:
raise Exception(stderr)
print(stderr)
| 36.135135
| 122
| 0.675393
| 324
| 2,674
| 5.509259
| 0.166667
| 0.078431
| 0.056022
| 0.053221
| 0.866667
| 0.816247
| 0.816247
| 0.816247
| 0.816247
| 0.816247
| 0
| 0.004746
| 0.212042
| 2,674
| 73
| 123
| 36.630137
| 0.84243
| 0
| 0
| 0.820896
| 0
| 0
| 0.101346
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.074627
| false
| 0
| 0.029851
| 0
| 0.179104
| 0.223881
| 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
|
efabfed8a313ca7e01a85b1f9601042f12e38b93
| 235
|
py
|
Python
|
losses.py
|
12-wu/-
|
69362fa00b3956e1d56caced340389e31cb944a0
|
[
"MIT"
] | null | null | null |
losses.py
|
12-wu/-
|
69362fa00b3956e1d56caced340389e31cb944a0
|
[
"MIT"
] | null | null | null |
losses.py
|
12-wu/-
|
69362fa00b3956e1d56caced340389e31cb944a0
|
[
"MIT"
] | null | null | null |
from torch.nn.functional import mse_loss
import torch.nn.functional as func
def completion_network_loss(input, output, mask):
#return func.cross_entropy(output * mask, input * mask)
return mse_loss(output * mask, input * mask)
| 39.166667
| 59
| 0.765957
| 35
| 235
| 5
| 0.514286
| 0.171429
| 0.194286
| 0.217143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144681
| 235
| 5
| 60
| 47
| 0.870647
| 0.229787
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.5
| 0.25
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 7
|
ef0809d831a85445f2bebb1986cdbc7233014890
| 131
|
py
|
Python
|
senseis/torch_modules/activation.py
|
armandli/ReconChessRL
|
3f3f018fd347ee17452ef6ad725d82f2f11678c6
|
[
"MIT"
] | 4
|
2021-08-19T14:06:01.000Z
|
2021-12-24T06:34:23.000Z
|
senseis/torch_modules/activation.py
|
captainzhu123/ReconChessRL
|
6d0de7acd7aeba0ad767e29c807ee0e6f30d95fb
|
[
"MIT"
] | 2
|
2021-09-18T08:34:01.000Z
|
2022-03-23T07:06:05.000Z
|
senseis/torch_modules/activation.py
|
captainzhu123/ReconChessRL
|
6d0de7acd7aeba0ad767e29c807ee0e6f30d95fb
|
[
"MIT"
] | 1
|
2021-09-18T08:30:23.000Z
|
2021-09-18T08:30:23.000Z
|
import torch.nn as nn
def relu_activation():
return nn.ReLU(inplace=True)
def silu_activation():
return nn.SiLU(inplace=True)
| 18.714286
| 30
| 0.755725
| 21
| 131
| 4.619048
| 0.52381
| 0.329897
| 0.371134
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129771
| 131
| 7
| 31
| 18.714286
| 0.850877
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| true
| 0
| 0.2
| 0.4
| 1
| 0
| 1
| 0
| 0
| null | 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
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 8
|
329fa0e8dcb5c538bf226fcbe5dd767fc652da1c
| 37
|
py
|
Python
|
src/vardb/datamodel/jsonschemas/__init__.py
|
Dabble-of-DevOps-Bio/ella
|
e38631d302611a143c9baaa684bcbd014d9734e4
|
[
"MIT"
] | null | null | null |
src/vardb/datamodel/jsonschemas/__init__.py
|
Dabble-of-DevOps-Bio/ella
|
e38631d302611a143c9baaa684bcbd014d9734e4
|
[
"MIT"
] | null | null | null |
src/vardb/datamodel/jsonschemas/__init__.py
|
Dabble-of-DevOps-Bio/ella
|
e38631d302611a143c9baaa684bcbd014d9734e4
|
[
"MIT"
] | null | null | null |
from .load_schema import load_schema
| 18.5
| 36
| 0.864865
| 6
| 37
| 5
| 0.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.108108
| 37
| 1
| 37
| 37
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
08604f1ec3de55274af5625eebf1950babed4f12
| 131
|
py
|
Python
|
7kyu/(7 kyu) Simple beads count/(7 kyu) Simple beads count.py
|
e1r0nd/codewars
|
dc98484281345e7675eb5e8a51c192e2fa77c443
|
[
"MIT"
] | 49
|
2018-04-30T06:42:45.000Z
|
2021-07-22T16:39:02.000Z
|
(7 kyu) Simple beads count/(7 kyu) Simple beads count.py
|
novsunheng/codewars
|
c54b1d822356889b91587b088d02ca0bd3d8dc9e
|
[
"MIT"
] | 1
|
2020-08-31T02:36:53.000Z
|
2020-08-31T10:14:00.000Z
|
(7 kyu) Simple beads count/(7 kyu) Simple beads count.py
|
novsunheng/codewars
|
c54b1d822356889b91587b088d02ca0bd3d8dc9e
|
[
"MIT"
] | 25
|
2018-04-02T20:57:58.000Z
|
2021-05-28T15:24:51.000Z
|
# #1
# def count_red_beads(n):
# return 0 if n < 2 else (n - 1) * 2
def count_red_beads(n): # 2
return max(0, 2 * (n-1))
| 16.375
| 39
| 0.541985
| 27
| 131
| 2.481481
| 0.444444
| 0.238806
| 0.328358
| 0.477612
| 0.507463
| 0
| 0
| 0
| 0
| 0
| 0
| 0.095745
| 0.282443
| 131
| 7
| 40
| 18.714286
| 0.617021
| 0.496183
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 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
|
08622d56deab354c2d91e585dea0dfc88dcadfc8
| 9,296
|
py
|
Python
|
src/models/model_feature_encoder.py
|
waverDeep/WaveBYOL
|
ab062c26598e0fa6ab8426498f9920048988b5c1
|
[
"MIT"
] | 1
|
2022-03-15T00:00:57.000Z
|
2022-03-15T00:00:57.000Z
|
src/models/model_feature_encoder.py
|
waverDeep/WaveBYOL
|
ab062c26598e0fa6ab8426498f9920048988b5c1
|
[
"MIT"
] | null | null | null |
src/models/model_feature_encoder.py
|
waverDeep/WaveBYOL
|
ab062c26598e0fa6ab8426498f9920048988b5c1
|
[
"MIT"
] | null | null | null |
import torchvision
import torch.nn as nn
def select_feature_encoder_model(model_name, pretrain=True):
feature_extractor_model = nn.Sequential()
if model_name == 'h1':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(256, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
elif model_name == 'h2':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.Conv2d(256, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.Conv2d(1024, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
elif model_name == 'h3':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 16, 3, stride=1, padding=1),
nn.BatchNorm2d(16),
nn.ReLU(),
nn.Conv2d(16, 16, 3, stride=1, padding=1),
nn.BatchNorm2d(16),
nn.ReLU(),
nn.Conv2d(16, 32, 3, stride=1, padding=1),
nn.BatchNorm2d(32),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(32, 32, 3, stride=1, padding=1),
nn.BatchNorm2d(32),
nn.ReLU(),
nn.Conv2d(32, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(64, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.Conv2d(128, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
elif model_name == 'h4':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.Conv2d(256, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(1024, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.Conv2d(1024, 2048, 3, stride=1, padding=1),
nn.BatchNorm2d(2048),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
elif model_name == 'h5':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.Conv2d(256, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.Conv2d(256, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(1024, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.Conv2d(1024, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.Conv2d(1024, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
elif model_name == 'l2':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(4, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.Conv2d(256, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(4, stride=2),
nn.Conv2d(512, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(4, stride=2),
)
)
elif model_name == 'l3':
feature_extractor_model.add_module(
"feature_extractor_layer",
nn.Sequential(
nn.Conv2d(3, 64, 3, stride=1, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.Conv2d(64, 128, 3, stride=1, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(128, 256, 3, stride=1, padding=1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(256, 512, 3, stride=1, padding=1),
nn.BatchNorm2d(512),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
nn.Conv2d(512, 1024, 3, stride=1, padding=1),
nn.BatchNorm2d(1024),
nn.ReLU(),
nn.MaxPool2d(2, stride=2),
)
)
return feature_extractor_model
| 33.081851
| 62
| 0.436102
| 1,019
| 9,296
| 3.929342
| 0.045142
| 0.107892
| 0.107892
| 0.202298
| 0.951299
| 0.948052
| 0.948052
| 0.938811
| 0.938811
| 0.932068
| 0
| 0.155413
| 0.429647
| 9,296
| 281
| 63
| 33.081851
| 0.599774
| 0
| 0
| 0.852321
| 0
| 0
| 0.018823
| 0.017317
| 0
| 0
| 0
| 0
| 0
| 1
| 0.004219
| false
| 0
| 0.008439
| 0
| 0.016878
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
086aa879295f7a4d1d8535e26339e6bb3680629f
| 469
|
py
|
Python
|
convert_date.py
|
Santhoshkumard11/csv-to-sql-convertor
|
681fd012e356a80ceffdca1099cfeaedfbe25842
|
[
"MIT"
] | null | null | null |
convert_date.py
|
Santhoshkumard11/csv-to-sql-convertor
|
681fd012e356a80ceffdca1099cfeaedfbe25842
|
[
"MIT"
] | null | null | null |
convert_date.py
|
Santhoshkumard11/csv-to-sql-convertor
|
681fd012e356a80ceffdca1099cfeaedfbe25842
|
[
"MIT"
] | null | null | null |
#paste your date in collections
collections = """28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/10/2019
28/11/2019
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020
28/12/2019
28/01/2020
28/02/2020
28/03/2020
28/04/2020
28/05/2020
28/06/2020
28/07/2020
28/08/2020""".split("\n")
for item in collections:
new_item = item[6:]+item[2:5]+"/"+item[0:2]
print(f"CAST(N'{new_item}' as date)")
| 13.4
| 47
| 0.684435
| 108
| 469
| 2.953704
| 0.296296
| 0.394984
| 0.075235
| 0.094044
| 0.60815
| 0.60815
| 0.60815
| 0.60815
| 0.60815
| 0.60815
| 0
| 0.514493
| 0.117271
| 469
| 34
| 48
| 13.794118
| 0.256039
| 0.063966
| 0
| 0.758621
| 0
| 0
| 0.719178
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.034483
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
08f52a603d48186ab21dd108c7203d58c64dc9a7
| 19,280
|
py
|
Python
|
autodisc/autodisc/representations/static/pytorchnnrepresentation/pytorchnnarchitectures.py
|
flowersteam/automated_discovery_of_lenia_patterns
|
97cc7cde2120fa95225d1e470e00b8aa8c034e97
|
[
"MIT"
] | 10
|
2019-10-05T16:22:11.000Z
|
2021-12-30T14:09:42.000Z
|
autodisc/autodisc/representations/static/pytorchnnrepresentation/pytorchnnarchitectures.py
|
flowersteam/automated_discovery_of_lenia_patterns
|
97cc7cde2120fa95225d1e470e00b8aa8c034e97
|
[
"MIT"
] | null | null | null |
autodisc/autodisc/representations/static/pytorchnnrepresentation/pytorchnnarchitectures.py
|
flowersteam/automated_discovery_of_lenia_patterns
|
97cc7cde2120fa95225d1e470e00b8aa8c034e97
|
[
"MIT"
] | 2
|
2019-10-14T12:12:38.000Z
|
2020-09-16T11:18:26.000Z
|
from autodisc.representations.static.pytorchnnrepresentation import helper
import torch
from torch import nn
class BetaVAEClassifier(nn.Module):
'''
BetaVAE with Classifier network architecture
'''
def __init__(self, n_channels = 1, n_latents = 2, input_size = (100,100), beta = 1.0, gamma = 1.0, num_classes = 2, use_gpu = True, add_var_to_KLD_loss = True, **kwargs):
super(BetaVAEClassifier, self).__init__()
self.init_params = locals()
if use_gpu and torch.cuda.is_available():
self.use_gpu = True
else:
self.use_gpu = False
# network parameters
self.n_channels = n_channels
self.n_latents = n_latents
self.input_size = input_size
self.beta = beta
self.num_classes = num_classes
self.gamma = gamma
self.add_var_to_KLD_loss = add_var_to_KLD_loss
# network architecture
self.encoder = nn.Sequential(
nn.Conv2d( self.n_channels, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
helper.Flatten(),
nn.Linear(32 * helper.conv2d_output_flatten_size(self.input_size, n_conv=4, kernels_size=[4,4,4,4], strides=[2,2,2,2], pads=[1,1,1,1], dils=[1,1,1,1]), 256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, 2 * self.n_latents)
)
self.decoder = nn.Sequential(
nn.Linear(self.n_latents, 256),
nn.ReLU(),
nn.Linear(256, 16 * 16 * 32),
nn.ReLU(),
helper.Channelize(32, 16, 16),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1), #The padding argument effectively adds kernel_size - 1 - padding amount of zero padding to both sizes of the input
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, self.n_channels, kernel_size=4, stride=2, padding=1)
)
self.fc = nn.Sequential(
nn.Linear(self.n_latents, 128),
nn.ReLU(),
nn.Linear(128, self.num_classes)
)
def encode(self, x):
if self.use_gpu and not x.is_cuda:
x = x.cuda()
return torch.chunk(self.encoder(x), 2, dim=1)
def decode(self, z):
if self.use_gpu and not z.is_cuda:
z = z.cuda()
return self.decoder(z)
def classify(self, z):
if self.use_gpu and not z.is_cuda:
z = z.cuda()
return self.fc(z)
def forward(self, x):
if self.use_gpu and not x.is_cuda:
x = x.cuda()
mu, logvar = self.encode(x)
z = self.reparameterize(mu, logvar)
return {'recon_x': self.decode(z), 'recon_y': self.classify(z), 'mu': mu, 'logvar': logvar}
def reparameterize(self, mu, logvar):
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
if self.training:
std = logvar.mul(0.5).exp_()
eps = torch.randn_like(std)
return eps.mul(std).add_(mu)
else:
return mu
def calc(self, x):
''' the function calc outputs a representation vector of size batch_size*n_latents'''
if self.use_gpu and not x.is_cuda:
x = x.cuda()
mu, logvar = self.encode(x)
return mu
def train_loss(self, outputs, inputs):
""" train loss:
recon_x: reconstructed images
x: origin images
mu: latent mean
logvar: latent log variance
"""
x = inputs['image']
y = inputs['label']
recon_x = outputs['recon_x']
recon_y = outputs['recon_y']
mu = outputs['mu']
logvar = outputs['logvar']
if self.use_gpu and not x.is_cuda:
x = x.cuda()
if self.use_gpu and not y.is_cuda:
y = y.cuda()
if self.use_gpu and not recon_x.is_cuda:
recon_x = recon_x.cuda()
if self.use_gpu and not recon_y.is_cuda:
recon_y = recon_y.cuda()
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
BCE = helper.BCE_with_digits_loss(recon_x, x)
KLD, KLD_per_latent_dim, KLD_var = helper.KLD_loss(mu, logvar)
CE = helper.CE_loss(recon_y, y)
total = (BCE + self.beta * (KLD + float(self.add_var_to_KLD_loss) * KLD_var) + self.gamma * CE)
return {'total': total, 'BCE': BCE, 'KLD': KLD, 'KLD_var': KLD_var, 'CE': CE}
def valid_losses(self, outputs, inputs):
""" train loss:
recon_x: reconstructed images
x: origin images
mu: latent mean
logvar: latent log variance
"""
x = inputs['image']
y = inputs['label']
recon_x = outputs['recon_x']
recon_y = outputs['recon_y']
mu = outputs['mu']
logvar = outputs['logvar']
if self.use_gpu and not x.is_cuda:
x = x.cuda()
if self.use_gpu and not y.is_cuda:
y = y.cuda()
if self.use_gpu and not recon_x.is_cuda:
recon_x = recon_x.cuda()
if self.use_gpu and not recon_y.is_cuda:
recon_y = recon_y.cuda()
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
BCE = helper.BCE_with_digits_loss(recon_x, x)
KLD, KLD_per_latent_dim, KLD_var = helper.KLD_loss(mu, logvar)
CE = helper.CE_loss(recon_y, y)
total = (BCE + self.beta * (KLD + float(self.add_var_to_KLD_loss) * KLD_var) + self.gamma * CE)
return {'total': total, 'BCE': BCE, 'KLD': KLD, 'KLD_var': KLD_var, 'CE': CE}
class BetaVAE(nn.Module):
'''
BetaVAE network architecture
'''
def __init__(self, n_channels = 1, n_latents = 2, input_size = (100,100), beta = 1.0, use_gpu = True, add_var_to_KLD_loss = True, **kwargs):
super(BetaVAE, self).__init__()
self.init_params = locals()
if use_gpu and torch.cuda.is_available():
self.use_gpu = True
else:
self.use_gpu = False
# network parameters
self.n_channels = n_channels
self.n_latents = n_latents
self.input_size = input_size
self.beta = beta
self.add_var_to_KLD_loss = add_var_to_KLD_loss
# network architecture
self.encoder = nn.Sequential(
nn.Conv2d( self.n_channels, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
#helper.LinearFromFlatten(256),
helper.Flatten(),
nn.Linear(32 * helper.conv2d_output_flatten_size(self.input_size, n_conv=4, kernels_size=[4,4,4,4], strides=[2,2,2,2], pads=[1,1,1,1], dils=[1,1,1,1]), 256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, 2 * self.n_latents)
)
self.decoder = nn.Sequential(
nn.Linear(self.n_latents, 256),
nn.ReLU(),
nn.Linear(256, 16 * 16 * 32),
nn.ReLU(),
helper.Channelize(32, 16, 16),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1), #The padding argument effectively adds kernel_size - 1 - padding amount of zero padding to both sizes of the input
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, self.n_channels, kernel_size=4, stride=2, padding=1)
)
'''
self.encoder = nn.Sequential(
helper.SphericPad (padding_size=1),
nn.Conv2d( self.n_channels, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.Flatten(),
nn.Linear(32 * helper.conv2d_output_flatten_size(self.input_size, n_conv=4, kernels_size=[4,4,4,4], strides=[2,2,2,2], pads=[1,1,1,1], dils=[1,1,1,1]), 256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, 2 * self.n_latents)
)
self.decoder = nn.Sequential(
nn.Linear(self.n_latents, 256),
nn.ReLU(),
nn.Linear(256, 16 * 16 * 32),
nn.ReLU(),
helper.Channelize(32, 16, 16),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1), #The padding argument effectively adds kernel_size - 1 - padding amount of zero padding to both sizes of the input
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, self.n_channels, kernel_size=4, stride=2, padding=4-1)
)
'''
def encode(self, x):
if self.use_gpu and not x.is_cuda:
x = x.cuda()
return torch.chunk(self.encoder(x), 2, dim=1)
def decode(self, z):
if self.use_gpu and not z.is_cuda:
z = z.cuda()
return self.decoder(z)
def forward(self, x):
if self.use_gpu and not x.is_cuda:
x = x.cuda()
mu, logvar = self.encode(x)
z = self.reparameterize(mu, logvar)
return {'recon_x': self.decode(z), 'mu': mu, 'logvar': logvar}
def reparameterize(self, mu, logvar):
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
if self.training:
std = logvar.mul(0.5).exp_()
eps = torch.randn_like(std)
return eps.mul(std).add_(mu)
else:
return mu
def calc(self, x):
''' the function calc outputs a representation vector of size batch_size*n_latents'''
if self.use_gpu and not x.is_cuda:
x = x.cuda()
mu, logvar = self.encode(x)
return mu
def train_loss(self, outputs, inputs):
""" train loss:
recon_x: reconstructed images
x: origin images
mu: latent mean
logvar: latent log variance
"""
x = inputs['image']
recon_x = outputs['recon_x']
mu = outputs['mu']
logvar = outputs['logvar']
if self.use_gpu and not x.is_cuda:
x = x.cuda()
if self.use_gpu and not recon_x.is_cuda:
recon_x = recon_x.cuda()
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
BCE = helper.BCE_with_digits_loss(recon_x, x)
KLD, KLD_per_latent_dim, KLD_var = helper.KLD_loss(mu, logvar)
total = (BCE + self.beta * (KLD + float(self.add_var_to_KLD_loss) * KLD_var))
return {'total': total, 'BCE': BCE, 'KLD': KLD, 'KLD_var': KLD_var}
def valid_losses(self, outputs, inputs):
""" train loss:
recon_x: reconstructed images
x: origin images
mu: latent mean
logvar: latent log variance
"""
x = inputs['image']
recon_x = outputs['recon_x']
mu = outputs['mu']
logvar = outputs['logvar']
if self.use_gpu and not x.is_cuda:
x = x.cuda()
if self.use_gpu and not recon_x.is_cuda:
recon_x = recon_x.cuda()
if self.use_gpu and not mu.is_cuda:
mu = mu.cuda()
if self.use_gpu and not logvar.is_cuda:
logvar = logvar.cuda()
BCE = helper.BCE_with_digits_loss(recon_x, x)
KLD, KLD_per_latent_dim, KLD_var = helper.KLD_loss(mu, logvar)
total = (BCE + self.beta * (KLD + float(self.add_var_to_KLD_loss) * KLD_var))
return {'total': total, 'BCE': BCE, 'KLD': KLD, 'KLD_var': KLD_var}
class AE(nn.Module):
'''
AE network architecture
'''
def __init__(self, n_channels = 1, n_latents = 2, input_size = (100,100), use_gpu = True, **kwargs):
super(AE, self).__init__()
self.init_params = locals()
if use_gpu and torch.cuda.is_available():
self.use_gpu = True
else:
self.use_gpu = False
# network parameters
self.n_channels = 1
self.n_latents = n_latents
self.input_size = input_size
# network architecture
self.encoder = nn.Sequential(
nn.Conv2d( self.n_channels, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
helper.LinearFromFlatten(256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, self.n_latents)
)
self.decoder = nn.Sequential(
nn.Linear(self.n_latents, 256),
nn.ReLU(),
nn.Linear(256, 16 * 16 * 32),
nn.ReLU(),
helper.Channelize(32, 16, 16),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1), #The padding argument effectively adds kernel_size - 1 - padding amount of zero padding to both sizes of the input
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=1),
nn.ReLU(),
nn.ConvTranspose2d(32, self.n_channels, kernel_size=4, stride=2, padding=1)
)
'''
self.encoder = nn.Sequential(
helper.SphericPad (padding_size=1),
nn.Conv2d( self.n_channels, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.Conv2d(32, 32, kernel_size=4, stride=2, padding=0),
nn.ReLU(),
helper.Flatten(),
nn.Linear(32 * helper.conv2d_output_flatten_size(self.input_size, n_conv=4, kernels_size=[4,4,4,4], strides=[2,2,2,2], pads=[1,1,1,1], dils=[1,1,1,1]), 256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, self.n_latents)
)
self.decoder = nn.Sequential(
nn.Linear(self.n_latents, 256),
nn.ReLU(),
nn.Linear(256, 16 * 16 * 32),
nn.ReLU(),
helper.Channelize(32, 16, 16),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1), #The padding argument effectively adds kernel_size - 1 - padding amount of zero padding to both sizes of the input
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, 32, kernel_size=4, stride=2, padding=4-1),
nn.ReLU(),
helper.SphericPad (padding_size=1),
nn.ConvTranspose2d(32, self.n_channels, kernel_size=4, stride=2, padding=4-1)
)
'''
def forward(self, x):
if self.use_gpu:
x = x.cuda()
z = self.encoder(x)
recon_x = self.decoder(z)
return {'recon_x': recon_x, 'mu': z, 'logvar': torch.zeros_like(z)}
def calc(self, x):
''' the function calc outputs a representation vector of size batch_size*n_latents'''
if self.use_gpu:
x = x.cuda()
z = self.encoder(x)
return z
def train_loss(self, output_x, x):
""" train loss """
recon_x = output_x ['recon_x']
return helper.MSE_loss(recon_x, x)
def valid_losses(self, output_x, x):
total = self.train_loss (output_x, x)
return {'total': total}
| 38.637275
| 197
| 0.515249
| 2,475
| 19,280
| 3.849697
| 0.056566
| 0.035264
| 0.043031
| 0.071369
| 0.940386
| 0.940386
| 0.940386
| 0.937028
| 0.935768
| 0.935768
| 0
| 0.050135
| 0.367894
| 19,280
| 498
| 198
| 38.714859
| 0.731681
| 0.06473
| 0
| 0.866221
| 0
| 0
| 0.017995
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.073579
| false
| 0
| 0.010033
| 0
| 0.16388
| 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
|
3e92c388888cc2bfe9a46d18b595962c4e8c4036
| 24,564
|
py
|
Python
|
Office-Home.py
|
PRIS-CV/Mutual-to-Separate
|
9a57a4dc15524e94e323e47da6c58362f4217a53
|
[
"MIT"
] | 7
|
2020-05-25T08:28:27.000Z
|
2021-03-28T06:02:17.000Z
|
Office-Home.py
|
PRIS-CV/Mutual-to-Separate
|
9a57a4dc15524e94e323e47da6c58362f4217a53
|
[
"MIT"
] | null | null | null |
Office-Home.py
|
PRIS-CV/Mutual-to-Separate
|
9a57a4dc15524e94e323e47da6c58362f4217a53
|
[
"MIT"
] | 3
|
2020-04-24T06:06:35.000Z
|
2021-04-18T09:42:39.000Z
|
from data import *
from utilities import *
from networks import *
# import matplotlib.pyplot as plt
import numpy as np
def skip(data, label, is_train):
return False
batch_size = 16
import sys
domain_train = sys.argv[1]
domain_test = sys.argv[2]
setGPU(sys.argv[3])
store_name = sys.argv[4]
loss_MSE_value = float(sys.argv[5])
three_domain_loss_value = float(sys.argv[6])
log = Logger(store_name + '/step_2', clear=True)
print('domain_train', domain_train)
print('domain_test', domain_test)
# Art 1089
# Clipart 1675
# Product 1785
# RealWorld 1811
def transform(data, label, is_train):
label = one_hot(26, label)
data = tl.prepro.crop(data, 224, 224, is_random=is_train)
data = np.transpose(data, [2, 0, 1])
data = np.asarray(data, np.float32) / 255.0
return data, label
ds = FileListDataset('/home/username/data/OfficeHomeDataset_10072016/'+domain_train + '_shared_list.txt', \
'/home/username/data/office/', transform=transform, skip_pred=skip, is_train=True, imsize=256)
source_train = CustomDataLoader(ds, batch_size=batch_size, num_threads=2)
def transform(data, label, is_train):
if label in range(25):
label = one_hot(26, label)
else:
label = one_hot(26,25)
data = tl.prepro.crop(data, 224, 224, is_random=is_train)
data = np.transpose(data, [2, 0, 1])
data = np.asarray(data, np.float32) / 255.0
return data, label
ds1 = FileListDataset('/home/username/data/OfficeHomeDataset_10072016/'+ domain_test+ '_list.txt', \
'/home/username/data/office/', transform=transform, skip_pred=skip, is_train=True, imsize=256)
target_train = CustomDataLoader(ds1, batch_size=batch_size, num_threads=2)
def transform(data, label, is_train):
label = one_hot(65,label)
data = tl.prepro.crop(data, 224, 224, is_random=is_train)
data = np.transpose(data, [2, 0, 1])
data = np.asarray(data, np.float32) / 255.0
return data, label
ds2 =FileListDataset('/home/username/data/OfficeHomeDataset_10072016/'+ domain_test+ '_list.txt', \
'/home/username/data/office/', transform=transform, skip_pred=skip, is_train=False, imsize=256)
target_test = CustomDataLoader(ds2, batch_size=batch_size, num_threads=2)
discriminator_p = Discriminator(n = 25).cuda() # 10 binary classifier
discriminator = LargeAdversarialNetwork(256).cuda()
feature_extractor_fix = ResNetFc(model_name='resnet50',model_path='/home/username/data/pytorchModels/resnet50.pth')
feature_extractor_nofix = ResNetFc(model_name='resnet50',model_path='/home/username/data/pytorchModels/resnet50.pth')
cls_upper = CLS(feature_extractor_fix.output_num(), 26, bottle_neck_dim=256)
cls_down = CLS(feature_extractor_nofix.output_num(), 26, bottle_neck_dim=256)
net_upper = nn.Sequential(feature_extractor_fix, cls_upper).cuda()
net_down = nn.Sequential(feature_extractor_nofix, cls_down).cuda()
three_domain_discriminator = Discriminator2(n = 3).cuda()
scheduler = lambda step, initial_lr : inverseDecaySheduler(step, initial_lr, gamma=10, power=0.75, max_iter=10000)
optimizer_discriminator = OptimWithSheduler(optim.SGD(discriminator.parameters(), lr=5e-4, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_feature_extractor_fix = OptimWithSheduler(optim.SGD(feature_extractor_fix.parameters(), lr=5e-5, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_feature_extractor_nofix = OptimWithSheduler(optim.SGD(feature_extractor_nofix.parameters(), lr=5e-5, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_cls_upper = OptimWithSheduler(optim.SGD(cls_upper.parameters(), lr=5e-4, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_cls_down = OptimWithSheduler(optim.SGD(cls_down.parameters(), lr=5e-4, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_discriminator_p = OptimWithSheduler(optim.SGD(discriminator_p.parameters(), lr=1e-3, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
optimizer_three_domain_discriminator = OptimWithSheduler(optim.SGD(three_domain_discriminator.parameters(), lr=5e-4, weight_decay=5e-4, momentum=0.9, nesterov=True),
scheduler)
KL = nn.KLDivLoss()
MSE = nn.MSELoss()
# =========================weighted adaptation of the source and target domains
k=0
while k <6000:
for (i, ((im_source, label_source), (im_target, label_target))) in enumerate(
zip(source_train.generator(), target_train.generator())):
im_source = Variable(torch.from_numpy(im_source)).cuda()
label_source = Variable(torch.from_numpy(label_source)).cuda()
im_target = Variable(torch.from_numpy(im_target)).cuda()
fs1, feature_source, __, predict_prob_source_upper = net_upper.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_upper.forward(im_target)
p0_upper = discriminator_p.forward(fs1)
p1_upper = discriminator_p.forward(ft1)
p2_upper = torch.sum(p1_upper, dim = -1).detach()
p3_upper = torch.sum(p0_upper, dim = -1).detach()
d1_upper = BCELossForMultiClassification(label_source[:,0:25],p0_upper)
ce_upper = CrossEntropyLoss(label_source, predict_prob_source_upper)
fs1, feature_source, __, predict_prob_source_down = net_down.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_down.forward(im_target)
domain_prob_discriminator_1_source = discriminator.forward(feature_source)
domain_prob_discriminator_1_target = discriminator.forward(feature_target)
p0_down = discriminator_p.forward(fs1)
p1_down = discriminator_p.forward(ft1)
r_unk = torch.sort(p2_upper,dim = 0)[1][:2] # 001
feature_otherep = torch.index_select(ft1, 0, r_unk.view(2))
feature_unk, feature_target_unkonwn, _, predict_prob_otherep = cls_down.forward(feature_otherep)
r = torch.sort(p2_upper,dim = 0)[1][-2:] # 010
feature_otherep = torch.index_select(ft1, 0, r.view(2))
_, feature_target_konwn, _, _ = cls_down.forward(feature_otherep)
r = torch.sort(p3_upper,dim = 0)[1][-2:] # 100
feature_otherep = torch.index_select(fs1, 0, r.view(2))
_, feature_source_konwn, _, _ = cls_down.forward(feature_otherep)
feature_target_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.zeros((2,2)), np.ones((2,1))), axis = -1).astype('float32'))).cuda() #001
feature_target_konwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
feature_source_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
three_domain_discriminator_feature = torch.cat([feature_target_unkonwn,feature_target_konwn, feature_source_konwn], 0)
three_domain_discriminator_labels = torch.cat([feature_target_unkonwn_labels,feature_target_konwn_labels, feature_source_unkonwn_labels], 0)
p0 = three_domain_discriminator.forward(three_domain_discriminator_feature)
three_domain_loss = BCELossForMultiClassification(three_domain_discriminator_labels,p0)
ce_ep = CrossEntropyLoss(Variable(torch.from_numpy(np.concatenate((np.zeros((2,25)), np.ones((2,1))), axis = -1).astype('float32'))).cuda(), \
predict_prob_otherep)
ce_down = CrossEntropyLoss(label_source, predict_prob_source_down)
loss_MSE_upper = MSE(p0_upper,p0_down.detach())
loss_MSE_upper += MSE(p1_upper,p1_down.detach())
entropy = EntropyLoss(predict_prob_target, instance_level_weight= p2_upper.contiguous())
adv_loss = BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_source), \
predict_prob=domain_prob_discriminator_1_source)
adv_loss += BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_target), \
predict_prob=1 - domain_prob_discriminator_1_target,
instance_level_weight = p2_upper.contiguous())
with OptimizerManager([optimizer_cls_upper, optimizer_discriminator_p,optimizer_feature_extractor_fix]):
loss = loss_MSE_value * loss_MSE_upper + d1_upper + ce_upper
loss.backward()
#---------------------------------------------------------------------------------------------------------------------------
fs1, feature_source, __, predict_prob_source_upper = net_upper.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_upper.forward(im_target)
p0_upper = discriminator_p.forward(fs1)
p1_upper = discriminator_p.forward(ft1)
p2_upper = torch.sum(p1_upper, dim = -1).detach()
p3_upper = torch.sum(p0_upper, dim = -1).detach()
d1_upper = BCELossForMultiClassification(label_source[:,0:25],p0_upper)
ce_upper = CrossEntropyLoss(label_source, predict_prob_source_upper)
fs1, feature_source, __, predict_prob_source_down = net_down.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_down.forward(im_target)
domain_prob_discriminator_1_source = discriminator.forward(feature_source)
domain_prob_discriminator_1_target = discriminator.forward(feature_target)
p0_down = discriminator_p.forward(fs1)
p1_down = discriminator_p.forward(ft1)
r_unk = torch.sort(p2_upper,dim = 0)[1][:2] # 001
feature_otherep = torch.index_select(ft1, 0, r_unk.view(2))
feature_unk, feature_target_unkonwn, _, predict_prob_otherep = cls_down.forward(feature_otherep)
r = torch.sort(p2_upper,dim = 0)[1][-2:] # 010
feature_otherep = torch.index_select(ft1, 0, r.view(2))
_, feature_target_konwn, _, _ = cls_down.forward(feature_otherep)
r = torch.sort(p3_upper,dim = 0)[1][-2:] # 100
feature_otherep = torch.index_select(fs1, 0, r.view(2))
_, feature_source_konwn, _, _ = cls_down.forward(feature_otherep)
feature_target_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.zeros((2,2)), np.ones((2,1))), axis = -1).astype('float32'))).cuda() #001
feature_target_konwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
feature_source_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
three_domain_discriminator_feature = torch.cat([feature_target_unkonwn,feature_target_konwn, feature_source_konwn], 0)
three_domain_discriminator_labels = torch.cat([feature_target_unkonwn_labels,feature_target_konwn_labels, feature_source_unkonwn_labels], 0)
p0 = three_domain_discriminator.forward(three_domain_discriminator_feature)
three_domain_loss = BCELossForMultiClassification(three_domain_discriminator_labels,p0)
ce_ep = CrossEntropyLoss(Variable(torch.from_numpy(np.concatenate((np.zeros((2,25)), np.ones((2,1))), axis = -1).astype('float32'))).cuda(), \
predict_prob_otherep)
ce_down = CrossEntropyLoss(label_source, predict_prob_source_down)
loss_MSE_down = MSE(p0_down,p0_upper.detach())
loss_MSE_down += MSE(p1_down,p1_upper.detach())
entropy = EntropyLoss(predict_prob_target, instance_level_weight= p2_upper.contiguous())
adv_loss = BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_source), \
predict_prob=domain_prob_discriminator_1_source)
adv_loss += BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_target), \
predict_prob=1 - domain_prob_discriminator_1_target,
instance_level_weight = p2_upper.contiguous())
with OptimizerManager([optimizer_cls_down, optimizer_feature_extractor_nofix,optimizer_discriminator,optimizer_three_domain_discriminator]):
loss = loss_MSE_value * loss_MSE_down + ce_down + 0.3 * adv_loss + 0.1 * entropy + three_domain_loss_value * three_domain_loss
loss.backward()
k += 1
log.step += 1
if log.step % 10 == 1:
counter_upper = AccuracyCounter()
counter_upper.addOntBatch(variable_to_numpy(predict_prob_source_upper), variable_to_numpy(label_source))
acc_train_upper = Variable(torch.from_numpy(np.asarray([counter_upper.reportAccuracy()], dtype=np.float32))).cuda()
counter_down = AccuracyCounter()
counter_down.addOntBatch(variable_to_numpy(predict_prob_source_down), variable_to_numpy(label_source))
acc_train_down = Variable(torch.from_numpy(np.asarray([counter_down.reportAccuracy()], dtype=np.float32))).cuda()
track_scalars(log, ['ce_down', 'acc_train_down', 'acc_train_upper','adv_loss','entropy',"d1_upper", "loss_MSE_upper","loss_MSE_down","three_domain_loss","ce_ep"], globals())
if log.step % 100 == 0:
clear_output()
print(k)
k=0
while k <3000:
for (i, ((im_source, label_source), (im_target, label_target))) in enumerate(
zip(source_train.generator(), target_train.generator())):
im_source = Variable(torch.from_numpy(im_source)).cuda()
label_source = Variable(torch.from_numpy(label_source)).cuda()
im_target = Variable(torch.from_numpy(im_target)).cuda()
fs1, feature_source, __, predict_prob_source_upper = net_upper.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_upper.forward(im_target)
p0_upper = discriminator_p.forward(fs1)
p1_upper = discriminator_p.forward(ft1)
p2_upper = torch.sum(p1_upper, dim = -1).detach()
p3_upper = torch.sum(p0_upper, dim = -1).detach()
d1_upper = BCELossForMultiClassification(label_source[:,0:25],p0_upper)
ce_upper = CrossEntropyLoss(label_source, predict_prob_source_upper)
fs1, feature_source, __, predict_prob_source_down = net_down.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_down.forward(im_target)
domain_prob_discriminator_1_source = discriminator.forward(feature_source)
domain_prob_discriminator_1_target = discriminator.forward(feature_target)
p0_down = discriminator_p.forward(fs1)
p1_down = discriminator_p.forward(ft1)
r_unk = torch.sort(p2_upper,dim = 0)[1][:2] # 001
feature_otherep = torch.index_select(ft1, 0, r_unk.view(2))
feature_unk, feature_target_unkonwn, _, predict_prob_otherep = cls_down.forward(feature_otherep)
r = torch.sort(p2_upper,dim = 0)[1][-2:] # 010
feature_otherep = torch.index_select(ft1, 0, r.view(2))
_, feature_target_konwn, _, _ = cls_down.forward(feature_otherep)
r = torch.sort(p3_upper,dim = 0)[1][-2:] # 100
feature_otherep = torch.index_select(fs1, 0, r.view(2))
_, feature_source_konwn, _, _ = cls_down.forward(feature_otherep)
feature_target_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.zeros((2,2)), np.ones((2,1))), axis = -1).astype('float32'))).cuda() #001
feature_target_konwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
feature_source_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
three_domain_discriminator_feature = torch.cat([feature_target_unkonwn,feature_target_konwn, feature_source_konwn], 0)
three_domain_discriminator_labels = torch.cat([feature_target_unkonwn_labels,feature_target_konwn_labels, feature_source_unkonwn_labels], 0)
p0 = three_domain_discriminator.forward(three_domain_discriminator_feature)
three_domain_loss = BCELossForMultiClassification(three_domain_discriminator_labels,p0)
ce_ep = CrossEntropyLoss(Variable(torch.from_numpy(np.concatenate((np.zeros((2,25)), np.ones((2,1))), axis = -1).astype('float32'))).cuda(), \
predict_prob_otherep)
ce_down = CrossEntropyLoss(label_source, predict_prob_source_down)
loss_MSE_upper = MSE(p0_upper,p0_down.detach())
loss_MSE_upper += MSE(p1_upper,p1_down.detach())
entropy = EntropyLoss(predict_prob_target, instance_level_weight= p2_upper.contiguous())
adv_loss = BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_source), \
predict_prob=domain_prob_discriminator_1_source)
adv_loss += BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_target), \
predict_prob=1 - domain_prob_discriminator_1_target,
instance_level_weight = p2_upper.contiguous())
with OptimizerManager([optimizer_cls_upper, optimizer_discriminator_p,optimizer_feature_extractor_fix]):
loss = loss_MSE_value * loss_MSE_upper + d1_upper + ce_upper
loss.backward()
#---------------------------------------------------------------------------------------------------------------------------
fs1, feature_source, __, predict_prob_source_upper = net_upper.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_upper.forward(im_target)
p0_upper = discriminator_p.forward(fs1)
p1_upper = discriminator_p.forward(ft1)
p2_upper = torch.sum(p1_upper, dim = -1).detach()
p3_upper = torch.sum(p0_upper, dim = -1).detach()
d1_upper = BCELossForMultiClassification(label_source[:,0:25],p0_upper)
ce_upper = CrossEntropyLoss(label_source, predict_prob_source_upper)
fs1, feature_source, __, predict_prob_source_down = net_down.forward(im_source)
ft1, feature_target, __, predict_prob_target = net_down.forward(im_target)
domain_prob_discriminator_1_source = discriminator.forward(feature_source)
domain_prob_discriminator_1_target = discriminator.forward(feature_target)
p0_down = discriminator_p.forward(fs1)
p1_down = discriminator_p.forward(ft1)
r_unk = torch.sort(p2_upper,dim = 0)[1][:2] # 001
feature_otherep = torch.index_select(ft1, 0, r_unk.view(2))
feature_unk, feature_target_unkonwn, _, predict_prob_otherep = cls_down.forward(feature_otherep)
r = torch.sort(p2_upper,dim = 0)[1][-2:] # 010
feature_otherep = torch.index_select(ft1, 0, r.view(2))
_, feature_target_konwn, _, _ = cls_down.forward(feature_otherep)
r = torch.sort(p3_upper,dim = 0)[1][-2:] # 100
feature_otherep = torch.index_select(fs1, 0, r.view(2))
_, feature_source_konwn, _, _ = cls_down.forward(feature_otherep)
feature_target_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.zeros((2,2)), np.ones((2,1))), axis = -1).astype('float32'))).cuda() #001
feature_target_konwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
feature_source_unkonwn_labels = Variable(torch.from_numpy(np.concatenate((np.ones((2,2)), np.zeros((2,1))), axis = -1).astype('float32'))).cuda()#110
three_domain_discriminator_feature = torch.cat([feature_target_unkonwn,feature_target_konwn, feature_source_konwn], 0)
three_domain_discriminator_labels = torch.cat([feature_target_unkonwn_labels,feature_target_konwn_labels, feature_source_unkonwn_labels], 0)
p0 = three_domain_discriminator.forward(three_domain_discriminator_feature)
three_domain_loss = BCELossForMultiClassification(three_domain_discriminator_labels,p0)
ce_ep = CrossEntropyLoss(Variable(torch.from_numpy(np.concatenate((np.zeros((2,25)), np.ones((2,1))), axis = -1).astype('float32'))).cuda(), \
predict_prob_otherep)
ce_down = CrossEntropyLoss(label_source, predict_prob_source_down)
loss_MSE_down = MSE(p0_down,p0_upper.detach())
loss_MSE_down += MSE(p1_down,p1_upper.detach())
entropy = EntropyLoss(predict_prob_target, instance_level_weight= p2_upper.contiguous())
adv_loss = BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_source), \
predict_prob=domain_prob_discriminator_1_source)
adv_loss += BCELossForMultiClassification(label=torch.ones_like(domain_prob_discriminator_1_target), \
predict_prob=1 - domain_prob_discriminator_1_target,
instance_level_weight = p2_upper.contiguous())
with OptimizerManager([optimizer_cls_down, optimizer_feature_extractor_nofix,optimizer_discriminator,optimizer_three_domain_discriminator]):
loss = loss_MSE_value * loss_MSE_down + ce_down + 0.3 * adv_loss + 0.1 * entropy + three_domain_loss_value * three_domain_loss + 0.3 * ce_ep
loss.backward()
k += 1
log.step += 1
if log.step % 10 == 1:
counter_upper = AccuracyCounter()
counter_upper.addOntBatch(variable_to_numpy(predict_prob_source_upper), variable_to_numpy(label_source))
acc_train_upper = Variable(torch.from_numpy(np.asarray([counter_upper.reportAccuracy()], dtype=np.float32))).cuda()
counter_down = AccuracyCounter()
counter_down.addOntBatch(variable_to_numpy(predict_prob_source_down), variable_to_numpy(label_source))
acc_train_down = Variable(torch.from_numpy(np.asarray([counter_down.reportAccuracy()], dtype=np.float32))).cuda()
track_scalars(log, ['ce_down', 'acc_train_down', 'acc_train_upper','adv_loss','entropy',"d1_upper", "loss_MSE_upper","loss_MSE_down","three_domain_loss","ce_ep"], globals())
if log.step % 100 == 0:
clear_output()
print(k)
with TrainingModeManager([feature_extractor_fix,feature_extractor_nofix, cls_down,cls_upper], train=False) \
as mgr, Accumulator(['predict_prob','predict_index', 'label']) as accumulator:
for (i, (im, label)) in enumerate(target_test.generator()):
im = Variable(torch.from_numpy(im), volatile=True).cuda()
label = Variable(torch.from_numpy(label), volatile=True).cuda()
ft1, feature_target, __, predict_prob = net_down.forward(im)
p1_upper = discriminator_p.forward(ft1)
p2_upper = torch.sum(p1_upper, dim = -1).detach()
predict_prob, label = [variable_to_numpy(x) for x in (predict_prob,label)]
label = np.argmax(label, axis=-1).reshape(-1, 1)
predict_index = np.argmax(predict_prob, axis=-1).reshape(-1, 1)
accumulator.updateData(globals())
# if i % 10 == 0:
# print(i)
for x in accumulator.keys():
globals()[x] = accumulator[x]
y_true = label.flatten()
y_pred = predict_index.flatten()
m = extended_confusion_matrix(y_true, y_pred, true_labels=list(range(25))+list(range(25,65)), pred_labels=list(range(26)))
cm = m
cm = cm.astype(np.float) / np.sum(cm, axis=1, keepdims=True)
acc_os_star = sum([cm[i][i] for i in range(25)]) / 25
acc_os = (acc_os_star * 25 + sum([cm[i][25] for i in range(25, 65)]) / 40) / 26
#unk = sum([cm[i][25] for i in range(25, 65)]) / 40
print("acc_os, acc_os_star, unk==",acc_os, acc_os_star, sum([cm[i][25] for i in range(25, 65)]) / 40)
| 44.5
| 185
| 0.674198
| 3,111
| 24,564
| 4.974285
| 0.077788
| 0.037674
| 0.030759
| 0.039806
| 0.876381
| 0.856349
| 0.854798
| 0.845428
| 0.845428
| 0.842197
| 0
| 0.03762
| 0.200293
| 24,564
| 551
| 186
| 44.580762
| 0.750153
| 0.024467
| 0
| 0.771704
| 0
| 0
| 0.032522
| 0.013126
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012862
| false
| 0
| 0.016077
| 0.003215
| 0.041801
| 0.016077
| 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
|
3ec4e50d0a647838f240ad74f1095217db1f8b2c
| 46
|
py
|
Python
|
tests/test_import_pymc3.py
|
drewblasius/pymc3-sklearn
|
a46c325179459a2eae394f72c4be186d3e074214
|
[
"MIT"
] | 1
|
2020-07-13T12:45:20.000Z
|
2020-07-13T12:45:20.000Z
|
tests/test_import_pymc3.py
|
drewblasius/pymc3-sklearn
|
a46c325179459a2eae394f72c4be186d3e074214
|
[
"MIT"
] | null | null | null |
tests/test_import_pymc3.py
|
drewblasius/pymc3-sklearn
|
a46c325179459a2eae394f72c4be186d3e074214
|
[
"MIT"
] | null | null | null |
def test_load_pymc3():
import pymc3 as pm
| 15.333333
| 22
| 0.717391
| 8
| 46
| 3.875
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0.217391
| 46
| 2
| 23
| 23
| 0.805556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0.5
| 0
| 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
| 1
| 0
| 1
| 0
|
0
| 7
|
412b0f89560d3787f98a4606d0ded14f0b485d14
| 2,089
|
py
|
Python
|
src/bioinformatics-stronghold/hamm-counting-point-mutations.py
|
spencerking/rosalind
|
66c50378813abf7b9cc535a963aeb9249d8a3ed7
|
[
"BSD-3-Clause"
] | null | null | null |
src/bioinformatics-stronghold/hamm-counting-point-mutations.py
|
spencerking/rosalind
|
66c50378813abf7b9cc535a963aeb9249d8a3ed7
|
[
"BSD-3-Clause"
] | null | null | null |
src/bioinformatics-stronghold/hamm-counting-point-mutations.py
|
spencerking/rosalind
|
66c50378813abf7b9cc535a963aeb9249d8a3ed7
|
[
"BSD-3-Clause"
] | null | null | null |
import itertools
def hamming(s, t):
distance = 0
for (base1, base2) in zip(s, t):
if base1 != base2:
distance += 1
return distance
print(hamming("AACCTGTTGTGGCTGTCGTCCCCTTCGACCAGCATATACCCGGGCGTGATCTACCCGTTCTTAGCAGCCGCTGAAGGTAACTTGAGACAGGATGGTCACGTGAGACTGCATCACCGGTTCTGTCAGGCAGGTACACGCTGTTAATGTAATACTAGCTCTCGCTAGATATAATGAATGTTCATGGAGCGGGATAATCCGCCCGAACTTGGTCACGTCGAGCGGTGGTCCCACGGGCATCTTTCGACAACATGGGATAAGAACCATGACACTAAGATTCTGAAGCGCGCCAGAGTTGGTGAGGACACCGAGTGCGAGTAGGATTCCCGTTCCCTATTCCAGGGCTGCTTTTAGCAGGACCGGCCTTTGAGCGTGACGTTCTCCAGGTTCTCGGACCACCAACGGGAACGACCGAGACGGAATTCCGGGTAGTCTTAAGGACCAAATGACATTTTCCTGGAGTGGCAAACCCGATAAGAGCGTTGGGGTATATAGCGACCTGTTTTCGCCGGCCCTAACCGTACGCAACTACCGCCCCACGCGAGCTAGGGGGGACGATCTGACTTTGGCGACGGATTTAGCACGGTGTACTCCTCAATATTCCGAGATTGCCACGACATAGATACAGTTCAGGATAGTCCACAGCTCGCGTCCACAGGACTTTTCCTGGCAAAATTATAGGAACTGACATCCGTTTCAACAGAGCCAATTTCCAATGGACGACTGCGGTCCGCCACTTAGGAAGGGTGACATCCGTCGCGGCTTGCGCCAGTGACATGTTAAAGTAGCGGTACAGAAATCGCGGACTGCTTGGGTCAGGTCCGACGGGGGTACGTATACGCTGTAGTTGACGGAAGTGCGAAGGATGTATCAGCTATCGTCAGGCTCCTGCTGCGACTGTAGTACAAGTTTTCCTCTGACTTTATCCCCACAACTTTCAGCGAGAG", "ACTCTGCGCCGGGTCTATCCTCCTGCGATCACCTCAGTCCAGGGCGTAAAATACCGTTCGTGAGCGTATGATACCGTTAAACTGATCCAGGATGCTACCTGGCGCGCAGCCGACATGTCCTGTACGTCAGGGAGAAGCTCATGTGGTGATCGCGACTTTTCTCAAATTGAAAGAATCCTGCTTTTGCAGGAAGTTGCTCCCGTCGTCGGACAGGTCACTTGGTGACTTGACAGACAGCTTTCCTCCCCATTGCATCAAATAAAAGGAACTTAGAAACCCCAGCGCGGCGTTGCTGGTCGCGAGGCCCATGGCCAGTTGAATCCGGGGTTTTGGCGTAAGTGTACTTTCTAAATCCACCGTCCGTTGTGCGTGAAACTCGGCATACGCGCTAGCCACCTGCGCAAACCACATAGTCTGGACGCCGACTCGTAACAACGTCACACACCCCTGCTCCTGGTGTACGATCCCTAATCTGAACCCATGGGCATCTAGCGACCTTTGTCACTTGGGCCGAGTCTCACATATCCTACGCCCGACCCCCATCAGAGAGCGTCCCCTGAAGCCTGTGACATGTTGACATGGTTGGACTATGCGATAATCACCGTTTATCACCTGCTCGCAGTGTATCTCAGTTGTTCGCGGGTAAACATAACAGGAGTTGACTTGCCAATCTTTGACGACCAGGGATCCCTTTCAGTCGGCGCCGTATCCCTGTGATTGCAGCTAGTGTCCGGGGAAGACGCAGTACATACTTCGTAACAGGGCAGAGCCCGCTGTCCGGGGTATCATAGTGTACGAACGTACAGTTCTGGTCGGGGCAAGCCTCCTTACTGATTCTATCCGGTTGTCTTGGTAGCGTGTTATGGAAACTGGCCCTTTAGGCACCCGTGGCGACATTTGCCAGCGCGGTTCTATGACTGCAAGCGCTTAAGTTGCGTTCATAG"))
| 174.083333
| 1,910
| 0.953088
| 26
| 2,089
| 76.576923
| 0.730769
| 0.002009
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.002975
| 0.034466
| 2,089
| 11
| 1,911
| 189.909091
| 0.984135
| 0
| 0
| 0
| 0
| 0
| 0.903782
| 0.903782
| 0
| 1
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.125
| 0
| 0.375
| 0.125
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f5ab023a85bc054e26fc306ae7811cf8c7cb12c3
| 561
|
py
|
Python
|
New folder/Multilevel.py
|
piyushparastiwari/python-project
|
5dba0ef4e77f1d2528f510327de4224b60b1d4ba
|
[
"Apache-2.0"
] | null | null | null |
New folder/Multilevel.py
|
piyushparastiwari/python-project
|
5dba0ef4e77f1d2528f510327de4224b60b1d4ba
|
[
"Apache-2.0"
] | null | null | null |
New folder/Multilevel.py
|
piyushparastiwari/python-project
|
5dba0ef4e77f1d2528f510327de4224b60b1d4ba
|
[
"Apache-2.0"
] | null | null | null |
class One:
def __init__(self):
super().__init__()
print("This is init method of class One")
self.i=5
class Two(One):
def __init__(self):
super().__init__()
print("This is init method of class Two")
self.j=10
class Three(Two):
def __init__(self):
super().__init__()
print("This is init method of class Three")
self.k=15
class Final(Three):
def __init__(self):
super().__init__()
print("This is init method of class Final")
| 23.375
| 52
| 0.547237
| 72
| 561
| 3.819444
| 0.277778
| 0.101818
| 0.16
| 0.232727
| 0.72
| 0.72
| 0.72
| 0.72
| 0.72
| 0.72
| 0
| 0.013477
| 0.338681
| 561
| 23
| 53
| 24.391304
| 0.727763
| 0
| 0
| 0.421053
| 0
| 0
| 0.245353
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.210526
| false
| 0
| 0
| 0
| 0.421053
| 0.210526
| 0
| 0
| 0
| null | 0
| 0
| 1
| 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
| 0
| 0
|
0
| 7
|
f5c856f7634a0d254f2f6098b7e98439e3e3e2c2
| 14,649
|
py
|
Python
|
tests/test_pipeline_manager/test_create_entry.py
|
nickderobertis/py-file-conf
|
100773b86373035a5b485a1ed96d8f5a1d69d066
|
[
"MIT"
] | 2
|
2020-11-29T19:09:14.000Z
|
2021-09-11T19:21:21.000Z
|
tests/test_pipeline_manager/test_create_entry.py
|
nickderobertis/py-file-conf
|
100773b86373035a5b485a1ed96d8f5a1d69d066
|
[
"MIT"
] | 47
|
2020-02-01T03:54:07.000Z
|
2022-01-13T02:24:45.000Z
|
tests/test_pipeline_manager/test_create_entry.py
|
nickderobertis/py-file-conf
|
100773b86373035a5b485a1ed96d8f5a1d69d066
|
[
"MIT"
] | null | null | null |
import os
from pyfileconf.sectionpath.sectionpath import SectionPath
from tests.input_files.mypackage.cmodule import ExampleClass
from tests.test_pipeline_manager.test_create import PipelineManagerLoadTestBase
from pyfileconf import Selector
from tests.input_files.amodule import a_function
from tests.test_pipeline_manager.base import PipelineManagerTestBase, CLASS_CONFIG_DICT_LIST
class PipelineManagerCreateEntryTestBase(PipelineManagerLoadTestBase):
pass
class TestPipelineManagerCreateEntry(PipelineManagerCreateEntryTestBase):
def test_create_entry_for_function(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing', a_function)
iv = sel.test_pipeline_manager.thing.a_function
module_folder = os.path.join(self.defaults_path, 'thing')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
def test_create_entries_for_function_get_section(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing.stuff', a_function)
pipeline_manager.create('thing.woo', a_function)
base_folder = os.path.join(self.defaults_path, 'thing')
module_folders = [os.path.join(base_folder, attr) for attr in ['stuff', 'woo']]
for module_folder in module_folders:
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
iv = sel.test_pipeline_manager.thing
result = pipeline_manager.get(iv)
assert result['stuff'][0].func == a_function
assert len(result['stuff']) == 1
assert result['woo'][0].func == a_function
assert len(result['woo']) == 1
assert len(result) == 2
def test_create_entry_for_previously_unimported_function(self):
self.write_example_class_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing', a_function)
iv = sel.test_pipeline_manager.thing.a_function
module_folder = os.path.join(self.defaults_path, 'thing')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
module_folder = os.path.join(self.defaults_path, 'stuff')
class_path = os.path.join(module_folder, 'ExampleClass.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_config_file_contents(contents)
def test_update_then_create_entry_for_function(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
orig_iv = sel.test_pipeline_manager.stuff.a_function
expected_b_result = ['a', 'b']
section_path = SectionPath.from_section_str_list(SectionPath(orig_iv.section_path_str)[1:])
pipeline_manager.update(
b=expected_b_result,
section_path_str=section_path.path_str
)
pipeline_manager.create('thing', a_function)
iv = sel.test_pipeline_manager.thing.a_function
module_folder = os.path.join(self.defaults_path, 'thing')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
result = pipeline_manager.run(orig_iv)
assert result == (None, expected_b_result)
def test_create_then_update_entry_for_function(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing', a_function)
iv = sel.test_pipeline_manager.thing.a_function
expected_b_result = ['a', 'b']
section_path = SectionPath.from_section_str_list(SectionPath(iv.section_path_str)[1:])
pipeline_manager.update(
b=expected_b_result,
section_path_str=section_path.path_str
)
module_folder = os.path.join(self.defaults_path, 'thing')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
result = pipeline_manager.run(iv)
assert result == (None, expected_b_result)
def test_create_entry_for_class(self):
self.write_example_class_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing', ExampleClass)
iv = sel.test_pipeline_manager.thing.ExampleClass
module_folder = os.path.join(self.defaults_path, 'thing')
class_path = os.path.join(module_folder, 'ExampleClass.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_config_file_contents(contents)
def test_create_entries_for_class_get_section(self):
self.write_example_class_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing.one', ExampleClass)
pipeline_manager.create('thing.two', ExampleClass)
base_folder = os.path.join(self.defaults_path, 'thing')
module_folders = [os.path.join(base_folder, attr) for attr in ['one', 'two']]
for module_folder in module_folders:
class_path = os.path.join(module_folder, 'ExampleClass.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_config_file_contents(contents)
iv = sel.test_pipeline_manager.thing
result = pipeline_manager.get(iv)
assert result['one'][0].func == ExampleClass
assert len(result['one']) == 1
assert result['two'][0].func == ExampleClass
assert len(result['two']) == 1
assert len(result) == 2
def test_create_entry_for_previously_unimported_class(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing', ExampleClass)
iv = sel.test_pipeline_manager.thing.ExampleClass
module_folder = os.path.join(self.defaults_path, 'stuff')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
module_folder = os.path.join(self.defaults_path, 'thing')
class_path = os.path.join(module_folder, 'ExampleClass.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_config_file_contents(contents)
def test_create_entry_for_specific_class_dict(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('example_class.thing.data')
iv = sel.test_pipeline_manager.example_class.thing.data
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'thing')
class_path = os.path.join(module_folder, 'data.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(contents)
def test_create_entries_for_specific_class_dict_get_section(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('example_class.thing.data')
pipeline_manager.create('example_class.thing.data2')
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'thing')
for attr in ['data', 'data2']:
class_path = os.path.join(module_folder, f'{attr}.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(
contents, name_value= f"name: Optional[str] = '{attr}'"
)
iv = sel.test_pipeline_manager.example_class.thing
result = pipeline_manager.get(iv)
assert result[0] == ExampleClass(a=None, name='data')
assert result[1] == ExampleClass(a=None, name='data2')
assert len(result) == 2
def test_update_then_create_entry_for_specific_class_dict(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
orig_iv = sel.test_pipeline_manager.example_class.stuff.data
expected_a_result = (1, 2)
section_path = SectionPath.from_section_str_list(SectionPath(orig_iv.section_path_str)[1:])
pipeline_manager.update(
a=expected_a_result,
section_path_str=section_path.path_str
)
pipeline_manager.create('example_class.thing.data')
iv = sel.test_pipeline_manager.example_class.thing.data
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'thing')
class_path = os.path.join(module_folder, 'data.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(contents)
ec = sel.test_pipeline_manager.example_class.stuff.data
expect_ec = ExampleClass(name='data', a=expected_a_result)
assert ec.name == expect_ec.name
assert ec.a == expect_ec.a
def test_create_then_update_entry_for_specific_class_dict(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('example_class.thing.data')
iv = sel.test_pipeline_manager.example_class.thing.data
expected_a_result = (1, 2)
section_path = SectionPath.from_section_str_list(SectionPath(iv.section_path_str)[1:])
pipeline_manager.update(
a=expected_a_result,
section_path_str=section_path.path_str
)
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'thing')
class_path = os.path.join(module_folder, 'data.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(contents)
ec = sel.test_pipeline_manager.example_class.thing.data
result = pipeline_manager.run(ec)
assert result == 'woo'
expect_ec = ExampleClass(name='data', a=expected_a_result)
got_ec = ec.item
assert ec.name == expect_ec.name == got_ec.name
assert ec.a == expect_ec.a == got_ec.a
def test_create_deeply_nested_entry_for_function(self):
self.write_a_function_to_pipeline_dict_file()
pipeline_manager = self.create_pm()
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('thing.stuff.whoa', a_function)
iv = sel.test_pipeline_manager.thing.stuff.whoa.a_function
module_folder = os.path.join(self.defaults_path, 'thing')
module_folder = os.path.join(module_folder, 'stuff')
module_folder = os.path.join(module_folder, 'whoa')
function_path = os.path.join(module_folder, 'a_function.py')
with open(function_path, 'r') as f:
contents = f.read()
self.assert_a_function_config_file_contents(contents)
def test_create_deeply_nested_entry_for_specific_class_dict(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('example_class.thing.stuff.whoa.data')
iv = sel.test_pipeline_manager.example_class.thing.stuff.whoa.data
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'thing')
module_folder = os.path.join(module_folder, 'stuff')
module_folder = os.path.join(module_folder, 'whoa')
class_path = os.path.join(module_folder, 'data.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(contents)
def test_create_entry_for_specific_class_dict_in_same_section_as_existing_entry(self):
self.write_example_class_dict_to_file()
pipeline_manager = self.create_pm(
specific_class_config_dicts=CLASS_CONFIG_DICT_LIST
)
pipeline_manager.load()
sel = Selector()
pipeline_manager.create('example_class.stuff.data2')
iv = sel.test_pipeline_manager.example_class.stuff.data2
class_folder = os.path.join(self.defaults_path, 'example_class')
module_folder = os.path.join(class_folder, 'stuff')
class_path = os.path.join(module_folder, 'data2.py')
with open(class_path, 'r') as f:
contents = f.read()
self.assert_example_class_dict_config_file_contents(
contents,
name_value="name: Optional[str] = 'data2'"
)
| 46.066038
| 99
| 0.67677
| 1,862
| 14,649
| 4.964554
| 0.052632
| 0.128191
| 0.049762
| 0.046733
| 0.905452
| 0.894959
| 0.869212
| 0.846928
| 0.816962
| 0.798248
| 0
| 0.002471
| 0.226568
| 14,649
| 317
| 100
| 46.211356
| 0.813416
| 0
| 0
| 0.722603
| 0
| 0
| 0.054133
| 0.012356
| 0
| 0
| 0
| 0
| 0.126712
| 1
| 0.05137
| false
| 0.003425
| 0.030822
| 0
| 0.089041
| 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
|
de7fc4c848afa459043d122f313669a01dafe3d3
| 68,446
|
py
|
Python
|
commands/play.py
|
EJ-Studio/EJ-DJ
|
ed794749216deb47bc93e432fdc7f024473f3236
|
[
"Apache-2.0"
] | null | null | null |
commands/play.py
|
EJ-Studio/EJ-DJ
|
ed794749216deb47bc93e432fdc7f024473f3236
|
[
"Apache-2.0"
] | null | null | null |
commands/play.py
|
EJ-Studio/EJ-DJ
|
ed794749216deb47bc93e432fdc7f024473f3236
|
[
"Apache-2.0"
] | null | null | null |
'''
******** ** ******** ** ** **
/**///// /** **////// /** /**//
/** /** /** ******** ** /** ** ****** ******
/******* /** /*********///**//** /** ******/** **////** **////
/**//// /** ////////** /** /** /** **///**/**/** /**//*****
/** ** /** /** /** /** /**/** /**/**/** /** /////**
/********//***** ******** //**//******//******/**//****** ******
//////// ///// //////// // ////// ////// // ////// ////// '''
'''
** **
/** ****** /**
/** ********** /**///** ****** ****** ************
/**//**//**//**/** /****////**//**//*///**/**////
/** /** /** /**/******/** /** /** / /**//*****
/** /** /** /**/**/// /** /** /** /** /////**
/** *** /** /**/** //****** /*** //********
// /// // // // ////// /// //////// '''
import discord
import youtube_dl
import os
from discord.ext import commands
from discord.utils import get
from discord import FFmpegPCMAudio
import os
from os import system
from packages.CRITICAL.CLIENT import client
from commands.data import FOOTER, BOT_CHANNELS
import asyncio
import subprocess
import urllib.request
import re #regular expression
from shutil import copyfile
import random
#IMPORTS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******** ** ** **
**//////**/** /** /**
** // /** ****** /** ****** /** ******
/** /** **////**/****** //////** /** **////
/** *****/**/** /**/**///** ******* /**//*****
//** ////**/**/** /**/** /****////** /** /////**
//******** ***//****** /******//*********** ******
//////// /// ////// ///// /////////// ////// '''#########################################################################################################################################################################
global url
url = ""
global radio
radio = False
global playlist
playlist = False
global previous_song_1
previous_song_1 = ""
global previous_song_2
previous_song_2 = ""
global WAITING_FOR_DOWNLOAD
WAITING_FOR_DOWNLOAD = False
#GLOBAL^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******* **
/**////**/** ** **
/** /**/** ****** //** **
/******* /** //////** //***
/**//// /** ******* /**
/** /** **////** **
/** ***//**********
// /// ////////// '''################################################################################################################################################################################################
@client.command(pass_context=True, aliases=['p', 'Play'])
async def play(ctx, *, url ):#, url):
if ctx.channel.name in BOT_CHANNELS.channels:
try:
if ctx.voice_client is None: #This should check if the bot is connected to a voice channel.
channel = ctx.author.voice.channel
await channel.connect()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Joined channel preparing to play!\nPlease read >info.")
update = await ctx.send(embed = update_embed)
await asyncio.sleep(5)
await update.delete()
else:
pass
# update_embed = discord.Embed(
# colour=discord.Colour.gold(),
# title="",
# description=f"Already joined this channel.")
# await ctx.send(embed = update_embed)
except Exception as Error:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"You are not in a voice channel.")
await ctx.send(embed = update_embed)
return
global radio
try:
if radio == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while radio is playing.")
await ctx.send(embed = update_embed)
return
else:
pass
except:
pass
global playlist
try:
if playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playlist is playing.")
await ctx.send(embed = update_embed)
return
else:
pass
except:
pass
while WAITING_FOR_DOWNLOAD == True:
pass
try:
global voice
if voice == voice:
pass
except Exception as Error:
voice = get(client.voice_clients, guild=ctx.guild)
#print(url)
if "https://" not in url:
await ctx.message.delete()
url = url.replace(" ", "+")
#print(url)
html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={url}")
#print(html.read().decode())
video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
#print(video_ids[0])
url = f"https://www.youtube.com/watch?v={video_ids[0]}"
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(url, download=False)
song_name = (meta['title'])
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Added song: {song_name}")
await ctx.send(embed = update_embed)
else:
await ctx.message.delete()
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(url, download=False)
song_name = (meta['title'])
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Added song: {song_name}")
await ctx.send(embed = update_embed)
#print(url)
#https://www.youtube.com/watch?v=fN1Cyr0ZK9M
#https://www.youtube.com/results?search_query=heello+their
# query = os.system('youtube_dl -g ytsearch5:python 3 ')
# print(query)
#https://www.youtube.com/watch?v=IDGOESHERE
try:#CHECKS IF RETRIES EXISTS, pretty much.
if retries == "":
retries = 0
except:
retries = 0
## try:
## if retries == "":
## retries = 0
## pass
## else:
## if retries == 1:
## pass
## except:
## retries = 0
try:
global queue_info
if queue_info != []:
pass
else:
queue_info = []
queue_info.append(url)
#await ctx.send(queue_info)
except:
queue_info = [url]
#await ctx.send(queue_info)
#return
while voice.is_playing():
return
else:
await playsong(ctx, queue_info[0], retries)
#pass
async def playsong(ctx, url, retries):
print("Someone wants to play music let me get that ready for them...")
voice = get(client.voice_clients, guild=ctx.guild)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
try:
global now_playing_url
now_playing_url = url
ydl_opts = {}#{"outtmpl": path}
with youtube_dl.YoutubeDL(ydl_opts) as yd:
meta = yd.extract_info(url, download=False)
song_name = (meta['title'])
song_duration = (meta['duration'])
if '"' in song_name:
print('An " was detected within the songs name.')
#song_name = file[:-12]
song_name = song_name.replace('"', "")
print(f'Replaced the ' )
if "|" in song_name:
song_name = song_name.replace("|", "_")
#print(song_duration)
if song_duration <= 599:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Preparing song: {song_name}")
preparing_embed = await ctx.send(embed = update_embed)
#possible_file = f"./cached_songs/{song_name}.mp3"
if os.path.isfile(rf'./cached_songs/{song_name}.mp3'):
song_dir = f"./cached_songs/{song_name}.mp3"
await preparing_embed.delete()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Playing now: {song_name}")
await ctx.send(embed = update_embed)
pass
else:
WAITING_FOR_DOWNLOAD = True
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Please wait as your song downloads <a:loading:768429190193086475>")
sent = await ctx.send(embed = update_embed)
song_dir = ()
try:
ydl.download([url])
await sent.delete()
await preparing_embed.delete()
except Exception as Error:
await sent.delete()
await preparing_embed.delete()
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="",
description=f"Error downloading song...")
await ctx.send(embed = update_embed)
return
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Playing now: {song_name}")
await ctx.send(embed = update_embed)
elif song_duration >= 600:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Cant play song because it is : {(round((song_duration)/60))} minutes long.")
await ctx.send(embed = update_embed)
queue_info.remove(url)
now_playing_url = []
song_dir = ()
return
# elif song_duration <= 599:
# update_embed = discord.Embed(
# colour=discord.Colour.green(),
# title="",
# description=f"Preparing song: {song_name}")
# await ctx.send(embed = update_embed)
# ydl.download([url])
#ydl.download([url])
except:
try:
print(retries)
if retries == 1:
retries = 0
queue_info.remove(url)
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="",
description=f"Could not resolve the issue, skipping song.")
await ctx.send(embed = update_embed)
print("REMOVED URL BECUASE OF ERROR<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
if queue_info != []:
await playsong(ctx, queue_info[0], retries)
else:
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="",
description=f"Sorry something went wrong while attempting to play this song. Retrying...")
await ctx.send(embed = update_embed)
#await ctx.send("Sorry something went wrong, we will retry once!")
retries = 1
await playsong(ctx, queue_info[0], retries)
except Exception as Error:
print(Error)
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="",
description=f"Sorry something went wrong while attempting to play this song. Retrying...")
await ctx.send(embed = update_embed)
#await ctx.send("Sorry something went wrong, we will retry once!")
retries = 1
await playsong(ctx, queue_info[0], retries)
#ydl.search([url])
if song_dir == ():
global file
for file in os.listdir("./"):
if file.endswith(".mp3"):
voice.play(discord.FFmpegPCMAudio(file))#, after= my_after(url))
queue_info.remove(url)
WAITING_FOR_DOWNLOAD = False
print("REMOVED URL<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
while True:
if not voice.is_playing(): #if the voice isnt playing.
if not voice.is_paused(): #if the music isnt paused
try:
retries = 0
for file in os.listdir("./"):
if file.endswith(".mp3"):
try:
print(file)
print(song_name)
os.rename(file, f'{song_name}.mp3')
if os.path.isfile(f'./cached_songs/{song_name}.mp3'):
pass
else:
try:
copyfile(f"./{song_name}.mp3", f"./cached_songs/{song_name}.mp3")
except Exception as Error:
print("died here because: ", Error)
pass
except Exception as Error:
print(Error)
pass
os.remove(rf"./{song_name}.mp3")
if queue_info != []:
now_playing_url = []
await playsong(ctx, queue_info[0], retries)
return
else:
now_playing_url = []
break
except Exception as Error:
await ctx.send(Error)
break #I CHANGED THIS FROM BREAK
else:
#print("2")
await asyncio.sleep(5)
continue
else:
#print("1")
await asyncio.sleep(5)
continue
elif song_dir != ():
voice.play(discord.FFmpegPCMAudio(song_dir))#, after= my_after(url))
#await ctx.send(queue_info)
voice.volume = 100
queue_info.remove(url)
song_dir = ()
print("REMOVED URL<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
while True:
if not voice.is_playing(): #if the voice isnt playing.
if not voice.is_paused(): #if the music isnt paused
try:
retries = 0
for file in os.listdir("./"):
if file.endswith(".mp3"):
try:
os.rename(file, f'{song_name}.mp3')
if os.path.isfile(rf'./cached_songs/{song_name}.mp3'):
pass
else:
try:
copyfile(f"./{song_name}.mp3", f"./cached_songs/{song_name}.mp3")
except Exception as Error:
print("died here because: ", Error)
pass
except Exception as Error:
print(Error)
break
os.remove(f"./{song_name}.mp3")
if queue_info != []:
now_playing_url = []
await playsong(ctx, queue_info[0], retries)
return
else:
now_playing_url = []
break
except Exception as Error:
await ctx.send(Error)
break
else:
#print("2")
await asyncio.sleep(5)
continue
else:
#print("1")
await asyncio.sleep(5)
continue
#PLAY^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******** ** **
**////// /** // ******
/** /** ** **/**///**
/*********/** ** /**/** /**
////////**/**** /**/******
/**/**/** /**/**///
******** /**//**/**/**
//////// // // // // '''#################################################################################################################################################################################################
#THE >skip COMMAND
@client.command(pass_context=True, aliases=["s", "Skip", "stop", "Stop"])
async def skip(ctx):#, url):
if ctx.channel.name in BOT_CHANNELS.channels:
try:
global radio
if radio == True:
voice.stop()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description="Skipping to next song.")
await ctx.send(embed = update_embed)
return
except:
pass
try:
global playlist
if playlist == True:
voice.stop()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description="Skipping to next song.")
await ctx.send(embed = update_embed)
return
except:
pass
try:
voice.stop()
#NEW V0.1.5
if queue_info == []:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Their are no songs in your queue.")
await ctx.send(embed = update_embed)
else:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Skipping song.")
await ctx.send(embed = update_embed)
#-----------------------------
await asyncio.sleep(5)
return
except:
print("OOF")
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"No music is playing...")
await ctx.send(embed = update_embed)
return
#await ctx.send("Music isnt playing.")
#queue_info.remove(url)
print("REMOVED URL BECUASE OF SKIP OVERIDE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
if queue_info == []:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Their are no songs in your queue.")
await ctx.send(embed = update_embed)
#SKIP^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
*******
**/////**
** //** ** ** ***** ** ** *****
/** /** /** /** **///**/** /** **///**
/** **/** /** /**/*******/** /**/*******
//** // ** /** /**/**//// /** /**/**////
//******* **//******//******//******//******
/////// // ////// ////// ////// ////// '''################################################################################################################################################################################
#THE queue COMMAND!
@client.command(pass_context=True, aliases=["q", "Queue"])
async def queue(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playing_radio
if radio == True:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Loading queue please wait <a:loading:768429190193086475>")
sent = await ctx.send(embed = update_embed)
pfp = client.user.avatar_url
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="QUEUE",
description="MODE: Radio")
update_embed.set_author(name="EJ DJ", icon_url=(pfp))
update_embed.set_thumbnail(url=(pfp))
update_embed.add_field(name="Currently playing:", value=f"{playing_radio}", inline=True)
await sent.delete()
await ctx.send(embed = update_embed)
return
elif playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Loading queue please wait <a:loading:768429190193086475>")
sent = await ctx.send(embed = update_embed)
pfp = client.user.avatar_url
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="QUEUE",
description="MODE: Playlist")
update_embed.set_author(name="EJ DJ", icon_url=(pfp))
update_embed.set_thumbnail(url=(pfp))
update_embed.add_field(name="Currently playing:", value=f"{playing_playlist}", inline=True)
await sent.delete()
await ctx.send(embed = update_embed)
return
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Loading queue please wait <a:loading:768429190193086475>")
sent = await ctx.send(embed = update_embed)
pfp = client.user.avatar_url
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="QUEUE",
description="MODE: Normal")
update_embed.set_author(name="EJ DJ", icon_url=(pfp))
update_embed.set_thumbnail(url=(pfp))
try:
if now_playing_url != []:
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(now_playing_url, download=False)
song_name = (meta['title'])
update_embed.add_field(name="Currently playing:", value=f"{song_name}", inline=True)
else:
update_embed.add_field(name="Currently playing:", value="No song Currently playing.", inline=True)
except Exception as Error:
print(Error)
update_embed.add_field(name="Currently playing:", value="No song Currently playing.", inline=True)
try:
for number in range(len(queue_info)):
up_next = queue_info[number]
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(up_next, download=False)
song_name = (meta['title'])
if number == 0:
update_embed.add_field(name="Up next:", value=f"{song_name}", inline=True)
else:
update_embed.add_field(name=f"{number} | Up next:", value=f"{song_name}", inline=True)
update_embed.set_footer(text=f"{FOOTER.footer}")
await sent.delete()
await ctx.send(embed = update_embed)
return
except:
update_embed.add_field(name="Up next:", value="No song Currently in queue.", inline=True)
update_embed.set_footer(text=f"{FOOTER.footer}")
await sent.delete()
await ctx.send(embed = update_embed)
return
#QUEUE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
****** **
**////**/**
** // /** ***** ****** ******
/** /** **///** //////** //**//*
/** /**/******* ******* /** /
//** **/**/**//// **////** /**
//****** ***//******//********/***
////// /// ////// //////// /// '''######################################################################################################################################################################################
#THE >clear COMMAND
@client.command(pass_context=True, aliases=["c", "Clear"])
async def clear(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
if queue_info != []:
queue_info.clear()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description="Cleared the queue.")
await ctx.send(embed = update_embed)
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="No songs in the queue.")
await ctx.send(embed = update_embed)
#CLEAR^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******* ** **
/**////** /**//
/** /** ****** /** ** ******
/******* //////** ******/** **////**
/**///** ******* **///**/**/** /**
/** //** **////** /** /**/**/** /**
/** //**//********//******/**//******
// // //////// ////// // ////// '''##################################################################################################################################################################################
@client.command(pass_context=True, aliases=["r", "Radio"])
async def radio(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playing_radio
global voice
global playlist
try:
if playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playlist is playing.")
await ctx.send(embed = update_embed)
return
else:
pass
except:
pass
try:
if ctx.voice_client is None: #This should check if the bot is connected to a voice channel.
channel = ctx.author.voice.channel
await channel.connect()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Joined channel preparing to play!")
update = await ctx.send(embed = update_embed)
await update.delete()
else:
##channel = ctx.author.voice.channel
##await channel.connect()
pass
except Exception as Error:
print(Error)
if radio == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="The radio is already going.")
await ctx.send(embed = update_embed)
return
elif voice.is_playing():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playing music.")
await ctx.send(embed = update_embed)
return
elif voice.is_paused():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while paused.")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"You are not in a voice channel.")
await ctx.send(embed = update_embed)
return
try:
if radio == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="The radio is already going.")
await ctx.send(embed = update_embed)
return
elif radio == False:
pass
except:
pass
try:
if voice == voice:
pass
except Exception as Error:
voice = get(client.voice_clients, guild=ctx.guild)
if voice.is_playing():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playing music.")
await ctx.send(embed = update_embed)
return
elif voice.is_paused():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while paused.")
await ctx.send(embed = update_embed)
return
else:
print("set radio to True")
radio = True
playing_radio = ()
while True:
try:
if radio == True:
if voice.is_playing():
await asyncio.sleep(5)
continue
elif voice.is_paused():
await asyncio.sleep(5)
continue
else:
path = r"./cached_songs/"
songs = []
for song in os.listdir(path):
songs += [song]
play1 = random.choices(songs)
play = rf"./cached_songs/{play1[0]}"
voice.play(discord.FFmpegPCMAudio(play))
play1 = ((play1[0]).replace(".mp3", ""))
playing_radio = play1
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Type `stop radio` to stop the radio\nNow playing: {play1}")
sent = await ctx.send(embed = update_embed)
await asyncio.sleep(5)
await sent.delete()
continue
else:
return
except Exception as Error:
print(Error)
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Please wait as the radio re-initializes.")
alert = await ctx.send(embed = update_embed)
await ctx.voice_client.disconnect()
channel = ctx.author.voice.channel
await channel.connect()
#RECONNECTING
voice = get(client.voice_clients, guild=ctx.guild)
await alert.delete()
continue
#RADIO^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******* ** ** ******* ** ** ** ** **
/**////** /**// /**////**/** ** **/**// /** /** ******
/** /** ****** /** ** ****** /** /**/** ****** //** ** /** ** ************ ************ ****** /**///**
/******* //////** ******/** **////** /******* /** //////** //*** /**/** **///////**/ **///////**/ **////**/** /**
/**///** ******* **///**/**/** /** ** /**//// /** ******* /** /**/**//***** /** //***** /** /** /**/******
/** //** **////** /** /**/**/** /** // /** /** **////** ** /**/** /////** /** /////** /** /** /**/**///
/** //**//********//******/**//****** ** /** ***//********** ***/** ****** //** ****** //**//****** /**
// // //////// ////// // ////// // // /// ////////// /// // ////// // ////// // ////// // '''########################################################################################
@client.event
async def on_message(message):
if message.channel.name in BOT_CHANNELS.channels:
global radio
global playlist
if radio == True:
if "stop radio" in message.content:
radio = False
voice.stop()
elif playlist == True:
if "stop playlist" in message.content:
playlist = False
voice.stop()
await client.process_commands(message)
#RADIO/ PLAYLIST STOP^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
**
/**
/** ***** ****** ** ** *****
/** **///** //////**/** /****///**
/** /******* *******//** /**/*******
/** /**//// **////** //**** /**////
/********//******//******** //** //******
//////// ////// //////// // ////// '''###############################################################################################################################################################################
@client.command(pass_context=True, aliases=["Leave"])
async def leave(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playlist
if ctx.voice_client is None: #This should check if the bot is playing music.
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Not currently in this channel.")
await ctx.send(embed = update_embed)
else:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Leaving channel.")
await ctx.send(embed = update_embed)
if radio == True:
radio = False
voice.stop()
print(radio)
elif playlist == True:
playlist = False
voice.stop()
print(playlist)
await ctx.voice_client.disconnect()
#LEAVE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******* ** **
/**////** /** /** *****
/** /** ***** /** ***** ****** ***** ****** ****** ******* **///**
/** /** **///**/** **///**///**/ **///** **//// **////**//**///**/** /**
/** /**/*******/**/******* /** /******* //***** /** /** /** /**//******
/** ** /**//// /**/**//// /** /**//// /////**/** /** /** /** /////**
/******* //*********//****** //**//****** ****** //****** *** /** *****
/////// ///////// ////// // ////// ////// ////// /// // ///// '''##########################################################################################################################################
@client.command(pass_context=True, aliases=["remove", "delete"])
async def delete_song(ctx, *, search=None):
if ctx.channel.name in BOT_CHANNELS.channels:
role = discord.utils.get(ctx.guild.roles, name="bot controller")
if role in ctx.author.roles:
pass
else:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"You do not have permission to perform this action.")
await ctx.send(embed = update_embed)
return
global radio
global playing_radio
if search == None:
if radio == True:
print(f"Deleting {playing_radio}.mp3")
song = str(playing_radio + ".mp3")
voice.stop()
await asyncio.sleep(5)
path = r"./cached_songs/"
song_path = str(path + song)
if os.path.exists(song_path):
os.remove(song_path)
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Removed: {song}")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="",
description=f"Could not find {song} in the data base.")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Your not using the radio")
await ctx.send(embed = update_embed)
return
else:
if "https://" not in search:
#await ctx.message.delete()
url = search
url = url.replace(" ", "+")
#print(url)
html = urllib.request.urlopen(f"https://www.youtube.com/results?search_query={url}")
#print(html.read().decode())
video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
#print(video_ids[0])
url = f"https://www.youtube.com/watch?v={video_ids[0]}"
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(url, download=False)
song_name = (meta['title'])
song = str(song_name + ".mp3")
path = r"./cached_songs/"
song_path = str(path + song)
if os.path.exists(song_path):
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Removing: {song}")
sent = await ctx.send(embed = update_embed)
os.remove(song_path)
await sent.delete()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Removed: {song}")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"{song} was not found in the data base.")
await ctx.send(embed = update_embed)
return
else:
url = search
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(url, download=False)
song_name = (meta['title'])
song = str(song_name + ".mp3")
path = r"./cached_songs/"
song_path = str(path + song)
if os.path.exists(song_path):
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Removing: {song}")
sent = await ctx.send(embed = update_embed)
os.remove(song_path)
await sent.delete()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Removed: {song}")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"{song} was not found in the data base.")
await ctx.send(embed = update_embed)
return
#DELETE SONG^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
** ** **
/** // /**
/** **/** ** *****
/** /**/** ** **///**
/** /**/**** /*******
/** /**/**/** /**////
/********/**/**//**//******
//////// // // // ////// '''################################################################################################################################################################################################
@client.command(pass_context=True, aliases=["Like"])
async def like(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playing_radio
print(ctx.author)
try:
print(now_playing_url)
except:
pass
if radio == True:
if os.path.isfile(rf'./commands/data/PROFILES/{ctx.author}.py'):
path = rf'./commands/data/PROFILES/{ctx.author}.py'
lines = open(path).read()
print(lines)
if (f"{playing_radio}.mp3") in lines:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"You have already liked this song!")
await ctx.send(embed = update_embed)
return
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="LIKED:heart:",
description=f"{playing_radio}")
await ctx.send(embed = update_embed)
path = r'./commands/data/PROFILES/'
file = f"{ctx.author}.py"
with open(os.path.join(path, file), 'a') as fp:
fp.write(str(f"{playing_radio}.mp3\n"))
fp.close()
else:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="LIKED:heart:",
description=f"Welcome {ctx.author} we have created a profile for you and saved {playing_radio} to it!")
await ctx.send(embed = update_embed)
path = r'./commands/data/PROFILES/'
file = f"{ctx.author}.py"
with open(os.path.join(path, file), 'a') as fp:
fp.write(str(f"{playing_radio}.mp3\n"))
fp.close()
#os.mkdir(rf'./commands/data/PROFILES/{ctx.author}.py')
#then continue to append the song to their name
else:
try:
if now_playing_url != []:
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(now_playing_url, download=False)
song_name = (meta['title'])
if os.path.isfile(rf'./commands/data/PROFILES/{ctx.author}.py'):
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="LIKED:heart:",
description=f"{song_name}")
await ctx.send(embed = update_embed)
path = r'./commands/data/PROFILES/'
file = f"{ctx.author}.py"
with open(os.path.join(path, file), 'a') as fp:
fp.write(str(f"{song_name}.mp3\n"))
fp.close()
else:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="LIKED:heart:",
description=f"Welcome {ctx.author} we have created a profile for you and saved {song_name} to it!")
await ctx.send(embed = update_embed)
path = r'./commands/data/PROFILES/'
file = f"{ctx.author}.py"
with open(os.path.join(path, file), 'a') as fp:
fp.write(str(f"{song_name}.mp3\n"))
fp.close()
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="No song?",
description=f"You need to have a song playing to like it.")
await ctx.send(embed = update_embed)
except Exception as Error:
print(Error)
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="No song?",
description=f"You need to have a song playing to like it.")
await ctx.send(embed = update_embed)
@client.command(pass_context=True, aliases=["Unlike"])
async def unlike(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playing_radio
global playlist
global playing_playlist
print(ctx.author)
try:
print(now_playing_url)
except:
pass
if os.path.isfile(rf'./commands/data/PROFILES/{ctx.author}.py'):
if radio == True:
path = rf'./commands/data/PROFILES/{ctx.author}.py'
lines = open(path).read()
if (f"{playing_radio}.mp3") not in lines:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"This song is not in your likes...")
await ctx.send(embed = update_embed)
return
elif (f"{playing_radio}.mp3") in lines:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="UNLIKED",
description=f"{playing_radio}")
await ctx.send(embed = update_embed)
path = rf'./commands/data/PROFILES/{ctx.author}.py'
with open(path, "r") as f:
lines = f.readlines()
with open(path, "w") as f:
for line in lines:
if line.strip("\n") != f"{playing_radio}.mp3":
f.write(line)
else:
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="Sorry an error occured",
description=f"While checking if this song was in your playlist.")
await ctx.send(embed = update_embed)
print("CRITICAL: An error has occured under radio in >unlike.")
return
elif playlist == True:
path = rf'./commands/data/PROFILES/{ctx.author}.py'
lines = open(path).read()
if (f"{playing_playlist}.mp3") not in lines:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"This song is not in your likes...")
await ctx.send(embed = update_embed)
return
elif (f"{playing_playlist}.mp3") in lines:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="UNLIKED",
description=f"{playing_playlist}")
await ctx.send(embed = update_embed)
path = rf'./commands/data/PROFILES/{ctx.author}.py'
with open(path, "r") as f:
lines = f.readlines()
with open(path, "w") as f:
for line in lines:
if line.strip("\n") != f"{playing_playlist}.mp3":
f.write(line)
else:
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="Sorry an error occured",
description=f"While checking if this song was in your playlist.")
await ctx.send(embed = update_embed)
print("CRITICAL: An error has occured under playlist in >unlike.")
return
else:
try:
if now_playing_url != []:
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(now_playing_url, download=False)
song_name = (meta['title'])
path = rf'./commands/data/PROFILES/{ctx.author}.py'
lines = open(path).read()
if (f"{song_name}.mp3") not in lines:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"This song is not in your likes...")
await ctx.send(embed = update_embed)
return
elif (f"{song_name}.mp3") in lines:
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="UNLIKED",
description=f"{song_name}")
await ctx.send(embed = update_embed)
path = rf'./commands/data/PROFILES/{ctx.author}.py'
with open(path, "r") as f:
lines = f.readlines()
with open(path, "w") as f:
for line in lines:
if line.strip("\n") != f"{song_name}.mp3":
f.write(line)
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="No song?",
description=f"You need to have a song playing to like it.")
await ctx.send(embed = update_embed)
except Exception as Error:
print(Error)
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="No song?",
description=f"You need to have a song playing to like it.")
await ctx.send(embed = update_embed)
@client.command(pass_context=True, aliases=["List"])
async def list(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
global radio
global playing_radio
if os.path.isfile(rf'./commands/data/PROFILES/{ctx.author}.py'):
path = rf'./commands/data/PROFILES/{ctx.author}.py'
lines = open(path).read()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="Your liked songs:",
description=f"{lines}")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.red(),
title="Sorry...",
description=f"You dont have a profile.\nPlease read >info under >like to figure out how to make a profile.")
await ctx.send(embed = update_embed)
return
#LIKE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'''
******* ** ** ** **
/**////**/** ** **/**// /**
/** /**/** ****** //** ** /** ** ************
/******* /** //////** //*** /**/** **///////**/
/**//// /** ******* /** /**/**//***** /**
/** /** **////** ** /**/** /////** /**
/** ***//********** ***/** ****** //**
// /// ////////// /// // ////// // '''#######################################################################################################################################################################
@client.command(pass_context=True, aliases=["profile", "pl"])
async def playlist(ctx):
if ctx.channel.name in BOT_CHANNELS.channels:
author = (ctx.author)
if os.path.isfile(rf'./commands/data/PROFILES/{ctx.author}.py'):
pass
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Sorry, you have no liked songs.")
await ctx.send(embed = update_embed)
return
global playlist
global playing_playlist
#voice = get(client.voice_clients, guild=ctx.guild)
#print(ctx.voice_client)
global voice
global radio
global previous_song_1
global previous_song_2
try:
if radio == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while the radio is playing.")
await ctx.send(embed = update_embed)
return
elif Playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Your playlist is already playing.")
await ctx.send(embed = update_embed)
return
else:
pass
except:
pass
try:
if ctx.voice_client is None: #This should check if the bot is connected to a voice channel.
channel = ctx.author.voice.channel
await channel.connect()
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Joined channel preparing to play!")
update = await ctx.send(embed = update_embed)
await update.delete()
else:
pass
except Exception as Error:
print(Error)
if playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="The playlist is already going.")
await ctx.send(embed = update_embed)
return
elif voice.is_playing():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playing music.")
await ctx.send(embed = update_embed)
return
elif voice.is_paused():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while paused.")
await ctx.send(embed = update_embed)
return
else:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"You are not in a voice channel.")
await ctx.send(embed = update_embed)
return
try:
if playlist == True:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="The playlist is already going.")
await ctx.send(embed = update_embed)
return
elif playlist == False:
pass
except:
pass
# radio = True
# playing_radio = ()
try:
#global voice
if voice == voice:
pass
except Exception as Error:
voice = get(client.voice_clients, guild=ctx.guild)
if voice.is_playing():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while playing music.")
await ctx.send(embed = update_embed)
return
elif voice.is_paused():
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description="Cannot perform this action while paused.")
await ctx.send(embed = update_embed)
return
else:
print("set playlist to True")
playlist = True
playing_playlist = ()
while True:
try:
if playlist == True:
if voice.is_playing():
await asyncio.sleep(5)
continue
elif voice.is_paused():
await asyncio.sleep(5)
continue
else:
path = rf'./commands/data/PROFILES/{ctx.author}.py'
retry = 0
while True:
try:
lines = open(path).read().splitlines()
song = random.choice(lines)
pass
except:
update_embed = discord.Embed(
colour=discord.Colour.gold(),
title="",
description=f"Sorry, you have no liked songs.")
await ctx.send(embed = update_embed)
playlist = False
return
if song == previous_song_1 or song == previous_song_2:
retry += 1
if retry == 5:
retry = 0
break
else:
continue
else:
previous_song_2 = previous_song_1
previous_song_1 = song
break
print(song)
play1 = song #random.sample(songs, 1)
#print(play1)
play = rf"./cached_songs/{play1}"
voice.play(discord.FFmpegPCMAudio(play))
play1 = ((play1).replace(".mp3", ""))
playing_playlist = play1
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Type `stop playlist` to stop your playlist\nNow playing: {play1}")
sent = await ctx.send(embed = update_embed)
await asyncio.sleep(5)
await sent.delete()
continue
# except Exception as Error:
# if Error == "Not connected to voice.":
# print(Error)
# update_embed = discord.Embed(
# colour=discord.Colour.green(),
# title="",
# description=f"Please wait re-initializing.")
# alert = await ctx.send(embed = update_embed)
# await ctx.voice_client.disconnect()
# channel = ctx.author.voice.channel
# await channel.connect()
# #RECONNECTING
# voice = get(client.voice_clients, guild=ctx.guild)
# await alert.delete()
# continue
# elif Error == "Cannot choose from an empty sequence":
# print(Error)
# update_embed = discord.Embed(
# colour=discord.Colour.gold(),
# title="",
# description=f"Sorry, you have no liked songs.")
# await ctx.send(embed = update_embed)
# playlist = False
# return
# else:
# print("CRITICAL:" + str(Error))
# #print(Error)
# update_embed = discord.Embed(
# colour=discord.Colour.green(),
# title="",
# description=f"Please wait re-initializing.")
# alert = await ctx.send(embed = update_embed)
# await ctx.voice_client.disconnect()
# channel = ctx.author.voice.channel
# await channel.connect()
# #RECONNECTING
# voice = get(client.voice_clients, guild=ctx.guild)
# await alert.delete()
# continue
else:
return
except Exception as Error:
print(Error)
update_embed = discord.Embed(
colour=discord.Colour.green(),
title="",
description=f"Please wait re-initializing.")
alert = await ctx.send(embed = update_embed)
await ctx.voice_client.disconnect()
channel = ctx.author.voice.channel
await channel.connect()
#RECONNECTING
voice = get(client.voice_clients, guild=ctx.guild)
await alert.delete()
continue
#PLAYLIST^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| 39.112
| 224
| 0.38011
| 5,272
| 68,446
| 4.831373
| 0.064871
| 0.085077
| 0.046641
| 0.060736
| 0.835499
| 0.822975
| 0.801735
| 0.777119
| 0.75533
| 0.739704
| 0
| 0.005351
| 0.426599
| 68,446
| 1,750
| 225
| 39.112
| 0.643642
| 0.099641
| 0
| 0.836735
| 0
| 0.002551
| 0.111954
| 0.024516
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.037415
| 0.013605
| 0
| 0.058673
| 0.030612
| 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
|
dec59d477970152d359ee900988711dc4f1d875f
| 22,665
|
py
|
Python
|
models.py
|
saleih/PAN
|
b8c5df9be20fdf400b05819a1055e5214219fd2b
|
[
"MIT"
] | 14
|
2019-05-20T13:04:32.000Z
|
2022-03-30T09:23:02.000Z
|
models.py
|
saleih/PAN
|
b8c5df9be20fdf400b05819a1055e5214219fd2b
|
[
"MIT"
] | 2
|
2019-11-14T07:03:30.000Z
|
2020-02-11T06:19:04.000Z
|
models.py
|
saleih/PAN
|
b8c5df9be20fdf400b05819a1055e5214219fd2b
|
[
"MIT"
] | 5
|
2019-10-20T13:18:35.000Z
|
2021-01-31T00:56:09.000Z
|
from lasagne.layers import InputLayer, ReshapeLayer, DenseLayer, batch_norm, DropoutLayer, Deconv2DLayer, BatchNormLayer, NonlinearityLayer, ElemwiseSumLayer, ConcatLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.layers import Conv2DLayer
from lasagne.nonlinearities import LeakyRectify, sigmoid,tanh, softmax
from theano.tensor import TensorType
from lasagne.init import Normal, HeNormal
def build_generator_unet(input_var=None, ngf=64):
# Input layer
lrelu = LeakyRectify(0.2)
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1_ = Conv2DLayer(
net, ngf*1, (3,3), (2,2), pad=1, W=Normal(0.05), nonlinearity=None)
net1 = NonlinearityLayer(BatchNormLayer(net1_),nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2_ = Conv2DLayer(
net1, ngf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net2 = NonlinearityLayer(BatchNormLayer(net2_),nonlinearity=lrelu)
print ("Gen conv2:", net2.output_shape)
net3_ = Conv2DLayer(
net2, ngf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net3 = NonlinearityLayer(BatchNormLayer(net3_),nonlinearity=lrelu)
print ("Gen conv3:", net3.output_shape)
net4_ = Conv2DLayer(
net3, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net4 = NonlinearityLayer(BatchNormLayer(net4_),nonlinearity=lrelu)
print ("Gen conv4:", net4.output_shape)
net5_ = Conv2DLayer(
net4, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net5 = NonlinearityLayer(BatchNormLayer(net5_),nonlinearity=lrelu)
print ("Gen conv5:", net5.output_shape)
net6_ = Conv2DLayer(
net5, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net6 = NonlinearityLayer(BatchNormLayer(net6_),nonlinearity=lrelu)
print ("Gen conv6:", net6.output_shape)
net7_ = Conv2DLayer(
net6, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net7 = NonlinearityLayer(BatchNormLayer(net7_),nonlinearity=lrelu)
print ("Gen conv7:", net7.output_shape)
net8_ = Conv2DLayer(
net7, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net8 = NonlinearityLayer(net8_)
print ("Gen conv8:", net8.output_shape)
# Decoder
dnet1_ = DropoutLayer(BatchNormLayer(Deconv2DLayer(net8, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None)))
skip1 = ConcatLayer([dnet1_,net7_])
print ("skip layer 1:", skip1.output_shape)
dnet1 = NonlinearityLayer(skip1)
print ("Gen Deconv layer 1:", dnet1.output_shape)
dnet2_ = DropoutLayer(BatchNormLayer(Deconv2DLayer(dnet1, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None)))
skip2 = ConcatLayer([dnet2_,net6_])
print ("skip layer 2:", skip2.output_shape)
dnet2 = NonlinearityLayer(skip2)
print ("Gen Deconv layer 2:", dnet2.output_shape)
dnet3_ = DropoutLayer(BatchNormLayer(Deconv2DLayer(dnet2, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None)))
skip3 = ConcatLayer([dnet3_,net5_])
print ("skip layer 3:", skip3.output_shape)
dnet3 = NonlinearityLayer(skip3)
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4_ = BatchNormLayer(Deconv2DLayer(dnet3, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip4 = ConcatLayer([dnet4_,net4_])
print ("skip layer 4:", skip4.output_shape)
dnet4 = NonlinearityLayer(skip4)
print ("Geneartor deconv 4:", dnet4.output_shape)
dnet5_ = BatchNormLayer(Deconv2DLayer(dnet4, ngf*4, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip5 = ConcatLayer([dnet5_,net3_])
print ("skip layer 5:", skip5.output_shape)
dnet5 = NonlinearityLayer(skip5)
print ("Geneartor deconv 5:", dnet5.output_shape)
dnet6_ = BatchNormLayer(Deconv2DLayer(dnet5, ngf*2, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip6 = ConcatLayer([dnet6_,net2_])
print ("skip layer 6:", skip6.output_shape)
dnet6 = NonlinearityLayer(skip6)
print ("Geneartor deconv 6:", dnet6.output_shape)
dnet7_ = BatchNormLayer(Deconv2DLayer(dnet6, ngf, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip7 = ConcatLayer([dnet7_,net1_])
print ("skip layer 7:", skip7.output_shape)
dnet7 = NonlinearityLayer(skip7)
print ("Geneartor deconv 7:", dnet7.output_shape)
dnet_out = Deconv2DLayer(dnet7,3,(4,4),(2,2),crop=1,W=Normal(0.02),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_generator_unet_nodrop(input_var=None, ngf=64):
# Input layer
lrelu = LeakyRectify(0.2)
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1_ = Conv2DLayer(
net, ngf*1, (3,3), (2,2), pad=1, W=Normal(0.05), nonlinearity=None)
net1 = NonlinearityLayer(BatchNormLayer(net1_),nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2_ = Conv2DLayer(
net1, ngf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net2 = NonlinearityLayer(BatchNormLayer(net2_),nonlinearity=lrelu)
print ("Gen conv2:", net2.output_shape)
net3_ = Conv2DLayer(
net2, ngf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net3 = NonlinearityLayer(BatchNormLayer(net3_),nonlinearity=lrelu)
print ("Gen conv3:", net3.output_shape)
net4_ = Conv2DLayer(
net3, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net4 = NonlinearityLayer(BatchNormLayer(net4_),nonlinearity=lrelu)
print ("Gen conv4:", net4.output_shape)
net5_ = Conv2DLayer(
net4, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net5 = NonlinearityLayer(BatchNormLayer(net5_),nonlinearity=lrelu)
print ("Gen conv5:", net5.output_shape)
net6_ = Conv2DLayer(
net5, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net6 = NonlinearityLayer(BatchNormLayer(net6_),nonlinearity=lrelu)
print ("Gen conv6:", net6.output_shape)
net7_ = Conv2DLayer(
net6, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net7 = NonlinearityLayer(BatchNormLayer(net7_),nonlinearity=lrelu)
print ("Gen conv7:", net7.output_shape)
net8_ = Conv2DLayer(
net7, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net8 = NonlinearityLayer(net8_)
print ("Gen conv8:", net8.output_shape)
# Decoder
dnet1_ = BatchNormLayer(Deconv2DLayer(net8, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip1 = ConcatLayer([dnet1_,net7_])
print ("skip layer 1:", skip1.output_shape)
dnet1 = NonlinearityLayer(skip1)
print ("Gen Deconv layer 1:", dnet1.output_shape)
dnet2_ = BatchNormLayer(Deconv2DLayer(dnet1, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip2 = ConcatLayer([dnet2_,net6_])
print ("skip layer 2:", skip2.output_shape)
dnet2 = NonlinearityLayer(skip2)
print ("Gen Deconv layer 2:", dnet2.output_shape)
dnet3_ = BatchNormLayer(Deconv2DLayer(dnet2, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip3 = ConcatLayer([dnet3_,net5_])
print ("skip layer 3:", skip3.output_shape)
dnet3 = NonlinearityLayer(skip3)
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4_ = BatchNormLayer(Deconv2DLayer(dnet3, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip4 = ConcatLayer([dnet4_,net4_])
print ("skip layer 4:", skip4.output_shape)
dnet4 = NonlinearityLayer(skip4)
print ("Geneartor deconv 4:", dnet4.output_shape)
dnet5_ = BatchNormLayer(Deconv2DLayer(dnet4, ngf*4, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip5 = ConcatLayer([dnet5_,net3_])
print ("skip layer 5:", skip5.output_shape)
dnet5 = NonlinearityLayer(skip5)
print ("Geneartor deconv 5:", dnet5.output_shape)
dnet6_ = BatchNormLayer(Deconv2DLayer(dnet5, ngf*2, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip6 = ConcatLayer([dnet6_,net2_])
print ("skip layer 6:", skip6.output_shape)
dnet6 = NonlinearityLayer(skip6)
print ("Geneartor deconv 6:", dnet6.output_shape)
dnet7_ = BatchNormLayer(Deconv2DLayer(dnet6, ngf, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip7 = ConcatLayer([dnet7_,net1_])
print ("skip layer 7:", skip7.output_shape)
dnet7 = NonlinearityLayer(skip7)
print ("Geneartor deconv 7:", dnet7.output_shape)
dnet_out = Deconv2DLayer(dnet7,3,(4,4),(2,2),crop=1,W=Normal(0.02),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_generator_unet_1(input_var=None, ngf=64):
# Input layer
lrelu = LeakyRectify(0.2)
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1_ = Conv2DLayer(
net, ngf*1, (3,3), (2,2), pad=1, W=Normal(0.05), nonlinearity=None)
net1 = NonlinearityLayer(BatchNormLayer(net1_),nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2_ = Conv2DLayer(
net1, ngf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net2 = NonlinearityLayer(BatchNormLayer(net2_),nonlinearity=lrelu)
print ("Gen conv2:", net2.output_shape)
net3_ = Conv2DLayer(
net2, ngf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net3 = NonlinearityLayer(BatchNormLayer(net3_),nonlinearity=lrelu)
print ("Gen conv3:", net3.output_shape)
net4_ = Conv2DLayer(
net3, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net4 = NonlinearityLayer(BatchNormLayer(net4_),nonlinearity=lrelu)
print ("Gen conv4:", net4.output_shape)
net5_ = Conv2DLayer(
net4, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net5 = NonlinearityLayer(BatchNormLayer(net5_),nonlinearity=lrelu)
print ("Gen conv5:", net5.output_shape)
net6_ = Conv2DLayer(
net5, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net6 = NonlinearityLayer(BatchNormLayer(net6_),nonlinearity=lrelu)
print ("Gen conv6:", net6.output_shape)
# Decoder
dnet3_ = BatchNormLayer(Deconv2DLayer(net6, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip3 = ConcatLayer([dnet3_,net5_])
print ("skip layer 3:", skip3.output_shape)
dnet3 = NonlinearityLayer(skip3)
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4_ = BatchNormLayer(Deconv2DLayer(dnet3, ngf*8, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip4 = ConcatLayer([dnet4_,net4_])
print ("skip layer 4:", skip4.output_shape)
dnet4 = NonlinearityLayer(skip4)
print ("Geneartor deconv 4:", dnet4.output_shape)
dnet5_ = BatchNormLayer(Deconv2DLayer(dnet4, ngf*4, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip5 = ConcatLayer([dnet5_,net3_])
print ("skip layer 5:", skip5.output_shape)
dnet5 = NonlinearityLayer(skip5)
print ("Geneartor deconv 5:", dnet5.output_shape)
dnet6_ = BatchNormLayer(Deconv2DLayer(dnet5, ngf*2, (4,4), (2,2), crop=1, W=Normal(0.02),nonlinearity=None))
skip6 = ConcatLayer([dnet6_,net2_])
print ("skip layer 6:", skip6.output_shape)
dnet6 = NonlinearityLayer(skip6)
print ("Geneartor deconv 6:", dnet6.output_shape)
dnet7 = batch_norm(Deconv2DLayer(dnet6, ngf, (4,4), (2,2), crop=1, W=Normal(0.02)))
print ("Geneartor deconv 7:", dnet7.output_shape)
dnet_out = Deconv2DLayer(dnet7,3,(4,4),(2,2),crop=1,W=Normal(0.02),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_generator_deraining(input_var=None, ngf=64):
lrelu = LeakyRectify(0.2)
# Input layer
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1 = Conv2DLayer(net, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2_ = BatchNormLayer(Conv2DLayer(net1, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=None))
net2 = NonlinearityLayer(net2_,nonlinearity=lrelu)
print ("Gen conv2:", net2.output_shape)
net3 = batch_norm(Conv2DLayer(net2, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv3:", net3.output_shape)
net4_ = BatchNormLayer(Conv2DLayer(net3, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=None))
net4 = NonlinearityLayer(net4_,nonlinearity=lrelu)
print ("Gen conv4:", net4.output_shape)
net5 = batch_norm(Conv2DLayer(net4, 32, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv5:", net5.output_shape)
net6 = batch_norm(Conv2DLayer(net5, 1, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv6:", net6.output_shape)
# Decoder
dnet1 = batch_norm(Deconv2DLayer(net6, 32, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 1:", dnet1.output_shape)
dnet2_ = BatchNormLayer(Deconv2DLayer(dnet1, ngf, (3,3), (1,1), crop=1, W=Normal(0.05),nonlinearity=None))
skip1 = ElemwiseSumLayer([dnet2_, net4_])
dnet2 = NonlinearityLayer(skip1)
print ("Gen Deconv layer 2:", dnet2.output_shape)
dnet3 = batch_norm(Deconv2DLayer(dnet2, ngf, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4_ = BatchNormLayer(Deconv2DLayer(dnet3, ngf, (3,3), (1,1), crop=1, W=Normal(0.05),nonlinearity=None))
skip2 = ElemwiseSumLayer([dnet4_, net2_])
dnet4 = NonlinearityLayer(skip2)
print ("Gen Deconv layer 4:", dnet4.output_shape)
dnet5 = batch_norm(Deconv2DLayer(dnet4, ngf, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 5:", dnet5.output_shape)
dnet_out = Deconv2DLayer(dnet5,3,(3,3),(1,1),crop=1,W=Normal(0.05),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_generator_facades(input_var=None, ngf=64):
lrelu = LeakyRectify(0.2)
# Input layer
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1 = Conv2DLayer(net, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2_ = BatchNormLayer(Conv2DLayer(net1, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=None))
net2 = NonlinearityLayer(net2_,nonlinearity=lrelu)
print ("Gen conv2:", net2.output_shape)
net3 = batch_norm(Conv2DLayer(net2, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv3:", net3.output_shape)
net4_ = BatchNormLayer(Conv2DLayer(net3, ngf, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=None))
net4 = NonlinearityLayer(net4_,nonlinearity=lrelu)
print ("Gen conv4:", net4.output_shape)
net5 = batch_norm(Conv2DLayer(net4, 32, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv5:", net5.output_shape)
net6 = batch_norm(Conv2DLayer(net5, 1, (3,3), (1,1), pad=1, W=Normal(0.05),nonlinearity=lrelu))
print ("Gen conv6:", net6.output_shape)
# Decoder
dnet1 = batch_norm(Deconv2DLayer(net6, 32, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 1:", dnet1.output_shape)
dnet2_ = BatchNormLayer(Deconv2DLayer(dnet1, ngf, (3,3), (1,1), crop=1, W=Normal(0.05),nonlinearity=None))
skip1 = ElemwiseSumLayer([dnet2_, net4_])
dnet2 = NonlinearityLayer(skip1)
print ("Gen Deconv layer 2:", dnet2.output_shape)
dnet3 = batch_norm(Deconv2DLayer(dnet2, ngf, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4_ = BatchNormLayer(Deconv2DLayer(dnet3, ngf, (3,3), (1,1), crop=1, W=Normal(0.05),nonlinearity=None))
skip2 = ElemwiseSumLayer([dnet4_, net2_])
dnet4 = NonlinearityLayer(skip2)
print ("Gen Deconv layer 4:", dnet4.output_shape)
dnet5 = batch_norm(Deconv2DLayer(dnet4, ngf, (3,3), (1,1), crop=1, W=Normal(0.05)))
print ("Gen Deconv layer 5:", dnet5.output_shape)
dnet_out = Deconv2DLayer(dnet5,3,(3,3),(1,1),crop=1,W=Normal(0.05),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_generator_inpainting(input_var=None, ngf=64):
# Input layer
lrelu = LeakyRectify(0.2)
net = InputLayer(shape=(None, 3, 128, 128), input_var=input_var)
print ("Generator input:", net.output_shape)
# ConvLayer
net1 = Conv2DLayer(
net, ngf, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu)
print ("Gen conv1:", net1.output_shape)
net2 = batch_norm(Conv2DLayer(
net1, ngf, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Gen conv2:", net2.output_shape)
net3 = batch_norm(Conv2DLayer(
net2, ngf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Gen conv3:", net3.output_shape)
net4 = batch_norm(Conv2DLayer(
net3, ngf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Gen conv4:", net4.output_shape)
net5 = batch_norm(Conv2DLayer(
net4, ngf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Gen conv5:", net5.output_shape)
net6 = batch_norm(Conv2DLayer(
net5, 4000, (4,4), pad=0, W=Normal(0.02), nonlinearity=lrelu))
print ("Gen conv6:", net6.output_shape)
# Decoder
dnet1 = batch_norm(Deconv2DLayer(net6,ngf*8,(4,4),(1,1),crop=0,W=Normal(0.02)))
print ("Gen Deconv layer 1:", dnet1.output_shape)
dnet2 = batch_norm(Deconv2DLayer(dnet1,ngf*4,(4,4),(2,2),crop=1,W=Normal(0.02)))
print ("Gen Deconv layer 2:", dnet2.output_shape)
dnet3 = batch_norm(Deconv2DLayer(dnet2,ngf*2,(4,4),(2,2),crop=1,W=Normal(0.02)))
print ("Gen Deconv layer 3:", dnet3.output_shape)
dnet4 = batch_norm(Deconv2DLayer(dnet3,ngf,(4,4),(2,2),crop=1,W=Normal(0.02)))
print ("Geneartor deconv 4:", dnet4.output_shape)
dnet_out = Deconv2DLayer(dnet4,3,(4,4),(2,2),crop=1,W=Normal(0.02),nonlinearity=tanh)
print ("Generator output:", dnet_out.output_shape)
print (' ')
return dnet_out
def build_discriminator(input_var=None, ndf=64):
lrelu = LeakyRectify(0.2)
# input: true images
net = InputLayer(shape=(None, 3, 256, 256), input_var=input_var)
print ("Discriminator input:", net.output_shape)
net1_ = Conv2DLayer(
net, ndf, (3,3), (1,1), pad=1, W=Normal(0.5), nonlinearity=None)
net1 = NonlinearityLayer(net1_,nonlinearity=tanh)
print ("Discriminator conv1:", net1.output_shape)
net2 = batch_norm(Conv2DLayer(
net1, ndf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Discriminator conv2:", net2.output_shape)
net2 = batch_norm(Conv2DLayer(
net2, ndf*2, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net2_ = Conv2DLayer(
net2, ndf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net2 = NonlinearityLayer(BatchNormLayer(net2_),nonlinearity=lrelu)
print ("Discriminator conv2:", net2.output_shape)
net3 = batch_norm(Conv2DLayer(
net2, ndf*4, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net3_ = Conv2DLayer(
net3, ndf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net3 = NonlinearityLayer(BatchNormLayer(net3_),nonlinearity=lrelu)
print ("Discriminator conv3:", net3.output_shape)
net4 = batch_norm(Conv2DLayer(
net3, ndf*8, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net4_ = Conv2DLayer(
net4, ndf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net4 = NonlinearityLayer(BatchNormLayer(net4_),nonlinearity=lrelu)
print ("Discriminator conv4:", net4.output_shape)
net5 = Conv2DLayer(
net4, 8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
print ("Discriminator conv5:", net5.output_shape)
net_out = DenseLayer(net5, 1, W=Normal(0.02), nonlinearity=sigmoid)
print ("Discriminator output:", net_out.output_shape)
print (' ')
return net1, net2, net3, net4, net_out
def build_discriminator_inpainting(input_var=None, ndf=64):
lrelu = LeakyRectify(0.2)
# input: true images
net = InputLayer(shape=(None, 3, 64, 64), input_var=input_var)
print ("Discriminator input:", net.output_shape)
net1_ = Conv2DLayer(
net, ndf, (3,3), (1,1), pad=0, W=Normal(0.5), nonlinearity=None)
net1 = NonlinearityLayer(net1_,nonlinearity=tanh)
print ("Discriminator conv1:", net1.output_shape)
net2 = batch_norm(Conv2DLayer(
net1, ndf*2, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=lrelu))
print ("Discriminator conv2:", net2.output_shape)
net2 = batch_norm(Conv2DLayer(
net2, ndf*2, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net2_ = Conv2DLayer(
net2, ndf*4, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net2 = NonlinearityLayer(BatchNormLayer(net2_),nonlinearity=lrelu)
print ("Discriminator conv2:", net2.output_shape)
net3 = batch_norm(Conv2DLayer(
net2, ndf*4, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net3_ = Conv2DLayer(
net3, ndf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net3 = NonlinearityLayer(BatchNormLayer(net3_),nonlinearity=lrelu)
print ("Discriminator conv3:", net3.output_shape)
net4 = batch_norm(Conv2DLayer(
net3, ndf*8, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=lrelu))
net4_ = Conv2DLayer(
net4, ndf*8, (3,3), (2,2), pad=1, W=Normal(0.02), nonlinearity=None)
net4 = NonlinearityLayer(BatchNormLayer(net4_),nonlinearity=lrelu)
print ("Discriminator conv4:", net4.output_shape)
net5 = Conv2DLayer(
net4, 8, (3,3), (1,1), pad=1, W=Normal(0.02), nonlinearity=None)
print ("Discriminator conv5:", net5.output_shape)
net_out = DenseLayer(net5, 1, W=Normal(0.02), nonlinearity=sigmoid)
print ("Discriminator output:", net_out.output_shape)
print (' ')
return net1, net2, net3, net4, net_out
| 50.591518
| 170
| 0.662563
| 3,150
| 22,665
| 4.656508
| 0.034603
| 0.089242
| 0.053995
| 0.058904
| 0.959299
| 0.957527
| 0.955959
| 0.9548
| 0.953436
| 0.942051
| 0
| 0.086515
| 0.173836
| 22,665
| 447
| 171
| 50.704698
| 0.696822
| 0.009574
| 0
| 0.891753
| 0
| 0
| 0.07977
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.020619
| false
| 0
| 0.015464
| 0
| 0.056701
| 0.32732
| 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
|
72007ac4a31a173c9fe52698f7f30489da78bbc6
| 538
|
py
|
Python
|
2diamond.py
|
he-lium/optiver-programming-chal2016
|
02813a2ca53a71b08848ccf5c47222138b67221b
|
[
"Apache-2.0"
] | null | null | null |
2diamond.py
|
he-lium/optiver-programming-chal2016
|
02813a2ca53a71b08848ccf5c47222138b67221b
|
[
"Apache-2.0"
] | 1
|
2016-08-30T14:02:38.000Z
|
2016-08-30T14:02:38.000Z
|
2diamond.py
|
he-lium/optiver-programming-chal2016
|
02813a2ca53a71b08848ccf5c47222138b67221b
|
[
"Apache-2.0"
] | null | null | null |
num = int(input())
n = int((num - 1) / 2)
for l in range(n+1):
space = ' ' * (n - l)
nums = [str(i) for i in range(n-l+1, n-l+1+3)]
left = space + ''.join(nums) + ' ' * l
right = left[::-1].rstrip()
middle = (str(num) if l == 0 else ' ')
print(left+middle+right)
for l in range(n, -1, -1):
space = ' ' * (n - l)
nums = [str(i) for i in range(n-l+1, n-l+1+3)]
left = space + ''.join(nums) + ' ' * l
right = left[::-1].rstrip()
middle = (str(num) if l == 0 else ' ')
print(left+middle+right)
| 31.647059
| 50
| 0.48513
| 95
| 538
| 2.747368
| 0.252632
| 0.045977
| 0.122605
| 0.084291
| 0.923372
| 0.923372
| 0.827586
| 0.827586
| 0.827586
| 0.827586
| 0
| 0.038462
| 0.275093
| 538
| 16
| 51
| 33.625
| 0.630769
| 0
| 0
| 0.75
| 0
| 0
| 0.011152
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.125
| 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
|
722a21eb6ded5c512a6922ce270f345cd99c637f
| 1,937
|
py
|
Python
|
scripts/py-scripts/ip-test.py
|
loafdog/loaf-src
|
3450b059a0a8d13c6709d63867888c113cd4a063
|
[
"Apache-2.0"
] | null | null | null |
scripts/py-scripts/ip-test.py
|
loafdog/loaf-src
|
3450b059a0a8d13c6709d63867888c113cd4a063
|
[
"Apache-2.0"
] | null | null | null |
scripts/py-scripts/ip-test.py
|
loafdog/loaf-src
|
3450b059a0a8d13c6709d63867888c113cd4a063
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/python
from netaddr import *
ip1_str = "1.2.3.9"
ip2_str = "1.2.3.1"
if IPAddress(ip1_str) >= IPAddress(ip2_str):
print("ip1 %s >= ip2 %s" % ( ip1_str, ip2_str))
else:
print("ip1 %s < ip2 %s" % ( ip1_str, ip2_str))
ip1_str = "1.2.3.9"
ip1 = IPAddress(ip1_str)
ip3 = ip1 - 1
print "ip3 " + str(ip3)
subnet_str = "1.2.3.0/24"
sub = IPNetwork(subnet_str)
print "sub " + str(sub)
if ip1 in sub:
print ("%s is in %s" %(str(ip1), str(sub)))
else:
print ("%s is NOT in %s" %(str(ip1), str(sub)))
ip1_str = "10.2.3.9"
ip1 = IPAddress(ip1_str)
if ip1 in sub:
print ("%s is in %s" %(str(ip1), str(sub)))
else:
print ("%s is NOT in %s" %(str(ip1), str(sub)))
sub = IPNetwork("70.105.72.0/24")
pub_ip = IPAddress("70.105.72.44")
ip_max = pub_ip - 1
pub_netmask = sub.netmask
pub_gateway = sub.ip + 1
print "-"*40
print "sub %s" % sub
print "ip max %s" % ip_max
print "pub ip %s" % pub_ip
print "pub_netmask %s" % pub_netmask
print "pub_gateway %s" % pub_gateway
ip_list = list(sub)
print "%s - %s len=%d" % (ip_list[0], ip_list[-1], len(ip_list))
if ip_max in sub:
print ("%s is in %s" % (ip_max, sub))
else:
print ("%s is NOT in %s" % (ip_max, sub))
sub = IPNetwork("70.105.72.128/25")
pub_ip = IPAddress("70.105.72.44")
ip_max = pub_ip - 1
pub_netmask = sub.netmask
pub_gateway = sub.ip + 1
print "-"*40
print "sub %s" % sub
print "ip max %s" % ip_max
print "pub ip %s" % pub_ip
print "pub_netmask %s" % pub_netmask
print "pub_gateway %s" % pub_gateway
ip_list = list(sub)
print "%s - %s len=%d" % (ip_list[0], ip_list[-1], len(ip_list))
if ip_max in sub:
print ("%s is in %s" % (ip_max, sub))
else:
print ("%s is NOT in %s" % (ip_max, sub))
try:
sub = IPNetwork("70.105.72.128/a")
print "sub %s" % sub
except AddrFormatError, e:
print e
try:
sub = IPNetwork("1.1.1.1")
print "sub %s" % sub
except AddrFormatError, e:
print e
| 20.827957
| 64
| 0.600929
| 365
| 1,937
| 3.052055
| 0.131507
| 0.064632
| 0.057451
| 0.021544
| 0.836625
| 0.836625
| 0.764811
| 0.72711
| 0.72711
| 0.610413
| 0
| 0.077225
| 0.211151
| 1,937
| 92
| 65
| 21.054348
| 0.651832
| 0.00826
| 0
| 0.779412
| 0
| 0
| 0.222106
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.014706
| null | null | 0.441176
| 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
| 1
|
0
| 9
|
a0c9884ef9d59c5d79ccdca2c09d3af1f1f5c02c
| 27
|
py
|
Python
|
app_config.py
|
usc-isi-i2/kgtk-graph-visualization
|
e582b81096999ef63214ccc536111455e80f44d8
|
[
"MIT"
] | null | null | null |
app_config.py
|
usc-isi-i2/kgtk-graph-visualization
|
e582b81096999ef63214ccc536111455e80f44d8
|
[
"MIT"
] | null | null | null |
app_config.py
|
usc-isi-i2/kgtk-graph-visualization
|
e582b81096999ef63214ccc536111455e80f44d8
|
[
"MIT"
] | null | null | null |
host='0.0.0.0'
port='9007'
| 9
| 14
| 0.592593
| 7
| 27
| 2.285714
| 0.571429
| 0.375
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.32
| 0.074074
| 27
| 2
| 15
| 13.5
| 0.32
| 0
| 0
| 0
| 0
| 0
| 0.407407
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 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
|
a0e5c9ef03f3405f975c842b3031a0c3bbb5feae
| 4,696
|
py
|
Python
|
sparkmagic/sparkmagic/tests/test_sendstringtosparkcommand.py
|
datalayer-contrib/jupyter-sparkmagic
|
2e4c2a2aa153e32a6428de863bd829ec03844609
|
[
"RSA-MD"
] | null | null | null |
sparkmagic/sparkmagic/tests/test_sendstringtosparkcommand.py
|
datalayer-contrib/jupyter-sparkmagic
|
2e4c2a2aa153e32a6428de863bd829ec03844609
|
[
"RSA-MD"
] | null | null | null |
sparkmagic/sparkmagic/tests/test_sendstringtosparkcommand.py
|
datalayer-contrib/jupyter-sparkmagic
|
2e4c2a2aa153e32a6428de863bd829ec03844609
|
[
"RSA-MD"
] | null | null | null |
# coding=utf-8
from sparkmagic.livyclientlib.sendstringtosparkcommand import SendStringToSparkCommand
from mock import MagicMock
from sparkmagic.livyclientlib.exceptions import BadUserDataException
from nose.tools import assert_raises, assert_equals
from sparkmagic.livyclientlib.command import Command
import sparkmagic.utils.constants as constants
def test_send_to_scala():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
sparkcommand._scala_command = MagicMock(return_value=MagicMock())
sparkcommand.to_command(
constants.SESSION_KIND_SPARK,
input_variable_name,
input_variable_value,
output_variable_name,
)
sparkcommand._scala_command.assert_called_with(
input_variable_name, input_variable_value, output_variable_name
)
def test_send_to_r():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
sparkcommand._r_command = MagicMock(return_value=MagicMock())
sparkcommand.to_command(
constants.SESSION_KIND_SPARKR,
input_variable_name,
input_variable_value,
output_variable_name,
)
sparkcommand._r_command.assert_called_with(
input_variable_name, input_variable_value, output_variable_name
)
def test_send_to_pyspark():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
sparkcommand._pyspark_command = MagicMock(return_value=MagicMock())
sparkcommand.to_command(
constants.SESSION_KIND_PYSPARK,
input_variable_name,
input_variable_value,
output_variable_name,
)
sparkcommand._pyspark_command.assert_called_with(
input_variable_name, input_variable_value, output_variable_name
)
def test_to_command_invalid():
input_variable_name = "input"
input_variable_value = 42
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
assert_raises(
BadUserDataException,
sparkcommand.to_command,
"invalid",
input_variable_name,
input_variable_value,
output_variable_name,
)
def test_should_raise_when_input_aint_a_string():
input_variable_name = "input"
input_variable_value = 42
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
assert_raises(
BadUserDataException,
sparkcommand.to_command,
"spark",
input_variable_name,
input_variable_value,
output_variable_name,
)
def test_should_create_a_valid_scala_expression():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
assert_equals(
sparkcommand._scala_command(
input_variable_name, input_variable_value, output_variable_name
),
Command('var {} = """{}"""'.format(output_variable_name, input_variable_value)),
)
def test_should_create_a_valid_python_expression():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
assert_equals(
sparkcommand._pyspark_command(
input_variable_name, input_variable_value, output_variable_name
),
Command("{} = {}".format(output_variable_name, repr(input_variable_value))),
)
def test_should_create_a_valid_r_expression():
input_variable_name = "input"
input_variable_value = "value"
output_variable_name = "output"
sparkcommand = SendStringToSparkCommand(
input_variable_name, input_variable_value, output_variable_name
)
assert_equals(
sparkcommand._r_command(
input_variable_name, input_variable_value, output_variable_name
),
Command(
"""assign("{}","{}")""".format(output_variable_name, input_variable_value)
),
)
| 32.164384
| 88
| 0.731474
| 491
| 4,696
| 6.474542
| 0.11609
| 0.233092
| 0.169865
| 0.186851
| 0.867883
| 0.863479
| 0.859704
| 0.831708
| 0.831708
| 0.804656
| 0
| 0.001334
| 0.201661
| 4,696
| 145
| 89
| 32.386207
| 0.846626
| 0.002555
| 0
| 0.601563
| 0
| 0
| 0.033054
| 0
| 0
| 0
| 0
| 0
| 0.070313
| 1
| 0.0625
| false
| 0
| 0.046875
| 0
| 0.109375
| 0
| 0
| 0
| 0
| null | 1
| 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
| 8
|
9d5e5b0ae2ce645aa528851be6013c1fa45994d0
| 245
|
py
|
Python
|
aws/cloudfront.py
|
anycode-inc/TerminalUI-CGI
|
8db7d19d25b0de6d599b9de8a4172d0668f4d688
|
[
"MIT"
] | null | null | null |
aws/cloudfront.py
|
anycode-inc/TerminalUI-CGI
|
8db7d19d25b0de6d599b9de8a4172d0668f4d688
|
[
"MIT"
] | null | null | null |
aws/cloudfront.py
|
anycode-inc/TerminalUI-CGI
|
8db7d19d25b0de6d599b9de8a4172d0668f4d688
|
[
"MIT"
] | null | null | null |
import subprocess as sp
def createDistribution(bucketName, defaultRootObject):
sp.getoutput("sudo aws cloudfront create-distribution --origin-domain-name {0}.s3.amazonaws.com --default-root-object {1}".format(bucketName, defaultRootObject))
| 61.25
| 165
| 0.8
| 29
| 245
| 6.758621
| 0.896552
| 0.27551
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013333
| 0.081633
| 245
| 4
| 165
| 61.25
| 0.857778
| 0
| 0
| 0
| 0
| 0.333333
| 0.434959
| 0.085366
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 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
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
19c1579a73815e114ba125542ef883dfa5231c68
| 8,911
|
py
|
Python
|
test/test_resolver_core/test_cname_and_name_server_resolution.py
|
jmiiller/dns_shark
|
80ee4c7ec32fc3fec202e5142cf745d432770947
|
[
"MIT"
] | 3
|
2020-01-21T20:32:35.000Z
|
2020-08-01T07:14:55.000Z
|
test/test_resolver_core/test_cname_and_name_server_resolution.py
|
jmiiller/dns_shark
|
80ee4c7ec32fc3fec202e5142cf745d432770947
|
[
"MIT"
] | 4
|
2020-01-20T01:16:39.000Z
|
2020-01-20T01:34:27.000Z
|
test/test_resolver_core/test_cname_and_name_server_resolution.py
|
jmiiller/dns_shark
|
80ee4c7ec32fc3fec202e5142cf745d432770947
|
[
"MIT"
] | null | null | null |
from unittest.mock import Mock
import unittest
from dns_shark.resolver_core import ResolverCore
from dns_shark.resource_record import ResourceRecord
from typing import List
class CnameAndNameServerResolutionTest(unittest.TestCase):
"""
Unit testing for resolver_core.
"""
@classmethod
def setUpClass(cls):
"""
Initialize test values used in the tests.
"""
cls.first_response: bytes = bytes.fromhex('ef7c800000010000000400080766696e616e636506676f6f676c650263610000010001c01b000200010002a300000f01630a63612d73657276657273c01bc01b000200010002a3000004016ac031c01b000200010002a30000040178c031c01b000200010002a300000603616e79c031c02f000100010002a3000004b99fc402c04a000100010002a3000004c6b6a701c05a000100010002a3000004c7fdfa44c06a000100010002a3000004c7049002c02f001c00010002a30000102620010a805300000000000000000002c04a001c00010002a300001020010500008300000000000000000001c05a001c00010002a30000102620010a80ba00000000000000000068c06a001c00010002a30000102001050000a700000000000000000002')
cls.second_response: bytes = bytes.fromhex('e38a800000010000000400000766696e616e636506676f6f676c650263610000010001c01400020001000151800010036e733106676f6f676c6503636f6d00c02300020001000151800006036e7332c033c02300020001000151800006036e7333c033c02300020001000151800006036e7334c033')
cls.third_response: bytes = bytes.fromhex('7d57800000010000000d000e036e733106676f6f676c6503636f6d0000010001c017000200010002a300001401610c67746c642d73657276657273036e657400c017000200010002a30000040162c02ec017000200010002a30000040163c02ec017000200010002a30000040164c02ec017000200010002a30000040165c02ec017000200010002a30000040166c02ec017000200010002a30000040167c02ec017000200010002a30000040168c02ec017000200010002a30000040169c02ec017000200010002a3000004016ac02ec017000200010002a3000004016bc02ec017000200010002a3000004016cc02ec017000200010002a3000004016dc02ec02c000100010002a3000004c005061ec04c000100010002a3000004c0210e1ec05c000100010002a3000004c01a5c1ec06c000100010002a3000004c01f501ec07c000100010002a3000004c00c5e1ec08c000100010002a3000004c023331ec09c000100010002a3000004c02a5d1ec0ac000100010002a3000004c036701ec0bc000100010002a3000004c02bac1ec0cc000100010002a3000004c0304f1ec0dc000100010002a3000004c034b21ec0ec000100010002a3000004c029a21ec0fc000100010002a3000004c037531ec02c001c00010002a300001020010503a83e00000000000000020030')
cls.fourth_response: bytes = bytes.fromhex('7c2f80000001000000040008036e733106676f6f676c6503636f6d0000010001c010000200010002a3000006036e7332c010c010000200010002a3000002c00cc010000200010002a3000006036e7333c010c010000200010002a3000006036e7334c010c02c001c00010002a30000102001486048020034000000000000000ac02c000100010002a3000004d8ef220ac00c001c00010002a30000102001486048020032000000000000000ac00c000100010002a3000004d8ef200ac04c001c00010002a30000102001486048020036000000000000000ac04c000100010002a3000004d8ef240ac05e001c00010002a30000102001486048020038000000000000000ac05e000100010002a3000004d8ef260a')
cls.fifth_response: bytes = bytes.fromhex('5aeb84000001000100000000036e733106676f6f676c6503636f6d0000010001c00c00010001000546000004d8ef200a')
cls.sixth_response: bytes = bytes.fromhex('741f840000010003000000000766696e616e636506676f6f676c650263610000010001c00c000500010005460000140766696e616e636506676f6f676c6503636f6d00c02f0005000100093a8000090477777733016cc037c04f000100010000012c0004d83ac14e')
cls.seventh_response: bytes = bytes.fromhex('9c5b800000010000000d000e0766696e616e636506676f6f676c6503636f6d0000010001c01b000200010002a300001401610c67746c642d73657276657273036e657400c01b000200010002a30000040162c032c01b000200010002a30000040163c032c01b000200010002a30000040164c032c01b000200010002a30000040165c032c01b000200010002a30000040166c032c01b000200010002a30000040167c032c01b000200010002a30000040168c032c01b000200010002a30000040169c032c01b000200010002a3000004016ac032c01b000200010002a3000004016bc032c01b000200010002a3000004016cc032c01b000200010002a3000004016dc032c030000100010002a3000004c005061ec050000100010002a3000004c0210e1ec060000100010002a3000004c01a5c1ec070000100010002a3000004c01f501ec080000100010002a3000004c00c5e1ec090000100010002a3000004c023331ec0a0000100010002a3000004c02a5d1ec0b0000100010002a3000004c036701ec0c0000100010002a3000004c02bac1ec0d0000100010002a3000004c0304f1ec0e0000100010002a3000004c034b21ec0f0000100010002a3000004c029a21ec100000100010002a3000004c037531ec030001c00010002a300001020010503a83e00000000000000020030')
cls.eighth_response: bytes = bytes.fromhex('e78c800000010000000400080766696e616e636506676f6f676c6503636f6d0000010001c014000200010002a3000006036e7332c014c014000200010002a3000006036e7331c014c014000200010002a3000006036e7333c014c014000200010002a3000006036e7334c014c030001c00010002a30000102001486048020034000000000000000ac030000100010002a3000004d8ef220ac042001c00010002a30000102001486048020032000000000000000ac042000100010002a3000004d8ef200ac054001c00010002a30000102001486048020036000000000000000ac054000100010002a3000004d8ef240ac066001c00010002a30000102001486048020038000000000000000ac066000100010002a3000004d8ef260a')
cls.ninth_response: bytes = bytes.fromhex('47e2840000010002000000000766696e616e636506676f6f676c6503636f6d0000010001c00c0005000100093a8000090477777733016cc014c030000100010000012c0004d83ac14e')
cls.tenth_response: bytes = bytes.fromhex('4fa6800000010000000d000e0477777733016c06676f6f676c6503636f6d0000010001c01a000200010002a300001401610c67746c642d73657276657273036e657400c01a000200010002a30000040162c031c01a000200010002a30000040163c031c01a000200010002a30000040164c031c01a000200010002a30000040165c031c01a000200010002a30000040166c031c01a000200010002a30000040167c031c01a000200010002a30000040168c031c01a000200010002a30000040169c031c01a000200010002a3000004016ac031c01a000200010002a3000004016bc031c01a000200010002a3000004016cc031c01a000200010002a3000004016dc031c02f000100010002a3000004c005061ec04f000100010002a3000004c0210e1ec05f000100010002a3000004c01a5c1ec06f000100010002a3000004c01f501ec07f000100010002a3000004c00c5e1ec08f000100010002a3000004c023331ec09f000100010002a3000004c02a5d1ec0af000100010002a3000004c036701ec0bf000100010002a3000004c02bac1ec0cf000100010002a3000004c0304f1ec0df000100010002a3000004c034b21ec0ef000100010002a3000004c029a21ec0ff000100010002a3000004c037531ec02f001c00010002a300001020010503a83e00000000000000020030')
cls.eleventh_response: bytes = bytes.fromhex('599a800000010000000400080477777733016c06676f6f676c6503636f6d0000010001c013000200010002a3000006036e7332c013c013000200010002a3000006036e7331c013c013000200010002a3000006036e7333c013c013000200010002a3000006036e7334c013c02f001c00010002a30000102001486048020034000000000000000ac02f000100010002a3000004d8ef220ac041001c00010002a30000102001486048020032000000000000000ac041000100010002a3000004d8ef200ac053001c00010002a30000102001486048020036000000000000000ac053000100010002a3000004d8ef240ac065001c00010002a30000102001486048020038000000000000000ac065000100010002a3000004d8ef260a')
cls.authoritative_response: bytes = bytes.fromhex('603c840000010001000000000477777733016c06676f6f676c6503636f6d0000010001c00c000100010000012c0004d83ac14e')
cls.mock_socket: Mock = Mock(**{'recv.side_effect': [cls.first_response,
cls.second_response,
cls.third_response,
cls.fourth_response,
cls.fifth_response,
cls.sixth_response,
cls.seventh_response,
cls.eighth_response,
cls.ninth_response,
cls.tenth_response,
cls.eleventh_response,
cls.authoritative_response]})
cls.mock_random: Mock = Mock(**{'randint.side_effect': [0xef7c, 0xe38a, 0x7d57, 0x7c2f, 0x5aeb, 0x741f, 0x9c5b,
0xe78c, 0x47e2, 0x4fa6, 0x599a, 0x603c]})
def test_cname_resolution(self):
"""
Test case for when two different cname resolutions and one name server resolution
needs to be performed before finding an authoritative response.
"""
resolver: ResolverCore = ResolverCore(self.mock_socket, False, "1.2.3.4", self.mock_random)
answers: List[ResourceRecord] = resolver.resolve_domain_name("finance.google.ca", "1.2.3.4", 1)
expected_answer: List[ResourceRecord] = [ResourceRecord('www3.l.google.com', 1, 1, 300, 4, '216.58.193.78')]
self.assertEqual(answers, expected_answer)
| 123.763889
| 1,047
| 0.842554
| 271
| 8,911
| 27.553506
| 0.431734
| 0.020892
| 0.028927
| 0.040177
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.674955
| 0.128942
| 8,911
| 71
| 1,048
| 125.507042
| 0.287039
| 0.024576
| 0
| 0
| 0
| 0
| 0.708734
| 0.697599
| 0
| 1
| 0.008352
| 0
| 0.025641
| 1
| 0.051282
| false
| 0
| 0.128205
| 0
| 0.205128
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
19e2d2753bbdd1ab62a6ba031c20f2943dfa43bb
| 9,688
|
py
|
Python
|
bs4/webscraping15.py
|
dirleif/aprendendo-scraping
|
0850897c019402c897e9ec58160a13aec2e02665
|
[
"MIT"
] | null | null | null |
bs4/webscraping15.py
|
dirleif/aprendendo-scraping
|
0850897c019402c897e9ec58160a13aec2e02665
|
[
"MIT"
] | null | null | null |
bs4/webscraping15.py
|
dirleif/aprendendo-scraping
|
0850897c019402c897e9ec58160a13aec2e02665
|
[
"MIT"
] | null | null | null |
"""
parseando arquivo html
buscando elementos com find_next/find_all_next/find_previous/find_all_previous
parser lxml
"""
# importando modulo BeautifulSoup do pacote bs4
from bs4 import BeautifulSoup
# abrir arquivo para leitura
with open('arquivo03.html','r') as f:
soup = BeautifulSoup(f, 'lxml')
producers = soup.find(id = 'producers')
tag_next = producers.find_next()
print(tag_next)
"""
<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>
"""
producers = soup.find(id = 'producers')
tag_next = producers.find_all_next()
print(tag_next)
"""
[<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>, <div class="name">plants</div>, <div class="number">100000</div>, <li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>, <div class="name">algae</div>, <div class="number">100000</div>, <ul id="primaryconsumers">
<li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>
<li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>
</ul>, <li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>, <div class="name">deer</div>, <div class="number">1000</div>, <li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>, <div class="name">rabbit</div>, <div class="number">2000</div>, <ul id="secondaryconsumers">
<li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>
<li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>
</ul>, <li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>, <div class="name">fox</div>, <div class="number">100</div>, <li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>, <div class="name">bear</div>, <div class="number">100</div>, <ul id="tertiaryconsumers">
<li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>
<li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>
</ul>, <li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>, <div class="name">lion</div>, <div class="number">80</div>, <li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>, <div class="name">tiger</div>, <div class="number">50</div>, <ul id="quaternaryconsumers">
<li class="quaternaryconsumerlist">
<div class="name animal">tutle</div>
<div class="number">1000</div>
</li>
<li class="quaternaryconsumerlist">
<div class="name animal">giraffe</div>
<div class="number">100</div>
</li>
</ul>, <li class="quaternaryconsumerlist">
<div class="name animal">tutle</div>
<div class="number">1000</div>
</li>, <div class="name animal">tutle</div>, <div class="number">1000</div>, <li class="quaternaryconsumerlist">
<div class="name animal">giraffe</div>
<div class="number">100</div>
</li>, <div class="name animal">giraffe</div>, <div class="number">100</div>]
"""
producers = soup.find(id = 'quaternaryconsumers')
tag_previous = producers.find_previous()
print(tag_previous)
#<div class="number">50</div>
producers = soup.find(id = 'quaternaryconsumers')
tag_previous = producers.find_all_previous()
print(tag_previous)
"""
[<div class="number">50</div>, <div class="name">tiger</div>, <li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>, <div class="number">80</div>, <div class="name">lion</div>, <li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>, <ul id="tertiaryconsumers">
<li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>
<li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>
</ul>, <div class="number">100</div>, <div class="name">bear</div>, <li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>, <div class="number">100</div>, <div class="name">fox</div>, <li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>, <ul id="secondaryconsumers">
<li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>
<li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>
</ul>, <div class="number">2000</div>, <div class="name">rabbit</div>, <li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>, <div class="number">1000</div>, <div class="name">deer</div>, <li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>, <ul id="primaryconsumers">
<li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>
<li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>
</ul>, <div class="number">100000</div>, <div class="name">algae</div>, <li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>, <div class="number">100000</div>, <div class="name">plants</div>, <li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>, <ul id="producers">
<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>
<li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>
</ul>, <div class="ecopyramid">
<ul id="producers">
<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>
<li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>
</ul>
<ul id="primaryconsumers">
<li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>
<li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>
</ul>
<ul id="secondaryconsumers">
<li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>
<li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>
</ul>
<ul id="tertiaryconsumers">
<li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>
<li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>
</ul>
<ul id="quaternaryconsumers">
<li class="quaternaryconsumerlist">
<div class="name animal">tutle</div>
<div class="number">1000</div>
</li>
<li class="quaternaryconsumerlist">
<div class="name animal">giraffe</div>
<div class="number">100</div>
</li>
</ul>
</div>, <body>
<div class="ecopyramid">
<ul id="producers">
<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>
<li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>
</ul>
<ul id="primaryconsumers">
<li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>
<li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>
</ul>
<ul id="secondaryconsumers">
<li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>
<li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>
</ul>
<ul id="tertiaryconsumers">
<li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>
<li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>
</ul>
<ul id="quaternaryconsumers">
<li class="quaternaryconsumerlist">
<div class="name animal">tutle</div>
<div class="number">1000</div>
</li>
<li class="quaternaryconsumerlist">
<div class="name animal">giraffe</div>
<div class="number">100</div>
</li>
</ul>
</div>
</body>, <html>
<body>
<div class="ecopyramid">
<ul id="producers">
<li class="producerlist">
<div class="name">plants</div>
<div class="number">100000</div>
</li>
<li class="producerlist">
<div class="name">algae</div>
<div class="number">100000</div>
</li>
</ul>
<ul id="primaryconsumers">
<li class="primaryconsumerlist">
<div class="name">deer</div>
<div class="number">1000</div>
</li>
<li class="primaryconsumerlist">
<div class="name">rabbit</div>
<div class="number">2000</div>
</li>
</ul>
<ul id="secondaryconsumers">
<li class="secondaryconsumerlist">
<div class="name">fox</div>
<div class="number">100</div>
</li>
<li class="secondaryconsumerlist">
<div class="name">bear</div>
[ 28 ]
www.it-ebooks.infoChapter 3
<div class="number">100</div>
</li>
</ul>
<ul id="tertiaryconsumers">
<li class="tertiaryconsumerlist">
<div class="name">lion</div>
<div class="number">80</div>
</li>
<li class="tertiaryconsumerlist">
<div class="name">tiger</div>
<div class="number">50</div>
</li>
</ul>
<ul id="quaternaryconsumers">
<li class="quaternaryconsumerlist">
<div class="name animal">tutle</div>
<div class="number">1000</div>
</li>
<li class="quaternaryconsumerlist">
<div class="name animal">giraffe</div>
<div class="number">100</div>
</li>
</ul>
</div>
</body>
</html>]
"""
| 28.410557
| 112
| 0.679088
| 1,356
| 9,688
| 4.837021
| 0.054572
| 0.207349
| 0.179296
| 0.176246
| 0.963714
| 0.945419
| 0.940235
| 0.938405
| 0.919957
| 0.892057
| 0
| 0.037597
| 0.085776
| 9,688
| 340
| 113
| 28.494118
| 0.702947
| 0.022192
| 0
| 0.533333
| 0
| 0
| 0.142857
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.066667
| 0
| 0.066667
| 0.266667
| 0
| 0
| 0
| null | 1
| 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
| 8
|
dffa6397258fd9e2c8c8d14b010235f68e6e7a17
| 8,742
|
py
|
Python
|
denet/layer/pool_inv_op.py
|
lachlants/denet
|
3337c54168b925d1f9d221e5df0201503b2e61c1
|
[
"BSD-3-Clause"
] | 121
|
2017-07-20T12:02:57.000Z
|
2021-05-29T09:24:46.000Z
|
denet/layer/pool_inv_op.py
|
m-kashani/denet
|
3337c54168b925d1f9d221e5df0201503b2e61c1
|
[
"BSD-3-Clause"
] | 7
|
2017-07-21T08:07:52.000Z
|
2018-11-22T09:47:32.000Z
|
denet/layer/pool_inv_op.py
|
m-kashani/denet
|
3337c54168b925d1f9d221e5df0201503b2e61c1
|
[
"BSD-3-Clause"
] | 28
|
2017-10-06T12:49:27.000Z
|
2021-03-12T07:55:32.000Z
|
import os
import theano
import theano.tensor as tensor
from theano.sandbox.cuda import GpuOp
from theano.sandbox.cuda.basic_ops import as_cuda_ndarray_variable, gpu_contiguous
class PoolInvOp(GpuOp):
def __init__(self, size):
self.size = size
def __eq__(self, other):
return type(self) == type(other) and self.size == other.size
def __hash__(self):
return hash((type(self), self.size[0], self.size[1]))
def __str__(self):
return self.__class__.__name__
def make_node(self, fmap):
fmap = as_cuda_ndarray_variable(fmap)
assert fmap.ndim == 4
return theano.Apply(self, [fmap], [fmap.type()])
def infer_shape(self, node, in_shapes):
b,f,h,w = in_shapes[0]
return [(b, f, h*self.size[1], w*self.size[0])]
def grad(self, inputs, output_grads):
dy, = output_grads
return [PoolInvGradOp(self.size)(dy)]
def c_support_code(self):
size_w = self.size[0]
size_h = self.size[1]
return """
static __global__ void k_pool_inv_%(size_w)ix%(size_h)i(float* fmap, size_t fs0, size_t fs1, size_t fs2, size_t fs3,
float* r, size_t rs0, size_t rs1, size_t rs2, size_t rs3,
size_t bs, size_t fn, size_t h, size_t w){
size_t index = blockIdx.x*blockDim.x + threadIdx.x;
if (index >= (bs*h*w))
return;
int b,y,x;
b = index / (h*w);
index -= b*(h*w);
y = index / w;
index -= y*w;
x = index;
//printf("b=%%i,y=%%i,x=%%i\\n",b,y,x);
const size_t size_w = %(size_w)i;
const size_t size_h = %(size_h)i;
for(size_t f=0; f < fn; f++){
for(size_t ry = y*size_h; ry < (y*size_h + size_h); ry++){
for(size_t rx = x*size_w; rx < (x*size_w + size_w); rx++){
r[b*rs0 + f*rs1 + ry*rs2 + rx*rs3] = fmap[b*fs0 + f*fs1 + y*fs2 + x*fs3];
}
}
}
};
"""%locals()
def c_code(self, node, name, inputs, output, sub):
fmap, = inputs
result, = output
fail = sub['fail']
size_w = self.size[0]
size_h = self.size[1]
return """
size_t batch_size = CudaNdarray_HOST_DIMS(%(fmap)s)[0];
size_t feature_num = CudaNdarray_HOST_DIMS(%(fmap)s)[1];
size_t height = CudaNdarray_HOST_DIMS(%(fmap)s)[2];
size_t width = CudaNdarray_HOST_DIMS(%(fmap)s)[3];
//choose grid / block dim
size_t total_threads = batch_size*height*width;
size_t threads_per_block = 1024;
size_t grid_num = std::ceil((double)total_threads / threads_per_block);
dim3 grid_dim(grid_num, 1, 1);
dim3 block_dim(threads_per_block, 1, 1);
cudaError_t err;
const size_t size_w = %(size_w)i;
const size_t size_h = %(size_h)i;
int dims[] = {batch_size, feature_num, height*size_h, width*size_w};
if (CudaNdarray_prep_output(&%(result)s, 4, dims) != 0){
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output array");
%(fail)s
}
//printf("result shape =(%%i,%%i,%%i,%%i)", CudaNdarray_HOST_DIMS(%(result)s)[0],
// CudaNdarray_HOST_DIMS(%(result)s)[1], CudaNdarray_HOST_DIMS(%(result)s)[2],
// CudaNdarray_HOST_DIMS(%(result)s)[3]);
//printf("batch_size %%i, feature_num=%%i, grid_size=%%i, sample_num=%%i\\n", batch_size, feature_num, grid_size, sample_num);
k_pool_inv_%(size_w)ix%(size_h)i<<<grid_dim, block_dim>>>(
CudaNdarray_DEV_DATA(%(fmap)s),
CudaNdarray_HOST_STRIDES(%(fmap)s)[0],
CudaNdarray_HOST_STRIDES(%(fmap)s)[1],
CudaNdarray_HOST_STRIDES(%(fmap)s)[2],
CudaNdarray_HOST_STRIDES(%(fmap)s)[3],
CudaNdarray_DEV_DATA(%(result)s),
CudaNdarray_HOST_STRIDES(%(result)s)[0],
CudaNdarray_HOST_STRIDES(%(result)s)[1],
CudaNdarray_HOST_STRIDES(%(result)s)[2],
CudaNdarray_HOST_STRIDES(%(result)s)[3],
batch_size, feature_num, height, width);
CNDA_THREAD_SYNC;
err = cudaGetLastError();
if (err != cudaSuccess){
PyErr_Format(PyExc_RuntimeError, "Cuda error: %%s:\\n", cudaGetErrorString(err));
%(fail)s
}
"""%locals()
def c_code_cache_version(self):
return (0,5)
class PoolInvGradOp(GpuOp):
def __init__(self, size):
self.size = size
def __eq__(self, other):
return type(self) == type(other) and self.size == other.size
def __hash__(self):
return hash((type(self), self.size[0], self.size[1]))
def __str__(self):
return self.__class__.__name__
def make_node(self, dy):
dy = as_cuda_ndarray_variable(dy)
assert dy.ndim == 4
return theano.Apply(self, [dy], [dy.type()])
def c_support_code(self):
size_w = self.size[0]
size_h = self.size[1]
return """
static __global__ void k_pool_inv_grad_%(size_w)ix%(size_h)i(float* fmap, size_t fs0, size_t fs1, size_t fs2, size_t fs3,
float* r, size_t rs0, size_t rs1, size_t rs2, size_t rs3,
size_t bs, size_t fn, size_t h, size_t w){
size_t index = blockIdx.x*blockDim.x + threadIdx.x;
if (index >= (bs*h*w))
return;
int b,y,x;
b = index / (h*w);
index -= b*(h*w);
y = index / w;
index -= y*w;
x = index;
const size_t size_w = %(size_w)i;
const size_t size_h = %(size_h)i;
for(size_t f=0; f < fn; f++){
r[b*rs0 + f*rs1 + y*rs2 + x*rs3] = 0.0;
for(size_t ry = y*size_h; ry < (y*size_h + size_h); ry++){
for(size_t rx = x*size_w; rx < (x*size_w + size_w); rx++){
r[b*rs0 + f*rs1 + y*rs2 + x*rs3] += fmap[b*fs0 + f*fs1 + ry*fs2 + rx*fs3];
}
}
}
};
"""%locals()
def c_code(self, node, name, inputs, output, sub):
dy, = inputs
result, = output
fail = sub['fail']
size_w = self.size[0]
size_h = self.size[1]
return """
size_t batch_size = CudaNdarray_HOST_DIMS(%(dy)s)[0];
size_t feature_num = CudaNdarray_HOST_DIMS(%(dy)s)[1];
size_t height = CudaNdarray_HOST_DIMS(%(dy)s)[2] / %(size_h)i;
size_t width = CudaNdarray_HOST_DIMS(%(dy)s)[3] / %(size_w)i;
//choose grid / block dim
size_t total_threads = batch_size*height*width;
size_t threads_per_block = 1024;
size_t grid_num = std::ceil((double)total_threads / threads_per_block);
dim3 grid_dim(grid_num, 1, 1);
dim3 block_dim(threads_per_block, 1, 1);
cudaError_t err;
int dims[] = {batch_size, feature_num, height, width};
if (CudaNdarray_prep_output(&%(result)s, 4, dims) != 0){
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output array");
%(fail)s
}
k_pool_inv_grad_%(size_w)ix%(size_h)i<<<grid_dim, block_dim>>>(
CudaNdarray_DEV_DATA(%(dy)s),
CudaNdarray_HOST_STRIDES(%(dy)s)[0],
CudaNdarray_HOST_STRIDES(%(dy)s)[1],
CudaNdarray_HOST_STRIDES(%(dy)s)[2],
CudaNdarray_HOST_STRIDES(%(dy)s)[3],
CudaNdarray_DEV_DATA(%(result)s),
CudaNdarray_HOST_STRIDES(%(result)s)[0],
CudaNdarray_HOST_STRIDES(%(result)s)[1],
CudaNdarray_HOST_STRIDES(%(result)s)[2],
CudaNdarray_HOST_STRIDES(%(result)s)[3],
batch_size, feature_num, height, width);
CNDA_THREAD_SYNC;
err = cudaGetLastError();
if (err != cudaSuccess){
PyErr_Format(PyExc_RuntimeError, "Cuda error: %%s:\\n", cudaGetErrorString(err));
%(fail)s
}
"""%locals()
def c_code_cache_version(self):
return (1,0)
| 39.026786
| 135
| 0.516815
| 1,146
| 8,742
| 3.656195
| 0.123909
| 0.062053
| 0.08401
| 0.053461
| 0.854893
| 0.772076
| 0.738186
| 0.722912
| 0.707637
| 0.682578
| 0
| 0.019912
| 0.350835
| 8,742
| 223
| 136
| 39.201794
| 0.718414
| 0
| 0
| 0.641711
| 0
| 0.042781
| 0.737849
| 0.215544
| 0
| 0
| 0
| 0
| 0.010695
| 1
| 0.096257
| false
| 0
| 0.026738
| 0.042781
| 0.219251
| 0.016043
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
5f2e1bc20c7c413e63b2794ccfc851344177b41e
| 2,905
|
py
|
Python
|
pyramid_journal/tests.py
|
jjskim/pyramid-journal
|
2c45e77a11f6848570b356541a99e6b565ed464f
|
[
"MIT"
] | null | null | null |
pyramid_journal/tests.py
|
jjskim/pyramid-journal
|
2c45e77a11f6848570b356541a99e6b565ed464f
|
[
"MIT"
] | 3
|
2019-12-26T16:39:18.000Z
|
2021-06-01T21:55:49.000Z
|
pyramid_journal/tests.py
|
jjskim/pyramid-journal
|
2c45e77a11f6848570b356541a99e6b565ed464f
|
[
"MIT"
] | null | null | null |
"""Test file for app views."""
from __future__ import unicode_literals
from pyramid import testing
import pytest
@pytest.fixture
def dummy_request():
"""Fixture to return a single dummy request."""
return testing.DummyRequest()
def test_list_view_response_status_code_200(dummy_request):
"""Test that requesting list_view returns a 200 response."""
from pyramid_journal.views.default import list_view
response = list_view(dummy_request)
assert response.status_code == 200
def test_detail_view_response_status_code_200(dummy_request):
"""Test that requesting detail_view returns a 200 response."""
from pyramid_journal.views.default import detail_view
response = detail_view(dummy_request)
assert response.status_code == 200
def test_update_view_response_status_code_200(dummy_request):
"""Test that requesting update_view returns a 200 response."""
from pyramid_journal.views.default import update_view
response = update_view(dummy_request)
assert response.status_code == 200
def test_create_view_response_status_code_200(dummy_request):
"""Test that requesting create_view returns a 200 response."""
from pyramid_journal.views.default import create_view
response = create_view(dummy_request)
assert response.status_code == 200
def test_list_view_text_response_is_content_type_html(dummy_request):
"""Test that list_view returns proper content within text."""
from pyramid_journal.views.default import list_view
response = list_view(dummy_request)
assert response.content_type == "text/html"
def test_list_view_text_response_has_proper_content(dummy_request):
"""Test that list_view returns proper content within text."""
from pyramid_journal.views.default import list_view
response = list_view(dummy_request)
the_tag = '<div class="entry_summary">'
assert the_tag in response.ubody
def test_detail_view_text_response_has_proper_content(dummy_request):
"""Test that detail_view returns proper content within text."""
from pyramid_journal.views.default import detail_view
response = detail_view(dummy_request)
the_tag = '<a href="/journal/1/edit-entry">Edit</a>'
assert the_tag in response.ubody
def test_edit_view_text_response_has_proper_content(dummy_request):
"""Test that edit_view returns proper content within text."""
from pyramid_journal.views.default import update_view
response = update_view(dummy_request)
the_tag = '<button type="submit">Edit Post</button>'
assert the_tag in response.ubody
def test_create_view_text_response_has_proper_content(dummy_request):
"""Test that create_view returns proper content within text."""
from pyramid_journal.views.default import create_view
response = create_view(dummy_request)
the_tag = '<button type="submit">Create New</button>'
assert the_tag in response.ubody
| 36.772152
| 69
| 0.777281
| 407
| 2,905
| 5.218673
| 0.14742
| 0.112994
| 0.067797
| 0.084746
| 0.832392
| 0.826742
| 0.812147
| 0.793785
| 0.725047
| 0.725047
| 0
| 0.014907
| 0.145611
| 2,905
| 78
| 70
| 37.24359
| 0.840854
| 0.198279
| 0
| 0.565217
| 0
| 0
| 0.069072
| 0.025957
| 0
| 0
| 0
| 0
| 0.195652
| 1
| 0.217391
| false
| 0
| 0.26087
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a05602803b1dbc6a53a084aeafa354778a424725
| 7,630
|
py
|
Python
|
problem/migrations/0001_initial.py
|
AngleMAXIN/nomooc
|
0c06b8af405b8254c242b34e85b7cba99c8f5737
|
[
"MIT"
] | 1
|
2019-12-04T03:20:16.000Z
|
2019-12-04T03:20:16.000Z
|
problem/migrations/0001_initial.py
|
AngleMAXIN/NoMooc
|
0c06b8af405b8254c242b34e85b7cba99c8f5737
|
[
"MIT"
] | null | null | null |
problem/migrations/0001_initial.py
|
AngleMAXIN/NoMooc
|
0c06b8af405b8254c242b34e85b7cba99c8f5737
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2019-09-19 03:48
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import utils.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ContestProblem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('_id', models.IntegerField(db_index=True, verbose_name='编号')),
('is_public', models.BooleanField(default=False, verbose_name='是否公开')),
('title', utils.models.MyCharField(default='题目标题', max_length=45)),
('description', utils.models.MyRichTextField(verbose_name='描述')),
('input_description', utils.models.MyRichTextField(verbose_name='输入描述')),
('output_description', utils.models.MyRichTextField(verbose_name='输出描述')),
('samples', utils.models.MyJSONField(verbose_name='例子')),
('test_case_id', models.CharField(default='', max_length=200, verbose_name='测试用例')),
('test_case_score', utils.models.MyJSONField(verbose_name='测试用例详情')),
('hint', utils.models.MyRichTextField(null=True, verbose_name='提示')),
('spj', models.BooleanField(default=False, verbose_name='是否为spj')),
('languages', utils.models.MyJSONField(verbose_name='支持语言')),
('template', utils.models.MyJSONField(default={}, verbose_name='模板')),
('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('last_update_time', models.DateTimeField(null=True, verbose_name='最近修改时间')),
('time_limit', models.IntegerField(verbose_name='cpu时间限制')),
('memory_limit', models.IntegerField(verbose_name='内存限制')),
('rule_type', utils.models.MyCharField(default='ACM', max_length=3, verbose_name='比赛类型')),
('visible', models.BooleanField(default=True, verbose_name='是否可见')),
('difficulty', utils.models.MyCharField(default='', max_length=3, verbose_name='难度')),
('bank', models.SmallIntegerField(default=1, verbose_name='题库')),
('answer', utils.models.MyJSONField(default=[], verbose_name='答案')),
('total_score', models.IntegerField(default=0)),
('submission_number', models.IntegerField(default=0, verbose_name='提交次数')),
('accepted_number', models.IntegerField(default=0, verbose_name='通过次数')),
('statistic_info', utils.models.MyJSONField(default=dict)),
('test_cases', utils.models.MyJSONField(default=[], verbose_name='测试用例')),
('contest_id', models.PositiveIntegerField(default=0, verbose_name='竞赛id')),
('source',
models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
verbose_name='来源')),
],
options={
'db_table': 'contest_problem',
},
),
migrations.CreateModel(
name='ContestProblemBasketModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uid', models.IntegerField(verbose_name='用户id')),
('problem_basket', utils.models.MyJSONField(verbose_name='试题篮')),
],
options={
'db_table': 'problem_basket',
},
),
migrations.CreateModel(
name='Problem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('_id', models.IntegerField(db_index=True, verbose_name='编号')),
('is_public', models.BooleanField(default=False, verbose_name='是否公开')),
('title', utils.models.MyCharField(default='题目标题', max_length=45)),
('description', utils.models.MyRichTextField(verbose_name='描述')),
('input_description', utils.models.MyRichTextField(verbose_name='输入描述')),
('output_description', utils.models.MyRichTextField(verbose_name='输出描述')),
('samples', utils.models.MyJSONField(verbose_name='例子')),
('test_case_id', models.CharField(default='', max_length=200, verbose_name='测试用例')),
('test_case_score', utils.models.MyJSONField(verbose_name='测试用例详情')),
('hint', utils.models.MyRichTextField(null=True, verbose_name='提示')),
('spj', models.BooleanField(default=False, verbose_name='是否为spj')),
('languages', utils.models.MyJSONField(verbose_name='支持语言')),
('template', utils.models.MyJSONField(default={}, verbose_name='模板')),
('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('last_update_time', models.DateTimeField(null=True, verbose_name='最近修改时间')),
('time_limit', models.IntegerField(verbose_name='cpu时间限制')),
('memory_limit', models.IntegerField(verbose_name='内存限制')),
('rule_type', utils.models.MyCharField(default='ACM', max_length=3, verbose_name='比赛类型')),
('visible', models.BooleanField(default=True, verbose_name='是否可见')),
('difficulty', utils.models.MyCharField(default='', max_length=3, verbose_name='难度')),
('bank', models.SmallIntegerField(default=1, verbose_name='题库')),
('answer', utils.models.MyJSONField(default=[], verbose_name='答案')),
('total_score', models.IntegerField(default=0)),
('submission_number', models.IntegerField(default=0, verbose_name='提交次数')),
('accepted_number', models.IntegerField(default=0, verbose_name='通过次数')),
('statistic_info', utils.models.MyJSONField(default=dict)),
('test_cases', utils.models.MyJSONField(default=[], verbose_name='测试用例')),
('old_pro_id', models.IntegerField(default=0, verbose_name='公有题库试题id')),
('source',
models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
verbose_name='来源')),
],
options={
'db_table': 'problem',
},
),
migrations.CreateModel(
name='ProblemTag',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='', max_length=25, verbose_name='名称')),
],
options={
'db_table': 'problem_tag',
},
),
migrations.AddField(
model_name='problem',
name='tags',
field=models.ManyToManyField(default='', to='problem.ProblemTag', verbose_name='标签'),
),
migrations.AlterUniqueTogether(
name='contestproblem',
unique_together=set([('id', 'contest_id')]),
),
migrations.AlterIndexTogether(
name='contestproblem',
index_together=set([('id', 'contest_id')]),
),
]
| 56.518519
| 120
| 0.589908
| 733
| 7,630
| 5.934516
| 0.222374
| 0.151724
| 0.075862
| 0.053333
| 0.797011
| 0.772184
| 0.763678
| 0.763678
| 0.763678
| 0.763678
| 0
| 0.007593
| 0.257798
| 7,630
| 134
| 121
| 56.940299
| 0.760551
| 0.008912
| 0
| 0.706349
| 1
| 0
| 0.138907
| 0.003307
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.039683
| 0
| 0.071429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a07c8403869a66cf810f29966ebaeb7db7f2eb15
| 45
|
py
|
Python
|
data/micro-benchmark/imports/init_func_import/nested/__init__.py
|
vitsalis/pycg-evaluation
|
ce37eb5668465b0c17371914e863d699826447ee
|
[
"Apache-2.0"
] | 121
|
2020-12-16T20:31:37.000Z
|
2022-03-21T20:32:43.000Z
|
data/micro-benchmark/imports/init_func_import/nested/__init__.py
|
vitsalis/pycg-evaluation
|
ce37eb5668465b0c17371914e863d699826447ee
|
[
"Apache-2.0"
] | 24
|
2021-03-13T00:04:00.000Z
|
2022-03-21T17:28:11.000Z
|
data/micro-benchmark/imports/init_func_import/nested/__init__.py
|
vitsalis/pycg-evaluation
|
ce37eb5668465b0c17371914e863d699826447ee
|
[
"Apache-2.0"
] | 19
|
2021-03-23T10:58:47.000Z
|
2022-03-24T19:46:50.000Z
|
from .mod import func2
def func():
pass
| 9
| 22
| 0.644444
| 7
| 45
| 4.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0.266667
| 45
| 4
| 23
| 11.25
| 0.848485
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| true
| 0.333333
| 0.333333
| 0
| 0.666667
| 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
| 1
| 1
| 0
| 1
| 0
|
0
| 8
|
a095eadf70fda60e35597acf984b1155d8982dc7
| 9,522
|
py
|
Python
|
tests/test_subcolumn_generator.py
|
isilber/EMC2
|
b500321743c10cca0067d71db7576b91369cbf46
|
[
"BSD-3-Clause"
] | 8
|
2019-10-14T15:08:37.000Z
|
2022-03-23T20:34:27.000Z
|
tests/test_subcolumn_generator.py
|
isilber/EMC2
|
b500321743c10cca0067d71db7576b91369cbf46
|
[
"BSD-3-Clause"
] | 20
|
2020-01-10T16:30:16.000Z
|
2022-03-23T20:17:45.000Z
|
tests/test_subcolumn_generator.py
|
isilber/EMC2
|
b500321743c10cca0067d71db7576b91369cbf46
|
[
"BSD-3-Clause"
] | 4
|
2019-10-07T14:58:24.000Z
|
2021-04-27T18:47:12.000Z
|
import emc2
import numpy as np
import xarray as xr
def test_set_convective_profile():
my_model = emc2.core.model.TestConvection()
column_ds = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
where_gt_1km = np.where(np.logical_and(column_ds.ds['height'] > 1000.,
column_ds.ds['t'] > 273.15))[0]
where_lt_1km = np.where(np.logical_and(column_ds.ds['height'] < 1000.,
column_ds.ds['t'] > 273.15))[0]
assert np.all(column_ds.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km, 0])
assert np.all(~column_ds.ds['conv_frac_subcolumns_cl'].values[:, where_lt_1km, 0])
# Set convective fraction to half, but still have 8 subcolumns
my_model.ds[my_model.conv_frac_names['cl']] *= 0.5
column_ds = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl')
assert np.all(column_ds.ds['conv_frac_subcolumns_cl'].values[:4, where_gt_1km, 0])
assert np.all(~column_ds.ds['conv_frac_subcolumns_cl'].values[4:, where_gt_1km, 0])
# Zero convection = all false arrays
my_model.ds[my_model.conv_frac_names['cl']] *= 0
column_ds = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl')
assert np.all(~column_ds.ds['conv_frac_subcolumns_cl'].values)
def test_set_stratiform_profile():
my_model = emc2.core.model.TestAllStratiform()
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
where_gt_1km = np.where(np.logical_and(my_model.ds['height'] > 1000.,
my_model.ds['t'] > 0))[0]
assert np.all(my_model.ds['strat_frac_subcolumns_cl'].values[:, where_gt_1km])
assert np.all(~my_model.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km])
my_model = emc2.core.model.TestHalfAndHalf()
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
where_gt_1km = np.where(np.logical_and(my_model.ds['z'] > 1000.,
my_model.ds['t'] > 0))[0]
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_cl'].values[:, where_gt_1km])
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km])
assert num_strat == num_conv
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_cl'].values[:, where_gt_1km[0]])
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km[0]])
assert num_strat == 480
assert num_conv == 480
my_model = emc2.core.model.TestHalfAndHalf()
my_model.ds[my_model.strat_frac_names['cl']] *= 0.5
my_model.ds[my_model.strat_frac_names['ci']] *= 0.5
my_model.ds[my_model.conv_frac_names['cl']] *= 0.5
my_model.ds[my_model.conv_frac_names['ci']] *= 0.5
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model, 'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model, 'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_cl'].values[:, where_gt_1km[1]])
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km[1]])
assert num_conv == 240
assert num_strat == 240
my_model = emc2.core.model.TestHalfAndHalf()
my_model.ds[my_model.strat_frac_names['cl']] *= 0.25
my_model.ds[my_model.strat_frac_names['ci']] *= 0.25
my_model.ds[my_model.conv_frac_names['cl']] *= 0.25
my_model.ds[my_model.conv_frac_names['ci']] *= 0.25
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model, 'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model, 'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_cl'].values[:, where_gt_1km[0]])
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_cl'].values[:, where_gt_1km[0]])
assert num_conv == 120
assert num_strat == 120
def test_set_precip_profile():
my_model = emc2.core.model.TestAllStratiform()
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=False)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=True)
where_gt_1km = np.where(np.logical_and(my_model.ds['height'] > 1000.,
my_model.ds['t'] > 274.15))[0]
assert np.all(my_model.ds['strat_frac_subcolumns_pl'].values[:, where_gt_1km])
assert np.all(~my_model.ds['conv_frac_subcolumns_pl'].values[:, where_gt_1km])
my_model = emc2.core.model.TestHalfAndHalf()
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=False)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=True)
where_gt_1km = np.where(np.logical_and(my_model.ds['height'] > 1000.,
my_model.ds['t'] > 274.15))[0]
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_pl'].values[:, where_gt_1km], axis=0)
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_pl'].values[:, where_gt_1km], axis=0)
assert np.all(num_strat == 4)
assert np.all(num_conv == 4)
my_model = emc2.core.model.TestHalfAndHalf()
my_model.ds[my_model.strat_frac_names['pl']] *= 0.25
my_model.ds[my_model.strat_frac_names['pi']] *= 0.25
my_model.ds[my_model.conv_frac_names['pl']] *= 0.5
my_model.ds[my_model.conv_frac_names['pi']] *= 0.5
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=False)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=True)
where_gt_1km = np.where(np.logical_and(my_model.ds['height'] > 1000.,
my_model.ds['t'] > 274.15))[0]
num_strat = np.sum(my_model.ds['strat_frac_subcolumns_pl'].values[:, where_gt_1km], axis=0)
num_conv = np.sum(my_model.ds['conv_frac_subcolumns_pl'].values[:, where_gt_1km], axis=0)
assert np.all(num_strat == 1)
assert np.all(num_conv == 2)
def test_set_qn():
my_model = emc2.core.model.TestAllStratiform()
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'cl', N_columns=8)
my_model = emc2.simulator.subcolumn.set_convective_sub_col_frac(my_model,
'ci', N_columns=8)
my_model = emc2.simulator.subcolumn.set_stratiform_sub_col_frac(my_model)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=False)
my_model = emc2.simulator.subcolumn.set_precip_sub_col_frac(my_model, is_conv=True)
my_model = emc2.simulator.subcolumn.set_q_n(my_model, 'cl', is_conv=False, qc_flag=False)
where_gt_1km = np.where(np.logical_and(my_model.ds['height'] > 1000.,
my_model.ds['t'] > 274.15))[0]
# There should only be a field named
assert "strat_q_subcolumns_cl" in my_model.ds.variables.keys()
q_sum = np.mean(my_model.ds["strat_q_subcolumns_cl"].values, axis=0)
assert np.all(q_sum[where_gt_1km] > 0)
assert np.all(q_sum[~where_gt_1km] == 0)
qcl = my_model.ds[my_model.q_names_stratiform["cl"]].values
np.testing.assert_almost_equal(q_sum, qcl)
| 59.142857
| 96
| 0.639151
| 1,385
| 9,522
| 4.013718
| 0.070036
| 0.173772
| 0.072855
| 0.1619
| 0.90376
| 0.893686
| 0.883073
| 0.879835
| 0.877136
| 0.877136
| 0
| 0.033232
| 0.241546
| 9,522
| 160
| 97
| 59.5125
| 0.7365
| 0.013653
| 0
| 0.6
| 0
| 0
| 0.069663
| 0.056775
| 0
| 0
| 0
| 0
| 0.177778
| 1
| 0.02963
| false
| 0
| 0.022222
| 0
| 0.051852
| 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
|
a09cd3f850ed2d06f1d2cb0a59d992e3add7fe8c
| 5,537
|
py
|
Python
|
test/test_mets_descriptive_metadata.py
|
DILCISBoard/py-ip-validator
|
1a00f7205d3676cf24c993076614fcbeb50cf8d7
|
[
"Apache-2.0"
] | 2
|
2018-11-20T12:17:57.000Z
|
2019-09-28T21:01:38.000Z
|
test/test_mets_descriptive_metadata.py
|
DILCISBoard/py-ip-validator
|
1a00f7205d3676cf24c993076614fcbeb50cf8d7
|
[
"Apache-2.0"
] | 2
|
2020-06-15T09:28:44.000Z
|
2020-06-18T10:30:26.000Z
|
test/test_mets_descriptive_metadata.py
|
DILCISBoard/py-ip-validator
|
1a00f7205d3676cf24c993076614fcbeb50cf8d7
|
[
"Apache-2.0"
] | null | null | null |
from base import Base
from metsvalidator.mets_validator_impl import validate
# In this class we test first the correct mets descriptive metadata element and then different error samples.
# If validation error was detected - validation result should be False.
class MetsDescriptiveMetadataTestCase(Base):
""" Tests for METS descriptive metadata element """
def test_load_rules(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_ok.xml")
self.assertTrue(validationResult==True)
def test_csip20_check_descriptive_metadata_element(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip21_check_descriptive_metadata_id(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_id_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip22_check_descriptive_metadata_admid(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_admid_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip23_check_descriptive_metadata_creation_date(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_creation_date_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip24_check_descriptive_metadata_status(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_status_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip25_check_descriptive_metadata_reference(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_element_reference_not_exists.xml")
self.assertTrue(validationResult==True)
# location group
def test_csip26_check_descriptive_metadata_location_type(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_location_location_type_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip27_check_descriptive_metadata_location_type_value_url(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_location_location_type_value_not_url.xml")
self.assertTrue(validationResult==True)
def test_csip28_check_descriptive_metadata_location_xlink_type(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_location_xlink_type_not_exists.xml")
self.assertTrue(validationResult==True)
def test_csip29_check_descriptive_metadata_location_xlink_type_value(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_location_xlink_type_value_not_simple.xml")
self.assertTrue(validationResult==True)
def test_csip30_check_descriptive_metadata_location_xlink_href_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_location_xlink_href_validation.xml")
self.assertTrue(validationResult==True)
def test_csip31_check_descriptive_metadata_mdtype_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_mdtype_validation.xml")
self.assertTrue(validationResult==True)
def test_csip32_check_descriptive_metadata_core_mimetype_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_core_mimetype_validation.xml")
self.assertTrue(validationResult==True)
def test_csip33_check_descriptive_metadata_core_size_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_core_size_validation.xml")
self.assertTrue(validationResult==True)
def test_csip34_check_descriptive_metadata_core_created_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_core_created_validation.xml")
self.assertTrue(validationResult==True)
def test_csip35_check_descriptive_metadata_core_checksum_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_core_checksum_validation.xml")
self.assertTrue(validationResult==True)
def test_csip36_check_descriptive_metadata_core_checksumtype_validation(self):
validationResult, report = validate(self.rules, self.SOURCES_PATH+"mets_descriptive_metadata_element/mets_descriptive_metadata_core_checksumtype_validation.xml")
self.assertTrue(validationResult==True)
| 65.916667
| 177
| 0.82626
| 643
| 5,537
| 6.664075
| 0.136858
| 0.243874
| 0.203967
| 0.189032
| 0.827538
| 0.765461
| 0.724621
| 0.683081
| 0.607468
| 0.545624
| 0
| 0.006867
| 0.105833
| 5,537
| 83
| 178
| 66.710843
| 0.858614
| 0.043164
| 0
| 0.315789
| 0
| 0
| 0.30471
| 0.30471
| 0
| 0
| 0
| 0
| 0.315789
| 1
| 0.315789
| false
| 0
| 0.035088
| 0
| 0.368421
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
a09feb746bcaf517dea1d8cf630616296e400b93
| 5,211
|
py
|
Python
|
test/test_readers.py
|
jgung/tf-nlp
|
9b7a56da46f285bdfa0fa568740927e3443f10bb
|
[
"Apache-2.0"
] | null | null | null |
test/test_readers.py
|
jgung/tf-nlp
|
9b7a56da46f285bdfa0fa568740927e3443f10bb
|
[
"Apache-2.0"
] | 1
|
2021-01-19T00:40:15.000Z
|
2021-01-19T00:40:15.000Z
|
test/test_readers.py
|
jgung/tf-nlp
|
9b7a56da46f285bdfa0fa568740927e3443f10bb
|
[
"Apache-2.0"
] | null | null | null |
import unittest
import pkg_resources
from tfnlp.common.constants import LABEL_KEY
from tfnlp.readers import conll_2003_reader, conll_2005_reader, conllx_reader, MultiConllReader, ConllReader
class TestChunk(unittest.TestCase):
def test_multi_reader(self):
filepath = pkg_resources.resource_filename(__name__, "resources/conllx.txt")
multireader = MultiConllReader([conllx_reader(), ConllReader({0: "pos"})], ['.dep', '.pos'])
instances = list(multireader.read_file(filepath))
self.assertEqual(2, len(instances))
self.assertTrue("pos" in instances[0])
self.assertEqual("XX", instances[0]["pos"][0])
def test_reader_single(self):
filepath = pkg_resources.resource_filename(__name__, "resources/conll03-test.txt")
instances = list(conll_2003_reader().read_file(filepath))
self.assertEqual(3, len(instances))
self.assertEqual(["O", "B-ORG", "I-ORG", "I-ORG", "O", "O", "O", "O"], instances[0][LABEL_KEY])
self.assertEqual(["B-LOC", "I-LOC", "O"], instances[1][LABEL_KEY])
def test_srl_reader(self):
filepath = pkg_resources.resource_filename(__name__, "resources/conll05-test.txt")
instances = list(conll_2005_reader().read_file(filepath))
self.assertEqual(6, len(instances))
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'I-A1', 'B-AM-MOD', 'O', 'B-V', 'B-A2', 'I-A2', 'I-A2', 'I-A2', 'B-AM-TMP', 'I-AM-TMP', 'O',
'B-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'O'], instances[0][LABEL_KEY])
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'O', 'B-V', 'B-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1',
'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'O', 'B-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'O'], instances[1][LABEL_KEY])
self.assertEqual(['B-A1', 'I-A1', 'I-A1', 'O', 'O', 'O', 'B-V', 'B-A4', 'I-A4', 'I-A4', 'I-A4', 'I-A4', 'B-A3', 'I-A3',
'I-A3', 'I-A3', 'I-A3', 'I-A3', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O',
'O', 'O', 'O', 'O'], instances[2][LABEL_KEY])
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'O', 'B-V', 'B-C-A1', 'I-C-A1', 'I-C-A1',
'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1',
'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'O'], instances[3][LABEL_KEY])
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'I-A1', 'O', 'O', 'O', 'B-V', 'O', 'B-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'O'], instances[4][LABEL_KEY])
self.assertEqual(
['O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'B-A1', 'I-A1',
'I-A1', 'I-A1', 'B-V', 'B-AM-TMP', 'B-AM-LOC', 'I-AM-LOC', 'I-AM-LOC', 'I-AM-LOC', 'I-AM-LOC', 'O'],
instances[5][LABEL_KEY])
def test_srl_reader_phrases(self):
filepath = pkg_resources.resource_filename(__name__, "resources/conll05-test.txt")
instances = list(conll_2005_reader(phrase=True).read_file(filepath))
self.assertEqual(6, len(instances))
self.assertEqual(
['B-A1', 'I-A1', 'B-AM-MOD', 'O', 'B-V', 'B-A2', 'I-A2', 'B-AM-TMP', 'O', 'B-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'O'], instances[0][LABEL_KEY])
self.assertEqual(
['B-A1', 'O', 'B-V', 'B-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'O', 'B-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'O'], instances[1][LABEL_KEY])
self.assertEqual(
['B-A1', 'O', 'O', 'O', 'B-V', 'B-A4', 'I-A4', 'B-A3', 'I-A3', 'I-A3', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O',
'O', 'O', 'O', 'O'], instances[2][LABEL_KEY])
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'I-A1', 'O', 'B-V', 'B-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1',
'I-C-A1', 'I-C-A1', 'I-C-A1', 'I-C-A1', 'O'], instances[3][LABEL_KEY])
self.assertEqual(
['B-A1', 'I-A1', 'I-A1', 'I-A1', 'O', 'O', 'O', 'B-V', 'O', 'B-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV',
'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'I-AM-ADV', 'O'], instances[4][LABEL_KEY])
self.assertEqual(['O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'B-A1', 'B-V', 'B-AM-TMP', 'B-AM-LOC', 'I-AM-LOC', 'O'],
instances[5][LABEL_KEY])
| 67.675325
| 129
| 0.484552
| 920
| 5,211
| 2.673913
| 0.077174
| 0.096341
| 0.158537
| 0.211382
| 0.810976
| 0.782114
| 0.748374
| 0.746748
| 0.710976
| 0.675203
| 0
| 0.040029
| 0.208981
| 5,211
| 76
| 130
| 68.565789
| 0.556769
| 0
| 0
| 0.308824
| 0
| 0
| 0.29265
| 0.014968
| 0
| 0
| 0
| 0
| 0.294118
| 1
| 0.058824
| false
| 0
| 0.058824
| 0
| 0.132353
| 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
|
a0b07b8221d7835579ba37c75c44b32042c688f6
| 9,919
|
py
|
Python
|
tests/data/test_vocab.py
|
inovex/multi2convai
|
5e151c5cf1504f0453dbd0d3d00bb68e83c82657
|
[
"MIT"
] | 7
|
2022-03-03T07:54:28.000Z
|
2022-03-15T08:03:26.000Z
|
tests/data/test_vocab.py
|
chiachienhung/multi2convai
|
e01b42b45535711621a8ce5066591d5fdb38dc23
|
[
"MIT"
] | null | null | null |
tests/data/test_vocab.py
|
chiachienhung/multi2convai
|
e01b42b45535711621a8ce5066591d5fdb38dc23
|
[
"MIT"
] | 1
|
2022-03-01T14:34:01.000Z
|
2022-03-01T14:34:01.000Z
|
import pytest
from multi2convai.data.vocab import LabelVocab, Vocab, WordVocab
class TestVocab:
def setup(self):
pass
def setup_class(self):
self.text2id = {"this": 0, "is": 1, "a": 2, "test": 3}
self.id2text = {v: k for k, v in self.text2id.items()}
def test_create_object(self):
# Given
# When
test_result = Vocab(self.text2id)
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert test_result._text2id == self.text2id
assert test_result._id2text == self.id2text
assert len(test_result) == 4
assert test_result.texts == list(self.text2id.keys())
assert test_result.ids == list(self.id2text.keys())
def test_from_list(self):
# Given
texts = ["this", "is", "a", "test"]
# When
test_result = Vocab.from_list(texts)
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert test_result._text2id == self.text2id
assert test_result._id2text == self.id2text
def test_text_to_id(self):
# Given
vocab = Vocab(self.text2id)
# When
test_result = vocab.text2id("test")
# Then
assert test_result is not None
assert isinstance(test_result, int)
assert test_result == 3
def test_text_to_id_with_unknown_text_raises_error(self):
# Given
vocab = Vocab(self.text2id)
# When
with pytest.raises(NotImplementedError):
_ = vocab.text2id("unknown")
def test_texts_to_ids(self):
# Given
vocab = Vocab(self.text2id)
# When
test_result = vocab.texts2ids(["test", "a", "test", "this", "is"])
# Then
assert test_result is not None
assert isinstance(test_result, list)
assert len(test_result) == 5
assert test_result == [3, 2, 3, 0, 1]
def test_id_to_text(self):
# Given
vocab = Vocab(self.text2id)
# When
test_result = vocab.id2text(3)
# Then
assert test_result is not None
assert isinstance(test_result, str)
assert test_result == "test"
def test_id_to_text_with_unknown_id_raises_error(self):
# Given
vocab = Vocab(self.text2id)
# When & Then
with pytest.raises(NotImplementedError):
_ = vocab.id2text(99)
def test_ids_to_texts(self):
# Given
vocab = Vocab(self.text2id)
# When
test_result = vocab.ids2texts([3, 2, 3, 0, 1])
# Then
assert test_result is not None
assert isinstance(test_result, list)
assert len(test_result) == 5
assert test_result == ["test", "a", "test", "this", "is"]
def test_to_dict(self):
# Given
vocab = Vocab(self.text2id)
# When
test_result = vocab.to_dict()
# Then
assert test_result is not None
assert isinstance(test_result, dict)
assert test_result == self.text2id
def test_equals(self):
# Given
dict_a = {"this": 0, "is": 1, "a": 2, "test": 3}
dict_b = {"this": 0, "is": 1, "a": 2, "another": 3, "test": 4}
vocab_1 = Vocab(dict_a)
vocab_2 = Vocab(dict_a)
vocab_3 = Vocab(dict_b)
# When & Then
assert vocab_1 == vocab_1
assert vocab_2 == vocab_2
assert vocab_3 == vocab_3
assert vocab_1 == vocab_2
assert vocab_1 != vocab_3
assert vocab_2 != vocab_3
assert vocab_1 != dict_a
class TestWordVocab:
def setup(self):
self.text2id = {"this": 0, "is": 1, "a": 2, "test": 3}
self.id2text = {v: k for k, v in self.text2id.items()}
self.text2id_with_unknown = {"this": 0, "is": 1, "a": 2, "test": 3, "UNK": 4}
self.id2text_with_unknown = {v: k for k, v in self.text2id_with_unknown.items()}
def setup_class(self):
pass
def test_create_object(self):
# Given
# When
test_result = WordVocab(self.text2id, "UNK")
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert isinstance(test_result, WordVocab)
assert test_result._text2id == self.text2id_with_unknown
assert test_result._id2text == self.id2text_with_unknown
assert test_result.UNK == "UNK"
assert len(test_result) == 5
assert test_result.texts == list(self.text2id_with_unknown.keys())
assert test_result.ids == list(self.id2text_with_unknown.keys())
def test_from_list(self):
# Given
texts = ["this", "is", "a", "test"]
# When
test_result = WordVocab.from_list(texts, "UNK")
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert test_result._text2id == self.text2id_with_unknown
assert test_result._id2text == self.id2text_with_unknown
@pytest.mark.parametrize(["text", "expected_id"], [["test", 3], ["unknown", 4]])
def test_text_to_id(self, text: str, expected_id: int):
# Given
vocab = WordVocab(self.text2id)
# When
test_result = vocab.text2id(text)
# Then
assert test_result is not None
assert isinstance(test_result, int)
assert test_result == expected_id
def test_texts_to_ids(self):
# Given
vocab = WordVocab(self.text2id)
# When
test_result = vocab.texts2ids(["test", "a", "test", "this", "is", "understand"])
# Then
assert test_result is not None
assert isinstance(test_result, list)
assert len(test_result) == 6
assert test_result == [3, 2, 3, 0, 1, 4]
def test_id_to_text(self):
# Given
vocab = WordVocab(self.text2id)
# When
test_result = vocab.id2text(3)
# Then
assert test_result is not None
assert isinstance(test_result, str)
assert test_result == "test"
def test_id_to_text_with_unknown_id_raises_error(self):
# Given
vocab = WordVocab(self.text2id)
# When & Then
with pytest.raises(ValueError) as e:
_ = vocab.id2text(99)
assert (
"Cannot find word with id '99' in WordVocab. Maximum vocab index is '4'."
== e.value.args[0]
)
def test_ids_to_texts(self):
# Given
vocab = WordVocab(self.text2id)
# When
test_result = vocab.ids2texts([3, 2, 3, 0, 1])
# Then
assert test_result is not None
assert isinstance(test_result, list)
assert len(test_result) == 5
assert test_result == ["test", "a", "test", "this", "is"]
def test_equals(self):
# Given
dict_a = {"this": 0, "is": 1, "a": 2, "test": 3}
dict_b = {"this": 0, "is": 1, "a": 2, "another": 3, "test": 4}
vocab_1 = WordVocab(dict_a)
vocab_2 = WordVocab(dict_a)
vocab_3 = WordVocab(dict_b)
vocab_4 = Vocab(dict_a)
# When & Then
assert vocab_1 == vocab_1
assert vocab_2 == vocab_2
assert vocab_3 == vocab_3
assert vocab_1 == vocab_2
assert vocab_1 != vocab_3
assert vocab_2 != vocab_3
assert vocab_1 != dict_a
assert vocab_1 != vocab_4
class TestLabelVocab:
def setup(self):
pass
def setup_class(self):
self.text2id = {"label_0": 0, "label_1": 1, "label_2": 2, "label_3": 3}
self.id2text = {v: k for k, v in self.text2id.items()}
def test_create_object(self):
# Given
# When
test_result = LabelVocab(self.text2id)
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert isinstance(test_result, LabelVocab)
assert test_result._text2id == self.text2id
assert test_result._id2text == self.id2text
assert len(test_result) == 4
assert test_result.texts == list(self.text2id.keys())
assert test_result.ids == list(self.id2text.keys())
def test_from_list(self):
# Given
labels = ["label_0", "label_1", "label_2", "label_3"]
# When
test_result = LabelVocab.from_list(labels)
# Then
assert test_result is not None
assert isinstance(test_result, Vocab)
assert test_result._text2id == self.text2id
assert test_result._id2text == self.id2text
def test_id_to_text_with_unknown_id_raises_error(self):
# Given
vocab = LabelVocab(self.text2id)
# When & Then
with pytest.raises(ValueError) as e:
_ = vocab.id2text(99)
assert (
"Cannot find label with id '99' in LabelVocab. Maximum vocab index is '3'."
== e.value.args[0]
)
def test_text_to_id_with_unknown_text_raises_error(self):
# Given
vocab = LabelVocab(self.text2id)
# When & Then
with pytest.raises(ValueError) as e:
_ = vocab.text2id("label_unknown")
assert (
"Cannot find label with name 'label_unknown' in LabelVocab."
== e.value.args[0]
)
def test_equals(self):
# Given
dict_a = {"label_0": 0, "label_1": 1, "label_2": 2}
dict_b = {"label_0": 0, "label_1": 1, "label_2": 2, "label_3": 3}
vocab_1 = LabelVocab(dict_a)
vocab_2 = LabelVocab(dict_a)
vocab_3 = LabelVocab(dict_b)
vocab_4 = Vocab(dict_a)
# When & Then
assert vocab_1 == vocab_1
assert vocab_2 == vocab_2
assert vocab_3 == vocab_3
assert vocab_1 == vocab_2
assert vocab_1 != vocab_3
assert vocab_2 != vocab_3
assert vocab_1 != dict_a
assert vocab_1 != vocab_4
| 29.173529
| 88
| 0.583527
| 1,274
| 9,919
| 4.308477
| 0.065934
| 0.14939
| 0.125342
| 0.080525
| 0.845874
| 0.825105
| 0.814174
| 0.797777
| 0.755329
| 0.727637
| 0
| 0.03403
| 0.309709
| 9,919
| 339
| 89
| 29.259587
| 0.767635
| 0.037907
| 0
| 0.7343
| 0
| 0
| 0.059066
| 0
| 0
| 0
| 0
| 0
| 0.449275
| 1
| 0.140097
| false
| 0.014493
| 0.009662
| 0
| 0.164251
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
260ba69185775f5e3682d0840ac3295e2f259b6f
| 3,737
|
py
|
Python
|
django_cleanup/testapp/test_integration.py
|
avallbona/django-cleanup
|
6dd155f49caf885c5bf9830c3946d0072842c15d
|
[
"MIT"
] | null | null | null |
django_cleanup/testapp/test_integration.py
|
avallbona/django-cleanup
|
6dd155f49caf885c5bf9830c3946d0072842c15d
|
[
"MIT"
] | null | null | null |
django_cleanup/testapp/test_integration.py
|
avallbona/django-cleanup
|
6dd155f49caf885c5bf9830c3946d0072842c15d
|
[
"MIT"
] | null | null | null |
# coding: utf-8
from __future__ import unicode_literals
import os
from django.conf import settings
from django.db import transaction
import pytest
from django_cleanup.signals import cleanup_pre_delete
from .testing_helpers import get_using, pic1
@pytest.mark.django_db(transaction=True)
def test_sorlthumbnail_replace(settings, pic1):
# https://github.com/mariocesar/sorl-thumbnail
models = pytest.importorskip("django_cleanup.testapp.models.integration")
ProductIntegration = models.ProductIntegration
sorl_delete = models.sorl_delete
cleanup_pre_delete.connect(sorl_delete)
from sorl.thumbnail import get_thumbnail
product = ProductIntegration.objects.create(sorl_image=pic1['filename'])
assert os.path.exists(pic1['path'])
im = get_thumbnail(
product.sorl_image, '100x100', crop='center', quality=50)
thumbnail_path = os.path.join(settings.MEDIA_ROOT, im.name)
assert os.path.exists(thumbnail_path)
product.sorl_image = 'new.png'
with transaction.atomic(get_using(product)):
product.save()
assert not os.path.exists(pic1['path'])
assert not os.path.exists(thumbnail_path)
cleanup_pre_delete.disconnect(sorl_delete)
@pytest.mark.django_db(transaction=True)
def test_sorlthumbnail_delete(pic1):
# https://github.com/mariocesar/sorl-thumbnail
models = pytest.importorskip("django_cleanup.testapp.models.integration")
ProductIntegration = models.ProductIntegration
sorl_delete = models.sorl_delete
cleanup_pre_delete.connect(sorl_delete)
from sorl.thumbnail import get_thumbnail
product = ProductIntegration.objects.create(sorl_image=pic1['filename'])
assert os.path.exists(pic1['path'])
im = get_thumbnail(
product.sorl_image, '100x100', crop='center', quality=50)
thumbnail_path = os.path.join(settings.MEDIA_ROOT, im.name)
assert os.path.exists(thumbnail_path)
with transaction.atomic(get_using(product)):
product.delete()
assert not os.path.exists(pic1['path'])
assert not os.path.exists(thumbnail_path)
cleanup_pre_delete.disconnect(sorl_delete)
@pytest.mark.django_db(transaction=True)
def test_easythumbnails_replace(pic1):
# https://github.com/SmileyChris/easy-thumbnails
models = pytest.importorskip("django_cleanup.testapp.models.integration")
ProductIntegration = models.ProductIntegration
from easy_thumbnails.files import get_thumbnailer
product = ProductIntegration.objects.create(easy_image=pic1['filename'])
assert os.path.exists(pic1['path'])
im = get_thumbnailer(product.easy_image).get_thumbnail(
{'size': (100, 100)})
thumbnail_path = os.path.join(settings.MEDIA_ROOT, im.name)
assert os.path.exists(thumbnail_path)
product.easy_image = 'new.png'
with transaction.atomic(get_using(product)):
product.save()
assert not os.path.exists(pic1['path'])
assert not os.path.exists(thumbnail_path)
@pytest.mark.django_db(transaction=True)
def test_easythumbnails_delete(pic1):
# https://github.com/SmileyChris/easy-thumbnails
models = pytest.importorskip("django_cleanup.testapp.models.integration")
ProductIntegration = models.ProductIntegration
from easy_thumbnails.files import get_thumbnailer
product = ProductIntegration.objects.create(easy_image=pic1['filename'])
assert os.path.exists(pic1['path'])
im = get_thumbnailer(product.easy_image).get_thumbnail(
{'size': (100, 100)})
thumbnail_path = os.path.join(settings.MEDIA_ROOT, im.name)
assert os.path.exists(thumbnail_path)
with transaction.atomic(get_using(product)):
product.delete()
assert not os.path.exists(pic1['path'])
assert not os.path.exists(thumbnail_path)
| 39.755319
| 77
| 0.75301
| 472
| 3,737
| 5.783898
| 0.158898
| 0.043956
| 0.07033
| 0.052747
| 0.915751
| 0.911355
| 0.911355
| 0.911355
| 0.911355
| 0.862271
| 0
| 0.014264
| 0.137008
| 3,737
| 93
| 78
| 40.182796
| 0.832248
| 0.052716
| 0
| 0.826667
| 0
| 0
| 0.078098
| 0.046406
| 0
| 0
| 0
| 0
| 0.213333
| 1
| 0.053333
| false
| 0
| 0.2
| 0
| 0.253333
| 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
|
264657efe15fe6b1201038036a3ffaad2f19e69f
| 155
|
py
|
Python
|
checkmate/__init__.py
|
Jacob-Zhou/GP-refactoring
|
feeca60589bc0d5926667bf28575722979b32ffd
|
[
"MIT"
] | 3
|
2019-09-29T11:22:43.000Z
|
2020-03-08T06:11:56.000Z
|
checkmate/__init__.py
|
Jacob-Zhou/GP-refactoring
|
feeca60589bc0d5926667bf28575722979b32ffd
|
[
"MIT"
] | null | null | null |
checkmate/__init__.py
|
Jacob-Zhou/GP-refactoring
|
feeca60589bc0d5926667bf28575722979b32ffd
|
[
"MIT"
] | null | null | null |
from checkmate.checkmate import BestCheckpointSaver
from checkmate.checkmate import get_best_checkpoint
from checkmate.checkmate import get_all_checkpoint
| 38.75
| 51
| 0.903226
| 19
| 155
| 7.157895
| 0.421053
| 0.286765
| 0.485294
| 0.617647
| 0.455882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.077419
| 155
| 3
| 52
| 51.666667
| 0.951049
| 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
|
cd8b82c74e9a2ab6abeda65c10964b053534f494
| 154
|
py
|
Python
|
clear_cut/utils/__init__.py
|
chrispdharman/clear-cut
|
799398172861bc2e98465e198b68a2af26abb461
|
[
"MIT"
] | null | null | null |
clear_cut/utils/__init__.py
|
chrispdharman/clear-cut
|
799398172861bc2e98465e198b68a2af26abb461
|
[
"MIT"
] | 4
|
2021-05-06T17:44:39.000Z
|
2022-03-12T00:19:26.000Z
|
clear_cut/utils/__init__.py
|
chrispdharman/clear-cut
|
799398172861bc2e98465e198b68a2af26abb461
|
[
"MIT"
] | null | null | null |
__all__ = ['tracers', 'edge_utility', 'graph_tools']
import clear_cut.utils.tracers
import clear_cut.utils.edge_utility
import clear_cut.utils.graph_tools
| 38.5
| 52
| 0.824675
| 23
| 154
| 5.043478
| 0.434783
| 0.284483
| 0.362069
| 0.491379
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.064935
| 154
| 4
| 53
| 38.5
| 0.805556
| 0
| 0
| 0
| 0
| 0
| 0.193548
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.75
| 0
| 0.75
| 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
|
f80b66c5f74e680476f5c56da5ea9757d9b23238
| 96
|
py
|
Python
|
src/tabs/nuke_launcher/util/__init__.py
|
sisoe24/ProfileInspector
|
38cfefe68c09b153f7380447c4c486728feecb9d
|
[
"MIT"
] | 4
|
2021-07-22T10:23:56.000Z
|
2021-11-03T19:01:21.000Z
|
src/tabs/nuke_launcher/util/__init__.py
|
Ripax/ProfileInspector
|
38cfefe68c09b153f7380447c4c486728feecb9d
|
[
"MIT"
] | null | null | null |
src/tabs/nuke_launcher/util/__init__.py
|
Ripax/ProfileInspector
|
38cfefe68c09b153f7380447c4c486728feecb9d
|
[
"MIT"
] | 1
|
2022-02-16T07:23:31.000Z
|
2022-02-16T07:23:31.000Z
|
from .bypass_filedialog_nuke import _bypass_filedialog
from .find_nuke_mac import mac_nuke_exec
| 32
| 54
| 0.895833
| 15
| 96
| 5.2
| 0.533333
| 0.410256
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 96
| 2
| 55
| 48
| 0.886364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
|
0
| 7
|
f811d05a4af4612841477bd00b89ed3a93d817ba
| 13,143
|
py
|
Python
|
test_lovasz.py
|
ZeyuChen/lovasz
|
7aeeda6bec06cb2b252e697c321d71147a88c3e8
|
[
"Apache-2.0"
] | 1
|
2020-11-17T12:14:50.000Z
|
2020-11-17T12:14:50.000Z
|
test_lovasz.py
|
ZeyuChen/lovasz
|
7aeeda6bec06cb2b252e697c321d71147a88c3e8
|
[
"Apache-2.0"
] | null | null | null |
test_lovasz.py
|
ZeyuChen/lovasz
|
7aeeda6bec06cb2b252e697c321d71147a88c3e8
|
[
"Apache-2.0"
] | null | null | null |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import time
import paddle.fluid as fluid
import numpy as np
from lovasz_losses import *
def test_lovasz_grad():
length = 5
shape = [length]
gt_sorted = fluid.layers.data(name='a', shape=shape, dtype='float32')
gt_sorted = fluid.layers.reshape(gt_sorted, [-1, 1])
jaccard = lovasz_grad(gt_sorted)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
data = np.arange(length, 0, -1).astype(np.float32)
out = exe.run(test_program,
fetch_list=[jaccard.name],
feed = {'a':data})
print(out[0], out[0].shape)
def test_lovasz_flatten_probas():
probas_shape = [3, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_probas(probas, labels, ignore=ignore)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.arange(probas_length, 0, -1).reshape(probas_shape).astype(np.float32)
values = np.array([2, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
out1, out2 = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(out1, out1.shape)
print(out2, out2.shape)
def test_lovasz_flatten_binary():
probas_shape = [1, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_binary_scores(probas, labels, ignore=ignore)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.arange(probas_length, 0, -1).reshape(probas_shape).astype(np.float32)
values = np.array([1, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
out1, out2 = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(out1, out1.shape)
print(out2, out2.shape)
def test_lovasz_hinge_all():
probas_shape = [1, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_binary_scores(probas, labels, ignore=ignore)
loss = lovasz_hinge_flat(vprobas, vlabels)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
#probas_data = np.arange(probas_length, 0, -1).reshape(probas_shape).astype(np.float32)
probas_data = np.array([0.23291497, 0.19052831, 0.79462721,
0.3297337]).reshape(probas_shape).astype(np.float32)
values = np.array([1, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
vp, vl, error = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name, loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(vp)
print(vl)
print(error)
def test_lovasz_hinge_single():
probas_shape = [1, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
lovasz_hinge(probas, labels, per_image=True, ignore=ignore)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.array([0.23291497, 0.19052831, 0.79462721,
0.3297337]).reshape(probas_shape).astype(np.float32)
values = np.array([1, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
loss = exe.run(
test_program,
fetch_list=[loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(loss)
def test_lovasz_softmax_flat():
probas_shape = [3, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_probas(probas, labels, ignore=ignore)
# loss = lovasz_softmax_flat(vprobas, vlabels, classes='present')
loss = lovasz_softmax_flat(vprobas, vlabels, classes='all')
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.array([0.90709059, 0.08367204, 0.86837787, 0.45287163,
0.83186626, 0.30239672, 0.45373512, 0.25180515, 0.92765359,
0.05688091, 0.88769571, 0.31187094]).reshape(probas_shape).astype("float32")
values = np.array([2, 1, 2, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
vp, vl, loss = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name, loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(vp)
print(vl)
print(loss)
def test_single_lovasz_softmax_flat():
probas_shape = [1, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_probas(probas, labels, ignore=ignore)
loss = lovasz_softmax_flat(vprobas, vlabels, classes='all')
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.array([0.90709059, 0.08367204, 0.86837787, 0.45287163]).reshape(probas_shape).astype("float32")
values = np.array([1, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([0, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
vp, vl, loss = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name, loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(vp)
print(vl)
print(loss)
def test_lovasz_softmax():
probas_shape = [3, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
loss = lovasz_softmax(probas, labels, classes='present', per_image=False,
ignore=ignore)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_data = \
np.array([0.67192201, 0.81870198, 0.77258366, 0.14495502, 0.23867289,
0.77602079, 0.6099467 , 0.84998262, 0.0811898 , 0.76430095,
0.79137547, 0.99642811, 0.54362771, 0.16157255, 0.27041143,
0.15576253, 0.02415075, 0.34646825, 0.87565063, 0.58807224,
0.32440345, 0.66848973, 0.42985255, 0.67140429, 0.09327043,
0.53752471, 0.11262969, 0.58534519, 0.22413638, 0.07070887,
0.3450199 , 0.18854945, 0.77802942, 0.67194227, 0.80362883,
0.59969173, 0.03151586, 0.74988883, 0.22059246, 0.58512586,
0.16135984, 0.314945 , 0.97941178, 0.93608287, 0.43164755,
0.94626785, 0.30692069, 0.95636061, 0.60257295, 0.38007489,
0.38334655, 0.49893603, 0.35552424, 0.55916771, 0.90335988,
0.64983527, 0.09720144, 0.02381892, 0.90885459, 0.35790411])
probas_data = probas_data.reshape([5,3,2,2]).astype(np.float32)
labels_data = np.array([1, 1, 2, 2, 0, 0, 0, 1, 0, 0, 1, 1, 2, 0, 2, 2, 0,
1, 2, 1], dtype='int32').reshape([5, 1, 2, 2])
ignore_data = np.where(labels_data==0, 0, 1)
loss = exe.run(
test_program,
fetch_list=[loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(loss)
def test_lovasz_hinge_all_v2():
probas_shape = [1, 2, 2]
labels_shape = [2, 2, 1]
probas = fluid.layers.data(name='p', shape=probas_shape, dtype='float32')
labels = fluid.layers.data(name='l', shape=labels_shape, dtype='int32')
ignore = fluid.layers.data(name='m', shape=labels_shape, dtype='int32')
vprobas, vlabels = flatten_binary_scores(probas, labels, ignore=ignore)
loss = lovasz_hinge_flat_v2(vprobas, vlabels)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
test_program = fluid.default_main_program().clone(for_test=True)
exe.run(fluid.default_startup_program())
probas_length = probas_shape[0] * probas_shape[1] * probas_shape[2]
labels_length = labels_shape[0] * labels_shape[1] * labels_shape[2]
probas_data = np.array([0.23291497, 0.19052831, 0.79462721,
0.3297337]).reshape(probas_shape).astype(np.float32)
values = np.array([1, 1, 1, 0])
labels_data = values.reshape(labels_shape).astype(np.int32)
ignore_data = np.array([1, 1, 1, 0], dtype=np.int32).reshape(labels_shape)
probas_data = np.expand_dims(probas_data, 0)
labels_data = np.expand_dims(labels_data, 0)
ignore_data = np.expand_dims(ignore_data, 0)
vp, vl, error = exe.run(
test_program,
fetch_list=[vprobas.name, vlabels.name, loss.name],
feed={'p':probas_data, 'l':labels_data, 'm':ignore_data})
print(vp)
print(vl)
print(error)
if __name__ == '__main__':
#test_lovasz_softmax()
#test_lovasz_hinge_all()
test_lovasz_hinge_all_v2()
#test_lovasz_hinge_single()
#test_single_lovasz_softmax_flat()
| 44.252525
| 116
| 0.671384
| 1,898
| 13,143
| 4.436776
| 0.08746
| 0.077069
| 0.044532
| 0.056407
| 0.843368
| 0.825674
| 0.819855
| 0.819855
| 0.81178
| 0.81178
| 0
| 0.103622
| 0.184965
| 13,143
| 296
| 117
| 44.402027
| 0.682506
| 0.019478
| 0
| 0.767717
| 0
| 0
| 0.018089
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.035433
| false
| 0
| 0.035433
| 0
| 0.070866
| 0.07874
| 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
|
f82d9d643734ee99f078b91741218ea09b21c288
| 87
|
py
|
Python
|
airmozilla/surveys/helpers.py
|
RAMilewski/airmozilla
|
70d52295294fd319e60b046bf75baf971cd00f98
|
[
"BSD-3-Clause"
] | 1
|
2019-08-17T21:22:08.000Z
|
2019-08-17T21:22:08.000Z
|
airmozilla/surveys/helpers.py
|
RAMilewski/airmozilla
|
70d52295294fd319e60b046bf75baf971cd00f98
|
[
"BSD-3-Clause"
] | 4
|
2021-03-19T15:38:56.000Z
|
2021-09-08T02:47:16.000Z
|
airmozilla/surveys/helpers.py
|
Acidburn0zzz/airmozilla
|
7b03af6d6efe9af00a6070f5327e10fb755c3766
|
[
"BSD-3-Clause"
] | null | null | null |
from jingo import register
@register.function
def max_(*args):
return max(*args)
| 12.428571
| 26
| 0.724138
| 12
| 87
| 5.166667
| 0.75
| 0.225806
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 87
| 6
| 27
| 14.5
| 0.861111
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0.25
| 0.75
| 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
|
f853b4070d153cfa29e0787815aa96c17f737a9e
| 2,500
|
py
|
Python
|
Auth.py
|
i-jelly/Qangeloid
|
e0043b3dad10356c7763ac60b228076c0c82aa7a
|
[
"Apache-2.0"
] | null | null | null |
Auth.py
|
i-jelly/Qangeloid
|
e0043b3dad10356c7763ac60b228076c0c82aa7a
|
[
"Apache-2.0"
] | null | null | null |
Auth.py
|
i-jelly/Qangeloid
|
e0043b3dad10356c7763ac60b228076c0c82aa7a
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding:utf-8 -*-
import Sql
import Game
def AuthNorUser(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getAuthLevel(None,group,qq) >= Game.Config.NorUserLevel):
return func(group,qq,msg)
return False
return False
return wrapper
def AuthUserFavorLevel(func):
def wrapper(group,qq,msg,level):
if(Sql.User.isExists(None,group,qq)):
_level = Sql.User.getFavor(None,group,qq)
if(_level >= Game.Config.HigFavorLevelThres):
return func(group,qq,msg,4)
elif(_level >= Game.Config.MidFavorLevelThres):
return func(group,qq,msg,3)
elif(_level >= Game.Config.LowFavorLevelThres):
return func(group,qq,msg,2)
return func(group,qq,msg,1)
return False
return wrapper
def AuthPremiumUser(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getAuthLevel(None,group,qq) >= Game.Config.PremiumUserLevel):
return func(group,qq,msg)
return False
return False
return wrapper
def AuthAdminUser(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getAuthLevel(None,group,qq) >= Game.Config.AdminUserLevel or str(qq) in Game.Config.Admin):
return func(group,qq,msg)
return False
return False
return wrapper
def AuthHighFavorLevel(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getFavor(None,group,qq) >= Game.Config.HigFavorLevelThres):
return func(group,qq,msg)
return False
return False
return wrapper
def AuthMidFavorLevel(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getFavor(None,group,qq) >= Game.Config.MidFavorLevelThres):
return func(group,qq,msg)
return False
return False
return wrapper
def AuthLowFavorLevel(func):
def wrapper(group,qq,msg):
if(Sql.User.isExists(None,group,qq)):
if(Sql.User.getFavor(None,group,qq) >= Game.Config.LowFavorLevelThres):
return func(group,qq,msg)
return False
return False
return wrapper
| 34.722222
| 116
| 0.588
| 296
| 2,500
| 4.952703
| 0.148649
| 0.148022
| 0.115962
| 0.115962
| 0.832196
| 0.800136
| 0.76603
| 0.74693
| 0.611869
| 0.611869
| 0
| 0.002852
| 0.2988
| 2,500
| 72
| 117
| 34.722222
| 0.833428
| 0.008
| 0
| 0.619048
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.031746
| 0
| 0.730159
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 7
|
f87406ddb0b162da0dd690e51866a672ddf4448a
| 238
|
py
|
Python
|
test/conftest.py
|
luizvbo/s2cholar
|
7f2be800168ef792230f7759bc7131c5f59e2103
|
[
"MIT"
] | 1
|
2021-12-03T13:02:34.000Z
|
2021-12-03T13:02:34.000Z
|
test/conftest.py
|
luizvbo/s2cholar
|
7f2be800168ef792230f7759bc7131c5f59e2103
|
[
"MIT"
] | null | null | null |
test/conftest.py
|
luizvbo/s2cholar
|
7f2be800168ef792230f7759bc7131c5f59e2103
|
[
"MIT"
] | null | null | null |
import pytest
import s2cholar
@pytest.fixture(scope='session')
def author_api():
return s2cholar.AuthorApi(s2cholar.ApiClient())
@pytest.fixture(scope='session')
def paper_api():
return s2cholar.PaperApi(s2cholar.ApiClient())
| 18.307692
| 51
| 0.756303
| 28
| 238
| 6.357143
| 0.5
| 0.146067
| 0.202247
| 0.280899
| 0.314607
| 0
| 0
| 0
| 0
| 0
| 0
| 0.023585
| 0.109244
| 238
| 12
| 52
| 19.833333
| 0.816038
| 0
| 0
| 0.25
| 0
| 0
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.25
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 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
| 1
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 7
|
e434327881a9237fd2de9bb809b5ab9ddc8b3945
| 1,376
|
py
|
Python
|
tests/object_analysis/test_field_extractor.py
|
jamie-davis/formatter
|
3a9a7aca82af9b1617e377ad9af5ad7d455dd853
|
[
"MIT"
] | null | null | null |
tests/object_analysis/test_field_extractor.py
|
jamie-davis/formatter
|
3a9a7aca82af9b1617e377ad9af5ad7d455dd853
|
[
"MIT"
] | null | null | null |
tests/object_analysis/test_field_extractor.py
|
jamie-davis/formatter
|
3a9a7aca82af9b1617e377ad9af5ad7d455dd853
|
[
"MIT"
] | null | null | null |
import pytest
from approvaltests import verify
from ObjectAnalysis.field_extractor import FieldExtractor
def test_keys_are_extracted():
class TestItem:
def __init__(self, name, age, numPets):
self.name = name
self.age = age
self.numPets = numPets
# Arrange
items = [TestItem("Ann", 21, 1), TestItem("Bob", 45, 2), TestItem("Cath", 52, 4)]
# Act
fx = FieldExtractor.extract(items)
# Assert
assert fx.keys == ["name", "age", "numPets"]
def test_row_values_are_extracted():
class TestItem:
def __init__(self, name, age, numPets):
self.name = name
self.age = age
self.numPets = numPets
# Arrange
items = [TestItem("Ann", 21, 1), TestItem("Bob", 45, 2), TestItem("Cath", 52, 4)]
# Act
fx = FieldExtractor.extract(items)
# Assert
assert str(fx.rows) == str([vars(item) for item in items])
def test_row_values_are_extracted_from_a_tuple():
class TestItem:
def __init__(self, name, age, numPets):
self.name = name
self.age = age
self.numPets = numPets
# Arrange
items = (TestItem("Ann", 21, 1), TestItem("Bob", 45, 2), TestItem("Cath", 52, 4))
# Act
fx = FieldExtractor.extract(items)
# Assert
assert str(fx.rows) == str([vars(item) for item in items])
| 25.018182
| 85
| 0.599564
| 171
| 1,376
| 4.666667
| 0.269006
| 0.06015
| 0.070175
| 0.075188
| 0.83208
| 0.83208
| 0.776942
| 0.776942
| 0.776942
| 0.776942
| 0
| 0.027027
| 0.273983
| 1,376
| 54
| 86
| 25.481481
| 0.771772
| 0.040698
| 0
| 0.733333
| 0
| 0
| 0.033588
| 0
| 0
| 0
| 0
| 0
| 0.1
| 1
| 0.2
| false
| 0
| 0.1
| 0
| 0.4
| 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
|
e491494e4caa7bc17b1e20398664e9ff0ce1973e
| 110,336
|
py
|
Python
|
src/mbed_cloud/_backends/iam/apis/account_admin_api.py
|
GQMai/mbed-cloud-sdk-python
|
76ef009903415f37f69dcc5778be8f5fb14c08fe
|
[
"Apache-2.0"
] | 12
|
2017-12-28T11:18:43.000Z
|
2020-10-04T12:11:15.000Z
|
src/mbed_cloud/_backends/iam/apis/account_admin_api.py
|
GQMai/mbed-cloud-sdk-python
|
76ef009903415f37f69dcc5778be8f5fb14c08fe
|
[
"Apache-2.0"
] | 50
|
2017-12-21T12:50:41.000Z
|
2020-01-13T16:07:08.000Z
|
src/mbed_cloud/_backends/iam/apis/account_admin_api.py
|
GQMai/mbed-cloud-sdk-python
|
76ef009903415f37f69dcc5778be8f5fb14c08fe
|
[
"Apache-2.0"
] | 8
|
2018-04-25T17:47:29.000Z
|
2019-08-29T06:38:27.000Z
|
# coding: utf-8
"""
Account Management API
API for managing accounts, users, creating API keys, uploading trusted certificates
OpenAPI spec version: v3
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 ..api_client import ApiClient
class AccountAdminApi(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 add_api_key_to_groups(self, api_key, body, **kwargs): # noqa: E501
"""Add API key to a list of groups. # noqa: E501
An endpoint for adding API key to groups. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_api_key_to_groups(api_key, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key to be added to the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.add_api_key_to_groups_with_http_info(api_key, body, **kwargs) # noqa: E501
else:
(data) = self.add_api_key_to_groups_with_http_info(api_key, body, **kwargs) # noqa: E501
return data
def add_api_key_to_groups_with_http_info(self, api_key, body, **kwargs): # noqa: E501
"""Add API key to a list of groups. # noqa: E501
An endpoint for adding API key to groups. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_api_key_to_groups_with_http_info(api_key, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key to be added to the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['api_key', 'body'] # noqa: E501
all_params.append('asynchronous')
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 add_api_key_to_groups" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'api_key' is set
if ('api_key' not in params or
params['api_key'] is None):
raise ValueError("Missing the required parameter `api_key` when calling `add_api_key_to_groups`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_api_key_to_groups`") # noqa: E501
collection_formats = {}
path_params = {}
if 'api_key' in params:
path_params['apiKey'] = params['api_key'] # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/api-keys/{apiKey}/groups', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 add_certificate(self, body, **kwargs): # noqa: E501
"""Upload a new trusted certificate. # noqa: E501
An endpoint for uploading new trusted certificates. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/trusted-certificates -d {\"name\": \"myCert1\", \"description\": \"very important cert\", \"certificate\": \"certificate_data\", \"service\": \"lwm2m\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_certificate(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param TrustedCertificateReq body: A trusted certificate object with attributes. (required)
:return: TrustedCertificateResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.add_certificate_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.add_certificate_with_http_info(body, **kwargs) # noqa: E501
return data
def add_certificate_with_http_info(self, body, **kwargs): # noqa: E501
"""Upload a new trusted certificate. # noqa: E501
An endpoint for uploading new trusted certificates. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/trusted-certificates -d {\"name\": \"myCert1\", \"description\": \"very important cert\", \"certificate\": \"certificate_data\", \"service\": \"lwm2m\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_certificate_with_http_info(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param TrustedCertificateReq body: A trusted certificate object with attributes. (required)
:return: TrustedCertificateResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('asynchronous')
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 add_certificate" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_certificate`") # noqa: E501
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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/trusted-certificates', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='TrustedCertificateResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 add_subjects_to_group(self, group_id, body, **kwargs): # noqa: E501
"""Add members to a group. # noqa: E501
An endpoint for adding users and API keys to a group. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"users\": [0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_subjects_to_group(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be updated. (required)
:param SubjectList body: A list of users and API keys to be added to the group. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.add_subjects_to_group_with_http_info(group_id, body, **kwargs) # noqa: E501
else:
(data) = self.add_subjects_to_group_with_http_info(group_id, body, **kwargs) # noqa: E501
return data
def add_subjects_to_group_with_http_info(self, group_id, body, **kwargs): # noqa: E501
"""Add members to a group. # noqa: E501
An endpoint for adding users and API keys to a group. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"users\": [0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_subjects_to_group_with_http_info(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be updated. (required)
:param SubjectList body: A list of users and API keys to be added to the group. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['group_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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 add_subjects_to_group" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'group_id' is set
if ('group_id' not in params or
params['group_id'] is None):
raise ValueError("Missing the required parameter `group_id` when calling `add_subjects_to_group`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_subjects_to_group`") # noqa: E501
collection_formats = {}
path_params = {}
if 'group_id' in params:
path_params['groupID'] = params['group_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups/{groupID}', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 add_user_to_groups(self, user_id, body, **kwargs): # noqa: E501
"""Add user to a list of groups. # noqa: E501
An endpoint for adding user to groups. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_user_to_groups(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be added to the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.add_user_to_groups_with_http_info(user_id, body, **kwargs) # noqa: E501
else:
(data) = self.add_user_to_groups_with_http_info(user_id, body, **kwargs) # noqa: E501
return data
def add_user_to_groups_with_http_info(self, user_id, body, **kwargs): # noqa: E501
"""Add user to a list of groups. # noqa: E501
An endpoint for adding user to groups. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.add_user_to_groups_with_http_info(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be added to the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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 add_user_to_groups" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `add_user_to_groups`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `add_user_to_groups`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}/groups', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 create_group(self, body, **kwargs): # noqa: E501
"""Create a new group. # noqa: E501
An endpoint for creating a new group. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/policy-groups -d '{\"name\": \"MyGroup1\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_group(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param GroupCreationInfo body: Details of the group to be created. (required)
:return: GroupSummary
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.create_group_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_group_with_http_info(body, **kwargs) # noqa: E501
return data
def create_group_with_http_info(self, body, **kwargs): # noqa: E501
"""Create a new group. # noqa: E501
An endpoint for creating a new group. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/policy-groups -d '{\"name\": \"MyGroup1\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_group_with_http_info(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param GroupCreationInfo body: Details of the group to be created. (required)
:return: GroupSummary
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('asynchronous')
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_group" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_group`") # noqa: E501
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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GroupSummary', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 create_invitation(self, body, **kwargs): # noqa: E501
"""Create a user invitation. # noqa: E501
An endpoint for inviting a new or an existing user to join the account. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/user-invitations -d {\"email\": \"myemail@company.com\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_invitation(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param UserInvitationReq body: A user invitation object with attributes. (required)
:return: UserInvitationResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.create_invitation_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_invitation_with_http_info(body, **kwargs) # noqa: E501
return data
def create_invitation_with_http_info(self, body, **kwargs): # noqa: E501
"""Create a user invitation. # noqa: E501
An endpoint for inviting a new or an existing user to join the account. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/user-invitations -d {\"email\": \"myemail@company.com\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_invitation_with_http_info(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param UserInvitationReq body: A user invitation object with attributes. (required)
:return: UserInvitationResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('asynchronous')
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_invitation" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_invitation`") # noqa: E501
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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/user-invitations', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInvitationResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 create_user(self, body, **kwargs): # noqa: E501
"""Create a new user. # noqa: E501
An endpoint for creating or inviting a new user to the account. In case of invitation email address is used only, other attributes are set in the 2nd step. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/users?action=invite -d {\"email\": \"myemail@company.com\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_user(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param UserInfoReq body: A user object with attributes. (required)
:param str action: Action, either 'create' or 'invite'.
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.create_user_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.create_user_with_http_info(body, **kwargs) # noqa: E501
return data
def create_user_with_http_info(self, body, **kwargs): # noqa: E501
"""Create a new user. # noqa: E501
An endpoint for creating or inviting a new user to the account. In case of invitation email address is used only, other attributes are set in the 2nd step. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/users?action=invite -d {\"email\": \"myemail@company.com\"} -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.create_user_with_http_info(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param UserInfoReq body: A user object with attributes. (required)
:param str action: Action, either 'create' or 'invite'.
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body', 'action'] # noqa: E501
all_params.append('asynchronous')
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_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_user`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'action' in params:
query_params.append(('action', params['action'])) # noqa: E501
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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInfoResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_group(self, group_id, **kwargs): # noqa: E501
"""Delete a group. # noqa: E501
An endpoint for deleting a group. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_group(group_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.delete_group_with_http_info(group_id, **kwargs) # noqa: E501
else:
(data) = self.delete_group_with_http_info(group_id, **kwargs) # noqa: E501
return data
def delete_group_with_http_info(self, group_id, **kwargs): # noqa: E501
"""Delete a group. # noqa: E501
An endpoint for deleting a group. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_group_with_http_info(group_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['group_id'] # noqa: E501
all_params.append('asynchronous')
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_group" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'group_id' is set
if ('group_id' not in params or
params['group_id'] is None):
raise ValueError("Missing the required parameter `group_id` when calling `delete_group`") # noqa: E501
collection_formats = {}
path_params = {}
if 'group_id' in params:
path_params['groupID'] = params['group_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups/{groupID}', '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,
asynchronous=params.get('asynchronous'),
_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_invitation(self, invitation_id, **kwargs): # noqa: E501
"""Delete a user invitation. # noqa: E501
An endpoint for deleting an active user invitation which has been sent for a new or an existing user to join the account. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/user-invitations/{invitation-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_invitation(invitation_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str invitation_id: The ID of the invitation to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.delete_invitation_with_http_info(invitation_id, **kwargs) # noqa: E501
else:
(data) = self.delete_invitation_with_http_info(invitation_id, **kwargs) # noqa: E501
return data
def delete_invitation_with_http_info(self, invitation_id, **kwargs): # noqa: E501
"""Delete a user invitation. # noqa: E501
An endpoint for deleting an active user invitation which has been sent for a new or an existing user to join the account. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/user-invitations/{invitation-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_invitation_with_http_info(invitation_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str invitation_id: The ID of the invitation to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['invitation_id'] # noqa: E501
all_params.append('asynchronous')
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_invitation" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'invitation_id' is set
if ('invitation_id' not in params or
params['invitation_id'] is None):
raise ValueError("Missing the required parameter `invitation_id` when calling `delete_invitation`") # noqa: E501
collection_formats = {}
path_params = {}
if 'invitation_id' in params:
path_params['invitation-id'] = params['invitation_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/user-invitations/{invitation-id}', '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,
asynchronous=params.get('asynchronous'),
_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_user(self, user_id, **kwargs): # noqa: E501
"""Delete a user. # noqa: E501
An endpoint for deleting a user. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_user(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.delete_user_with_http_info(user_id, **kwargs) # noqa: E501
else:
(data) = self.delete_user_with_http_info(user_id, **kwargs) # noqa: E501
return data
def delete_user_with_http_info(self, user_id, **kwargs): # noqa: E501
"""Delete a user. # noqa: E501
An endpoint for deleting a user. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.delete_user_with_http_info(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be deleted. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id'] # noqa: E501
all_params.append('asynchronous')
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_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `delete_user`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}', '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,
asynchronous=params.get('asynchronous'),
_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_all_invitations(self, **kwargs): # noqa: E501
"""Get the details of all the user invitations. # noqa: E501
An endpoint for retrieving the details of all the active user invitations sent for new or existing users to join the account. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/user-invitations -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_all_invitations(asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:return: UserInvitationRespList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_all_invitations_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_all_invitations_with_http_info(**kwargs) # noqa: E501
return data
def get_all_invitations_with_http_info(self, **kwargs): # noqa: E501
"""Get the details of all the user invitations. # noqa: E501
An endpoint for retrieving the details of all the active user invitations sent for new or existing users to join the account. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/user-invitations -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_all_invitations_with_http_info(asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:return: UserInvitationRespList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['limit', 'after', 'order'] # noqa: E501
all_params.append('asynchronous')
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_all_invitations" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'after' in params:
query_params.append(('after', params['after'])) # noqa: E501
if 'order' in params:
query_params.append(('order', params['order'])) # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/user-invitations', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInvitationRespList', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_all_users(self, **kwargs): # noqa: E501
"""Get the details of all users. # noqa: E501
An endpoint for retrieving the details of all users. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_all_users(asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:param str email__eq: Filter for email address
:param str status__eq: Filter for status, for example active or reset
:param str status__in: An optional filter for getting users with a specified set of statuses.
:param str status__nin: An optional filter for excluding users with a specified set of statuses.
:return: UserInfoRespList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_all_users_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_all_users_with_http_info(**kwargs) # noqa: E501
return data
def get_all_users_with_http_info(self, **kwargs): # noqa: E501
"""Get the details of all users. # noqa: E501
An endpoint for retrieving the details of all users. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_all_users_with_http_info(asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:param str email__eq: Filter for email address
:param str status__eq: Filter for status, for example active or reset
:param str status__in: An optional filter for getting users with a specified set of statuses.
:param str status__nin: An optional filter for excluding users with a specified set of statuses.
:return: UserInfoRespList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['limit', 'after', 'order', 'include', 'email__eq', 'status__eq', 'status__in', 'status__nin'] # noqa: E501
all_params.append('asynchronous')
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_all_users" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'after' in params:
query_params.append(('after', params['after'])) # noqa: E501
if 'order' in params:
query_params.append(('order', params['order'])) # noqa: E501
if 'include' in params:
query_params.append(('include', params['include'])) # noqa: E501
if 'email__eq' in params:
query_params.append(('email__eq', params['email__eq'])) # noqa: E501
if 'status__eq' in params:
query_params.append(('status__eq', params['status__eq'])) # noqa: E501
if 'status__in' in params:
query_params.append(('status__in', params['status__in'])) # noqa: E501
if 'status__nin' in params:
query_params.append(('status__nin', params['status__nin'])) # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInfoRespList', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_groups_of_apikey(self, api_key, **kwargs): # noqa: E501
"""Get groups of the API key. # noqa: E501
An endpoint for retrieving groups of the API key. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_groups_of_apikey(api_key, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key whose details are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:return: GroupSummaryList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_groups_of_apikey_with_http_info(api_key, **kwargs) # noqa: E501
else:
(data) = self.get_groups_of_apikey_with_http_info(api_key, **kwargs) # noqa: E501
return data
def get_groups_of_apikey_with_http_info(self, api_key, **kwargs): # noqa: E501
"""Get groups of the API key. # noqa: E501
An endpoint for retrieving groups of the API key. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_groups_of_apikey_with_http_info(api_key, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key whose details are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:return: GroupSummaryList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['api_key', 'limit', 'after', 'order', 'include'] # noqa: E501
all_params.append('asynchronous')
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_groups_of_apikey" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'api_key' is set
if ('api_key' not in params or
params['api_key'] is None):
raise ValueError("Missing the required parameter `api_key` when calling `get_groups_of_apikey`") # noqa: E501
collection_formats = {}
path_params = {}
if 'api_key' in params:
path_params['apiKey'] = params['api_key'] # noqa: E501
query_params = []
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'after' in params:
query_params.append(('after', params['after'])) # noqa: E501
if 'order' in params:
query_params.append(('order', params['order'])) # noqa: E501
if 'include' in params:
query_params.append(('include', params['include'])) # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/api-keys/{apiKey}/groups', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GroupSummaryList', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_groups_of_user(self, user_id, **kwargs): # noqa: E501
"""Get groups of the user. # noqa: E501
An endpoint for retrieving groups of the user. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_groups_of_user(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:return: GroupSummaryList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_groups_of_user_with_http_info(user_id, **kwargs) # noqa: E501
else:
(data) = self.get_groups_of_user_with_http_info(user_id, **kwargs) # noqa: E501
return data
def get_groups_of_user_with_http_info(self, user_id, **kwargs): # noqa: E501
"""Get groups of the user. # noqa: E501
An endpoint for retrieving groups of the user. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_groups_of_user_with_http_info(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:return: GroupSummaryList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id', 'limit', 'after', 'order', 'include'] # noqa: E501
all_params.append('asynchronous')
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_groups_of_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `get_groups_of_user`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id'] # noqa: E501
query_params = []
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'after' in params:
query_params.append(('after', params['after'])) # noqa: E501
if 'order' in params:
query_params.append(('order', params['order'])) # noqa: E501
if 'include' in params:
query_params.append(('include', params['include'])) # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}/groups', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GroupSummaryList', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_invitation(self, invitation_id, **kwargs): # noqa: E501
"""Details of a user invitation. # noqa: E501
An endpoint for retrieving the details of an active user invitation sent for a new or an existing user to join the account. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/user-invitations/{invitation-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_invitation(invitation_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str invitation_id: The ID of the invitation to be retrieved. (required)
:return: UserInvitationResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_invitation_with_http_info(invitation_id, **kwargs) # noqa: E501
else:
(data) = self.get_invitation_with_http_info(invitation_id, **kwargs) # noqa: E501
return data
def get_invitation_with_http_info(self, invitation_id, **kwargs): # noqa: E501
"""Details of a user invitation. # noqa: E501
An endpoint for retrieving the details of an active user invitation sent for a new or an existing user to join the account. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/user-invitations/{invitation-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_invitation_with_http_info(invitation_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str invitation_id: The ID of the invitation to be retrieved. (required)
:return: UserInvitationResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['invitation_id'] # noqa: E501
all_params.append('asynchronous')
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_invitation" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'invitation_id' is set
if ('invitation_id' not in params or
params['invitation_id'] is None):
raise ValueError("Missing the required parameter `invitation_id` when calling `get_invitation`") # noqa: E501
collection_formats = {}
path_params = {}
if 'invitation_id' in params:
path_params['invitation-id'] = params['invitation_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/user-invitations/{invitation-id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInvitationResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_user(self, user_id, **kwargs): # noqa: E501
"""Details of a user. # noqa: E501
An endpoint for retrieving the details of a user. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_user(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are retrieved. (required)
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_user_with_http_info(user_id, **kwargs) # noqa: E501
else:
(data) = self.get_user_with_http_info(user_id, **kwargs) # noqa: E501
return data
def get_user_with_http_info(self, user_id, **kwargs): # noqa: E501
"""Details of a user. # noqa: E501
An endpoint for retrieving the details of a user. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_user_with_http_info(user_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are retrieved. (required)
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id'] # noqa: E501
all_params.append('asynchronous')
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_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `get_user`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInfoResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_users_of_group(self, group_id, **kwargs): # noqa: E501
"""Get users of a group. # noqa: E501
An endpoint for listing the users of a group with details. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id}/users -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_users_of_group(group_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group whose users are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:param str status__eq: An optional filter for getting users by status.
:param str status__in: An optional filter for getting users with a specified set of statuses.
:param str status__nin: An optional filter for excluding users with a specified set of statuses.
:return: UserInfoRespList
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.get_users_of_group_with_http_info(group_id, **kwargs) # noqa: E501
else:
(data) = self.get_users_of_group_with_http_info(group_id, **kwargs) # noqa: E501
return data
def get_users_of_group_with_http_info(self, group_id, **kwargs): # noqa: E501
"""Get users of a group. # noqa: E501
An endpoint for listing the users of a group with details. **Example usage:** `curl https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id}/users -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.get_users_of_group_with_http_info(group_id, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group whose users are retrieved. (required)
:param int limit: The number of results to return (2-1000), default is 50.
:param str after: The entity ID to fetch after the given one.
:param str order: The order of the records based on creation time, ASC or DESC; by default ASC
:param str include: Comma separated additional data to return. Currently supported: total_count
:param str status__eq: An optional filter for getting users by status.
:param str status__in: An optional filter for getting users with a specified set of statuses.
:param str status__nin: An optional filter for excluding users with a specified set of statuses.
:return: UserInfoRespList
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['group_id', 'limit', 'after', 'order', 'include', 'status__eq', 'status__in', 'status__nin'] # noqa: E501
all_params.append('asynchronous')
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_users_of_group" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'group_id' is set
if ('group_id' not in params or
params['group_id'] is None):
raise ValueError("Missing the required parameter `group_id` when calling `get_users_of_group`") # noqa: E501
collection_formats = {}
path_params = {}
if 'group_id' in params:
path_params['groupID'] = params['group_id'] # noqa: E501
query_params = []
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'after' in params:
query_params.append(('after', params['after'])) # noqa: E501
if 'order' in params:
query_params.append(('order', params['order'])) # noqa: E501
if 'include' in params:
query_params.append(('include', params['include'])) # noqa: E501
if 'status__eq' in params:
query_params.append(('status__eq', params['status__eq'])) # noqa: E501
if 'status__in' in params:
query_params.append(('status__in', params['status__in'])) # noqa: E501
if 'status__nin' in params:
query_params.append(('status__nin', params['status__nin'])) # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups/{groupID}/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInfoRespList', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 remove_api_key_from_groups(self, api_key, body, **kwargs): # noqa: E501
"""Remove API key from groups. # noqa: E501
An endpoint for removing API key from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_api_key_from_groups(api_key, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key to be removed from the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.remove_api_key_from_groups_with_http_info(api_key, body, **kwargs) # noqa: E501
else:
(data) = self.remove_api_key_from_groups_with_http_info(api_key, body, **kwargs) # noqa: E501
return data
def remove_api_key_from_groups_with_http_info(self, api_key, body, **kwargs): # noqa: E501
"""Remove API key from groups. # noqa: E501
An endpoint for removing API key from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/api-keys/{apikey-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_api_key_from_groups_with_http_info(api_key, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str api_key: The ID of the API key to be removed from the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['api_key', 'body'] # noqa: E501
all_params.append('asynchronous')
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 remove_api_key_from_groups" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'api_key' is set
if ('api_key' not in params or
params['api_key'] is None):
raise ValueError("Missing the required parameter `api_key` when calling `remove_api_key_from_groups`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `remove_api_key_from_groups`") # noqa: E501
collection_formats = {}
path_params = {}
if 'api_key' in params:
path_params['apiKey'] = params['api_key'] # 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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/api-keys/{apiKey}/groups', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 remove_user_from_groups(self, user_id, body, **kwargs): # noqa: E501
"""Remove user from groups. # noqa: E501
An endpoint for removing user from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_user_from_groups(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be removed from the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.remove_user_from_groups_with_http_info(user_id, body, **kwargs) # noqa: E501
else:
(data) = self.remove_user_from_groups_with_http_info(user_id, body, **kwargs) # noqa: E501
return data
def remove_user_from_groups_with_http_info(self, user_id, body, **kwargs): # noqa: E501
"""Remove user from groups. # noqa: E501
An endpoint for removing user from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/users/{user-id}/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_user_from_groups_with_http_info(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user to be removed from the group. (required)
:param list[str] body: A list of IDs of the groups to be updated. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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 remove_user_from_groups" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `remove_user_from_groups`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `remove_user_from_groups`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}/groups', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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 remove_users_from_group(self, group_id, body, **kwargs): # noqa: E501
"""Remove users from a group. # noqa: E501
An endpoint for removing users from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id}/users -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_users_from_group(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group whose users are removed. (required)
:param SubjectList body: A list of users to be removed from the group. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.remove_users_from_group_with_http_info(group_id, body, **kwargs) # noqa: E501
else:
(data) = self.remove_users_from_group_with_http_info(group_id, body, **kwargs) # noqa: E501
return data
def remove_users_from_group_with_http_info(self, group_id, body, **kwargs): # noqa: E501
"""Remove users from a group. # noqa: E501
An endpoint for removing users from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id}/users -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.remove_users_from_group_with_http_info(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group whose users are removed. (required)
:param SubjectList body: A list of users to be removed from the group. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['group_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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 remove_users_from_group" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'group_id' is set
if ('group_id' not in params or
params['group_id'] is None):
raise ValueError("Missing the required parameter `group_id` when calling `remove_users_from_group`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `remove_users_from_group`") # noqa: E501
collection_formats = {}
path_params = {}
if 'group_id' in params:
path_params['groupID'] = params['group_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups/{groupID}/users', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_group_name(self, group_id, body, **kwargs): # noqa: E501
"""Update the group name. # noqa: E501
An endpoint for updating a group name. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"name\": \"TestGroup2\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_group_name(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be updated. (required)
:param GroupUpdateInfo body: Details of the group to be created. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.update_group_name_with_http_info(group_id, body, **kwargs) # noqa: E501
else:
(data) = self.update_group_name_with_http_info(group_id, body, **kwargs) # noqa: E501
return data
def update_group_name_with_http_info(self, group_id, body, **kwargs): # noqa: E501
"""Update the group name. # noqa: E501
An endpoint for updating a group name. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"name\": \"TestGroup2\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_group_name_with_http_info(group_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str group_id: The ID of the group to be updated. (required)
:param GroupUpdateInfo body: Details of the group to be created. (required)
:return: UpdatedResponse
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['group_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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_group_name" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'group_id' is set
if ('group_id' not in params or
params['group_id'] is None):
raise ValueError("Missing the required parameter `group_id` when calling `update_group_name`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_group_name`") # noqa: E501
collection_formats = {}
path_params = {}
if 'group_id' in params:
path_params['groupID'] = params['group_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/policy-groups/{groupID}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdatedResponse', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_my_account(self, body, **kwargs): # noqa: E501
"""Updates attributes of the account. # noqa: E501
An endpoint for updating the account. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/accounts/me -d '{\"phone_number\": \"12345678\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_my_account(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param AccountUpdateReq body: Details of the account to be updated. (required)
:return: AccountInfo
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.update_my_account_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.update_my_account_with_http_info(body, **kwargs) # noqa: E501
return data
def update_my_account_with_http_info(self, body, **kwargs): # noqa: E501
"""Updates attributes of the account. # noqa: E501
An endpoint for updating the account. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/accounts/me -d '{\"phone_number\": \"12345678\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_my_account_with_http_info(body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param AccountUpdateReq body: Details of the account to be updated. (required)
:return: AccountInfo
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('asynchronous')
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_my_account" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_my_account`") # noqa: E501
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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/accounts/me', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='AccountInfo', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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_user(self, user_id, body, **kwargs): # noqa: E501
"""Update user details. # noqa: E501
An endpoint for updating user details. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -d '{\"username\": \"myusername\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_user(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are updated. (required)
:param UserUpdateReq body: A user object with attributes. (required)
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('asynchronous'):
return self.update_user_with_http_info(user_id, body, **kwargs) # noqa: E501
else:
(data) = self.update_user_with_http_info(user_id, body, **kwargs) # noqa: E501
return data
def update_user_with_http_info(self, user_id, body, **kwargs): # noqa: E501
"""Update user details. # noqa: E501
An endpoint for updating user details. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/users/{user-id} -d '{\"username\": \"myusername\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.update_user_with_http_info(user_id, body, asynchronous=True)
>>> result = thread.get()
:param asynchronous bool
:param str user_id: The ID of the user whose details are updated. (required)
:param UserUpdateReq body: A user object with attributes. (required)
:return: UserInfoResp
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['user_id', 'body'] # noqa: E501
all_params.append('asynchronous')
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_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params or
params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `update_user`") # noqa: E501
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_user`") # noqa: E501
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_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 = ['Bearer'] # noqa: E501
return self.api_client.call_api(
'/v3/users/{user-id}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserInfoResp', # noqa: E501
auth_settings=auth_settings,
asynchronous=params.get('asynchronous'),
_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)
| 45.443163
| 383
| 0.622073
| 13,207
| 110,336
| 4.999016
| 0.022034
| 0.045318
| 0.019509
| 0.025083
| 0.98755
| 0.985187
| 0.983748
| 0.98034
| 0.976765
| 0.974842
| 0
| 0.025656
| 0.280761
| 110,336
| 2,427
| 384
| 45.461887
| 0.806296
| 0.410664
| 0
| 0.837262
| 1
| 0
| 0.191825
| 0.039401
| 0
| 0
| 0
| 0
| 0
| 1
| 0.035741
| false
| 0
| 0.003042
| 0
| 0.092015
| 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
|
5f72eb7a4da9263acae3c74f9a4cc448c1e6cd7b
| 146
|
py
|
Python
|
core/__init__.py
|
FloydaGithub/sublime_lua_format
|
e45e045965d2fdbf920c0843104e04b3904af8ae
|
[
"MIT"
] | 17
|
2017-01-22T15:40:56.000Z
|
2019-03-24T09:34:54.000Z
|
core/__init__.py
|
Sublime-Chinese/sublime_lua_format
|
e45e045965d2fdbf920c0843104e04b3904af8ae
|
[
"MIT"
] | 20
|
2017-06-06T16:25:01.000Z
|
2018-11-27T02:56:54.000Z
|
core/__init__.py
|
Sublime-Chinese/sublime_lua_format
|
e45e045965d2fdbf920c0843104e04b3904af8ae
|
[
"MIT"
] | 8
|
2017-01-22T15:43:39.000Z
|
2019-03-24T09:34:56.000Z
|
import os
if os.sys.version.startswith('3'):
from LuaFormat.core.LuaFormat import lua_format
else:
from core.LuaFormat import lua_format
| 20.857143
| 51
| 0.767123
| 22
| 146
| 5
| 0.590909
| 0.236364
| 0.345455
| 0.4
| 0.509091
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008065
| 0.150685
| 146
| 6
| 52
| 24.333333
| 0.879032
| 0
| 0
| 0
| 0
| 0
| 0.006849
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
399c6c30f4f4457cc10ff28ff9e6ae3ba72afad6
| 54,260
|
py
|
Python
|
Compiler/nonlinear_config.py
|
Fannxy/MP-SPDZ
|
5f87d2a62c486d241cf97caa4fec63a6cfb28a5e
|
[
"BSD-2-Clause"
] | 1
|
2021-11-28T11:26:31.000Z
|
2021-11-28T11:26:31.000Z
|
Compiler/nonlinear_config.py
|
Fannxy/MP-SPDZ
|
5f87d2a62c486d241cf97caa4fec63a6cfb28a5e
|
[
"BSD-2-Clause"
] | null | null | null |
Compiler/nonlinear_config.py
|
Fannxy/MP-SPDZ
|
5f87d2a62c486d241cf97caa4fec63a6cfb28a5e
|
[
"BSD-2-Clause"
] | null | null | null |
"""Generated config, with scaler.
Date: 2022-01-09
Change: f = 48, n = 128 with relative error constrain in 1e-3.
added zero_mask = 1e-10.
The scaler directly save the reciprocal, have some problems in the round of its reciprocal.
The error evaluation method changed for both plain-text and cipher-text.
"""
sigmoid_config = {
'breaks': [-50.0, -23.02086353302002, -23.00117015838623, -23.00114631652832, -22.96290397644043, -22.962876223027706, -22.96287603676319, -22.926005721092224, -22.92600553482771, -22.890446335077286, -22.89044614881277, -22.87312988191843, -22.873129695653915, -22.65625, -22.0703125, -21.875, -21.58203125, -21.484375, -21.2890625, -21.19140625, -20.8984375, -20.80078125, -20.751953125, -20.703125, -19.53125, -18.75, -17.96875, -17.1875, -16.40625, -15.625, -14.84375, -14.0625, -13.28125, -12.5, -11.71875, -10.9375, -10.15625, -9.375, -8.59375, -7.8125, -7.03125, -6.25, -5.46875, -4.6875, -3.90625, -3.125, -1.5625, 0.0, 1.5625, 3.125, 6.25, 25.0, 50.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[0.00398701932, 0.000319266006, 8.35443e-06, 7.1561e-08, ],
[-0.004609651251, -0.003382475498, -0.00025153453, -4.956335e-06, ],
[2.443568924838, 0.015237808418, -0.001071448385, 0.000125385714, ],
[0.109202026501, 0.006502759379, -3.3997035e-05, -4.830837e-06, ],
[0.003795294665, 0.000181086613, -3.283487e-06, -2.09687e-07, ],
[807.928583923834, 35.184100261716, 0.0, 0.0, ],
[0.110513329528, 0.006205912744, -6.7637124e-05, -5.62464e-06, ],
[0.000461372626, 0.0, 0.0, 0.0, ],
[0.015608644171, -0.005850463733, -0.000578002143, -1.2823834e-05, ],
[805.386981669484, 35.184394910007, 0.0, 0.0, ],
[0.148682338328, 0.006361740552, -0.000277233065, -1.1896364e-05, ],
[804.77772113169, 35.184394910007, 0.0, 0.0, ],
[0.02791734738, -0.003836235541, -0.000471549938, -1.0991296e-05, ],
[1.857777565079, 0.238340934316, 0.010212548128, 0.000146128887, ],
[0.183683186621, 0.009219303994, -0.000239946464, -1.2814192e-05, ],
[-0.438302705956, -0.08047002275, -0.004541200393, -8.1431103e-05, ],
[0.29047867927, 0.015596861543, -0.000332010523, -2.0149644e-05, ],
[-0.173396062055, -0.051915677482, -0.00360236141, -7.288212e-05, ],
[0.204347665331, -0.002770333895, -0.001485267861, -4.2722338e-05, ],
[3.130668565602, 0.407751898633, 0.017709607313, 0.000256412379, ],
[0.384060633392, 0.008786069493, -0.001604814706, -5.5215687e-05, ],
[0.464459025844, 0.017578793894, -0.001316670973, -5.2751809e-05, ],
[0.569795445652, 0.030454984429, -0.000809457046, -4.642299e-05, ],
[12.393312855154, 1.752391686569, 0.08278736893, 0.001306472968, ],
[28.35849717192, 4.203208499893, 0.208210086966, 0.00344625708, ],
[54.369315319399, 8.373855128197, 0.431137690337, 0.007418494544, ],
[106.117212273805, 17.033761401987, 0.914253961424, 0.016403284022, ],
[203.576816649827, 34.089925468572, 1.909332507378, 0.035756466888, ],
[389.26651982389, 68.137969500417, 3.990563669718, 0.078166831121, ],
[737.580312820157, 135.200790536874, 8.295043663876, 0.170272633304, ],
[1391.676395525416, 267.776804046227, 17.253271595774, 0.372068675205, ],
[2606.241464359107, 527.673828575312, 35.793791267158, 0.813011364004, ],
[4841.078174045158, 1034.124008207964, 74.056460334491, 1.776753583626, ],
[8908.600625741838, 2013.714664426048, 152.709552606543, 3.88219350237, ],
[16225.279258744256, 3893.726410122101, 313.764635055505, 8.482161990765, ],
[29193.556836921845, 7464.727582505348, 641.616673476718, 18.517802201465, ],
[51856.35172915142, 14187.01071688224, 1306.456354574977, 40.441446289881, ],
[90712.37062726509, 26676.77622353886, 2645.108377415158, 88.282102487219, ],
[155890.6643892056, 49539.76281835047, 5319.389388136198, 192.591491716634, ],
[262293.74270467437, 90611.3062693571, 10606.36320720412, 419.55195362967, ],
[430018.15811611747, 162575.87036799625, 20904.72515598179, 911.072215600344, ],
[682128.9810741317, 284317.88470148906, 40514.99844996233, 1964.771183079816, ],
[1035639.4459240435, 479463.8025506491, 76457.60547223434, 4173.520460766672, ],
[1479035.5923163493, 764945.084830472, 137806.89037193387, 8573.788756959639, ],
[1934390.314777591, 1115975.2676433255, 228179.66341296295, 16343.780890003678, ],
[2271477.582305388, 1442688.3819854176, 334189.02979225264, 27858.42056965208, ],
[2098807.2574304864, 1069197.0761318174, 55190.12954996164, -43418.866480025245, ],
[2095489.338059525, 1069197.0761290812, -55190.12954666437, -43418.866481168065, ],
[1922819.0128503852, 1442688.3824313267, -334189.0299862884, 27858.42059717758, ],
[2824875.51285168, 675885.8621337626, -114551.63971729192, 6608.706941762957, ],
[4172121.7922186563, 4160.245603410802, -247.810517087053, 4.722093547679, ],
[4194296.5954582347, -2.082612e-06, 1.62989e-07, -2.231e-09, ],
],
},
tanh_config = {
'breaks': [-50.0, -6.25, -0.78125, 0.0, 0.78125, 6.25, 50.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[-4194045.93541855, 81.04725611976, 10.463138575184, 0.704258478102, 0.026889953954, 0.00058642039, 6.804412e-06, 3.2576e-08, ],
[810126.6458983729, 7340700.604237439, 4704475.711939846, 1691640.5294427716, 365946.0693131795, 47378.83112188167, 3387.321196714939, 102.931349820303, ],
[0.947596785746, 4194387.117002231, 2081.209567983285, -1378059.7058902322, 98674.32465989991, 827618.6436768449, 400058.05869667773, 50783.229858411, ],
[-0.947567793221, 4194387.11483649, -2081.171600424905, -1378059.9775897914, -98673.36544149525, 827616.8732579398, -400056.4212395759, 50782.631016997955, ],
[-810130.6685373887, 7340712.763415546, -4704490.067068877, 1691649.1859599578, -365948.9786652053, 47379.3814831848, -3387.375931182968, 102.933573951061, ],
[4194045.935418548, 81.047256119806, -10.463138575191, 0.704258478103, -0.026889953954, 0.00058642039, -6.804412e-06, 3.2576e-08, ],
],
},
soft_plus_config = {
'breaks': [-20.0, -18.359375, -17.8125, -15.625, -13.4375, -11.25, -9.0625, -6.875, -4.6875, -2.5, -0.3125, 1.875, 6.25, 50.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[101.990248984024, 17.483235392741, 0.975152586375, 0.011170665848, -0.000640822284, -1.5474678e-05, ],
[25.942501887721, 2.120761240954, -0.036904826627, -0.003617744719, 0.000172668934, 7.923789e-06, ],
[1569.738573465028, 392.841311731982, 38.939569792452, 1.903103355115, 0.045588812843, 0.000424320654, ],
[10221.802869958385, 3036.975886093738, 361.071894491868, 21.446173115814, 0.63552374276, 0.007505662736, ],
[35603.079414978376, 11513.08770106031, 1471.231413480248, 92.182707733191, 2.800074890892, 0.032344003442, ],
[160671.3536358581, 62520.46925517268, 9691.474227099754, 743.850983797148, 28.057479690946, 0.411475235179, ],
[850748.4860730075, 446968.1223768878, 95799.79790873424, 10434.720040596265, 575.956571969616, 12.857823670119, ],
[2017144.149192322, 1321353.4391367515, 359524.95696972066, 50428.121673075984, 3624.368593631209, 106.255849052987, ],
[3020298.4292094633, 2379721.317270482, 811342.251332228, 148011.1516516293, 14286.954017588305, 577.647131251679, ],
[2908418.620371011, 2103977.837523053, 538379.745870657, 11767.887577989604, -20028.24621414198, -2906.476283611212, ],
[2906969.2484707027, 2097924.7410250027, 530800.4184051917, -16987.819649040128, -10739.172346407797, 0.0, ],
[2965004.3617158523, 1903118.0684465575, 756597.1504591476, -131632.224789337, 11908.853608537796, -443.192632294796, ],
[24159.949877974494, 4189189.7498553684, 397.81890063514, -14.455954764833, 0.247787205621, -0.001617694049, ],
],
},
snormal_dis_config = {
'breaks': [-5.0, -4.6875, -4.375, -3.75, -2.5, 0.0, 2.5, 3.75, 4.375, 5.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[31304.26993311414, 9130.16546364382, -1844.81978546199, -526.011308571866, 57.353080900898, 3.321006341503, -4.109487312933, -0.428353097768, ],
[119974.45879010632, 47580.55647943287, -3015.990590286581, -973.360778760376, 1237.486873833178, 395.014415959766, 40.071459102838, 1.196160897825, ],
[1421717.3776566053, 1031307.6043607326, 164737.01107375935, -32690.584175583015, -4606.937267693005, 3142.278139580568, 790.535586663009, 52.788095666519, ],
[3715122.932142754, 3333883.0658577476, 747774.7420066955, -182179.35601190457, -110575.30925502056, -16986.67754749418, -561.753626667674, 48.16881980522, ],
[1673533.3800128698, 7411.481525721444, -784376.7411539048, 152324.44435410656, 430386.40876365715, 167337.49911572924, 23090.286085915846, 666.100152429783, ],
[1673533.3803870187, -7411.48957529468, -784376.6992619456, -152324.5346228467, 430386.50553242775, -167337.5536508544, 23090.30154824131, -666.101891074295, ],
[3640594.2065956094, -3132256.5349616604, 520370.44485455274, 321617.2842362122, -160977.95331293883, 27757.15588128624, -1824.147188080396, 14.536518568956, ],
[1208675.669925383, -866707.8277553315, 150582.63085789658, 11919.162975807238, 2713.91449180321, -3907.342025584125, 774.706793877178, -47.624175447624, ],
[225060.34561747377, -97200.35296877172, -19012.206481532394, 14740.852669650061, -1187.682098772117, -482.91270246705, 101.88771139137, -5.720905524657, ],
],
},
scauchy_dis_config = {
'breaks': [-50.0, -12.5, -3.125, -1.5625, 0.0, 1.5625, 6.25, 12.5, 50.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[97248.63341904456, 20083.36092359592, 1985.328816334903, 116.357674006848, 4.321683011041, 0.102959390815, 0.001526833252, 1.2840302e-05, 4.6793e-08, ],
[1162592.4394692497, 900485.853088537, 340969.43715777266, 77509.8644109634, 11255.412887364964, 1054.029274259123, 61.672238047634, 2.051949837655, 0.029644529004, ],
[2033913.8648985175, 2389334.78350175, 1528516.9888125868, 700668.1347334182, 263499.160313978, 80707.98933717232, 17719.89760418472, 2336.449711275477, 135.58988093684, ],
[1335167.9660587362, 5267.286636123638, -1253148.882543776, 538806.0458725075, 3158496.1042466583, 3365195.2714636633, 1752385.860870584, 466963.69493033673, 50876.2343621253, ],
[1335167.96863223, -5267.407738641146, -1253147.517000925, -538812.473993154, 3158511.554611758, -3365215.854591981, 1752401.2352791475, -466969.7200421834, 50877.198380017595, ],
[2059118.043569359, -2409667.139443788, 1456407.699712485, -550726.0489455989, 137310.53922303024, -22631.072310798772, 2376.727085525736, -144.194508047845, 3.84762307433, ],
[479604.8745796233, -217577.14889334625, 44443.91061381256, -4584.46291565951, 157.824615827344, 15.116009722535, -1.97120617861, 0.087607464233, -0.00145258403, ],
[96819.04716239087, -19948.14008432831, 1967.32555219075, -115.032286206253, 4.262592212067, -0.101322959424, 0.001499293141, -1.2582302e-05, 4.5761e-08, ],
],
},
gamma_dis_config = {
'breaks': [0.0, 2.5, 5.0, 10.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[27.778670375448, 4370493.675291532, -4365291.05201621, 2167206.1260501323, -699253.2175441002, 155609.89788421427, -22192.3371535075, 1519.839684014879, ],
[798245.3159432518, 2472434.6691442183, -2354423.9968063263, 917561.614169512, -199389.27033708373, 25543.657383226317, -1818.33352599695, 55.783331926126, ],
[4461288.157574071, -2513362.898088136, 612925.1338774561, -82651.58685956625, 6510.418496914853, -287.752446254029, 5.985938119069, -0.028147716533, ],
],
},
sexp_dis_config = {
'breaks': [1e-05, 0.31250968749999997, 2.5000074999999997, 5.000005, 7.5000025, 10.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[4193364.7574642934, -4157887.3704455155, 1796903.7881006491, 0.0, 0.0, 0.0, ],
[4189712.6596682654, -4163925.9690107177, 2020635.6658743396, -602775.1929061551, 108273.33405801615, -8968.256777581586, ],
[3544591.3264654144, -2952946.301988507, 1066196.3636716001, -205316.2116045786, 20776.88833314614, -872.822702581336, ],
[1781678.9951623098, -1117221.369676658, 289279.3399066672, -38419.914571291985, 2603.771010084266, -71.732986127335, ],
[573976.5559249318, -279374.46842363675, 55251.428167102706, -5534.823818602391, 280.220142642649, -5.725620461664, ],
],
},
chi_square_config = {
'breaks': [0.0, 0.78125, 3.125, 6.25, 9.375, 12.5, 15.625, 18.75, 21.875, 25.0, 28.125, 31.25, 35.9375, 37.5, 39.0625, 42.1875, 43.75, 46.09375, 47.265625, 47.65625, 47.8515625, 48.046875, 49.21875, 50.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[2.633441150834, 1092728.9144141169, -545481.3827921028, 133341.74702396255, -17860.708524061814, ],
[19113.198247381682, 1030861.0442907239, -468582.0444834488, 87993.01136196367, -6650.871566929995, ],
[551187.2275055703, 385613.4849649353, -163674.79991835158, 21294.81684114599, -961.228131802494, ],
[1624339.441034664, -339721.9720143102, 22679.589341669634, -246.164578373642, -17.553125051984, ],
[1876716.0995595504, -461669.6276171044, 44674.10928103387, -2002.503525663182, 34.87074068853, ],
[1396628.1536118898, -309130.2230161316, 26442.366404456392, -1030.960874220241, 15.394606022949, ],
[803048.2287268342, -155755.10674898268, 11548.437974838385, -386.773274301008, 4.924355347912, ],
[388757.230944264, -66355.70888842308, 4303.331635308104, -125.431726925591, 1.384189721931, ],
[167601.0515877717, -25447.677607674636, 1462.732158532948, -37.675127480918, 0.366487061576, ],
[63114.682330625576, -8569.204305638894, 439.37469704111, -10.074389618197, 0.08709216139, ],
[21689.031920045098, -2654.822462991433, 122.509408784946, -2.52439491857, 0.019587488472, ],
[6557.667075833707, -725.863031075515, 30.249125998658, -0.5622300182, 0.003930983085, ],
[164.717815387793, -3.662838482048, -0.367322737727, 0.015032798448, -0.000153354373, ],
[93.578321649794, -2.42028813585, -0.162017454274, 0.006827318496, -6.8125109e-05, ],
[418.767571815519, -38.491868800087, 1.33023200346, -0.02047990636, 0.000118492219, ],
[29.39151117008, -1.755300811364, 0.030351463853, -3.5752273e-05, -2.097012e-06, ],
[50.510267214252, -4.074983181051, 0.123253745211, -0.001655791098, 8.332248e-06, ],
[6.345810039409, -0.350025288389, 0.005575013118, -5.541983e-06, -3.34293e-07, ],
[0.355807867984, -0.014772520498, 0.00036417105, -8.342798e-06, 8.2672e-08, ],
[0.079911567574, 0.005672092545, -0.000238430799, 1.38746e-07, 3.4626e-08, ],
[0.234371388425, 0.034594471822, -0.002477441427, 5.0188312e-05, -3.26901e-07, ],
[0.92465180232, 0.006132369987, -0.002508207143, 6.3562473e-05, -4.6485e-07, ],
[0.99339365892, -0.025508747209, -0.000744989288, 2.8791656e-05, -2.32589e-07, ],
],
},
slog_dis_config = {
'breaks': [0.001, 0.0022206420898437497, 0.005882568359375, 0.040060546875, 0.1572421875, 1.2509375, 5.00075, 10.0005, 20.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[0.268626462114, -1175.322435991052, 2086915.8118898626, -1861216224.7804956, 753737048776.9146, 0.0, 0.0, 0.0, ],
[-4.017171180823, 3872.335253195195, 642862.6598793622, -2289145194.2375584, 1048043128944.0438, -42204023033820.9, 0.0, 0.0, ],
[-916.909970836132, 568734.4835124938, -145531775.45853516, 17816966566.259033, -437578342697.19763, 5200615954744.682, -25956540754680.117, 0.0, ],
[88677.84013405546, -11238694.421728892, 546463980.4795989, -5366724537.81832, 28977360342.438774, -92939497805.85388, 160845353115.72794, -108356412192.32516, ],
[-1366725.4544273522, 35080284.704431385, -118514860.12695184, 214550352.55726737, -238770767.85162464, 162641519.9148953, -62130989.8920718, 10184500.096544107, ],
[4915442.06884933, -5445579.99049578, 3068014.287737718, -1068728.9057128155, 238873.04358133572, -33415.457416519406, 2666.426128012068, -92.677074524944, ],
[2172029.495401563, -1418118.9298525134, 434370.3094184368, -78174.94994270892, 8750.367131815334, -601.717127220767, 23.351852536198, -0.392492299234, ],
[566190.3710634038, -209511.98409202718, 35161.3715728029, -3396.672848478098, 201.401683126878, -7.270930099694, 0.147195944012, -0.001284382678, ],
],
},
reciprocal_config = {
'breaks': [1e-05, 1.0727595761345585e-05, 1.1455191522691167e-05, 1.2910383045382332e-05, 1.4365574568073499e-05, 1.5820766090764666e-05, 1.727595761345583e-05, 1.8731149136146995e-05, 2.164153218152933e-05, 2.4551915226911662e-05, 2.7462298272293992e-05, 3.0372681317676325e-05, 3.328306436305866e-05, 4.4924596544587984e-05, 5.656612872611732e-05, 7.984919308917597e-05, 0.00010313225745223464, 0.0001264153218152933, 0.00014969838617835197, 0.00019626451490446927, 0.00024283064363058658, 0.0002893967723567039, 0.0003825290298089385, 0.0005687935447134078, 0.000755058059617877, 0.0009413225745223462, 0.0011275870894268156, 0.001500116119235754, 0.0018726451490446924, 0.002245174178853631, 0.002990232238471508, 0.003735290298089385, 0.004480348357707262, 0.005970464476943016, 0.008950696715414524, 0.011930928953886033, 0.014911161192357542, 0.01789139343082905, 0.023851857907772066, 0.02981232238471508, 0.0357727868616581, 0.04769371581554413, 0.0715355737233162, 0.09537743163108826, 0.11921928953886032, 0.1430611474466324, 0.19074486326217652, 0.23842857907772064, 0.2861122948932648, 0.381479726524353, 0.5722145897865296, 0.7629494530487061, 1.1444191795730592, 1.5258889060974121, 2.2888283591461183, 3.051767812194824, 6.103525624389649, 9.155283436584472, 12.207041248779298, 18.31055687316895, 24.414072497558596, 36.621103746337894, 48.82813499511719, 97.65625999023437, 146.48438498535157, 195.31250998046875, 292.9687599707031, 390.6250099609375, 781.2500099218751, 1171.8750098828127, 1562.5000098437501, 2343.7500097656252, 3125.0000096875, 6250.000009375, 9375.0000090625, 12500.000008750001, 18750.000008125004, 25000.000007500003, 37500.000006250004, 50000.000005, 75000.0000025, 87500.00000125001, 100000.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[1214848305201.7212, -1.1726175021863675e+17, 3.7719172330132954e+21, 0.0, ],
[1135067767149.0073, -1.0236924063621528e+17, 3.076821157374724e+21, 0.0, ],
[1034639238440.2142, -8.5013176464605e+16, 2.32675958220783e+21, 0.0, ],
[923916702238.2401, -6.780114081398221e+16, 1.6575704308591333e+21, 0.0, ],
[834625529784.4006, -5.533505341471934e+16, 1.222321204806124e+21, 0.0, ],
[761087120022.1727, -4.601716534457355e+16, 9.270768758998886e+20, 0.0, ],
[699467689173.8698, -3.88698264416475e+16, 7.19770543010074e+20, 0.0, ],
[624919327864.6323, -3.100369813020414e+16, 5.121872698607899e+20, 0.0, ],
[545846649207.2183, -2.365998201672148e+16, 3.415788826842872e+20, 0.0, ],
[484563947718.2919, -1.864870553331774e+16, 2.390849742977128e+20, 0.0, ],
[435668041872.8745, -1.5076835876799296e+16, 1.7382926289623145e+20, 0.0, ],
[395744655418.059, -1.2441350109558014e+16, 1.3032167744002246e+20, 0.0, ],
[433807307180.66315, -1.6771223034780776e+16, 2.8724647613555356e+20, -1.83904142289776e+24, ],
[332780975171.7099, -9882410408571190.0, 1.3018487612612487e+20, -6.419024811178374e+23, ],
[249582927729.615, -5545615624566329.0, 5.453308489413506e+19, -2.0025278239473964e+23, ],
[184857408409.9937, -3048082795019133.0, 2.22852795386553e+19, -6.0957962449103176e+22, ],
[146923264876.5295, -1927119505425625.5, 1.1217621852588933e+19, -2.4450240852089985e+22, ],
[121952047914.95476, -1328329695346346.5, 6.423863148464207e+18, -1.1637915372956364e+22, ],
[97866458121.68951, -854078618021366.9, 3.304008079042826e+18, -4.780625268936685e+21, ],
[76844381560.47073, -527097754273004.75, 1.6042939407275036e+18, -1.8281298285779165e+21, ],
[63284510011.637596, -357674764737716.44, 8.974673456440484e+17, -8.4353589328015e+20, ],
[50417451722.47956, -226632331059323.06, 4.5151540491469357e+17, -3.3639923698694075e+20, ],
[35957455256.58562, -114946300440941.16, 1.623981842486456e+17, -8.556464405434568e+19, ],
[25597088402.53554, -58412225839135.836, 5.907306166399155e+16, -2.2339335182340452e+19, ],
[19898613589.70386, -35339575208248.94, 2.784598230247185e+16, -8.213787717481314e+18, ],
[16283600889.486416, -23679144817850.81, 1.5285962690313482e+16, -3.696119716467635e+18, ],
[12897918385.70013, -14830045297332.854, 7556464048147028.0, -1.4396960916661842e+18, ],
[10009021895.759388, -8941078010902.893, 3543576383428429.0, -5.25732060415756e+17, ],
[8181660824.292896, -5977823526747.435, 1938880186054058.5, -2.3554852191102733e+17, ],
[6474096226.651072, -3736385371039.796, 955581368496632.8, -9.13797768392177e+16, ],
[5019575068.292841, -2248722730118.6396, 446944866647957.44, -3.325356442569236e+16, ],
[4100866197.2357106, -1501788706260.6936, 244143872857263.0, -1.4866264827703008e+16, ],
[3243369549.145814, -937737440654.8092, 120144705208591.86, -5755586122700288.0, ],
[2294356414.664274, -467881653543.9552, 42158964274085.13, -1416355592706204.8, ],
[1623269828.1805296, -234891510207.94733, 15061908401411.326, -361120198130006.06, ],
[1257733259.0418537, -141180792034.89288, 7030857671436.026, -131070142502106.73, ],
[1027108083.0408603, -94208054109.11949, 3835851538441.582, -58499574399535.16, ],
[812031755.4214405, -58780146101.66049, 1885485273287.6787, -22613797507881.88, ],
[629103856.3656212, -35321784434.630844, 879848642648.5188, -8204186027217.122, ],
[513711869.80238444, -23566474819.65455, 479922598999.8428, -3660704084411.957, ],
[406115161.67893225, -14702203003.390936, 235857580936.91092, -1414733125330.8018, ],
[287145121.4881742, -7328429805.452841, 82640531249.98502, -347454375022.0402, ],
[203082409.8565995, -3676447012.5617747, 29492950085.99371, -88463694254.62822, ],
[157320466.87547022, -2208858811.3929977, 13759266945.734987, -32083696775.96685, ],
[128457622.91012286, -1473584168.2328494, 7503974155.046968, -14312790746.9261, ],
[101547414.69153644, -919223841.3690333, 3687291183.8983016, -5530321606.418934, ],
[78663955.72269376, -552266874.2642107, 1720151679.0648403, -2005608621.6891162, ],
[64231264.76572271, -368424151.6847547, 938104000.7680513, -894685614.849884, ],
[50775258.94795117, -229819964.4003704, 460953405.3410016, -345686980.5560453, ],
[35898625.827740006, -114541514.27543631, 161480441.84307322, -84878698.27466165, ],
[25388017.297504853, -57456741.300646536, 57621800.728921734, -21606744.87199083, ],
[17949508.746989015, -28635999.75656981, 20185708.216685258, -5305146.1426766105, ],
[12694106.167835038, -14364405.377651522, 7202890.119223511, -1350462.688238372, ],
[8974803.38633344, -7159077.675340518, 2523254.3853634074, -331578.75150387816, ],
[6347077.228802648, -3591128.5851397156, 900371.4792873418, -84405.1909881744, ],
[3883943.146521119, -1325461.4724356544, 197649.8234867383, -10873.444182561774, ],
[2243710.031715976, -447445.9967070064, 39426.32833293847, -1295.250339730292, ],
[1586773.8710038532, -224446.8238585654, 14068.425039578748, -329.711537175173, ],
[1121855.7814935807, -111861.65096726571, 4928.301014271693, -80.953363389819, ],
[793387.3167701394, -56111.7597367675, 1758.555650399108, -20.607010338639, ],
[560928.0789783113, -27965.431398902678, 616.038239636852, -5.059591884258, ],
[396693.7506751451, -14027.94644155921, 219.8196087988, -1.287939333991, ],
[242747.0049307499, -5177.607288408621, 48.254673258057, -0.165917042613, ],
[140232.0568260839, -1747.84038162402, 9.625605044631, -0.019764051351, ],
[99173.45564041885, -876.746969419574, 3.434683243725, -0.005031016638, ],
[70116.03098505261, -436.960127229206, 1.203200761117, -0.001235253387, ],
[49586.72854752321, -219.186748739082, 0.429335424113, -0.000314438558, ],
[30343.37965829213, -80.900135066137, 0.094247445105, -4.0507111e-05, ],
[17529.00817095287, -27.310009264045, 0.018800013237, -4.825209e-06, ],
[12396.68310550891, -13.699173936784, 0.006708367573, -1.228276e-06, ],
[8764.5072674914, -6.827507283297, 0.002350004218, -3.01576e-07, ],
[6198.336504560807, -3.424787899638, 0.000838543896, -7.6767e-08, ],
[3792.880995880726, -1.264036807841, 0.000184070975, -9.889e-09, ],
[2191.112274199987, -0.426713529058, 3.6718083e-05, -1.178e-09, ],
[1549.750722987758, -0.214095317269, 1.3106478e-05, -3e-10, ],
[1096.952247626264, -0.106950838807, 4.607339e-06, -7.4e-11, ],
[777.460136258028, -0.053881248262, 1.654716e-06, -1.9e-11, ],
[559.645007917267, -0.027827535868, 6.11074e-07, -5e-12, ],
[373.221419571156, -0.012398055232, 1.8223e-07, -1e-12, ],
[205.363276649164, -0.00332413008, 1.779e-08, 0.0, ],
[155.314246541756, -0.001914806752, 7.86e-09, 0.0, ],
[134.508750860544, -0.001436589214, 5.11e-09, 0.0, ],
],
},
func_sqrt_config = {
'breaks': [1e-05, 2.164153218152933e-05, 3.328306436305866e-05, 0.00010313225745223464, 0.0003825290298089385, 0.001500116119235754, 0.005970464476943016, 0.023851857907772066, 0.09537743163108826, 0.381479726524353, 1.5258889060974121, 3.051767812194824, 6.103525624389649, 12.207041248779298, 24.414072497558596, 48.82813499511719, 97.65625999023437, 195.31250998046875, 390.6250099609375, 781.2500099218751, 1562.5000098437501, 3125.0000096875, 6250.000009375, 12500.000008750001, 25000.000007500003, 50000.000005, 100000.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.60718e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 5.899382e-06, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 0.000133487768, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 0.003020483497, ],
],
'coeffA': [
[6087.910008000412, 806670578.0734799, -8653686004226.553, 0.0, 0.0, ],
[8171.21797943674, 604109148.1665217, -3687851762744.753, 0.0, 0.0, ],
[10182.584790670635, 500285782.8155899, -2610996141480.068, 7848463135519062.0, 0.0, ],
[18847.727982598903, 269181067.6290992, -402305769971.454, 342153175562074.94, 0.0, ],
[36874.74801490772, 137394595.18648067, -53303552697.465836, 11722041982805.848, 0.0, ],
[63875.0675036597, 81243211.8323662, -12246872544.72834, 1406578316151.286, -69037902436265.23, ],
[127562.9832354304, 40678055.35278445, -1536924822.06809, 44232420855.43458, -543912908102.1798, ],
[255032.24777690784, 20346105.918614928, -192306022.7686363, 1384438736.904362, -4258277745.4704275, ],
[510017.61820003367, 10173938.433720784, -24044210.27647331, 43280732.28136732, -33285322.291408498, ],
[1020011.7952173861, 5087079.924153827, -3005712.5097418283, 1352655.916783002, -260075.8292175082, ],
[1692159.6696493637, 3098755.2841766533, -699881.5910587178, 124813.04853557886, -9811.461488348765, ],
[2393072.202723289, 2191153.542146234, -247446.40146300496, 22064.169094807177, -867.225978137874, ],
[3384313.2073925077, 1549380.4117955733, -87485.66182447817, 3900.441717429753, -76.652965111606, ],
[4786140.080081948, 1095577.7479335656, -30930.881822571235, 689.508277878265, -6.775243615287, ],
[6768623.12273683, 774690.5780275554, -10935.723289833188, 121.889089123498, -0.598853228913, ],
[9572278.011501513, 547788.9952693733, -3866.362762028228, 21.547156914181, -0.052931669623, ],
[13537244.57738656, 387345.33616976056, -1366.965904372728, 3.809036297159, -0.004678544693, ],
[19144554.908571858, 273894.51337321516, -483.295427493586, 0.6733488421, -0.000413528829, ],
[27074488.535208836, 193672.672457932, -170.870749479676, 0.119032397413, -3.6551136e-05, ],
[38289108.04590936, 136947.263011236, -60.411936770362, 0.02104215612, -3.230695e-06, ],
[54148970.22213954, 96836.34850722857, -21.358851799828, 0.003719764764, -2.85556e-07, ],
[76578130.68216178, 68473.7081388537, -7.551517437059, 0.000657571041, -2.524e-08, ],
[108298695.04328549, 48417.83570473754, -2.669800497596, 0.000116238604, -2.04e-09, ],
[153070905.49426642, 34256.001331673455, -0.945522627109, 2.0606287e-05, -8e-12, ],
[247809860.0169848, 20708.084443096737, -0.189014151239, 1.01824e-06, 0.0, ],
[350456064.8803675, 14642.82693697629, -0.066826594066, 1.80001e-07, 0.0, ],
],
},
func_log_config = {
'breaks': [1e-05, 2.164153218152933e-05, 3.328306436305866e-05, 5.656612872611732e-05, 0.00010313225745223464, 0.00019626451490446927, 0.0003825290298089385, 0.000755058059617877, 0.001500116119235754, 0.002990232238471508, 0.005970464476943016, 0.011930928953886033, 0.023851857907772066, 0.04769371581554413, 0.09537743163108826, 0.19074486326217652, 0.381479726524353, 0.7629494530487061, 0.9536843163108826, 1.1444191795730592, 3.051767812194824, 6.103525624389649, 12.207041248779298, 24.414072497558596, 48.82813499511719, 97.65625999023437, 195.31250998046875, 390.6250099609375, 781.2500099218751, 1562.5000098437501, 3125.0000096875, 6250.000009375, 12500.000008750001, 25000.000007500003, 50000.000005, 100000.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.0, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 1.244446e-06, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.1702877e-05, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 0.00037591392, ],
],
'coeffA': [
[-52907053.3045768, 554553863780.7839, -8905895621876480.0, 0.0, 0.0, ],
[-50422688.6381559, 309883064726.99286, -2835734590041575.0, 0.0, 0.0, ],
[-49803838.16343454, 287254943815.1977, -3246175253784058.5, 1.6145071290316872e+19, 0.0, ],
[-47426743.40076958, 162745338395.53778, -1039039657857159.8, 2.9117842886391793e+18, 0.0, ],
[-44814214.37720375, 87212018647.7152, -297817124138036.56, 4.456130710021452e+17, 0.0, ],
[-42063189.662707984, 45235225498.05543, -80033296736474.42, 6.198002158756902e+16, 0.0, ],
[-39236492.50062724, 23049120381.059166, -20766581879536.742, 8185027439644241.0, 0.0, ],
[-37425253.15901713, 15567664233.638752, -10692683575157.012, 4296634858971709.5, -7.193659113579882e+17, ],
[-34538681.5061307, 7821824209.159908, -2698987254734.0093, 544777830605097.44, -4.5810839640771816e+16, ],
[-31641805.98102574, 3920483377.9127536, -678010034800.1215, 68585422486020.67, -2890232433176117.0, ],
[-28739746.13294046, 1962643555.8745673, -169912665840.36423, 8603910538442.83, -181492515586615.56, ],
[-25835086.44801704, 981923398.3475907, -42529579342.841484, 1077416613472.3837, -11370057413736.934, ],
[-22929124.97508764, 491112264.25358987, -10638831095.250317, 134797796220.59602, -711467273997.1382, ],
[-20022512.040494416, 245593795.2497136, -2660512949.3026605, 16857277134.570581, -44492945509.4718, ],
[-17115573.207356904, 122806316.31796865, -665228926.4476411, 2107631928.0102031, -2781629638.484502, ],
[-14208471.338917349, 61405512.64114904, -166319817.40497124, 263483509.6372729, -173877496.40379688, ],
[-11301287.767603613, 30703343.434013497, -41581523.53558351, 32937278.885669306, -10868142.852881767, ],
[-9402678.505221475, 19643965.89592554, -17226558.165984664, 8939710.934655428, -1954491.0447710238, ],
[-8558114.346234925, 16064958.347902356, -11526537.362982642, 4896345.566269092, -876652.1313933254, ],
[-6064262.567726699, 8748236.541592587, -3330755.912324062, 732478.1879922964, -66338.68968723173, ],
[-2579564.545375263, 3837982.356228537, -649732.8307702426, 64333.778327958426, -2653.526527654393, ],
[327695.17549985193, 1918993.4983586718, -162433.59535260298, 8041.750708322973, -165.846179546145, ],
[3234957.479452729, 959497.3261013938, -40608.44703090038, 1005.220604862897, -10.36541020031, ],
[6142221.035866809, 479748.81013977714, -10152.117900540805, 125.652688158264, -0.647838901299, ],
[9049485.321816122, 239874.4373968575, -2538.030149555125, 15.706592195852, -0.040489952289, ],
[11956749.793250307, 119937.2296833339, -634.507652342515, 1.963324551918, -0.002530622914, ],
[14864014.433238434, 59968.61795596701, -158.626929410987, 0.245415606498, -0.000158163964, ],
[17771279.369304083, 29984.30841914865, -39.656730854532, 0.030676949064, -9.885247e-06, ],
[20678544.120356895, 14992.154596675364, -9.914183223197, 0.003834618927, -6.17828e-07, ],
[23585815.81089784, 7496.065039027543, -2.47853769745, 0.000479325022, -3.8614e-08, ],
[26493244.634272583, 3747.885396141649, -0.619585772235, 5.9908597e-05, -2.413e-09, ],
[29399197.779824484, 1874.531192611712, -0.154993747405, 7.495606e-06, -1.51e-10, ],
[32194344.898805153, 962.41615521808, -0.040827690483, 1.012075e-06, -2e-12, ],
[36270094.35686787, 350.149243450115, -0.004789457388, 2.8642e-08, 0.0, ],
[39177359.21527551, 175.074621774201, -0.001197364348, 3.58e-09, 0.0, ],
],
},
func_exp_config = {
'breaks': [-10.0, -7.5, -5.0, 0.0, 2.5, 5.0, 7.5, 10.0],
'scaler': [
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
[2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, 2.38419e-07, ],
],
'coeffA': [
[526952.2236450694, 247495.47145293362, 51015.33095497295, 7447.281491148959, 1097.510263564984, 142.092043351885, 11.974457047043, 0.548200730254, 0.010355932269, ],
[775084.8766015827, 33752.70090109223, -179080.789804224, -59704.04657927617, -5222.771272765303, 755.861943742096, 202.609535057021, 16.556411699872, 0.486267137349, ],
[4194247.734624573, 4193367.576124194, 2092860.1099856922, 690577.6781143154, 165863.70720933672, 29418.57274474665, 3664.512625284119, 283.083987752937, 10.055028216333, ],
[4194299.566074874, 4194188.758756912, 2098087.7434277167, 695606.5097762228, 181297.2991822334, 27911.819635815176, 10252.73388052373, -741.719121318769, 378.292902135551, ],
[-24208208.45235331, 59483065.98257767, -41621895.13667925, 17833594.620398935, -2618780.848042712, -241461.34205112996, 208304.99786753883, -33565.73686248778, 2353.898908294744, ],
[9140274074.888178, -6747428730.014044, 1371393490.868318, 160474494.1885468, -100673575.46956167, 12395200.535052016, 161347.02048750856, -136454.43010849901, 8193.722920803822, ],
[-3163405651011.4004, 2545761880832.431, -828521098478.8964, 132028912101.65466, -8244745581.355271, -492194575.1655775, 119541063.1983122, -7774674.699008414, 184939.6771912824, ],
],
},
| 81.349325
| 1,742
| 0.682418
| 7,863
| 54,260
| 4.706092
| 0.314002
| 0.256134
| 0.329316
| 0.352665
| 0.358637
| 0.358232
| 0.357394
| 0.356367
| 0.355502
| 0.355502
| 0
| 0.736315
| 0.128013
| 54,260
| 666
| 1,743
| 81.471471
| 0.045779
| 0.005566
| 0
| 0.491473
| 1
| 0
| 0.004337
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f2fe11223eaaa7fd840642f09ec26f71c57c09f5
| 234
|
py
|
Python
|
knx_stack/encode/layer/transport/__init__.py
|
majamassarini/knx-stack
|
11a9baac6b7600649b5fbca43c93b200b23676b4
|
[
"MIT"
] | 2
|
2021-07-28T07:42:28.000Z
|
2022-01-25T18:56:05.000Z
|
knx_stack/encode/layer/transport/__init__.py
|
majamassarini/knx-stack
|
11a9baac6b7600649b5fbca43c93b200b23676b4
|
[
"MIT"
] | 6
|
2021-07-25T21:36:01.000Z
|
2022-02-20T21:11:31.000Z
|
knx_stack/encode/layer/transport/__init__.py
|
majamassarini/knx-stack
|
11a9baac6b7600649b5fbca43c93b200b23676b4
|
[
"MIT"
] | null | null | null |
from knx_stack.encode.layer.transport import t_connect
from knx_stack.encode.layer.transport import t_disconnect
from knx_stack.encode.layer.transport import t_data_group
from knx_stack.encode.layer.transport import t_data_individual
| 46.8
| 62
| 0.880342
| 38
| 234
| 5.157895
| 0.342105
| 0.142857
| 0.244898
| 0.367347
| 0.836735
| 0.836735
| 0.836735
| 0.836735
| 0.438776
| 0
| 0
| 0
| 0.068376
| 234
| 4
| 63
| 58.5
| 0.899083
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 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
| 10
|
ffc32bb83c2fcf8d1ca1be95e67f1ab0b79b152d
| 540
|
py
|
Python
|
backend/tests/phone_test_data.py
|
hack4impact-uiuc/c2tc-fall-2018
|
a64698ac47c35b244d32dc86019327b35d69e9ed
|
[
"MIT"
] | 7
|
2018-10-03T23:40:31.000Z
|
2019-01-30T07:46:59.000Z
|
backend/tests/phone_test_data.py
|
hack4impact-uiuc/c2tc-fall-2018
|
a64698ac47c35b244d32dc86019327b35d69e9ed
|
[
"MIT"
] | 46
|
2018-10-05T22:35:04.000Z
|
2019-01-30T07:49:11.000Z
|
backend/tests/phone_test_data.py
|
hack4impact-uiuc/c2tc-fall-2018
|
a64698ac47c35b244d32dc86019327b35d69e9ed
|
[
"MIT"
] | 1
|
2020-02-07T21:26:01.000Z
|
2020-02-07T21:26:01.000Z
|
phones = [
{"id": 6, "latitude": 40.1011685523957, "longitude": -88.2200390954902},
{"id": 7, "latitude": 40.0963186128832, "longitude": -88.2255865263258},
{"id": 8, "latitude": 40.1153308841568, "longitude": -88.223901994968},
]
def get_phones():
return phones
bad_data = [
{"id": 6, "longitude": -88.2200390954902},
{"id": 7, "latitude": 40.0963186128832, "longitude": -88.2255865263258},
{"id": 8, "latitude": 40.1153308841568, "longitude": -88.223901994968},
]
def get_bad_data():
return bad_data
| 25.714286
| 76
| 0.635185
| 60
| 540
| 5.633333
| 0.333333
| 0.195266
| 0.142012
| 0.153846
| 0.763314
| 0.763314
| 0.763314
| 0.763314
| 0.763314
| 0.763314
| 0
| 0.373894
| 0.162963
| 540
| 20
| 77
| 27
| 0.373894
| 0
| 0
| 0.285714
| 0
| 0
| 0.196296
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0.142857
| 0.285714
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 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
| 1
| 0
| 0
|
0
| 8
|
fff9d93f0314a3864f7ae37a1dbeff3c9e251e23
| 18,165
|
py
|
Python
|
grapevine/emails/south_migrations/0001_initial.py
|
craiglabenz/django-grapevine
|
d71d510814ba965fe836b3e6a522945e74c01120
|
[
"MIT"
] | 7
|
2015-04-02T20:47:55.000Z
|
2022-01-20T13:49:31.000Z
|
grapevine/emails/south_migrations/0001_initial.py
|
craiglabenz/django-grapevine
|
d71d510814ba965fe836b3e6a522945e74c01120
|
[
"MIT"
] | 3
|
2020-02-12T00:31:44.000Z
|
2021-06-10T20:07:23.000Z
|
grapevine/emails/south_migrations/0001_initial.py
|
craiglabenz/django-grapevine
|
d71d510814ba965fe836b3e6a522945e74c01120
|
[
"MIT"
] | 2
|
2015-05-21T16:23:52.000Z
|
2020-09-04T21:31:39.000Z
|
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Email'
db.create_table(u'emails_email', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('type', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['contenttypes.ContentType'], null=True, blank=True)),
('html_body', self.gf('django.db.models.fields.TextField')(blank=True)),
('text_body', self.gf('django.db.models.fields.TextField')(blank=True)),
('status', self.gf('django.db.models.fields.IntegerField')(default=2, db_index=True)),
('sent_at', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True, db_index=True, blank=True)),
('communication_time', self.gf('django.db.models.fields.DecimalField')(default=None, null=True, max_digits=8, decimal_places=5, blank=True)),
('is_test', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True)),
('guid', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=36, null=True, blank=True)),
('log', self.gf('django.db.models.fields.TextField')(default=None, null=True, blank=True)),
('backend', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emails.EmailBackend'], blank=True)),
('from_email', self.gf('django.db.models.fields.CharField')(default=u'Craig Labenz <admins@djangograpevine.com>', max_length=255, db_index=True)),
('reply_to', self.gf('django.db.models.fields.EmailField')(default=u'help@djangograpevine.com', max_length=255, blank=True)),
('subject', self.gf('django.db.models.fields.CharField')(default=u'Hello from Grapevine!', max_length=255)),
))
db.send_create_signal(u'emails', ['Email'])
# Adding model 'EmailRecipient'
db.create_table(u'emails_emailrecipient', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('email', self.gf('django.db.models.fields.related.ForeignKey')(related_name=u'recipients', to=orm['emails.Email'])),
('address', self.gf('django.db.models.fields.EmailField')(max_length=254, db_index=True)),
('domain', self.gf('django.db.models.fields.CharField')(max_length=100, db_index=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=150, blank=True)),
('type', self.gf('django.db.models.fields.IntegerField')(default=1)),
))
db.send_create_signal(u'emails', ['EmailRecipient'])
# Adding model 'EmailBackend'
db.create_table(u'emails_emailbackend', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
('path', self.gf('django.db.models.fields.CharField')(max_length=255)),
('username', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
('password', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
))
db.send_create_signal(u'emails', ['EmailBackend'])
# Adding model 'EmailVariable'
db.create_table(u'emails_emailvariable', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('email', self.gf('django.db.models.fields.related.ForeignKey')(related_name=u'variables', to=orm['emails.Email'])),
('key', self.gf('django.db.models.fields.CharField')(max_length=100)),
('value', self.gf('django.db.models.fields.CharField')(max_length=5000, blank=True)),
))
db.send_create_signal(u'emails', ['EmailVariable'])
# Adding index on 'EmailVariable', fields ['key', 'value']
db.create_index(u'emails_emailvariable', ['key', 'value'])
# Adding model 'RawEvent'
db.create_table(u'emails_rawevent', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('backend', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['emails.EmailBackend'])),
('payload', self.gf('django.db.models.fields.TextField')()),
('processed_on', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True, blank=True)),
('processed_in', self.gf('django.db.models.fields.DecimalField')(default=None, null=True, max_digits=5, decimal_places=4, blank=True)),
('is_queued', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True)),
('is_broken', self.gf('django.db.models.fields.NullBooleanField')(default=None, null=True, db_index=True, blank=True)),
('remote_ip', self.gf('django.db.models.fields.GenericIPAddressField')(max_length=39, db_index=True)),
))
db.send_create_signal(u'emails', ['RawEvent'])
# Adding model 'Event'
db.create_table(u'emails_event', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
('should_stop_sending', self.gf('django.db.models.fields.BooleanField')(default=False)),
))
db.send_create_signal(u'emails', ['Event'])
# Adding model 'EmailEvent'
db.create_table(u'emails_emailevent', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('email', self.gf('django.db.models.fields.related.ForeignKey')(related_name=u'events', to=orm['emails.Email'])),
('event', self.gf('django.db.models.fields.related.ForeignKey')(related_name=u'email_events', to=orm['emails.Event'])),
('raw_event', self.gf('django.db.models.fields.related.ForeignKey')(related_name=u'email_events', to=orm['emails.RawEvent'])),
('happened_at', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
))
db.send_create_signal(u'emails', ['EmailEvent'])
# Adding model 'UnsubscribedAddress'
db.create_table(u'emails_unsubscribedaddress', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('updated_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('address', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
('email', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name=u'unsubscribed_addresses', null=True, blank=True, to=orm['emails.Email'])),
))
db.send_create_signal(u'emails', ['UnsubscribedAddress'])
def backwards(self, orm):
# Removing index on 'EmailVariable', fields ['key', 'value']
db.delete_index(u'emails_emailvariable', ['key', 'value'])
# Deleting model 'Email'
db.delete_table(u'emails_email')
# Deleting model 'EmailRecipient'
db.delete_table(u'emails_emailrecipient')
# Deleting model 'EmailBackend'
db.delete_table(u'emails_emailbackend')
# Deleting model 'EmailVariable'
db.delete_table(u'emails_emailvariable')
# Deleting model 'RawEvent'
db.delete_table(u'emails_rawevent')
# Deleting model 'Event'
db.delete_table(u'emails_event')
# Deleting model 'EmailEvent'
db.delete_table(u'emails_emailevent')
# Deleting model 'UnsubscribedAddress'
db.delete_table(u'emails_unsubscribedaddress')
models = {
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'emails.email': {
'Meta': {'object_name': 'Email'},
'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emails.EmailBackend']", 'blank': 'True'}),
'communication_time': ('django.db.models.fields.DecimalField', [], {'default': 'None', 'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'from_email': ('django.db.models.fields.CharField', [], {'default': "u'Craig Labenz <admins@djangograpevine.com>'", 'max_length': '255', 'db_index': 'True'}),
'guid': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '36', 'null': 'True', 'blank': 'True'}),
'html_body': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_test': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
'log': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'reply_to': ('django.db.models.fields.EmailField', [], {'default': "u'help@djangograpevine.com'", 'max_length': '255', 'blank': 'True'}),
'sent_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'status': ('django.db.models.fields.IntegerField', [], {'default': '2', 'db_index': 'True'}),
'subject': ('django.db.models.fields.CharField', [], {'default': "u'Hello from Grapevine!'", 'max_length': '255'}),
'text_body': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'type': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'emails.emailbackend': {
'Meta': {'object_name': 'EmailBackend'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'path': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'})
},
u'emails.emailevent': {
'Meta': {'object_name': 'EmailEvent'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'events'", 'to': u"orm['emails.Email']"}),
'event': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'email_events'", 'to': u"orm['emails.Event']"}),
'happened_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'raw_event': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'email_events'", 'to': u"orm['emails.RawEvent']"}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'emails.emailrecipient': {
'Meta': {'object_name': 'EmailRecipient'},
'address': ('django.db.models.fields.EmailField', [], {'max_length': '254', 'db_index': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'}),
'email': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'recipients'", 'to': u"orm['emails.Email']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '150', 'blank': 'True'}),
'type': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'emails.emailvariable': {
'Meta': {'object_name': 'EmailVariable', 'index_together': "((u'key', u'value'),)"},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'variables'", 'to': u"orm['emails.Email']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '5000', 'blank': 'True'})
},
u'emails.event': {
'Meta': {'object_name': 'Event'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'should_stop_sending': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'emails.rawevent': {
'Meta': {'object_name': 'RawEvent'},
'backend': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['emails.EmailBackend']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_broken': ('django.db.models.fields.NullBooleanField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'is_queued': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
'payload': ('django.db.models.fields.TextField', [], {}),
'processed_in': ('django.db.models.fields.DecimalField', [], {'default': 'None', 'null': 'True', 'max_digits': '5', 'decimal_places': '4', 'blank': 'True'}),
'processed_on': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'remote_ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'db_index': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'emails.unsubscribedaddress': {
'Meta': {'object_name': 'UnsubscribedAddress'},
'address': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "u'unsubscribed_addresses'", 'null': 'True', 'blank': 'True', 'to': u"orm['emails.Email']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
}
}
complete_apps = ['emails']
| 73.841463
| 201
| 0.608313
| 2,125
| 18,165
| 5.066353
| 0.069176
| 0.09883
| 0.171652
| 0.245216
| 0.844789
| 0.80875
| 0.786922
| 0.757106
| 0.72376
| 0.700725
| 0
| 0.00782
| 0.176383
| 18,165
| 246
| 202
| 73.841463
| 0.711784
| 0.031985
| 0
| 0.280788
| 0
| 0
| 0.501452
| 0.29741
| 0
| 0
| 0
| 0
| 0
| 1
| 0.009852
| false
| 0.009852
| 0.019704
| 0
| 0.044335
| 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
|
f29bb6a74b5b87d77083201c00d05325b5c2dc18
| 11,388
|
py
|
Python
|
pyfuzzy_toolbox/features/max.py
|
matheuscas/pyfuzzy_toolbox
|
57885f3ff53d1b7ab3559c7ff6197ceb97f67c3b
|
[
"BSD-3-Clause"
] | null | null | null |
pyfuzzy_toolbox/features/max.py
|
matheuscas/pyfuzzy_toolbox
|
57885f3ff53d1b7ab3559c7ff6197ceb97f67c3b
|
[
"BSD-3-Clause"
] | null | null | null |
pyfuzzy_toolbox/features/max.py
|
matheuscas/pyfuzzy_toolbox
|
57885f3ff53d1b7ab3559c7ff6197ceb97f67c3b
|
[
"BSD-3-Clause"
] | null | null | null |
from . import pre
from . import set_pos_tags_codes
from . import ADJS, ADVS, VERBS, ALL, ADJS_AND_ADVS, ADJS_AND_VERBS, ADVS_AND_VERBS, ALL_NON_GENERAL_BIGRAMS, ADVS_AND_BI_ADV_ADV, VERBS_AND_BI_ADV_VERB, ADJS_AND_BI_ADV_ADJ
""" ------------------------------ Base functions ------------------------------ """
def max_rule_score_for_unigrams(bow_sentences, unigram=ADJS):
pos_tags_codes = set_pos_tags_codes(unigram)
there_is_a_max_unigram = -1
max_value = 0
for bs in bow_sentences:
for ngram in bs:
if pre.is_unigram(ngram) and ngram.pos_tag in pos_tags_codes:
if abs(ngram.polarity) > abs(max_value) and ngram.polarity < 0:
there_is_a_max_unigram = 0
max_value = ngram.polarity
elif abs(ngram.polarity) > abs(max_value) and ngram.polarity > 0:
there_is_a_max_unigram = 1
max_value = ngram.polarity
return {'sign': there_is_a_max_unigram, 'value': max_value}
def max_rule_score_for_bigrams(bow_sentences, bigram_word_1=ADVS, bigram_word_2=ADJS):
pos_tags_codes_word_1 = set_pos_tags_codes(bigram_word_1)
pos_tags_codes_word_2 = set_pos_tags_codes(bigram_word_2)
there_is_a_max_bigram = -1
max_value = 0
for bs in bow_sentences:
for ngram in bs:
if pre.is_bigram(ngram) and ngram.word_1.pos_tag in pos_tags_codes_word_1 and ngram.word_2.pos_tag in pos_tags_codes_word_2:
if abs(ngram.polarity) > abs(max_value) and ngram.polarity < 0:
there_is_a_max_bigram = 0
max_value = ngram.polarity
elif abs(ngram.polarity) > abs(max_value) and ngram.polarity > 0:
there_is_a_max_bigram = 1
max_value = ngram.polarity
return {'sign': there_is_a_max_bigram, 'value': max_value}
# UNTESTED
def max_rule_score_for_trigrams(bow_sentences, bigram_word_1=ADVS, bigram_word_2=ADVS, bigram_word_3=ADJS):
pos_tags_codes_word_1 = set_pos_tags_codes(bigram_word_1)
pos_tags_codes_word_2 = set_pos_tags_codes(bigram_word_2)
pos_tags_codes_word_3 = set_pos_tags_codes(bigram_word_3)
there_is_a_max_trigram = -1
max_value = 0
for bs in bow_sentences:
for ngram in bs:
if pre.is_trigram(ngram) and \
ngram.word_1.pos_tag in pos_tags_codes_word_1 and \
ngram.word_2.pos_tag in pos_tags_codes_word_2 and \
ngram.word_2.pos_tag in pos_tags_codes_word_3:
if abs(ngram.polarity) > abs(max_value) and ngram.polarity < 0:
there_is_a_max_trigram = 0
max_value = ngram.polarity
elif abs(ngram.polarity) > abs(max_value) and ngram.polarity > 0:
there_is_a_max_trigram = 1
max_value = ngram.polarity
return {'sign': there_is_a_max_trigram, 'value': max_value}
def max_rule_score_for_unigrams_and_bigrams(bow_sentences, unigram=ADJS, bigram_word_1=ADVS, bigram_word_2=ADJS):
unigram_sign_and_value = max_rule_score_for_unigrams(
bow_sentences, unigram=unigram)
bigram_sign_and_value = max_rule_score_for_bigrams(
bow_sentences, bigram_word_1=bigram_word_1, bigram_word_2=bigram_word_2)
if unigram_sign_and_value['sign'] == -1 and bigram_sign_and_value['sign'] == -1:
return -1
elif (unigram_sign_and_value['sign'] == 0 or unigram_sign_and_value['sign'] == 1) and bigram_sign_and_value['sign'] == -1:
return unigram_sign_and_value['sign']
elif (bigram_sign_and_value['sign'] == 0 or bigram_sign_and_value['sign'] == 1) and unigram_sign_and_value['sign'] == -1:
return bigram_sign_and_value['sign']
elif (bigram_sign_and_value['sign'] == 0 or bigram_sign_and_value['sign'] == 1) and \
(unigram_sign_and_value['sign'] == 0 or unigram_sign_and_value['sign'] == 1):
if abs(bigram_sign_and_value['value']) > abs(unigram_sign_and_value['value']):
return bigram_sign_and_value['sign']
else:
return unigram_sign_and_value['sign']
""" ------------------------------ Features functions ------------------------------ """
def max_rule_for_adjective(bow_sentences):
return {'value': max_rule_score_for_unigrams(bow_sentences, unigram=ADJS)['sign'], 'name': 'max_rule_for_adjective'}
def max_rule_for_adverbs(bow_sentences):
return {'value': max_rule_score_for_unigrams(
bow_sentences, unigram=ADVS)['sign'], 'name': 'max_rule_for_adverbs'}
def max_rule_for_verbs(bow_sentences):
return {'value': max_rule_score_for_unigrams(
bow_sentences, unigram=VERBS)['sign'], 'name': 'max_rule_for_verbs'}
def max_rule_for_adjective_and_bigrams_with_adjectives(bow_sentences):
return {'value': max_rule_score_for_unigrams_and_bigrams(bow_sentences, unigram=ADJS, bigram_word_1=ADVS, bigram_word_2=ADJS), 'name': 'max_rule_for_adjective_and_bigrams_with_adjectives'}
def max_rule_for_adverbs_and_bigrams_with_adverbs(bow_sentences):
return {'value': max_rule_score_for_unigrams_and_bigrams(bow_sentences, unigram=ADVS, bigram_word_1=ADVS, bigram_word_2=ADVS), 'name': 'max_rule_for_adverbs_and_bigrams_with_adverbs'}
def max_rule_for_verbs_and_bigrams_with_verbs(bow_sentences):
return {'value': max_rule_score_for_unigrams_and_bigrams(bow_sentences, unigram=VERBS, bigram_word_1=ADVS, bigram_word_2=VERBS), 'name': 'max_rule_for_verbs_and_bigrams_with_verbs'}
def max_rule_for_unigrams_and_bigrams(bow_sentences):
return {'value': max_rule_score_for_unigrams_and_bigrams(bow_sentences, unigram=ALL, bigram_word_1=ALL, bigram_word_2=ALL), 'name': 'max_rule_for_unigrams_and_bigrams'}
def max_rule_for_unigrams_bigrams_and_trigrams(bow_sentences):
unigram_sign_and_value = max_rule_score_for_unigrams(
bow_sentences, unigram=ALL)
bigram_sign_and_value = max_rule_score_for_bigrams(
bow_sentences, bigram_word_1=ALL, bigram_word_2=ALL)
max_tri = max_rule_score_for_trigrams(
bow_sentences, bigram_word_1=ALL, bigram_word_2=ALL, bigram_word_3=ALL)
result = {
'value': None, 'name': 'max_rule_for_unigrams_bigrams_and_trigrams'}
if unigram_sign_and_value['sign'] == -1 and bigram_sign_and_value['sign'] == -1 and max_tri['sign'] == -1:
result['value'] = -1
elif unigram_sign_and_value['sign'] != -1 and bigram_sign_and_value['sign'] == -1 and max_tri['sign'] == -1:
result['value'] = unigram_sign_and_value['sign']
elif unigram_sign_and_value['sign'] == -1 and bigram_sign_and_value['sign'] != -1 and max_tri['sign'] == -1:
result['value'] = bigram_sign_and_value['sign']
elif unigram_sign_and_value['sign'] == -1 and bigram_sign_and_value['sign'] == -1 and max_tri['sign'] != -1:
result['value'] = max_tri['sign']
elif unigram_sign_and_value['sign'] != -1 and bigram_sign_and_value['sign'] != -1 and max_tri['sign'] == -1:
if abs(unigram_sign_and_value['value']) > abs(bigram_sign_and_value['value']):
result['value'] = unigram_sign_and_value['sign']
else:
result['value'] = bigram_sign_and_value['sign']
elif unigram_sign_and_value['sign'] != -1 and bigram_sign_and_value['sign'] == -1 and max_tri['sign'] != -1:
if abs(unigram_sign_and_value['value']) > abs(max_tri['value']):
result['value'] = unigram_sign_and_value['sign']
else:
result['value'] = max_tri['sign']
elif unigram_sign_and_value['sign'] == -1 and bigram_sign_and_value['sign'] != -1 and max_tri['sign'] != -1:
if abs(bigram_sign_and_value['value']) > abs(max_tri['value']):
result['value'] = bigram_sign_and_value['sign']
else:
result['value'] = max_tri['sign']
elif unigram_sign_and_value['sign'] == bigram_sign_and_value['sign'] and max_tri['sign'] == bigram_sign_and_value['sign']:
result['value'] = unigram_sign_and_value['sign']
elif unigram_sign_and_value['sign'] != -1 and bigram_sign_and_value['sign'] != -1 and max_tri['sign'] != -1:
if abs(unigram_sign_and_value['value']) >= abs(bigram_sign_and_value['value']) or \
abs(unigram_sign_and_value['value']) >= abs(max_tri['value']):
result['value'] = unigram_sign_and_value['sign']
elif abs(bigram_sign_and_value['value']) >= abs(unigram_sign_and_value['value']) or \
abs(bigram_sign_and_value['value']) >= abs(max_tri['value']):
result['value'] = bigram_sign_and_value['sign']
else:
result['value'] = max_tri['sign']
if result['value'] != -1 and None:
print unigram_sign_and_value['sign'], bigram_sign_and_value['sign'], max_tri['sign']
return result
def all(bow_sentences,
unigrams=True,
unigram_type=ALL,
non_general_unigrams_and_bigrams=True,
non_general_bigram_type=ALL_NON_GENERAL_BIGRAMS,
general_unigrams_and_bigrams=True,
unigrams_and_bigrams_trigram=True):
features_list = []
if unigrams:
if unigram_type == ADJS:
features_list.append(max_rule_for_adjective(bow_sentences))
elif unigram_type == ADJS_AND_ADVS:
features_list.append(max_rule_for_adjective(bow_sentences))
features_list.append(max_rule_for_adverbs(bow_sentences))
elif unigram_type == ADJS_AND_VERBS:
features_list.append(max_rule_for_adjective(bow_sentences))
features_list.append(max_rule_for_verbs(bow_sentences))
elif unigram_type == ADVS_AND_VERBS:
features_list.append(max_rule_for_adverbs(bow_sentences))
features_list.append(max_rule_for_verbs(bow_sentences))
elif unigram_type == ADVS:
features_list.append(max_rule_for_adverbs(bow_sentences))
elif unigram_type == VERBS:
features_list.append(max_rule_for_verbs(bow_sentences))
else:
features_list.append(max_rule_for_verbs(bow_sentences))
features_list.append(max_rule_for_adverbs(bow_sentences))
features_list.append(max_rule_for_adjective(bow_sentences))
if non_general_unigrams_and_bigrams:
if non_general_bigram_type == ADVS_AND_BI_ADV_ADV:
features_list.append(
max_rule_for_adverbs_and_bigrams_with_adverbs(bow_sentences))
elif non_general_bigram_type == VERBS_AND_BI_ADV_VERB:
features_list.append(
max_rule_for_verbs_and_bigrams_with_verbs(bow_sentences))
elif non_general_bigram_type == ADJS_AND_BI_ADV_ADJ:
features_list.append(
max_rule_for_adjective_and_bigrams_with_adjectives(bow_sentences))
else:
features_list.append(
max_rule_for_adverbs_and_bigrams_with_adverbs(bow_sentences))
features_list.append(
max_rule_for_verbs_and_bigrams_with_verbs(bow_sentences))
features_list.append(
max_rule_for_adjective_and_bigrams_with_adjectives(bow_sentences))
if general_unigrams_and_bigrams:
features_list.append(max_rule_for_unigrams_and_bigrams(bow_sentences))
if unigrams_and_bigrams_trigram:
features_list.append(
max_rule_for_unigrams_bigrams_and_trigrams(bow_sentences))
return features_list
| 49.729258
| 192
| 0.689234
| 1,635
| 11,388
| 4.308869
| 0.042202
| 0.062598
| 0.105607
| 0.104471
| 0.910433
| 0.859759
| 0.825834
| 0.79929
| 0.74961
| 0.702484
| 0
| 0.011093
| 0.200474
| 11,388
| 228
| 193
| 49.947368
| 0.762658
| 0.000702
| 0
| 0.441989
| 0
| 0
| 0.069338
| 0.020792
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.016575
| null | null | 0.005525
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
f2bdf4f3266ef767c9015d9bb8a27d3781855c04
| 174
|
py
|
Python
|
tests/basics/enumerate.py
|
bygreencn/micropython
|
3f759b71c63f5e01df18a6e204c50f78d1b6a20b
|
[
"MIT"
] | 1
|
2019-05-07T15:01:19.000Z
|
2019-05-07T15:01:19.000Z
|
tests/basics/enumerate.py
|
bygreencn/micropython
|
3f759b71c63f5e01df18a6e204c50f78d1b6a20b
|
[
"MIT"
] | null | null | null |
tests/basics/enumerate.py
|
bygreencn/micropython
|
3f759b71c63f5e01df18a6e204c50f78d1b6a20b
|
[
"MIT"
] | null | null | null |
print(list(enumerate([])))
print(list(enumerate([1, 2, 3])))
print(list(enumerate([1, 2, 3], 5)))
print(list(enumerate([1, 2, 3], -5)))
print(list(enumerate(range(10000))))
| 24.857143
| 37
| 0.637931
| 28
| 174
| 3.964286
| 0.321429
| 0.405405
| 0.810811
| 0.513514
| 0.747748
| 0.747748
| 0.558559
| 0.558559
| 0.558559
| 0.558559
| 0
| 0.1
| 0.08046
| 174
| 6
| 38
| 29
| 0.59375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 8
|
29a09daf29858d2740d488e0a94efbf37730cba8
| 31,437
|
py
|
Python
|
test/api/storage/test_file_api.py
|
aspose-imaging-cloud/aspose-imaging-cloud-python
|
9280a4a1aa415cb569ec26a05792b33186d31a85
|
[
"MIT"
] | 1
|
2022-01-14T10:06:26.000Z
|
2022-01-14T10:06:26.000Z
|
test/api/storage/test_file_api.py
|
aspose-imaging-cloud/aspose-imaging-cloud-python
|
9280a4a1aa415cb569ec26a05792b33186d31a85
|
[
"MIT"
] | 3
|
2019-07-17T15:01:31.000Z
|
2020-12-29T09:16:10.000Z
|
test/api/storage/test_file_api.py
|
aspose-imaging-cloud/aspose-imaging-cloud-python
|
9280a4a1aa415cb569ec26a05792b33186d31a85
|
[
"MIT"
] | null | null | null |
# coding: utf-8
# ----------------------------------------------------------------------------
# <copyright company="Aspose" file="test_file_api.py">
# Copyright (c) 2019 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# </summary>
# ----------------------------------------------------------------------------
import six
import asposeimagingcloud.models.requests as requests
from test.api.storage.storage_api_tester import StorageApiTester
if six.PY2:
import unittest2 as unittest
else:
import unittest
class TestFileApi(StorageApiTester):
""" Specific file API tests for Storage """
def test_copy_download_file(self):
folder = self.temp_folder + '/Storage'
file = 'Storage.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file,
folder + '/' + file,
self.test_storage,
self.test_storage))
exists_response = self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file, self.test_storage))
self.assertIsNotNone(exists_response)
self.assertFalse(exists_response.is_folder)
self.assertTrue(exists_response.exists)
original_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
self.original_data_folder,
self.test_storage)).value if x.name == file)
copied_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
folder, self.test_storage)).value if x.name == file)
self.assertEqual(original_file_info.size, copied_file_info.size)
original_file = self.imaging_api.download_file(
requests.DownloadFileRequest(
self.original_data_folder + '/' + file,
self.test_storage))
copied_file = self.imaging_api.download_file(
requests.DownloadFileRequest(
folder + '/' + file, self.test_storage))
with open(original_file, 'r') as original_reader, open(copied_file, 'r') as copied_reader:
original_string = original_reader.read()
copied_string = copied_reader.read()
self.assertEqual(len(original_string), len(copied_string))
self.assertEqual(len(original_string), original_file_info.size)
self.assertEqual(original_string, copied_string)
self.assertEqual(
original_string,
original_file_info.path.strip('/'))
self.assertEqual(
original_string.replace(
self.original_data_folder,
folder),
copied_file_info.path.strip('/'))
finally:
self.imaging_api.delete_file(
requests.DeleteFileRequest(
folder + '/' + file,
self.test_storage))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file,
self.test_storage)).exists)
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
@unittest.skip('IMAGINGCLOUD-644')
def test_file_versions_copy(self):
if self.imaging_api.api_client.configuration.on_premise:
return
folder = self.temp_folder + '/Storage'
file1 = 'Storage.txt'
file2 = 'Folder1/Folder1.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
recent_version = next(x for x in versions if x.is_latest is True)
old_version = next(x for x in versions if x.is_latest is not True)
self.imaging_api.copy_file(
requests.CopyFileRequest(
folder + '/' + file1,
folder + '/' + file1 + '.recent',
self.test_storage,
self.test_storage,
recent_version.version_id))
copied_versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1 + '.recent',
self.test_storage)).value
self.assertEqual(1, len(copied_versions))
self.assertTrue(copied_versions[0].is_latest)
self.assertEqual(recent_version.size, copied_versions[0].size)
self.imaging_api.copy_file(
requests.CopyFileRequest(
folder + '/' + file1,
folder + '/' + file1 + '.old',
self.test_storage,
self.test_storage,
old_version.version_id))
copied_versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1 + '.old',
self.test_storage)).value
self.assertEqual(1, len(copied_versions))
self.assertTrue(copied_versions[0].is_latest)
self.assertEqual(old_version.size, copied_versions[0].size)
finally:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
@unittest.skip('IMAGINGCLOUD-644')
def test_file_versions_create(self):
if self.imaging_api.api_client.configuration.on_premise:
return
folder = self.temp_folder + '/Storage'
file1 = 'Storage.txt'
file2 = 'Folder1/Folder1.txt'
file1_size = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
self.original_data_folder,
self.test_storage)).value if x.name == file1).size
file2_size = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
self.original_data_folder + '/Folder1',
self.test_storage)).value if x.name == 'Folder1.txt').size
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
self.assertEqual(2, len(versions))
recent_version_size = next(
x for x in versions if x.is_latest is True).size
old_version_size = next(
x for x in versions if x.is_latest is not True).size
self.assertNotEqual(recent_version_size, old_version_size)
self.assertEqual(old_version_size, file1_size)
self.assertEqual(recent_version_size, file2_size)
finally:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
@unittest.skip('IMAGINGCLOUD-644')
def test_file_versions_delete(self):
if self.imaging_api.api_client.configuration.on_premise:
return
folder = self.temp_folder + '/Storage'
file1 = 'Storage.txt'
file2 = 'Folder1/Folder1.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
recent_version = next(x for x in versions if x.is_latest is True)
old_version = next(x for x in versions if x.is_latest is not True)
self.assertTrue(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file1,
self.test_storage,
recent_version.version_id)).exists)
self.assertTrue(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file1,
self.test_storage,
old_version.version_id)).exists)
self.imaging_api.delete_file(
requests.DeleteFileRequest(
folder + '/' + file1,
self.test_storage,
recent_version.version_id))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file1,
self.test_storage,
recent_version.version_id)).exists)
self.assertTrue(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file1,
self.test_storage,
old_version.version_id)).exists)
self.assertEqual(1, len(versions))
self.assertEqual(old_version.size, versions[0].size)
self.imaging_api.delete_file(
requests.DeleteFileRequest(
folder + '/' + file1,
self.test_storage,
old_version.version_id))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file1,
self.test_storage)).exists)
finally:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
@unittest.skip('IMAGINGCLOUD-644')
def test_file_versions_download(self):
if self.imaging_api.api_client.configuration.on_premise:
return
folder = self.temp_folder + '/Storage'
file1 = 'Storage.txt'
file2 = 'Folder1/Folder1.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
recent_version = next(x for x in versions if x.is_latest is True)
old_version = next(x for x in versions if x.is_latest is not True)
with open(self.imaging_api.download_file(
requests.DownloadFileRequest(folder + '/' + file1, self.test_storage,
old_version.version_id)), 'r') as old_file:
self.assertEqual(old_version.size, len(old_file.read()))
with open(self.imaging_api.download_file(
requests.DownloadFileRequest(folder + '/' + file1, self.test_storage,
recent_version.version_id)), 'r') as old_file:
self.assertEqual(recent_version.size, len(old_file.read()))
finally:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
@unittest.skip('IMAGINGCLOUD-644')
def test_file_versions_move(self):
if self.imaging_api.api_client.configuration.on_premise:
return
folder = self.temp_folder + '/Storage'
file1 = 'Storage.txt'
file2 = 'Folder1/Folder1.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
recent_version = next(x for x in versions if x.is_latest is True)
self.imaging_api.move_file(
requests.MoveFileRequest(
folder + '/' + file1,
folder + '/' + file1 + '.recent',
self.test_storage,
self.test_storage,
recent_version.version_id))
copied_versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1 + '.recent',
self.test_storage)).value
self.assertEqual(1, len(copied_versions))
self.assertTrue(copied_versions[0].is_latest)
self.assertEqual(recent_version.size, copied_versions[0].size)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file1,
folder + '/' + file1,
self.test_storage,
self.test_storage))
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file2,
folder + '/' + file1,
self.test_storage,
self.test_storage))
versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(
folder + '/' + file1, self.test_storage)).value
old_version = next(x for x in versions if x.is_latest is not True)
self.imaging_api.move_file(
requests.MoveFileRequest(
folder + '/' + file1,
folder + '/' + file1 + '.old',
self.test_storage,
self.test_storage,
old_version.version_id))
copied_versions = self.imaging_api.get_file_versions(
requests.GetFileVersionsRequest(folder + '/' + file1 + '.old',
self.test_storage)).value
self.assertEqual(1, len(copied_versions))
self.assertTrue(copied_versions[0].is_latest)
self.assertEqual(old_version.size, copied_versions[0].size)
finally:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
def test_move_file(self):
folder = self.temp_folder + '/Storage'
file = 'Storage.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
self.imaging_api.copy_file(
requests.CopyFileRequest(
self.original_data_folder + '/' + file,
folder + '/' + file + '.copied',
self.test_storage,
self.test_storage))
exist_response = self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file + '.copied',
self.test_storage))
self.assertIsNotNone(exist_response)
self.assertFalse(exist_response.is_folder)
self.assertTrue(exist_response.exists)
self.imaging_api.move_file(
requests.MoveFileRequest(
folder + '/' + file + '.copied',
folder + '/' + file,
self.test_storage,
self.test_storage))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file + '.copied',
self.test_storage)).exists)
exist_response = self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file, self.test_storage))
self.assertIsNotNone(exist_response)
self.assertFalse(exist_response.is_folder)
self.assertTrue(exist_response.exists)
original_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
self.original_data_folder,
self.test_storage)).value if x.name == file)
moved_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
folder, self.test_storage)).value if x.name == file)
self.assertEqual(original_file_info.size, moved_file_info.size)
with open(self.imaging_api.download_file(
requests.DownloadFileRequest(self.original_data_folder + '/' + file,
self.test_storage)), 'r') as original_file, \
open(self.imaging_api.download_file(requests.DownloadFileRequest(folder + '/' + file,
self.test_storage)),
'r') as moved_file:
original_string = original_file.read()
moved_string = moved_file.read()
self.assertEqual(len(original_string), len(moved_string))
self.assertEqual(len(original_string), original_file_info.size)
self.assertEqual(original_string, moved_string)
self.assertEqual(
original_string,
original_file_info.path.strip('/'))
self.assertEqual(
original_string.replace(
self.original_data_folder,
folder),
moved_file_info.path.strip('/'))
finally:
self.imaging_api.delete_file(
requests.DeleteFileRequest(
folder + '/' + file,
self.test_storage))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file,
self.test_storage)).exists)
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
def test_upload_file(self):
folder = self.temp_folder + '/Storage'
file = 'Storage.txt'
try:
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
original_file = self.imaging_api.download_file(
requests.DownloadFileRequest(
self.original_data_folder + '/' + file,
self.test_storage))
result = self.imaging_api.upload_file(
requests.UploadFileRequest(
folder + '/' + file,
original_file,
self.test_storage))
self.assertIsNotNone(result)
self.assertTrue(not result.errors or len(result) == 0)
self.assertIsNotNone(result.uploaded)
self.assertEqual(1, len(result.uploaded))
self.assertEqual(file, result.uploaded[0])
exist_response = self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file, self.test_storage))
self.assertIsNotNone(exist_response)
self.assertFalse(exist_response.is_folder)
self.assertTrue(exist_response.exists)
original_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
self.original_data_folder,
self.test_storage)).value if x.name == file)
uploaded_file_info = next(
x for x in self.imaging_api.get_files_list(
requests.GetFilesListRequest(
folder, self.test_storage)).value if x.name == file)
self.assertEqual(original_file_info.size, uploaded_file_info.size)
original_file = self.imaging_api.download_file(
requests.DownloadFileRequest(
self.original_data_folder + '/' + file,
self.test_storage))
uploaded_file = self.imaging_api.download_file(
requests.DownloadFileRequest(
folder + '/' + file, self.test_storage))
with open(original_file, 'r') as original_reader, open(uploaded_file, 'r') as uploaded_reader:
original_string = original_reader.read()
copied_string = uploaded_reader.read()
self.assertEqual(len(original_string), len(copied_string))
self.assertEqual(len(original_string), original_file_info.size)
self.assertEqual(original_string, copied_string)
self.assertEqual(
original_string,
original_file_info.path.strip('/'))
self.assertEqual(
original_string.replace(
self.original_data_folder,
folder),
uploaded_file_info.path.strip('/'))
finally:
self.imaging_api.delete_file(
requests.DeleteFileRequest(
folder + '/' + file,
self.test_storage))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder + '/' + file,
self.test_storage)).exists)
if self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists:
self.imaging_api.delete_folder(
requests.DeleteFolderRequest(
folder, self.test_storage, True))
self.assertFalse(
self.imaging_api.object_exists(
requests.ObjectExistsRequest(
folder, self.test_storage)).exists)
| 43.361379
| 106
| 0.536502
| 2,836
| 31,437
| 5.712271
| 0.070169
| 0.06321
| 0.118519
| 0.064815
| 0.882593
| 0.87463
| 0.867037
| 0.861049
| 0.845494
| 0.836605
| 0
| 0.00609
| 0.378408
| 31,437
| 724
| 107
| 43.421271
| 0.822936
| 0.045074
| 0
| 0.88216
| 0
| 0
| 0.016973
| 0
| 0
| 0
| 0
| 0
| 0.12275
| 1
| 0.013093
| false
| 0
| 0.008183
| 0
| 0.031097
| 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
|
d9c4cb0f070270ef5ccc873ec2bf29b981dcb8a0
| 131
|
py
|
Python
|
pyLearn/exercises/19_sum_of_squares_of_first_n_natural_numbers.py
|
sravanrekandar/pyLearn
|
0d584b4d434b65ea23d7bfc810301861eac84c4d
|
[
"MIT"
] | null | null | null |
pyLearn/exercises/19_sum_of_squares_of_first_n_natural_numbers.py
|
sravanrekandar/pyLearn
|
0d584b4d434b65ea23d7bfc810301861eac84c4d
|
[
"MIT"
] | null | null | null |
pyLearn/exercises/19_sum_of_squares_of_first_n_natural_numbers.py
|
sravanrekandar/pyLearn
|
0d584b4d434b65ea23d7bfc810301861eac84c4d
|
[
"MIT"
] | null | null | null |
"""19_sum_of_squares_of_first_n_natural_numbers.py."""
print("---- Sum of Squares of first n Natural numbers ----")
print("TODO")
| 26.2
| 60
| 0.717557
| 21
| 131
| 4.095238
| 0.52381
| 0.116279
| 0.27907
| 0.325581
| 0.790698
| 0.790698
| 0.790698
| 0.790698
| 0
| 0
| 0
| 0.016949
| 0.099237
| 131
| 4
| 61
| 32.75
| 0.711864
| 0.366412
| 0
| 0
| 0
| 0
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 10
|
d9d6847109a9e3245618d70bb95ffc2eb738504f
| 7,152
|
py
|
Python
|
inferensi.py
|
cahyoardhi/fuzzy-algorithm
|
b5c7c44a9aaccfd07759b70d3feb094a886c51e6
|
[
"MIT"
] | 3
|
2020-05-05T15:31:04.000Z
|
2020-05-23T05:08:28.000Z
|
inferensi.py
|
cahyoardhi/fuzzy-algorithm
|
b5c7c44a9aaccfd07759b70d3feb094a886c51e6
|
[
"MIT"
] | null | null | null |
inferensi.py
|
cahyoardhi/fuzzy-algorithm
|
b5c7c44a9aaccfd07759b70d3feb094a886c51e6
|
[
"MIT"
] | null | null | null |
def finferensi(berat, pinjam, harga):
linguistik = []
derajat = []
for bk, bv in berat.items():
for pk, pv in pinjam.items():
for hk, hv in harga.items():
# rule 1
if bk == 'ringan' and pk == 'sebentar' and hk == 'rendah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 2
if bk == 'ringan' and pk == 'sebentar' and hk == 'menengah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 3
if bk == 'ringan' and pk == 'sebentar' and hk == 'tinggi':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 4
if bk == 'ringan' and pk == 'menengah' and hk == 'rendah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 5
if bk == 'ringan' and pk == 'menengah' and hk == 'menengah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 6
if bk == 'ringan' and pk == 'menengah' and hk == 'tinggi':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 7
if bk == 'ringan' and pk == 'lama' and hk == 'rendah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 8
if bk == 'ringan' and pk == 'lama' and hk == 'menengah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 9
if bk == 'ringan' and pk == 'lama' and hk == 'tinggi':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 10
if bk == 'sedang' and pk == 'sebentar' and hk == 'rendah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 11
if bk == 'sedang' and pk == 'sebentar' and hk == 'menengah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 12
if bk == 'sedang' and pk == 'sebentar' and hk == 'tinggi':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 13
if bk == 'sedang' and pk == 'menengah' and hk == 'rendah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 14
if bk == 'sedang' and pk == 'menengah' and hk == 'menengah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 15
if bk == 'sedang' and pk == 'menengah' and hk == 'tinggi':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 16
if bk == 'sedang' and pk == 'lama' and hk == 'rendah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 17
if bk == 'sedang' and pk == 'lama' and hk == 'menengah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 18
if bk == 'sedang' and pk == 'lama' and hk == 'tinggi':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 19
if bk == 'berat' and pk == 'sebentar' and hk == 'rendah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 20
if bk == 'berat' and pk == 'sebentar' and hk == 'menengah':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 21
if bk == 'berat' and pk == 'sebentar' and hk == 'tinggi':
linguistik.append('kecil')
derajat.append(min(bv, pv, hv))
# rule 22
if bk == 'berat' and pk == 'menengah' and hk == 'rendah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 23
if bk == 'berat' and pk == 'menengah' and hk == 'menengah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 24
if bk == 'berat' and pk == 'menengah' and hk == 'tinggi':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 25
if bk == 'berat' and pk == 'lama' and hk == 'rendah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 26
if bk == 'berat' and pk == 'lama' and hk == 'menengah':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
# rule 27
if bk == 'berat' and pk == 'lama' and hk == 'tinggi':
linguistik.append('besar')
derajat.append(min(bv, pv, hv))
i = 0
templinguistik = []
tempderajat = []
for index,nama in enumerate(linguistik):
if derajat[i] != 0:
templinguistik.append(nama)
tempderajat.append(derajat[i])
print(f'{index+1}. {nama}: {derajat[i]}')
i += 1
tkecil = []
tbesar = []
for li,de in zip (templinguistik,tempderajat):
if li == 'kecil':
tkecil.append(de)
else:
tbesar.append(de)
if tkecil == []:
tkecil = [0,0]
elif tbesar == []:
tbesar = [0,0]
kecil = max(tkecil)
besar = max(tbesar)
output = dict(kecil=kecil,besar=besar)
return output
| 40.179775
| 95
| 0.370386
| 638
| 7,152
| 4.152038
| 0.12069
| 0.04077
| 0.16308
| 0.183465
| 0.813892
| 0.813892
| 0.813892
| 0.813892
| 0.700642
| 0.700642
| 0
| 0.015269
| 0.514681
| 7,152
| 177
| 96
| 40.40678
| 0.747911
| 0.028803
| 0
| 0.486486
| 0
| 0
| 0.098873
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.009009
| false
| 0
| 0
| 0
| 0.018018
| 0.009009
| 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
|
d9fc64f761bd8c779842573ce911a312782c332a
| 170
|
py
|
Python
|
python/testData/formatter/spacesWithinParenthesesInClassPatterns_after.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
python/testData/formatter/spacesWithinParenthesesInClassPatterns_after.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
python/testData/formatter/spacesWithinParenthesesInClassPatterns_after.py
|
06needhamt/intellij-community
|
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
|
[
"Apache-2.0"
] | null | null | null |
match x:
case Class( ):
pass
case Class( foo=1 ):
pass
case Class( foo=1, bar=2 ):
pass
case Class( foo=1, bar=2, ):
pass
| 17
| 32
| 0.458824
| 24
| 170
| 3.25
| 0.375
| 0.461538
| 0.5
| 0.615385
| 0.807692
| 0.589744
| 0.589744
| 0.589744
| 0
| 0
| 0
| 0.050505
| 0.417647
| 170
| 9
| 33
| 18.888889
| 0.737374
| 0
| 0
| 0.444444
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.444444
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 8
|
8a5106300e6c5d2df19d6b825e760dd418a01b08
| 179
|
py
|
Python
|
browser/__init__.py
|
mfg637/Derpibooru-DL
|
bb3bde7afb8025947a1bc7185dfa002b38acb572
|
[
"Unlicense"
] | 2
|
2018-09-22T00:47:33.000Z
|
2021-04-21T05:31:33.000Z
|
browser/__init__.py
|
mfg637/Derpibooru-DL
|
bb3bde7afb8025947a1bc7185dfa002b38acb572
|
[
"Unlicense"
] | null | null | null |
browser/__init__.py
|
mfg637/Derpibooru-DL
|
bb3bde7afb8025947a1bc7185dfa002b38acb572
|
[
"Unlicense"
] | null | null | null |
from . import net, images, gui
def pil_unlook_load_truncated_images():
import PIL.ImageFile
PIL.ImageFile.LOAD_TRUNCATED_IMAGES = True
pil_unlook_load_truncated_images()
| 25.571429
| 46
| 0.804469
| 25
| 179
| 5.36
| 0.48
| 0.291045
| 0.425373
| 0.328358
| 0.41791
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128492
| 179
| 7
| 47
| 25.571429
| 0.858974
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 8
|
8a5b1f53dcfd354584f736ee5b557f8c5db1fa0e
| 18,892
|
py
|
Python
|
test/cpp/naming/resolver_component_tests_runner.py
|
joshjung/grpc
|
ec10359c7bc9e92e01457b83f524f3b8be388fde
|
[
"Apache-2.0"
] | null | null | null |
test/cpp/naming/resolver_component_tests_runner.py
|
joshjung/grpc
|
ec10359c7bc9e92e01457b83f524f3b8be388fde
|
[
"Apache-2.0"
] | null | null | null |
test/cpp/naming/resolver_component_tests_runner.py
|
joshjung/grpc
|
ec10359c7bc9e92e01457b83f524f3b8be388fde
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by 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.
# This file is auto-generated
import argparse
import sys
import subprocess
import tempfile
import os
import time
import signal
import platform
argp = argparse.ArgumentParser(description='Run c-ares resolver tests')
argp.add_argument('--test_bin_path', default=None, type=str,
help='Path to gtest test binary to invoke.')
argp.add_argument('--dns_server_bin_path', default=None, type=str,
help='Path to local DNS server python script.')
argp.add_argument('--records_config_path', default=None, type=str,
help=('Path to DNS records yaml file that '
'specifies records for the DNS sever. '))
argp.add_argument('--dns_server_port', default=None, type=int,
help=('Port that local DNS server is listening on.'))
argp.add_argument('--dns_resolver_bin_path', default=None, type=str,
help=('Path to the DNS health check utility.'))
argp.add_argument('--tcp_connect_bin_path', default=None, type=str,
help=('Path to the TCP health check utility.'))
args = argp.parse_args()
def test_runner_log(msg):
sys.stderr.write('\n%s: %s\n' % (__file__, msg))
def python_args(arg_list):
if platform.system() == 'Windows':
return [sys.executable] + arg_list
return arg_list
cur_resolver = os.environ.get('GRPC_DNS_RESOLVER')
if cur_resolver and cur_resolver != 'ares':
test_runner_log(('WARNING: cur resolver set to %s. This set of tests '
'needs to use GRPC_DNS_RESOLVER=ares.'))
test_runner_log('Exit 1 without running tests.')
sys.exit(1)
os.environ.update({'GRPC_DNS_RESOLVER': 'ares'})
os.environ.update({'GRPC_TRACE': 'cares_resolver'})
def wait_until_dns_server_is_up(args,
dns_server_subprocess,
dns_server_subprocess_output):
for i in range(0, 30):
test_runner_log('Health check: attempt to connect to DNS server over TCP.')
tcp_connect_subprocess = subprocess.Popen(python_args([
args.tcp_connect_bin_path,
'--server_host', '127.0.0.1',
'--server_port', str(args.dns_server_port),
'--timeout', str(1)]))
tcp_connect_subprocess.communicate()
if tcp_connect_subprocess.returncode == 0:
test_runner_log(('Health check: attempt to make an A-record '
'query to DNS server.'))
dns_resolver_subprocess = subprocess.Popen(python_args([
args.dns_resolver_bin_path,
'--qname', 'health-check-local-dns-server-is-alive.resolver-tests.grpctestingexp',
'--server_host', '127.0.0.1',
'--server_port', str(args.dns_server_port)]),
stdout=subprocess.PIPE)
dns_resolver_stdout, _ = dns_resolver_subprocess.communicate()
if dns_resolver_subprocess.returncode == 0:
if '123.123.123.123' in dns_resolver_stdout:
test_runner_log(('DNS server is up! '
'Successfully reached it over UDP and TCP.'))
return
time.sleep(0.1)
dns_server_subprocess.kill()
dns_server_subprocess.wait()
test_runner_log(('Failed to reach DNS server over TCP and/or UDP. '
'Exitting without running tests.'))
test_runner_log('======= DNS server stdout '
'(merged stdout and stderr) =============')
with open(dns_server_subprocess_output, 'r') as l:
test_runner_log(l.read())
test_runner_log('======= end DNS server output=========')
sys.exit(1)
dns_server_subprocess_output = tempfile.mktemp()
with open(dns_server_subprocess_output, 'w') as l:
dns_server_subprocess = subprocess.Popen(python_args([
args.dns_server_bin_path,
'--port', str(args.dns_server_port),
'--records_config_path', args.records_config_path]),
stdin=subprocess.PIPE,
stdout=l,
stderr=l)
def _quit_on_signal(signum, _frame):
test_runner_log('Received signal: %d' % signum)
dns_server_subprocess.kill()
dns_server_subprocess.wait()
sys.exit(1)
signal.signal(signal.SIGINT, _quit_on_signal)
signal.signal(signal.SIGTERM, _quit_on_signal)
wait_until_dns_server_is_up(args,
dns_server_subprocess,
dns_server_subprocess_output)
num_test_failures = 0
test_runner_log('Run test with target: %s' % 'no-srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'no-srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '5.5.5.5:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-single-target.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:1234,True',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-multi-target.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.5:1234,True;1.2.3.6:1234,True;1.2.3.7:1234,True',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv6-single-target.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '[2607:f8b0:400a:801::1001]:1234,True',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv6-multi-target.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1003]:1234,True;[2607:f8b0:400a:801::1004]:1234,True',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-simple-service-config.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:1234,True',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}',
'--expected_lb_policy', 'round_robin',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-no-srv-simple-service-config.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"NoSrvSimpleService","waitForReady":true}]}]}',
'--expected_lb_policy', 'round_robin',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-no-config-for-cpp.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-cpp-config-has-zero-percentage.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-second-language-is-cpp.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"CppService","waitForReady":true}]}]}',
'--expected_lb_policy', 'round_robin',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-config-with-percentages.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"AlwaysPickedService","waitForReady":true}]}]}',
'--expected_lb_policy', 'round_robin',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:1234,True;1.2.3.4:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv6-target-has-backend-and-balancer.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '[2607:f8b0:400a:801::1002]:1234,True;[2607:f8b0:400a:801::1002]:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'ipv4-config-causing-fallback-to-tcp.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '1.2.3.4:443,False',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwo","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooThree","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFour","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooFive","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSix","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooSeven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEight","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooNine","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTen","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooEleven","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]},{"name":[{"method":"FooTwelve","service":"SimpleService","waitForReady":true}]}]}',
'--expected_lb_policy', '',
'--enable_srv_queries', 'True',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-single-target-srv-disabled.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-single-target-srv-disabled.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '2.3.4.5:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'False',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-multi-target-srv-disabled.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-multi-target-srv-disabled.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '9.2.3.5:443,False;9.2.3.6:443,False;9.2.3.7:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'False',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv6-single-target-srv-disabled.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv6-single-target-srv-disabled.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '[2600::1001]:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'False',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv6-multi-target-srv-disabled.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv6-multi-target-srv-disabled.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '[2600::1002]:443,False;[2600::1003]:443,False;[2600::1004]:443,False',
'--expected_chosen_service_config', '',
'--expected_lb_policy', '',
'--enable_srv_queries', 'False',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('Run test with target: %s' % 'srv-ipv4-simple-service-config-srv-disabled.resolver-tests-version-4.grpctestingexp.')
current_test_subprocess = subprocess.Popen([
args.test_bin_path,
'--target_name', 'srv-ipv4-simple-service-config-srv-disabled.resolver-tests-version-4.grpctestingexp.',
'--expected_addrs', '5.5.3.4:443,False',
'--expected_chosen_service_config', '{"loadBalancingPolicy":"round_robin","methodConfig":[{"name":[{"method":"Foo","service":"SimpleService","waitForReady":true}]}]}',
'--expected_lb_policy', 'round_robin',
'--enable_srv_queries', 'False',
'--local_dns_server_address', '127.0.0.1:%d' % args.dns_server_port])
current_test_subprocess.communicate()
if current_test_subprocess.returncode != 0:
num_test_failures += 1
test_runner_log('now kill DNS server')
dns_server_subprocess.kill()
dns_server_subprocess.wait()
test_runner_log('%d tests failed.' % num_test_failures)
sys.exit(num_test_failures)
| 50.513369
| 1,271
| 0.724063
| 2,558
| 18,892
| 5.08405
| 0.104769
| 0.048443
| 0.092042
| 0.061361
| 0.812303
| 0.797693
| 0.753403
| 0.741869
| 0.733487
| 0.724491
| 0
| 0.033973
| 0.104118
| 18,892
| 373
| 1,272
| 50.648794
| 0.734417
| 0.031707
| 0
| 0.574924
| 0
| 0.097859
| 0.530091
| 0.347467
| 0
| 0
| 0
| 0
| 0
| 1
| 0.012232
| false
| 0
| 0.024465
| 0
| 0.045872
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
8a75089e8aead85843282546d97ee0a27278444c
| 2,200
|
py
|
Python
|
hapast/views.py
|
cuizhenduo/apple
|
7701a0664aaf712aa9f855b28d8f19eb8b71645d
|
[
"Apache-2.0"
] | null | null | null |
hapast/views.py
|
cuizhenduo/apple
|
7701a0664aaf712aa9f855b28d8f19eb8b71645d
|
[
"Apache-2.0"
] | null | null | null |
hapast/views.py
|
cuizhenduo/apple
|
7701a0664aaf712aa9f855b28d8f19eb8b71645d
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .models import Cao,Chong,Bing
from django.http import HttpResponse
import json
# Create your views here.
def chongdata(req):
page = int(req.GET.get('page', None))
n = 15 #每页显示的数量
response = ''
#list = wenzhang.objects.all()
list = Chong.objects.order_by('-id')[n*(page-1):n*(page-1)+n]
cd = len(list)
js = []
if cd != 0:
for var in list:
js.append({'id': var.id, 'title': var.title})
jsobj = {'tit': js}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
else:
return HttpResponse('')
def chongread(req):
num = req.GET.get('num')
res = Chong.objects.get(id=num)
jsobj = {'title': res.title, 'article': res.article}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
def bingdata(req):
page = int(req.GET.get('page', None))
n = 15 #每页显示的数量
response = ''
#list = wenzhang.objects.all()
list = Bing.objects.order_by('-id')[n*(page-1):n*(page-1)+n]
cd = len(list)
js = []
if cd != 0:
for var in list:
js.append({'id': var.id, 'title': var.title})
jsobj = {'tit': js}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
else:
return HttpResponse('')
def bingread(req):
num = req.GET.get('num')
res = Bing.objects.get(id=num)
jsobj = {'title': res.title, 'article': res.article}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
def caodata(req):
page = int(req.GET.get('page', None))
n = 15 #每页显示的数量
response = ''
#list = wenzhang.objects.all()
list = Cao.objects.order_by('-id')[n*(page-1):n*(page-1)+n]
cd = len(list)
js = []
if cd != 0:
for var in list:
js.append({'id': var.id, 'title': var.title})
jsobj = {'tit': js}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
else:
return HttpResponse('')
def caoread(req):
num = req.GET.get('num')
res = Cao.objects.get(id=num)
jsobj = {'title': res.title, 'article': res.article}
jsdata = json.dumps(jsobj)
return HttpResponse(jsdata)
| 28.571429
| 65
| 0.576818
| 298
| 2,200
| 4.231544
| 0.211409
| 0.128469
| 0.042823
| 0.033307
| 0.837431
| 0.837431
| 0.837431
| 0.78747
| 0.78747
| 0.78747
| 0
| 0.00975
| 0.254091
| 2,200
| 77
| 66
| 28.571429
| 0.758684
| 0.069545
| 0
| 0.761194
| 0
| 0
| 0.047082
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.089552
| false
| 0
| 0.059701
| 0
| 0.283582
| 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
|
8a93321fc37e0bcfee23818df6b46bed266c7a73
| 12,534
|
py
|
Python
|
BlackHat_Python/decoders/base64_decode.py
|
w1sd0m-404/BlackHat_Python
|
76d5280aba64c9e8c30a536ab94aef6557532474
|
[
"MIT"
] | null | null | null |
BlackHat_Python/decoders/base64_decode.py
|
w1sd0m-404/BlackHat_Python
|
76d5280aba64c9e8c30a536ab94aef6557532474
|
[
"MIT"
] | null | null | null |
BlackHat_Python/decoders/base64_decode.py
|
w1sd0m-404/BlackHat_Python
|
76d5280aba64c9e8c30a536ab94aef6557532474
|
[
"MIT"
] | null | null | null |
from base64 import b64decode
decode = b64decode(b"K n a b r w z b t b t z s o c m n s m g f t i l x f s x t p q k s z v e g d o N e t i y v h a l f i v g c o u i c c k s k k l g s g n x h o q v q n q v h U l p a p y e y u k m t y u s i a n w p e k z l s r q W g l h p p k u h e d j q y q c d i l p x k n j x x z t s j c s g b t n q k i p u n s k z u z i z z E i q c y b o w j e o j k r y d e k n c y x q x d o m v l u v d h m c Z d m v f k n g x t a v p a e c n z l y z x s f k k n m a w w j e m x a o e w c r a l n w s h L y l t l o b z x c i d n g i m y n h x z q a l c h z y i h j c t v t v x a n r c e l n y u S h w a s p s b n P t n p p e d q h s t q g y k t y F b f e g m e m U h i k k w z b x w j m v e q b w o d r a x z q b n c W p t m b p t k l c f d o c e Y k p d n z q s c m i o i k t q i v w p b n k p o d a l m z y w x b p p o n w v n b e g s y Z h d x a x z n a y r c a f r e g x a u y p w k b u e v o l j v e n o s u j k e x q s t e y s D l g a y t u k u y n f l o e u g q t l k f p i x g b m a x J x e n m e k s f z e x q e s x x p s s a t e f v z m x q b h s d u e n P p z p r a l f I w m k l t o l n u l k e y d s b q d h h q t q x a m s y r l k n z q u c t y q x z l k v j k f b v Z z a s q v d f e q m c w j g i a o y f a o c x c i b b g c b d b r t f m k x x g x k g a c b t X a a d w v r r w W f t g c d e b z h b c n i f Z f j o b m a q d s d e v z o a o r d b m i e h k j y m j m h u t w x a r t y k v u j b h q y p i x q K p r e t a s d e z c w w s a k v v c u z t e m p f w q b j Y q b r i q v x i q w j w j i m i j n u j d d d y l n c m f a y h q r r p k b e s K e r p k x q n k i z h h q u v h i q f t l v q x n v r l o z j J l r z v n p b n l z d y f j j w b v l w f g m x p h v i a r j k d a u w a v p m t t v s x v g t V s n f x k d v i l t i g w n o n j F n i x o w g o x a v a p k u v n c q d z y p b c k s n g r n g v c l w u r e g m I t k v i e s a g u p b n z r p r y d u m j e d x s c s o c d n i p b f k o y R k q a i e C u x o b e t a x x l w m r e m f f l k v n e p g i z r j d k l q b b t y i p i j r b z a s n l O e o a g i b k a z s l t x h u b q n l n s d q n x d a q k p x g c n P g v a i s j k g p j x s n c p w F b w y z g a b v s s a f z u x l v p r j x a r s x s b z o o z v e q u n r s x s i s q u g b t q a R y y w t s q y f n k u r d m m n x n l w e m g e p h a e y v f o q j l f c W y o q w h U t c h b p e Z r w n f n w k h p o d b a e c a t B n a f x h j d j q x d b l w f f c f s m u b a c n R e y x u p s h z v f h u n k l u r v l i c b w h d h q v w i e u q s o v a m i w m y m g m x a o t s J r t l y m d a z a m k j g j h y s a t q l h k w b Z b d m y i s y g p u p q m l u v j s s z n e f h j c u q z x u c a g z d h q l k g c e y k c n n D w s t a s h q o v q w t l d h p a e q x u t d w x j h n e c z s o q a t a g o f a a m l g m t T y q b a k l z r h f e q c j t d o x i o z p v Q i z r k f b v g f N d c o k k c c u r m b n s o w v o j r f l w v f j p s b x q q v d q q b c u l r y x p x d C h z u t k i a p s c c n h p s d W p u v l a d q m m y k j e t p p f b k j a g r h j s j u t a z j G e b b y n d u c j p v c y c z b b m f s y l p g t p g v r o h h r N y k h t w p o b b y g d v w a f q p z o i q k q j j w z y e y u v s d i d q h q h B p t h c v b a s t l g p h z k o e d v p h m f o v u z d g j g x g e w f m b d x b v u a j f f x d v E x u a j b t b l e b q v k m j k s m x c s e h c o e u y r z b l s n Y m u p l t p j c a s j p y j b o U j h x k x Z f z z y o k j i m a k o u h x f c l d d l n T s t v v g d k w y a i u q m s v g r d i n c d w m x m b t k c p x i a l r N h q b r t q d h s i e u e c l u i g u i z w x u w w c j g i R n e r o w z z t n s t t x u y v m v n h z d b q s l c j x k j e u y o q o l e j v u t m d d e c C j t f v n a n v i a b r g v b v e v r c m k u l q u w h F b i e o e o k u m d y d k h s r x j z q K b y f v g n h g l e s o f f x m o c o a g c u c r z e u o h k e R z q e d g f x p f m h j i i p q d u j e t K m u g e z x s i d c v j v h o s t n n q p g j b p h c f b r r f r j h t n r s S p d z s f z j b y t e g z w e z o l n v b a j x g z z v y f y d a l b w t w o h f K c q h w f t m j f f u m u g b p f o p c s y o z a n n q x q f c x u m 5 i d r v l w h r t f o o i u o w i c g y t p u x G a b n n r b a j h v j h k d u s r q q w l j u l o a g w w j p s b v x s y h s y q e s g n m n q o m D f x y j b k t r k A m s m l m g p n l v a q y e q z u M c f w x z k p b i z f e v r j c d y i o b J f z b e f h k t p h g q m d u W k f b c d n u z x g w k x g J j y t l w h g y o i x v m m q g i c q m r y s e c i m r t o i i b i k s z t k o i q x r w v a i r s Q b q t e t q g m x r l y o v n z h e c y r l n t x v Z v z g t l i c t x g u q z g n k w p x g b e y i p c e b x u j l s o b b y m r z o w V a v i r s o q n t k K x s p t i w d i f m z h 5 e m p a b z t o x a m q g x z b i s r w b b t u o g o 3 q p t z e h C m n q k z i q m r c v g w g e g y z j s m g i q p b m G w g s p f v a d c r m p N w q c c r t x b u D x u t h b p h m f x c s r j p a z q n f v p u l d m w r h m m s g l n t o t u z k w E p n u e u j u z t w v z o a w p a t p w h g q l e o m b e Y x p s u b l o l i v u d v l y q b f m a V w p c y x h s i w t q a a y z r s s t i x q c z k v u b m C m v s y c q t c o u u y v k k r j l o q v f o h w I o m y n q t f i v z w a w v z w i k w f c J l u g x j s i d u h y x p u w c g g w v v b z h h k e o d i r u u a j f u j e q x m k d c Z w y t b h a l Y i k g v p g t y v w o c n p r d F d l m g q y j u y s G b m b o b s j t w s k v i i y f k 2 m z b p n k u o s i c h w b q e y r j v d i p v d h w z y b l d k n x t q c d t Z x s n g j i a a i y b m f y V q e x c h i e l a c p l m v j g b e j w d q v g o e p l j e y v w c g w y h l i c c z p y k J u g d h i q g v h x u Z l x f n b j p J n d u z q z g r f y e o v h d d h s n q n i i k n m w k j v u c G f z t v r l b h o z t e z t c r p o r k v m a b o j e 2 s h m h t v z u z q k n o o k g w g p y k o d p u r b y g w v R c w c m f p s o q p g t h c o c x u d x s j b f y z k r b y i e u y i c i u f R h w r p w i p a b s p d u g n t r g n t n h t p l t m e y f v o p q g i q m j z W a x z b h z p b t d v n c v n s g u b q w n u o a m q o h v a o k t w k K v n f b i r a y w d y n s v h d x x c t r f n k o o q d z m l x n j t f z w h y o Z z f m d j k x n x q a n a i t x t b D z q m n q d n e o s h k b r v n w s T t x f p b p b y v d l q y a d b z q x p m K m i u v w m x o d k k l e l n a s h c l z i v i r q v g w y o d r f v V z b b u h i f z e r S c h l p k v o o f r v i c m q s q p t k w h y c c l r h z h t o p w f i y w g j e b s o y w m x k 2 j b k k i i t s q u x y x l r r m k r r x x k r l o x h t y l x z b h h x h g t x a w o i P k s o u c p g z y r x v b o a h v c h k e a o J g t y t v b w v c l q a f n z c q v h y c g a o s k r i w a c d u k g t i m k N i b l u q w j z i f w b n D n d e n r w u m k d q o y q q q z w c t e l d a n v M g v v r h i T b z t i r y s x g m b a p b k z 2 w e y p j q p b U f p n h o d J r v u i v s y e m z h h f p V z d w p u h k k y k l o 4 f n b z t f j e t x u c w m n u q b v y z a z W w b e l b w s y x q x e r s n a r e z y i j s n k g c t r k e e g v d y f i t w q d b o j y w n n q G a z k d j h e f g u e h d m i c b y o e t u v o c v v x z o x a z h w c a o s f d R y a c g m t r c z r i m j k m p l y s x a b 2 v p x r t s z o b b q z v f z r y s u i d z e b h l u u y g i j m s e z h K g j a e m e h q b x a v s v w i a c h i b s m e b m g i c a l h O a e a t t r x s a g w i z x k r q c g F p h n g o w g w f t o h t h n r k t e v t K s f y x k w y c h g e o j d z c b w f l X p w x r d c r y r y z f f s a e r b v f r q h y o c h s m y s z w U v k x m l y b m g l s j r f i a r j j c t Q d v a l l y t o j o h y z t a u u t q d u f y n S z x p o g v y e l d m v z b x y r p p s n n h l r m s g w t j u e n n a u m p a q z y y k l l D e b y a k z b o h w g r k p u b p s t M r n d s o z c x f y c t v e c j m s e o j c j t e m s n y z e m j g o b b w w b s v m u a r q d p o N b o s m l r h t x b 5 n a j b g p o y d j v f k d w z j e p z u q t h z f s t j l s a z u n f j d E r a z d v h h i e x x h p e f l o t a U p e p i a m y d y x t j w y h m z n k h v b a t u n s w t d g p q e j c s u t m c s p a n c d 2 s y h l x n r d u k m y K m o x m j u x n Z p v j c b k k l v s q j y y i c a i g r o q b s j e k g o y u e g n i d h k h w n h y c b N m w o e m s z y d V m i r b s j q l d u p v n d m u z p b l i s r b n w x t g b t h u U z n q c q y c y n s m p n o q n b q h q t q c e u v z k c l x n r q r l q t w m H o o l d n f l j c l p u y d v a k K u h c w v o o z j T x i b g e o f s n q f y k i a v h f s j w p h t l h n h y q z y t h e u w K m d f x s p v f m j u v x z k z u n a y m i d a d f y c q y q y i e a a j r y c b r U e f v q e j d f c j b q n a e v t u t d n l v l e b t d j y l g b p r x l s f n l k b e I j x d x y l f w x x k v h r s g i g t w y e j h Y u o l h o j s h o m v z z f n f y f Y x m u t f q b l j i s l r o z j w d d x h g d p p s d k n u w c v f r r x z G a v d w p d k i s a j g m z o i j q m j o q o s v l d o v v l G f l e t q f x o a v q d q p w v p o r x d p e i o V b e q r u s m v q o u k r w a a z s z g r j x n u t j f b y g k q u m z r t s s c c x l d k D j v g p b k d t w p b i o d d m t v q f f r c t q u w q u m d E w o h s s d y a c u e n z i k z u v r d d z m p u j n w y l m h J d v b i r f g k i m f o f g x u a x c l s l i z o f q d y r f f y z s u V b p l i c o n n K h b h q h x f k f n q a d p m w g u f k f q o a s c j c u r b o s o m u y h o q l p f e u W g m x x w y g s a v m j j d m m k i m n u h n v i g f j r c n f d x d j t o g x k i w w q f l n U s k s h d a u o e t o g v p u f i w z y o z w v w n v s f c l b d e d r w e W d c e t a b x d r z s b m R v u u l h p q a c k a s x u o q f o b e r s y z g n d b y j u v n l x c y u z v Q m q q c y t e l b w j x y o b y z j z n s l e J x d n v q f b s v h b b t l g m r p r b i f e m t p l w e l a o h t p m x d m V n z c t h l o f m g u r a w j x g g D s i v g o y y p v r q w v W z o r p s l b b u w y k g z x k v Q h t q l f r j n h n e s x m f j p w b o w i s b s s c f x b t b w m c m i 6 q f z g b l a b c a j d g c n r w x D h y o e n u g r d l m e n e w w q m a d c r x z b c q u g g g p q l p r t j g r l h e x l o r F y s g o q v u f h w p t a h p m d I r a k u j b l c V h y p m l z d h y v d b m b u u b j c p n e x l b y f v i k n w s c v y l v m a w u v j o V e z j v w t e o u f m f s e y u l f y g r m u q b l s y s d g w k f c s h w l k y q p u p e u w s n T r x p t e t w b q u d f e j y p x y u q k z t r u e e c u a h r j i f z q v k C b x j q r n o w m g o p U g c j i u o y x p j x p g x k y b c o s u z h p p g m b l l f d h 2 d x u u r h c i n k a q g w k l w c b l u c u a x m v o z f x p p z q i q e q g g f s F l c d a l l h c t t o h l k w t f y w a x y e x l r u a a d i n q r x u k x n p f s l p t v l u N b c b g v e z h q n B i t l s x n a t m n y v w j x u f g l n u f d a k v o y k v e t w h k b g f f y j t g w B z z v p m w j p e n k h n p g h c n u d y v W x i h t l f l d c j p j u n y p n j p f o s q r a o r c n v y z y g n k x u i e q m e a l r C r e d k m o f q k z u y m g s h h e z d x u d e k e h g v V j y v r k m l f e g m n t h l f i a k o d e f g c c J q c u q z e p s o v n g m d e v s y j x c y m o i o j R m k i v e q a q k t f v e O f d t i g w h o f e z b e y s f y k o l e f x e o a p c b p d e f t n c p r a d f y V e w d m x y m d d w f a h i s w d x p x t q p z x u l J b b j p l a t w j a z s v w a l d g G i z l x q l t a z x u d y e g a t t f x r a o w Y y w b q r i v j n o a x d s n a c j q i r q i j a a l f n u f a z x v k a r n d n k q R v n e s n u e h S f k c z x g i k p s n a g d s o v g q i z U k b c j w g e w x p i h y r o m b a b e e e i j a p g l w p g s m a n y M w p y a x s z g x j z w s q u g x w l r s y c m V s z d a y x w l a w x j m l n j k m r d z i t x d l y d w y i m v x y e j p y q d e r j c L q e p x j e w k a z b h e n x w j t z z r W o u d f i c n g b c w l f x q h m z q G e r a x w z w O w h m y l s s n p s a m n y h j m r k g s p q z r v t a m p s u b j z h v i h l u n y w x w h q i K i a l n g r k Q y g z o f f v v j q g x t h d l a q s t h c f a n b p t p h e x c h o l k z q p y l p j m K i m q z g b n j t w E b g u a w p f o e g w s y l p i w c e z v x y i z x w h 6 y r f f n g h w c v k k e k d l v f a c d t z y b r k r f r x r t k n w k s g x a s b l v T u o j x j r o a w l h w p v q q e k z h 2 c e k p f c x r t c b n 7 e w c s e l m a a b l z e z e f c z m y r I m h s b o v n t n a r x x s f l = a f h n d n b w n f b f f j a y b q e ")
print(decode)
| 2,506.8
| 12,486
| 0.501197
| 6,239
| 12,534
| 1.006892
| 0.006091
| 0.006686
| 0.00191
| 0.001273
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003498
| 0.498165
| 12,534
| 5
| 12,487
| 2,506.8
| 0.995231
| 0
| 0
| 0
| 0
| 0.333333
| 0.994494
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 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
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 7
|
8a9872cbda3f06b2eccc44cd6ec69ed53d112f08
| 3,479
|
py
|
Python
|
test1/test_map.py
|
gr0mph/SpringChallenge2020
|
f076e4b466e255ce7b911735bd5f38084339f1f0
|
[
"MIT"
] | null | null | null |
test1/test_map.py
|
gr0mph/SpringChallenge2020
|
f076e4b466e255ce7b911735bd5f38084339f1f0
|
[
"MIT"
] | null | null | null |
test1/test_map.py
|
gr0mph/SpringChallenge2020
|
f076e4b466e255ce7b911735bd5f38084339f1f0
|
[
"MIT"
] | null | null | null |
# unittest
import unittest
# PACMAN_MAP = []
# PACMAN_MAP.append(list('#################################'))
# PACMAN_MAP.append(list('# # # # # # # #'))
# PACMAN_MAP.append(list('# ##### # # # ##### # # # ##### #'))
# PACMAN_MAP.append(list('# # # # # # # #'))
# PACMAN_MAP.append(list('# # # ##### # # # # # ##### # # #'))
# PACMAN_MAP.append(list('# # # # # # #'))
# PACMAN_MAP.append(list('### ### # # # # # # # # # ### ###'))
# PACMAN_MAP.append(list('# # # # #'))
# PACMAN_MAP.append(list('# ### # # ##### # ##### # # ### #'))
# PACMAN_MAP.append(list('# ### # # ### #'))
# PACMAN_MAP.append(list('# ### ##### ### # ### ##### ### #'))
# PACMAN_MAP.append(list('# # # # #'))
# PACMAN_MAP.append(list('### # # # # # # # # # # # # # ###'))
# PACMAN_MAP.append(list(' # # # # # # # # '))
# PACMAN_MAP.append(list('### # ### # # ##### # # ### # ###'))
# PACMAN_MAP.append(list('#################################'))
# PACMAN_MAP = []
# PACMAN_MAP.append(list('#### ####'))
# PACMAN_MAP.append(list('# #'))
# PACMAN_MAP.append(list('# ##### #'))
# PACMAN_MAP.append(list(' # '))
# PACMAN_MAP.append(list('#### ####'))
PACMAN_MAP = []
PACMAN_MAP.append(list('#######'))
PACMAN_MAP.append(list('# #'))
PACMAN_MAP.append(list('# # # #'))
PACMAN_MAP.append(list('# #'))
PACMAN_MAP.append(list('### ###'))
HEIGHT = len(PACMAN_MAP)
WIDTH = len(PACMAN_MAP[0])
PACMAN_MAP = []
PACMAN_MAP.append(list('###############################'))
PACMAN_MAP.append(list('# # # ####### # # #'))
PACMAN_MAP.append(list('# # ### # # ####### # # ### # #'))
PACMAN_MAP.append(list('# # # # # #'))
PACMAN_MAP.append(list('# ### # # ### ### ### # # ### #'))
PACMAN_MAP.append(list('# # # #'))
PACMAN_MAP.append(list('### # ##### # ### # ##### # ###'))
PACMAN_MAP.append(list(' # # # # '))
PACMAN_MAP.append(list('### # ##### ### ### ##### # ###'))
PACMAN_MAP.append(list(' # # # # # # '))
PACMAN_MAP.append(list('### ### # # # ### # # # ### ###'))
PACMAN_MAP.append(list('# # # #'))
PACMAN_MAP.append(list('# # ### ### # ### # ### ### # #'))
PACMAN_MAP.append(list('# # # # # # # # # #'))
PACMAN_MAP.append(list('# ### # # # ### ### # # # ### #'))
PACMAN_MAP.append(list('###############################'))
HEIGHT = len(PACMAN_MAP)
WIDTH = len(PACMAN_MAP[0])
PACMAN_MAP = []
PACMAN_MAP.append(list('###################################'))
PACMAN_MAP.append(list(' # # # # # # # # '))
PACMAN_MAP.append(list('### # # # # ### # # ### # # # # ###'))
PACMAN_MAP.append(list('# # # # # #'))
PACMAN_MAP.append(list('# ### ##### # # ### # # ##### ### #'))
PACMAN_MAP.append(list('# # # ### # # #'))
PACMAN_MAP.append(list('# # ### # # # # ### # # # # ### # #'))
PACMAN_MAP.append(list('# # # # # #'))
PACMAN_MAP.append(list('### ##### # ### # # ### # ##### ###'))
PACMAN_MAP.append(list('# # # # # #'))
PACMAN_MAP.append(list('# # ##### ### # # # # ### ##### # #'))
PACMAN_MAP.append(list('# # # # # # # # # #'))
PACMAN_MAP.append(list('# ### # # # # # ### # # # # # ### #'))
PACMAN_MAP.append(list('###################################'))
HEIGHT = len(PACMAN_MAP)
WIDTH = len(PACMAN_MAP[0])
| 44.602564
| 62
| 0.375395
| 264
| 3,479
| 4.693182
| 0.037879
| 0.486683
| 0.677966
| 0.858757
| 0.982244
| 0.982244
| 0.982244
| 0.982244
| 0.982244
| 0.982244
| 0
| 0.001157
| 0.254383
| 3,479
| 77
| 63
| 45.181818
| 0.476484
| 0.259557
| 0
| 0.777778
| 0
| 0
| 0.453174
| 0.058589
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.022222
| 0
| 0.022222
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 11
|
8aa82506dc8d54c843280d6ac3d8fceac51e18f2
| 2,370
|
py
|
Python
|
project euler/q11.py
|
milkmeat/thomas
|
fbc72af34267488d931a4885d4e19fce22fea582
|
[
"MIT"
] | null | null | null |
project euler/q11.py
|
milkmeat/thomas
|
fbc72af34267488d931a4885d4e19fce22fea582
|
[
"MIT"
] | null | null | null |
project euler/q11.py
|
milkmeat/thomas
|
fbc72af34267488d931a4885d4e19fce22fea582
|
[
"MIT"
] | null | null | null |
s=[
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[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,2,22,97,38,15,0,40,0,75,4,5,7,78,52,12,50,77,91,8,0,0,0,0],
[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,4,56,62,0,0,0,0,0],
[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,3,49,13,36,65,0,0,0,0],
[52,70,95,23,4,60,11,42,69,24,68,56,1,32,56,71,37,2,36,91,0,0,0,0],
[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80,0,0,0,0],
[24,47,32,60,99,3,45,2,44,75,33,53,78,36,84,20,35,17,12,50,0,0,0,0],
[32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70,0,0,0,0],
[67,26,20,68,2,62,12,20,95,63,94,39,63,8,40,91,66,49,94,21,0,0,0,0],
[24,55,58,5,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72,0,0,0,0],
[21,36,23,9,75,0,76,44,20,45,35,14,0,61,33,97,34,31,33,95,0,0,0,0],
[78,17,53,28,22,75,31,67,15,94,3,80,4,62,16,14,9,53,56,92,0,0,0,0],
[16,39,5,42,96,35,31,47,55,58,88,24,0,17,54,24,36,29,85,57,0,0,0,0],
[86,56,0,48,35,71,89,7,5,44,44,37,44,60,21,58,51,54,17,58,0,0,0,0],
[19,80,81,68,5,94,47,69,28,73,92,13,86,52,17,77,4,89,55,40,0,0,0,0],
[4,52,8,83,97,35,99,16,7,97,57,32,16,26,26,79,33,27,98,66,0,0,0,0],
[88,36,68,87,57,62,20,72,3,46,33,67,46,55,12,32,63,93,53,69,0,0,0,0],
[4,42,16,73,38,25,39,11,24,94,72,18,8,46,29,32,40,62,76,36,0,0,0,0],
[20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,4,36,16,0,0,0,0],
[20,73,35,29,78,31,90,1,74,31,49,71,48,86,81,16,23,57,5,54,0,0,0,0],
[1,70,54,71,83,51,54,69,16,92,33,48,61,43,52,1,89,19,67,48,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
]
def heng (x,y):
return s[y][x]*s[y][x+1]*s[y][x+2]*s[y][x+3]
def shu (x,y):
return s[y][x]*s[y+1][x]*s[y+2][x]*s[y+3][x]
def xie (x,y):
return s[y][x]*s[y+1][x+1]*s[y+2][x+2]*s[y+3][x+3]
def xieshang (x,y):
return s[y][x]*s[y-1][x+1]*s[y-2][x+2]*s[y-3][x+3]
d=1
for x in range(0,20):
for y in range (0,24):
if d<heng(x,y):
d=heng(x,y)
if d<xie(x,y):
d=xie(x,y)
if d<shu(x,y):
d=shu(x,y)
if d<xieshang(x,y):
d=xieshang(x,y)
print d
| 47.4
| 71
| 0.532489
| 811
| 2,370
| 1.556104
| 0.140567
| 0.399366
| 0.549128
| 0.66561
| 0.249604
| 0.2187
| 0.2187
| 0.2187
| 0.208399
| 0.208399
| 0
| 0.490689
| 0.093671
| 2,370
| 50
| 72
| 47.4
| 0.096834
| 0
| 0
| 0.16
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.02
| 0
| 0
| 1
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 7
|
0a7184b321c66e609f740f8aba628cd9682cde8a
| 11,030
|
py
|
Python
|
onconet/datasets/mgh_mammo_cancer_survival_all_images.py
|
harrivle/Mirai
|
ea2d4839f1f8b9f881798b819b2192ce2795bd5d
|
[
"MIT"
] | 37
|
2021-01-28T06:00:34.000Z
|
2022-03-29T21:14:12.000Z
|
onconet/datasets/mgh_mammo_cancer_survival_all_images.py
|
NkwamPhilip/Mirai
|
70413de690da36c5878e2e6006711476e166bb1d
|
[
"MIT"
] | null | null | null |
onconet/datasets/mgh_mammo_cancer_survival_all_images.py
|
NkwamPhilip/Mirai
|
70413de690da36c5878e2e6006711476e166bb1d
|
[
"MIT"
] | 14
|
2021-02-02T09:42:18.000Z
|
2022-03-23T00:36:41.000Z
|
import os
from collections import Counter
import torch
from onconet.datasets.factory import RegisterDataset
from onconet.datasets.abstract_onco_dataset import Abstract_Onco_Dataset
from onconet.datasets.mgh_mammo_cancer_survival import MGH_Mammo_Cancer_Survival_Dataset, METADATA_FILENAMES
import onconet.utils
import tqdm
from random import shuffle
import numpy as np
import pdb
SUMMARY_MSG = "Contructed MGH Mammo {} Survival {} dataset with {} records, {} exams, {} patients, and the following class balance \n {}"
BIRADS_TO_PROB = {'NA':1.0, '1-Negative':0.0, '2-Benign':0.0, '0-Additional imaging needed':1.0, "3-Probably benign": 1.0, "4-Suspicious": 1.0, "5-Highly suspicious": 1.0, "6-Known malignancy": 1.0}
MAX_VIEWS = 2
MAX_SIDES = 2
MAX_TIME=10
@RegisterDataset("mgh_mammo_risk_full_future_all_images")
class MGH_Mammo_Cancer_Survival_All_Images_Dataset(MGH_Mammo_Cancer_Survival_Dataset):
'''
Working dataset for suvival analysis. Note, does not support invasive cancer yet.
'''
def create_dataset(self, split_group, img_dir):
"""
Return the dataset from the paths and labels in the json.
:split_group: - ['train'|'dev'|'test'].
:img_dir: - The path to the dir containing the images.
"""
dataset = []
for mrn_row in tqdm.tqdm(self.metadata_json):
ssn, split, exams = mrn_row['ssn'], mrn_row['split'], mrn_row['accessions']
if not split == split_group:
continue
# Sort exams by sdate
exams = sorted(exams, key = lambda exam: exam['sdate'])
for side in ['L', 'R']:
all_images_so_far = []
all_views_so_far = []
all_sides_so_far = []
time_stamps_so_far = []
past_exams = []
for i, exam in enumerate(exams):
prev_year = exams[i-1]['sdate'] if i != 0 else exams[0]['sdate']
year = exam['sdate']
if split_group == 'train':
if not (year in self.args.train_years):
continue
elif split_group == 'dev':
if not (year in self.args.dev_years):
continue
else:
assert split_group == 'test'
if not (year in self.args.test_years):
continue
if self.check_label(exam):
left_ccs, left_mlos, right_ccs, right_mlos = self.image_paths_by_views(exam)
if side == 'L':
right_ccs, right_mlos = [], []
elif side == 'R':
left_ccs, left_mlos = [], []
y, y_seq, y_mask, time_at_event = self.get_label(exam, side)
birads = int(BIRADS_TO_PROB[exam['birads']])
# Update time stamps
year_delta = year - prev_year
time_stamps_so_far = [t+year_delta for t in time_stamps_so_far]
# Update with new data
all_images_so_far.extend( right_ccs + right_mlos + left_ccs + left_mlos )
all_views_so_far.extend( [0]*len(right_ccs) + [1]*len(right_mlos) + [0]*len(left_ccs) + [1]*len(left_mlos) )
all_sides_so_far.extend( [0]*len(right_ccs) + [0]*len(right_mlos) + [1]*len(left_ccs) + [1]*len(left_mlos) )
time_stamps_so_far.extend( [0]*len(right_ccs + right_mlos + left_ccs + left_mlos) )
# Truncate with Max len exams
all_images_so_far = all_images_so_far[-self.args.num_images:]
all_views_so_far = all_views_so_far[-self.args.num_images:]
all_sides_so_far = all_sides_so_far[-self.args.num_images:]
time_stamps_so_far = time_stamps_so_far[-self.args.num_images:]
if time_at_event < 0: # Case of negative breast with 0 yr follow but pos other breast
continue
dist_key = 'neg'
if y_seq[0] == 1 and self.args.shift_class_bal_towards_imediate_cancers:
dist_key = 'pos:1'
elif y:
dist_key = 'pos:any'
if self.args.year_weighted_class_bal:
dist_key = "year={};{}".format(year, dist_key)
if len(all_images_so_far) < self.args.min_num_images:
continue
dataset.append({
'paths': pad_to_length(all_images_so_far, '<PAD>', self.args.num_images),
'y': y,
'y_mask': y_mask,
'y_seq': y_seq,
'time_at_event': time_at_event,
'birads': birads,
'year': year,
'additional': {},
'exam': exam['accession'],
'dist_key': dist_key,
'ssn': ssn,
'time_seq': pad_to_length(time_stamps_so_far, MAX_TIME , self.args.num_images),
'view_seq': pad_to_length(all_views_so_far, MAX_VIEWS , self.args.num_images),
'side_seq': pad_to_length(all_sides_so_far, MAX_SIDES, self.args.num_images)
})
return dataset
@RegisterDataset("mgh_mammo_risk_full_future_all_images_both_sides")
class MGH_Mammo_Cancer_Survival_All_Images_Both_Sides_Dataset(MGH_Mammo_Cancer_Survival_Dataset):
'''
Working dataset for suvival analysis. Note, does not support invasive cancer yet.
'''
def create_dataset(self, split_group, img_dir):
"""
Return the dataset from the paths and labels in the json.
:split_group: - ['train'|'dev'|'test'].
:img_dir: - The path to the dir containing the images.
"""
dataset = []
for mrn_row in tqdm.tqdm(self.metadata_json):
ssn, split, exams = mrn_row['ssn'], mrn_row['split'], mrn_row['accessions']
if not split == split_group:
continue
# Sort exams by sdate
exams = sorted(exams, key = lambda exam: exam['sdate'])
all_images_so_far = []
all_views_so_far = []
all_sides_so_far = []
time_stamps_so_far = []
past_exams = []
for i, exam in enumerate(exams):
prev_year = exams[i-1]['sdate'] if i != 0 else exams[0]['sdate']
year = exam['sdate']
if split_group == 'train':
if not (year in self.args.train_years):
continue
elif split_group == 'dev':
if not (year in self.args.dev_years):
continue
else:
assert split_group == 'test'
if not (year in self.args.test_years):
continue
if self.check_label(exam):
left_ccs, left_mlos, right_ccs, right_mlos = self.image_paths_by_views(exam)
if len(left_ccs+left_mlos+right_ccs+right_mlos) != 4:
continue
y, y_seq, y_mask, time_at_event = self.get_label(exam, 'Any')
y_l, y_seq_l, y_mask_l, time_at_event_l = self.get_label(exam, 'L')
y_r, y_seq_r, y_mask_r, time_at_event_r = self.get_label(exam, 'R')
birads = int(BIRADS_TO_PROB[exam['birads']])
# Update time stamps
year_delta = year - prev_year
time_stamps_so_far = [t+year_delta for t in time_stamps_so_far]
# Update with new data
all_images_so_far.extend( right_ccs + right_mlos + left_ccs + left_mlos )
all_views_so_far.extend( [0]*len(right_ccs) + [1]*len(right_mlos) + [0]*len(left_ccs) + [1]*len(left_mlos) )
all_sides_so_far.extend( [0]*len(right_ccs) + [0]*len(right_mlos) + [1]*len(left_ccs) + [1]*len(left_mlos) )
time_stamps_so_far.extend( [0]*len(right_ccs + right_mlos + left_ccs + left_mlos) )
# Truncate with Max len exams
all_images_so_far = all_images_so_far[-self.args.num_images:]
all_views_so_far = all_views_so_far[-self.args.num_images:]
all_sides_so_far = all_sides_so_far[-self.args.num_images:]
time_stamps_so_far = time_stamps_so_far[-self.args.num_images:]
if time_at_event < 0: # Case of negative breast with 0 yr follow but pos other breast
continue
dist_key = 'neg'
if y_seq[0] == 1 and self.args.shift_class_bal_towards_imediate_cancers:
dist_key = 'pos:1'
elif y:
dist_key = 'pos:any'
if self.args.year_weighted_class_bal:
dist_key = "year={};{}".format(year, dist_key)
if len(all_images_so_far) < self.args.min_num_images:
continue
dataset.append({
'paths': pad_to_length(all_images_so_far, '<PAD>', self.args.num_images),
'y': y,
'y_mask': y_mask,
'y_seq': y_seq,
'time_at_event': time_at_event,
'y_l': y_l,
'y_mask_l': y_mask_l,
'y_seq_l': y_seq_l,
'time_at_event_l': time_at_event_l,
'y_r': y_r,
'y_mask_r': y_mask_r,
'y_seq_r': y_seq_r,
'time_at_event_r': time_at_event_r,
'birads': birads,
'year': year,
'exam': exam['accession'],
'dist_key': dist_key,
'ssn': ssn,
'time_seq': pad_to_length(time_stamps_so_far, MAX_TIME , self.args.num_images),
'view_seq': pad_to_length(all_views_so_far, MAX_VIEWS , self.args.num_images),
'side_seq': pad_to_length(all_sides_so_far, MAX_SIDES, self.args.num_images),
'additionals': []
})
return dataset
def pad_to_length(arr, pad_token, max_length):
arr = arr[-max_length:]
return np.array( [pad_token]* (max_length - len(arr)) + arr)
| 47.543103
| 198
| 0.515322
| 1,335
| 11,030
| 3.910861
| 0.134082
| 0.044053
| 0.03371
| 0.052097
| 0.832982
| 0.802911
| 0.802911
| 0.789121
| 0.765371
| 0.765371
| 0
| 0.009206
| 0.389393
| 11,030
| 231
| 199
| 47.748918
| 0.765999
| 0.069991
| 0
| 0.741379
| 0
| 0.005747
| 0.075321
| 0.008391
| 0
| 0
| 0
| 0
| 0.011494
| 1
| 0.017241
| false
| 0
| 0.063218
| 0
| 0.109195
| 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
|
6a501a9d152f13375fa371129bd0ac3cdc0eae2b
| 133
|
py
|
Python
|
exercises/glob-file.py
|
DaniDiazTech/Check-if-a-file-exists-in-Python
|
fbed0ae4e053076568279c6ba8a4531a54458d9e
|
[
"MIT"
] | null | null | null |
exercises/glob-file.py
|
DaniDiazTech/Check-if-a-file-exists-in-Python
|
fbed0ae4e053076568279c6ba8a4531a54458d9e
|
[
"MIT"
] | null | null | null |
exercises/glob-file.py
|
DaniDiazTech/Check-if-a-file-exists-in-Python
|
fbed0ae4e053076568279c6ba8a4531a54458d9e
|
[
"MIT"
] | null | null | null |
import glob
print(glob.glob('testfile.txt'))
print(glob.glob('testdirectory'))
print(glob.glob('*.txt'))
print(glob.glob('*.py'))
| 14.777778
| 33
| 0.684211
| 19
| 133
| 4.789474
| 0.368421
| 0.395604
| 0.571429
| 0.351648
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067669
| 133
| 9
| 34
| 14.777778
| 0.733871
| 0
| 0
| 0
| 0
| 0
| 0.253731
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0.8
| 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
| 0
| 0
| 0
| 1
|
0
| 7
|
0ac215453ab1820d0e109d27e1640edf7fe75601
| 20,182
|
py
|
Python
|
sdk/python/pulumi_ovh/iploadbalancing_http_farm_server.py
|
legitbee/pulumi-ovh
|
23205a76a958edfbfcd96242d9663b3d7c81ccd9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_ovh/iploadbalancing_http_farm_server.py
|
legitbee/pulumi-ovh
|
23205a76a958edfbfcd96242d9663b3d7c81ccd9
|
[
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_ovh/iploadbalancing_http_farm_server.py
|
legitbee/pulumi-ovh
|
23205a76a958edfbfcd96242d9663b3d7c81ccd9
|
[
"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
__all__ = ['IploadbalancingHttpFarmServerArgs', 'IploadbalancingHttpFarmServer']
@pulumi.input_type
class IploadbalancingHttpFarmServerArgs:
def __init__(__self__, *,
address: pulumi.Input[str],
farm_id: pulumi.Input[int],
service_name: pulumi.Input[str],
status: pulumi.Input[str],
backup: Optional[pulumi.Input[bool]] = None,
chain: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input[bool]] = None,
proxy_protocol_version: Optional[pulumi.Input[str]] = None,
ssl: Optional[pulumi.Input[bool]] = None,
weight: Optional[pulumi.Input[int]] = None):
"""
The set of arguments for constructing a IploadbalancingHttpFarmServer resource.
"""
pulumi.set(__self__, "address", address)
pulumi.set(__self__, "farm_id", farm_id)
pulumi.set(__self__, "service_name", service_name)
pulumi.set(__self__, "status", status)
if backup is not None:
pulumi.set(__self__, "backup", backup)
if chain is not None:
pulumi.set(__self__, "chain", chain)
if display_name is not None:
pulumi.set(__self__, "display_name", display_name)
if port is not None:
pulumi.set(__self__, "port", port)
if probe is not None:
pulumi.set(__self__, "probe", probe)
if proxy_protocol_version is not None:
pulumi.set(__self__, "proxy_protocol_version", proxy_protocol_version)
if ssl is not None:
pulumi.set(__self__, "ssl", ssl)
if weight is not None:
pulumi.set(__self__, "weight", weight)
@property
@pulumi.getter
def address(self) -> pulumi.Input[str]:
return pulumi.get(self, "address")
@address.setter
def address(self, value: pulumi.Input[str]):
pulumi.set(self, "address", value)
@property
@pulumi.getter(name="farmId")
def farm_id(self) -> pulumi.Input[int]:
return pulumi.get(self, "farm_id")
@farm_id.setter
def farm_id(self, value: pulumi.Input[int]):
pulumi.set(self, "farm_id", value)
@property
@pulumi.getter(name="serviceName")
def service_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "service_name")
@service_name.setter
def service_name(self, value: pulumi.Input[str]):
pulumi.set(self, "service_name", value)
@property
@pulumi.getter
def status(self) -> pulumi.Input[str]:
return pulumi.get(self, "status")
@status.setter
def status(self, value: pulumi.Input[str]):
pulumi.set(self, "status", value)
@property
@pulumi.getter
def backup(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "backup")
@backup.setter
def backup(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "backup", value)
@property
@pulumi.getter
def chain(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "chain")
@chain.setter
def chain(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "chain", value)
@property
@pulumi.getter(name="displayName")
def display_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "display_name")
@display_name.setter
def display_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "display_name", value)
@property
@pulumi.getter
def port(self) -> Optional[pulumi.Input[int]]:
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[bool]]:
return pulumi.get(self, "probe")
@probe.setter
def probe(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "probe", value)
@property
@pulumi.getter(name="proxyProtocolVersion")
def proxy_protocol_version(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "proxy_protocol_version")
@proxy_protocol_version.setter
def proxy_protocol_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "proxy_protocol_version", value)
@property
@pulumi.getter
def ssl(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "ssl")
@ssl.setter
def ssl(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "ssl", value)
@property
@pulumi.getter
def weight(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "weight")
@weight.setter
def weight(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "weight", value)
@pulumi.input_type
class _IploadbalancingHttpFarmServerState:
def __init__(__self__, *,
address: Optional[pulumi.Input[str]] = None,
backup: Optional[pulumi.Input[bool]] = None,
chain: Optional[pulumi.Input[str]] = None,
cookie: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
farm_id: Optional[pulumi.Input[int]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input[bool]] = None,
proxy_protocol_version: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
ssl: Optional[pulumi.Input[bool]] = None,
status: Optional[pulumi.Input[str]] = None,
weight: Optional[pulumi.Input[int]] = None):
"""
Input properties used for looking up and filtering IploadbalancingHttpFarmServer resources.
"""
if address is not None:
pulumi.set(__self__, "address", address)
if backup is not None:
pulumi.set(__self__, "backup", backup)
if chain is not None:
pulumi.set(__self__, "chain", chain)
if cookie is not None:
pulumi.set(__self__, "cookie", cookie)
if display_name is not None:
pulumi.set(__self__, "display_name", display_name)
if farm_id is not None:
pulumi.set(__self__, "farm_id", farm_id)
if port is not None:
pulumi.set(__self__, "port", port)
if probe is not None:
pulumi.set(__self__, "probe", probe)
if proxy_protocol_version is not None:
pulumi.set(__self__, "proxy_protocol_version", proxy_protocol_version)
if service_name is not None:
pulumi.set(__self__, "service_name", service_name)
if ssl is not None:
pulumi.set(__self__, "ssl", ssl)
if status is not None:
pulumi.set(__self__, "status", status)
if weight is not None:
pulumi.set(__self__, "weight", weight)
@property
@pulumi.getter
def address(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "address")
@address.setter
def address(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "address", value)
@property
@pulumi.getter
def backup(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "backup")
@backup.setter
def backup(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "backup", value)
@property
@pulumi.getter
def chain(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "chain")
@chain.setter
def chain(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "chain", value)
@property
@pulumi.getter
def cookie(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "cookie")
@cookie.setter
def cookie(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "cookie", value)
@property
@pulumi.getter(name="displayName")
def display_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "display_name")
@display_name.setter
def display_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "display_name", value)
@property
@pulumi.getter(name="farmId")
def farm_id(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "farm_id")
@farm_id.setter
def farm_id(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "farm_id", value)
@property
@pulumi.getter
def port(self) -> Optional[pulumi.Input[int]]:
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[bool]]:
return pulumi.get(self, "probe")
@probe.setter
def probe(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "probe", value)
@property
@pulumi.getter(name="proxyProtocolVersion")
def proxy_protocol_version(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "proxy_protocol_version")
@proxy_protocol_version.setter
def proxy_protocol_version(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "proxy_protocol_version", value)
@property
@pulumi.getter(name="serviceName")
def service_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "service_name")
@service_name.setter
def service_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_name", value)
@property
@pulumi.getter
def ssl(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "ssl")
@ssl.setter
def ssl(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "ssl", value)
@property
@pulumi.getter
def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status")
@status.setter
def status(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "status", value)
@property
@pulumi.getter
def weight(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "weight")
@weight.setter
def weight(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "weight", value)
class IploadbalancingHttpFarmServer(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
address: Optional[pulumi.Input[str]] = None,
backup: Optional[pulumi.Input[bool]] = None,
chain: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
farm_id: Optional[pulumi.Input[int]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input[bool]] = None,
proxy_protocol_version: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
ssl: Optional[pulumi.Input[bool]] = None,
status: Optional[pulumi.Input[str]] = None,
weight: Optional[pulumi.Input[int]] = None,
__props__=None):
"""
Create a IploadbalancingHttpFarmServer resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: IploadbalancingHttpFarmServerArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Create a IploadbalancingHttpFarmServer resource with the given unique name, props, and options.
:param str resource_name: The name of the resource.
:param IploadbalancingHttpFarmServerArgs 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(IploadbalancingHttpFarmServerArgs, 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,
address: Optional[pulumi.Input[str]] = None,
backup: Optional[pulumi.Input[bool]] = None,
chain: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
farm_id: Optional[pulumi.Input[int]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input[bool]] = None,
proxy_protocol_version: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
ssl: Optional[pulumi.Input[bool]] = None,
status: Optional[pulumi.Input[str]] = None,
weight: Optional[pulumi.Input[int]] = 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__ = IploadbalancingHttpFarmServerArgs.__new__(IploadbalancingHttpFarmServerArgs)
if address is None and not opts.urn:
raise TypeError("Missing required property 'address'")
__props__.__dict__["address"] = address
__props__.__dict__["backup"] = backup
__props__.__dict__["chain"] = chain
__props__.__dict__["display_name"] = display_name
if farm_id is None and not opts.urn:
raise TypeError("Missing required property 'farm_id'")
__props__.__dict__["farm_id"] = farm_id
__props__.__dict__["port"] = port
__props__.__dict__["probe"] = probe
__props__.__dict__["proxy_protocol_version"] = proxy_protocol_version
if service_name is None and not opts.urn:
raise TypeError("Missing required property 'service_name'")
__props__.__dict__["service_name"] = service_name
__props__.__dict__["ssl"] = ssl
if status is None and not opts.urn:
raise TypeError("Missing required property 'status'")
__props__.__dict__["status"] = status
__props__.__dict__["weight"] = weight
__props__.__dict__["cookie"] = None
super(IploadbalancingHttpFarmServer, __self__).__init__(
'ovh:index/iploadbalancingHttpFarmServer:IploadbalancingHttpFarmServer',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
address: Optional[pulumi.Input[str]] = None,
backup: Optional[pulumi.Input[bool]] = None,
chain: Optional[pulumi.Input[str]] = None,
cookie: Optional[pulumi.Input[str]] = None,
display_name: Optional[pulumi.Input[str]] = None,
farm_id: Optional[pulumi.Input[int]] = None,
port: Optional[pulumi.Input[int]] = None,
probe: Optional[pulumi.Input[bool]] = None,
proxy_protocol_version: Optional[pulumi.Input[str]] = None,
service_name: Optional[pulumi.Input[str]] = None,
ssl: Optional[pulumi.Input[bool]] = None,
status: Optional[pulumi.Input[str]] = None,
weight: Optional[pulumi.Input[int]] = None) -> 'IploadbalancingHttpFarmServer':
"""
Get an existing IploadbalancingHttpFarmServer 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.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _IploadbalancingHttpFarmServerState.__new__(_IploadbalancingHttpFarmServerState)
__props__.__dict__["address"] = address
__props__.__dict__["backup"] = backup
__props__.__dict__["chain"] = chain
__props__.__dict__["cookie"] = cookie
__props__.__dict__["display_name"] = display_name
__props__.__dict__["farm_id"] = farm_id
__props__.__dict__["port"] = port
__props__.__dict__["probe"] = probe
__props__.__dict__["proxy_protocol_version"] = proxy_protocol_version
__props__.__dict__["service_name"] = service_name
__props__.__dict__["ssl"] = ssl
__props__.__dict__["status"] = status
__props__.__dict__["weight"] = weight
return IploadbalancingHttpFarmServer(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def address(self) -> pulumi.Output[str]:
return pulumi.get(self, "address")
@property
@pulumi.getter
def backup(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "backup")
@property
@pulumi.getter
def chain(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "chain")
@property
@pulumi.getter
def cookie(self) -> pulumi.Output[str]:
return pulumi.get(self, "cookie")
@property
@pulumi.getter(name="displayName")
def display_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "display_name")
@property
@pulumi.getter(name="farmId")
def farm_id(self) -> pulumi.Output[int]:
return pulumi.get(self, "farm_id")
@property
@pulumi.getter
def port(self) -> pulumi.Output[Optional[int]]:
return pulumi.get(self, "port")
@property
@pulumi.getter
def probe(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "probe")
@property
@pulumi.getter(name="proxyProtocolVersion")
def proxy_protocol_version(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "proxy_protocol_version")
@property
@pulumi.getter(name="serviceName")
def service_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "service_name")
@property
@pulumi.getter
def ssl(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "ssl")
@property
@pulumi.getter
def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status")
@property
@pulumi.getter
def weight(self) -> pulumi.Output[Optional[int]]:
return pulumi.get(self, "weight")
| 38.007533
| 139
| 0.625359
| 2,265
| 20,182
| 5.3117
| 0.064018
| 0.106059
| 0.157925
| 0.089602
| 0.819716
| 0.805835
| 0.772587
| 0.742748
| 0.706508
| 0.660211
| 0
| 0.000067
| 0.255525
| 20,182
| 530
| 140
| 38.079245
| 0.800666
| 0.061193
| 0
| 0.78169
| 1
| 0
| 0.079761
| 0.019087
| 0
| 0
| 0
| 0
| 0
| 1
| 0.164319
| false
| 0.002347
| 0.011737
| 0.089202
| 0.274648
| 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
|
7c336de6b862504ed1ce3504dab40ea05f11e64d
| 28,472
|
py
|
Python
|
sdk/python/pulumi_oci/waas/http_redirect.py
|
EladGabay/pulumi-oci
|
6841e27d4a1a7e15c672306b769912efbfd3ba99
|
[
"ECL-2.0",
"Apache-2.0"
] | 5
|
2021-08-17T11:14:46.000Z
|
2021-12-31T02:07:03.000Z
|
sdk/python/pulumi_oci/waas/http_redirect.py
|
pulumi-oci/pulumi-oci
|
6841e27d4a1a7e15c672306b769912efbfd3ba99
|
[
"ECL-2.0",
"Apache-2.0"
] | 1
|
2021-09-06T11:21:29.000Z
|
2021-09-06T11:21:29.000Z
|
sdk/python/pulumi_oci/waas/http_redirect.py
|
pulumi-oci/pulumi-oci
|
6841e27d4a1a7e15c672306b769912efbfd3ba99
|
[
"ECL-2.0",
"Apache-2.0"
] | 2
|
2021-08-24T23:31:30.000Z
|
2022-01-02T19:26:54.000Z
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *
__all__ = ['HttpRedirectArgs', 'HttpRedirect']
@pulumi.input_type
class HttpRedirectArgs:
def __init__(__self__, *,
compartment_id: pulumi.Input[str],
domain: pulumi.Input[str],
target: pulumi.Input['HttpRedirectTargetArgs'],
defined_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
display_name: Optional[pulumi.Input[str]] = None,
freeform_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
response_code: Optional[pulumi.Input[int]] = None):
"""
The set of arguments for constructing a HttpRedirect resource.
:param pulumi.Input[str] compartment_id: (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
:param pulumi.Input[str] domain: The domain from which traffic will be redirected.
:param pulumi.Input['HttpRedirectTargetArgs'] target: (Updatable) The redirect target object including all the redirect data.
:param pulumi.Input[Mapping[str, Any]] defined_tags: (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
:param pulumi.Input[str] display_name: (Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
:param pulumi.Input[Mapping[str, Any]] freeform_tags: (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
:param pulumi.Input[int] response_code: (Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
"""
pulumi.set(__self__, "compartment_id", compartment_id)
pulumi.set(__self__, "domain", domain)
pulumi.set(__self__, "target", target)
if defined_tags is not None:
pulumi.set(__self__, "defined_tags", defined_tags)
if display_name is not None:
pulumi.set(__self__, "display_name", display_name)
if freeform_tags is not None:
pulumi.set(__self__, "freeform_tags", freeform_tags)
if response_code is not None:
pulumi.set(__self__, "response_code", response_code)
@property
@pulumi.getter(name="compartmentId")
def compartment_id(self) -> pulumi.Input[str]:
"""
(Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
"""
return pulumi.get(self, "compartment_id")
@compartment_id.setter
def compartment_id(self, value: pulumi.Input[str]):
pulumi.set(self, "compartment_id", value)
@property
@pulumi.getter
def domain(self) -> pulumi.Input[str]:
"""
The domain from which traffic will be redirected.
"""
return pulumi.get(self, "domain")
@domain.setter
def domain(self, value: pulumi.Input[str]):
pulumi.set(self, "domain", value)
@property
@pulumi.getter
def target(self) -> pulumi.Input['HttpRedirectTargetArgs']:
"""
(Updatable) The redirect target object including all the redirect data.
"""
return pulumi.get(self, "target")
@target.setter
def target(self, value: pulumi.Input['HttpRedirectTargetArgs']):
pulumi.set(self, "target", value)
@property
@pulumi.getter(name="definedTags")
def defined_tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
"""
return pulumi.get(self, "defined_tags")
@defined_tags.setter
def defined_tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "defined_tags", value)
@property
@pulumi.getter(name="displayName")
def display_name(self) -> Optional[pulumi.Input[str]]:
"""
(Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
"""
return pulumi.get(self, "display_name")
@display_name.setter
def display_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "display_name", value)
@property
@pulumi.getter(name="freeformTags")
def freeform_tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
"""
return pulumi.get(self, "freeform_tags")
@freeform_tags.setter
def freeform_tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "freeform_tags", value)
@property
@pulumi.getter(name="responseCode")
def response_code(self) -> Optional[pulumi.Input[int]]:
"""
(Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
"""
return pulumi.get(self, "response_code")
@response_code.setter
def response_code(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "response_code", value)
@pulumi.input_type
class _HttpRedirectState:
def __init__(__self__, *,
compartment_id: Optional[pulumi.Input[str]] = None,
defined_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
display_name: Optional[pulumi.Input[str]] = None,
domain: Optional[pulumi.Input[str]] = None,
freeform_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
response_code: Optional[pulumi.Input[int]] = None,
state: Optional[pulumi.Input[str]] = None,
target: Optional[pulumi.Input['HttpRedirectTargetArgs']] = None,
time_created: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering HttpRedirect resources.
:param pulumi.Input[str] compartment_id: (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
:param pulumi.Input[Mapping[str, Any]] defined_tags: (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
:param pulumi.Input[str] display_name: (Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
:param pulumi.Input[str] domain: The domain from which traffic will be redirected.
:param pulumi.Input[Mapping[str, Any]] freeform_tags: (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
:param pulumi.Input[int] response_code: (Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
:param pulumi.Input[str] state: The current lifecycle state of the HTTP Redirect.
:param pulumi.Input['HttpRedirectTargetArgs'] target: (Updatable) The redirect target object including all the redirect data.
:param pulumi.Input[str] time_created: The date and time the policy was created, expressed in RFC 3339 timestamp format.
"""
if compartment_id is not None:
pulumi.set(__self__, "compartment_id", compartment_id)
if defined_tags is not None:
pulumi.set(__self__, "defined_tags", defined_tags)
if display_name is not None:
pulumi.set(__self__, "display_name", display_name)
if domain is not None:
pulumi.set(__self__, "domain", domain)
if freeform_tags is not None:
pulumi.set(__self__, "freeform_tags", freeform_tags)
if response_code is not None:
pulumi.set(__self__, "response_code", response_code)
if state is not None:
pulumi.set(__self__, "state", state)
if target is not None:
pulumi.set(__self__, "target", target)
if time_created is not None:
pulumi.set(__self__, "time_created", time_created)
@property
@pulumi.getter(name="compartmentId")
def compartment_id(self) -> Optional[pulumi.Input[str]]:
"""
(Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
"""
return pulumi.get(self, "compartment_id")
@compartment_id.setter
def compartment_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "compartment_id", value)
@property
@pulumi.getter(name="definedTags")
def defined_tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
"""
return pulumi.get(self, "defined_tags")
@defined_tags.setter
def defined_tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "defined_tags", value)
@property
@pulumi.getter(name="displayName")
def display_name(self) -> Optional[pulumi.Input[str]]:
"""
(Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
"""
return pulumi.get(self, "display_name")
@display_name.setter
def display_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "display_name", value)
@property
@pulumi.getter
def domain(self) -> Optional[pulumi.Input[str]]:
"""
The domain from which traffic will be redirected.
"""
return pulumi.get(self, "domain")
@domain.setter
def domain(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "domain", value)
@property
@pulumi.getter(name="freeformTags")
def freeform_tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
"""
return pulumi.get(self, "freeform_tags")
@freeform_tags.setter
def freeform_tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "freeform_tags", value)
@property
@pulumi.getter(name="responseCode")
def response_code(self) -> Optional[pulumi.Input[int]]:
"""
(Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
"""
return pulumi.get(self, "response_code")
@response_code.setter
def response_code(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "response_code", value)
@property
@pulumi.getter
def state(self) -> Optional[pulumi.Input[str]]:
"""
The current lifecycle state of the HTTP Redirect.
"""
return pulumi.get(self, "state")
@state.setter
def state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "state", value)
@property
@pulumi.getter
def target(self) -> Optional[pulumi.Input['HttpRedirectTargetArgs']]:
"""
(Updatable) The redirect target object including all the redirect data.
"""
return pulumi.get(self, "target")
@target.setter
def target(self, value: Optional[pulumi.Input['HttpRedirectTargetArgs']]):
pulumi.set(self, "target", value)
@property
@pulumi.getter(name="timeCreated")
def time_created(self) -> Optional[pulumi.Input[str]]:
"""
The date and time the policy was created, expressed in RFC 3339 timestamp format.
"""
return pulumi.get(self, "time_created")
@time_created.setter
def time_created(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "time_created", value)
class HttpRedirect(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
compartment_id: Optional[pulumi.Input[str]] = None,
defined_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
display_name: Optional[pulumi.Input[str]] = None,
domain: Optional[pulumi.Input[str]] = None,
freeform_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
response_code: Optional[pulumi.Input[int]] = None,
target: Optional[pulumi.Input[pulumi.InputType['HttpRedirectTargetArgs']]] = None,
__props__=None):
"""
This resource provides the Http Redirect resource in Oracle Cloud Infrastructure Web Application Acceleration and Security service.
Creates a new HTTP Redirect on the WAF edge.
## Example Usage
```python
import pulumi
import pulumi_oci as oci
test_http_redirect = oci.waas.HttpRedirect("testHttpRedirect",
compartment_id=var["compartment_id"],
domain=var["http_redirect_domain"],
target=oci.waas.HttpRedirectTargetArgs(
host=var["http_redirect_target_host"],
path=var["http_redirect_target_path"],
protocol=var["http_redirect_target_protocol"],
query=var["http_redirect_target_query"],
port=var["http_redirect_target_port"],
),
defined_tags={
"Operations.CostCenter": "42",
},
display_name=var["http_redirect_display_name"],
freeform_tags={
"Department": "Finance",
},
response_code=var["http_redirect_response_code"])
```
## Import
HttpRedirects can be imported using the `id`, e.g.
```sh
$ pulumi import oci:waas/httpRedirect:HttpRedirect test_http_redirect "id"
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] compartment_id: (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
:param pulumi.Input[Mapping[str, Any]] defined_tags: (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
:param pulumi.Input[str] display_name: (Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
:param pulumi.Input[str] domain: The domain from which traffic will be redirected.
:param pulumi.Input[Mapping[str, Any]] freeform_tags: (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
:param pulumi.Input[int] response_code: (Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
:param pulumi.Input[pulumi.InputType['HttpRedirectTargetArgs']] target: (Updatable) The redirect target object including all the redirect data.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: HttpRedirectArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
This resource provides the Http Redirect resource in Oracle Cloud Infrastructure Web Application Acceleration and Security service.
Creates a new HTTP Redirect on the WAF edge.
## Example Usage
```python
import pulumi
import pulumi_oci as oci
test_http_redirect = oci.waas.HttpRedirect("testHttpRedirect",
compartment_id=var["compartment_id"],
domain=var["http_redirect_domain"],
target=oci.waas.HttpRedirectTargetArgs(
host=var["http_redirect_target_host"],
path=var["http_redirect_target_path"],
protocol=var["http_redirect_target_protocol"],
query=var["http_redirect_target_query"],
port=var["http_redirect_target_port"],
),
defined_tags={
"Operations.CostCenter": "42",
},
display_name=var["http_redirect_display_name"],
freeform_tags={
"Department": "Finance",
},
response_code=var["http_redirect_response_code"])
```
## Import
HttpRedirects can be imported using the `id`, e.g.
```sh
$ pulumi import oci:waas/httpRedirect:HttpRedirect test_http_redirect "id"
```
:param str resource_name: The name of the resource.
:param HttpRedirectArgs 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(HttpRedirectArgs, 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,
compartment_id: Optional[pulumi.Input[str]] = None,
defined_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
display_name: Optional[pulumi.Input[str]] = None,
domain: Optional[pulumi.Input[str]] = None,
freeform_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
response_code: Optional[pulumi.Input[int]] = None,
target: Optional[pulumi.Input[pulumi.InputType['HttpRedirectTargetArgs']]] = 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__ = HttpRedirectArgs.__new__(HttpRedirectArgs)
if compartment_id is None and not opts.urn:
raise TypeError("Missing required property 'compartment_id'")
__props__.__dict__["compartment_id"] = compartment_id
__props__.__dict__["defined_tags"] = defined_tags
__props__.__dict__["display_name"] = display_name
if domain is None and not opts.urn:
raise TypeError("Missing required property 'domain'")
__props__.__dict__["domain"] = domain
__props__.__dict__["freeform_tags"] = freeform_tags
__props__.__dict__["response_code"] = response_code
if target is None and not opts.urn:
raise TypeError("Missing required property 'target'")
__props__.__dict__["target"] = target
__props__.__dict__["state"] = None
__props__.__dict__["time_created"] = None
super(HttpRedirect, __self__).__init__(
'oci:waas/httpRedirect:HttpRedirect',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
compartment_id: Optional[pulumi.Input[str]] = None,
defined_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
display_name: Optional[pulumi.Input[str]] = None,
domain: Optional[pulumi.Input[str]] = None,
freeform_tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
response_code: Optional[pulumi.Input[int]] = None,
state: Optional[pulumi.Input[str]] = None,
target: Optional[pulumi.Input[pulumi.InputType['HttpRedirectTargetArgs']]] = None,
time_created: Optional[pulumi.Input[str]] = None) -> 'HttpRedirect':
"""
Get an existing HttpRedirect 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] compartment_id: (Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
:param pulumi.Input[Mapping[str, Any]] defined_tags: (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
:param pulumi.Input[str] display_name: (Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
:param pulumi.Input[str] domain: The domain from which traffic will be redirected.
:param pulumi.Input[Mapping[str, Any]] freeform_tags: (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
:param pulumi.Input[int] response_code: (Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
:param pulumi.Input[str] state: The current lifecycle state of the HTTP Redirect.
:param pulumi.Input[pulumi.InputType['HttpRedirectTargetArgs']] target: (Updatable) The redirect target object including all the redirect data.
:param pulumi.Input[str] time_created: The date and time the policy was created, expressed in RFC 3339 timestamp format.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _HttpRedirectState.__new__(_HttpRedirectState)
__props__.__dict__["compartment_id"] = compartment_id
__props__.__dict__["defined_tags"] = defined_tags
__props__.__dict__["display_name"] = display_name
__props__.__dict__["domain"] = domain
__props__.__dict__["freeform_tags"] = freeform_tags
__props__.__dict__["response_code"] = response_code
__props__.__dict__["state"] = state
__props__.__dict__["target"] = target
__props__.__dict__["time_created"] = time_created
return HttpRedirect(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="compartmentId")
def compartment_id(self) -> pulumi.Output[str]:
"""
(Updatable) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the HTTP Redirects compartment.
"""
return pulumi.get(self, "compartment_id")
@property
@pulumi.getter(name="definedTags")
def defined_tags(self) -> pulumi.Output[Mapping[str, Any]]:
"""
(Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
"""
return pulumi.get(self, "defined_tags")
@property
@pulumi.getter(name="displayName")
def display_name(self) -> pulumi.Output[str]:
"""
(Updatable) The user-friendly name of the HTTP Redirect. The name can be changed and does not need to be unique.
"""
return pulumi.get(self, "display_name")
@property
@pulumi.getter
def domain(self) -> pulumi.Output[str]:
"""
The domain from which traffic will be redirected.
"""
return pulumi.get(self, "domain")
@property
@pulumi.getter(name="freeformTags")
def freeform_tags(self) -> pulumi.Output[Mapping[str, Any]]:
"""
(Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
"""
return pulumi.get(self, "freeform_tags")
@property
@pulumi.getter(name="responseCode")
def response_code(self) -> pulumi.Output[int]:
"""
(Updatable) The response code returned for the redirect to the client. For more information, see [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6.4).
"""
return pulumi.get(self, "response_code")
@property
@pulumi.getter
def state(self) -> pulumi.Output[str]:
"""
The current lifecycle state of the HTTP Redirect.
"""
return pulumi.get(self, "state")
@property
@pulumi.getter
def target(self) -> pulumi.Output['outputs.HttpRedirectTarget']:
"""
(Updatable) The redirect target object including all the redirect data.
"""
return pulumi.get(self, "target")
@property
@pulumi.getter(name="timeCreated")
def time_created(self) -> pulumi.Output[str]:
"""
The date and time the policy was created, expressed in RFC 3339 timestamp format.
"""
return pulumi.get(self, "time_created")
| 50.571936
| 347
| 0.661035
| 3,405
| 28,472
| 5.352717
| 0.072247
| 0.064578
| 0.064633
| 0.035005
| 0.894107
| 0.877812
| 0.860145
| 0.84171
| 0.837595
| 0.804675
| 0
| 0.00477
| 0.226819
| 28,472
| 562
| 348
| 50.661922
| 0.823158
| 0.4424
| 0
| 0.685619
| 1
| 0
| 0.107714
| 0.017929
| 0
| 0
| 0
| 0
| 0
| 1
| 0.160535
| false
| 0.003344
| 0.023411
| 0
| 0.280936
| 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
|
7c3a08fcd7ac6104569df88c17c894dc6f1ff438
| 5,481
|
py
|
Python
|
helper/paths.py
|
edualc/mt-join-query-optimization-with-drl
|
63619aa70bf4a8ac64cb9c8421530bb48e0b4822
|
[
"Python-2.0",
"OLDAP-2.7"
] | 1
|
2020-04-17T11:50:18.000Z
|
2020-04-17T11:50:18.000Z
|
helper/paths.py
|
edualc/mt-join-query-optimization-with-drl
|
63619aa70bf4a8ac64cb9c8421530bb48e0b4822
|
[
"Python-2.0",
"OLDAP-2.7"
] | null | null | null |
helper/paths.py
|
edualc/mt-join-query-optimization-with-drl
|
63619aa70bf4a8ac64cb9c8421530bb48e0b4822
|
[
"Python-2.0",
"OLDAP-2.7"
] | null | null | null |
import os
import os.path as path
import agents.queries.path_helper as queries_helper
def join(base, *args):
for arg in args:
base = path.join(base, arg)
return base
def get_queries(*args):
return join(queries_helper.get_queries_path(), *args)
# # query_parser_joinonly.py
# # ===================================================================================================================================================
# #
# "~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_label.txt"
# "~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_labled.txt"
# # cm1_postgres_card_env_job.py
# # ===================================================================================================================================================
# #
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_test_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_rejoin_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_3_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_0_train.txt'
# # cm1_postgres_card_env_job_crossval_0.py
# # ===================================================================================================================================================
# #
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_test_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_0_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_train_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_sipmle_rejoin_train.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_0_train_sort_a.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_0_train.txt'
# # cm1_postgres_card_env_job_crossval_1.py
# # ===================================================================================================================================================
# #
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_test_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_1_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_train_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_train.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_0_train_sort_a.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_1_train.txt'
# # cm1_postgres_card_env_job_crossval_2.py
# # ===================================================================================================================================================
# #
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_test_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_2_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_train_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_train.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_0_train_sort_a.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_2_train.txt'
# # cm1_postgres_card_env_job_crossval_3.py
# # ===================================================================================================================================================
# #
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_test_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_3_test.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_train_7400.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/job_queries_simple_rejoin_train.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval/job_queries_simple_crossval_7400_0_train_sort_a.txt'
# '~//PycharmProjects/mt-join-queryoptimization-with-drl/agents/queries/crossval_sens/job_queries_simple_crossval_3_train.txt'
| 72.118421
| 152
| 0.683999
| 609
| 5,481
| 5.819376
| 0.077176
| 0.128386
| 0.201467
| 0.36456
| 0.934537
| 0.934537
| 0.927765
| 0.927765
| 0.906885
| 0.886851
| 0
| 0.015888
| 0.046889
| 5,481
| 75
| 153
| 73.08
| 0.662519
| 0.913519
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.333333
| 0.111111
| 0.777778
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 13
|
7c48da2edb1791b6a3fdffd3bee7b4270da19ba3
| 69,896
|
py
|
Python
|
lrs/tests/test_StatementMore.py
|
dblacksmith/ADL_LRS
|
4732f62a53fecf76844a8b5fb420db0f5aed4647
|
[
"Apache-2.0"
] | null | null | null |
lrs/tests/test_StatementMore.py
|
dblacksmith/ADL_LRS
|
4732f62a53fecf76844a8b5fb420db0f5aed4647
|
[
"Apache-2.0"
] | null | null | null |
lrs/tests/test_StatementMore.py
|
dblacksmith/ADL_LRS
|
4732f62a53fecf76844a8b5fb420db0f5aed4647
|
[
"Apache-2.0"
] | null | null | null |
import os
import json
import base64
import uuid
from datetime import datetime, timedelta
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
from ..models import Statement
from ..utils import retrieve_statement
from adl_lrs.views import register
class StatementMoreTests(TestCase):
@classmethod
def setUpClass(cls):
print "\n%s" % __name__
super(StatementMoreTests, cls).setUpClass()
def setUp(self):
settings.SERVER_STMT_LIMIT = 10
self.username = "auth1"
self.email = "auth1@example.com"
self.password = "test"
self.auth = "Basic %s" % base64.b64encode(
"%s:%s" % (self.username, self.password))
form = {'username': self.username, 'email': self.email,
'password': self.password, 'password2': self.password}
self.client.post(reverse(register), form)
self.guid1 = str(uuid.uuid1())
self.guid2 = str(uuid.uuid1())
self.guid3 = str(uuid.uuid1())
self.guid4 = str(uuid.uuid1())
self.guid5 = str(uuid.uuid1())
self.guid6 = str(uuid.uuid1())
self.guid7 = str(uuid.uuid1())
self.guid8 = str(uuid.uuid1())
self.guid9 = str(uuid.uuid1())
self.guid10 = str(uuid.uuid1())
self.guid11 = str(uuid.uuid1())
self.guid12 = str(uuid.uuid1())
self.guid13 = str(uuid.uuid1())
self.guid14 = str(uuid.uuid1())
self.guid15 = str(uuid.uuid1())
self.guid16 = str(uuid.uuid1())
self.guid17 = str(uuid.uuid1())
self.guid18 = str(uuid.uuid1())
self.guid19 = str(uuid.uuid1())
self.guid20 = str(uuid.uuid1())
self.guid21 = str(uuid.uuid1())
self.guid22 = str(uuid.uuid1())
self.guid23 = str(uuid.uuid1())
self.guid24 = str(uuid.uuid1())
self.guid25 = str(uuid.uuid1())
# Context guids
self.cguid1 = str(uuid.uuid1())
self.cguid2 = str(uuid.uuid1())
self.cguid3 = str(uuid.uuid1())
self.cguid4 = str(uuid.uuid1())
self.cguid5 = str(uuid.uuid1())
self.mytime = str(datetime.utcnow().replace(tzinfo=utc).isoformat())
stmt_list = []
self.existStmt1 = {"id": self.guid1, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"verb": {"id": "verb:attempted",
"display": {"en-US": "attempted", 'en-GB': "altattempted"}}, "object": {'objectType': 'Activity',
'id': 'act:foogie', 'definition': {'name': {'en-US': 'testname2', 'en-GB': 'altname'},
'description': {'en-US': 'testdesc2', 'en-GB': 'altdesc'}, 'type': 'http://adlnet.gov/expapi/activities/cmi.interaction',
'interactionType': 'fill-in', 'correctResponsesPattern': ['answer'], 'extensions': {'ext:key1': 'value1',
'ext:key2': 'value2', 'ext:key3': 'value3'}}}, "result": {'score': {'scaled': .85}, 'completion': True, 'success': True,
'response': 'kicked', 'duration': "P3Y6M4DT12H30M5S", 'extensions': {'ext:key1': 'value1', 'ext:key2': 'value2'}},
'context': {'registration': self.cguid1, 'contextActivities': {'other': {'id': 'act:NewActivityID2'}},
'revision': 'food', 'platform': 'bard', 'language': 'en-US', 'extensions': {'ext:ckey1': 'cval1',
'ext:ckey2': 'cval2'}}, 'authority': {'objectType': 'Agent', 'name': 'auth1', 'mbox': 'mailto:auth1@example.com'}}
stmt_list.append(self.existStmt1)
self.existStmt2 = {"id": self.guid2, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"verb": {"id": "verb:verb/created",
"display": {"en-US": "created", 'en-GB': "altcreated"}}, "object": {'objectType': 'Activity',
'id': 'act:foogie', 'definition': {'name': {'en-US': 'testname3'}, 'description': {'en-US': 'testdesc3'},
'type': 'http://adlnet.gov/expapi/activities/cmi.interaction', 'interactionType': 'fill-in', 'correctResponsesPattern': ['answers'],
'extensions': {'ext:key11': 'value11', 'ext:key22': 'value22', 'ext:key33': 'value33'}}},
"result": {'score': {'scaled': .75}, 'completion': True, 'success': True, 'response': 'shouted',
'duration': "P3Y6M4DT12H30M5S", 'extensions': {'ext:dkey1': 'dvalue1', 'ext:dkey2': 'dvalue2'}},
'context': {'registration': self.cguid2, 'contextActivities': {'other': {'id': 'act:NewActivityID24'}},
'revision': 'food', 'platform': 'bard', 'language': 'en-US', 'extensions': {'ext:ckey11': 'cval11',
'ext:ckey22': 'cval22'}}, 'authority': {'objectType': 'Agent', 'name': 'auth1', 'mbox': 'mailto:auth1@example.com'}}
stmt_list.append(self.existStmt2)
self.existStmt3 = {"id": self.guid3, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"verb": {"id": "verb:created",
"display": {"en-US": "created", 'en-GB': "altcreated"}}, "object": {'objectType': 'Activity',
'id': 'act:foogals', 'definition': {'name': {'en-US': 'testname3'}, 'description': {'en-US': 'testdesc3'},
'type': 'http://adlnet.gov/expapi/activities/cmi.interaction',
'interactionType': 'fill-in', 'correctResponsesPattern': ['answers'],
'extensions': {'ext:key111': 'value111', 'ext:key222': 'value222', 'ext:key333': 'value333'}}},
"result": {'score': {'scaled': .79}, 'completion': True, 'success': True, 'response': 'shouted',
'duration': "P3Y6M4DT12H30M5S", 'extensions': {'ext:dkey1': 'dvalue1', 'ext:dkey2': 'dvalue2'}},
'context': {'registration': self.cguid3, 'contextActivities': {'other': {'id': 'act:NewActivityID23'}},
'revision': 'food', 'platform': 'bard', 'language': 'en-US', 'instructor': {'name': 'bill',
'mbox': 'mailto:bill@bill.com'}, 'extensions': {'ext:ckey111': 'cval111',
'ext:ckey222': 'cval222'}}, 'authority': {'objectType': 'Agent', 'name': 'auth1', 'mbox': 'mailto:auth1@example.com'}}
stmt_list.append(self.existStmt3)
self.existStmt4 = {"id": self.guid4, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"verb": {"id": "verb:verb/created",
"display": {"en-US": "created", 'en-GB': "altcreated"}}, "object": {'objectType': 'Activity', 'id': 'act:foogal',
'definition': {'name': {'en-US': 'testname3'}, 'description': {'en-US': 'testdesc3'}, 'type': 'http://adlnet.gov/expapi/activities/cmi.interaction',
'interactionType': 'fill-in', 'correctResponsesPattern': ['answers'],
'extensions': {'ext:key111': 'value111', 'ext:key222': 'value222', 'ext:key333': 'value333'}}},
"result": {'score': {'scaled': .79}, 'completion': True, 'success': True, 'response': 'shouted',
'duration': "P3Y6M4DT12H30M5S", 'extensions': {'ext:dkey1': 'dvalue1', 'ext:dkey2': 'dvalue2'}},
'context': {'registration': self.cguid4, 'contextActivities': {'other': {'id': 'act:NewActivityID22'}},
'revision': 'food', 'platform': 'bard', 'language': 'en-US', 'instructor': {'name': 'bill',
'mbox': 'mailto:bill@bill.com'}, 'extensions': {'ext:ckey111': 'cval111',
'ext:ckey222': 'cval222'}}, 'authority': {'objectType': 'Agent', 'name': 'auth1', 'mbox': 'mailto:auth1@example.com'}}
stmt_list.append(self.existStmt4)
self.existStmt5 = {"id": self.guid5, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon1',
'mbox': 'mailto:jon1@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt5)
self.existStmt6 = {"id": self.guid6, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon2',
'mbox': 'mailto:jon2@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt6)
self.existStmt7 = {"id": self.guid7, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon3',
'mbox': 'mailto:jon3@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt7)
self.existStmt8 = {"id": self.guid8, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon4',
'mbox': 'mailto:jon4@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt8)
self.existStmt9 = {"id": self.guid9, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon5',
'mbox': 'mailto:jon5@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt9)
self.existStmt10 = {"id": self.guid10, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon33',
'mbox': 'mailto:jon33@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt10)
self.existStmt11 = {"id": self.guid11, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon6',
'mbox': 'mailto:jon6@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt11)
self.existStmt12 = {"id": self.guid12, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon7',
'mbox': 'mailto:jon7@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt12)
self.existStmt13 = {"id": self.guid13, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon8',
'mbox': 'mailto:jon8@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt13)
self.existStmt14 = {"id": self.guid14, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon9',
'mbox': 'mailto:jon9@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt14)
self.existStmt15 = {"id": self.guid15, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon10',
'mbox': 'mailto:jon10@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt15)
self.existStmt16 = {"id": self.guid16, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon11',
'mbox': 'mailto:jon11@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt16)
self.existStmt17 = {"id": self.guid17, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon12',
'mbox': 'mailto:jon12@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt17)
self.existStmt18 = {"id": self.guid18, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon13',
'mbox': 'mailto:jon13@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt18)
self.existStmt19 = {"id": self.guid19, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon14',
'mbox': 'mailto:jon14@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt19)
self.existStmt20 = {"id": self.guid20, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon15',
'mbox': 'mailto:jon15@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt20)
self.existStmt21 = {"id": self.guid21, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon16',
'mbox': 'mailto:jon16@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt21)
self.existStmt22 = {"id": self.guid22, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon17',
'mbox': 'mailto:jon17@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt22)
self.existStmt23 = {"id": self.guid23, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon18',
'mbox': 'mailto:jon18@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt23)
self.existStmt24 = {"id": self.guid24, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon19',
'mbox': 'mailto:jon19@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt24)
self.existStmt25 = {"id": self.guid25, "actor": {"objectType": "Agent", "mbox": "mailto:s@s.com"},
"object": {'objectType': 'Agent', 'name': 'jon20',
'mbox': 'mailto:jon20@jon.com'}, "verb": {"id": "verb:verb/passed",
"display": {"en-US": "passed", 'en-GB': "altpassed"}}}
stmt_list.append(self.existStmt25)
# Post statements
post_statements = self.client.post(reverse('lrs:statements'), json.dumps(stmt_list),
content_type="application/json", HTTP_AUTHORIZATION=self.auth, X_Experience_API_Version=settings.XAPI_VERSION)
self.assertEqual(post_statements.status_code, 200)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=1)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid1).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=2)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid2).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=3)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid3).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=4)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid4).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=5)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid5).update(stored=time)
self.secondTime = str(
(datetime.utcnow() + timedelta(seconds=6)).replace(tzinfo=utc).isoformat())
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=7)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid6).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=8)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid7).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=9)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid8).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=10)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid9).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=11)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid10).update(stored=time)
self.thirdTime = str(
(datetime.utcnow() + timedelta(seconds=12)).replace(tzinfo=utc).isoformat())
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=13)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid11).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=14)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid12).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=15)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid13).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=16)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid14).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=17)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid15).update(stored=time)
self.fourthTime = str(
(datetime.utcnow() + timedelta(seconds=18)).replace(tzinfo=utc).isoformat())
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=19)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid16).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=20)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid17).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=21)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid18).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=22)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid19).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=23)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid20).update(stored=time)
self.fifthTime = str(
(datetime.utcnow() + timedelta(seconds=24)).replace(tzinfo=utc).isoformat())
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=25)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid21).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=26)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid22).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=27)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid23).update(stored=time)
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=28)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid24).update(stored=time)
self.sixthTime = str(
(datetime.utcnow() + timedelta(seconds=29)).replace(tzinfo=utc).isoformat())
time = retrieve_statement.convert_to_datetime_object(
str((datetime.utcnow() + timedelta(seconds=30)).replace(tzinfo=utc).isoformat()))
Statement.objects.filter(statement_id=self.guid25).update(stored=time)
def tearDown(self):
settings.SERVER_STMT_LIMIT = 100
attach_folder_path = os.path.join(
settings.MEDIA_ROOT, "attachment_payloads")
for the_file in os.listdir(attach_folder_path):
file_path = os.path.join(attach_folder_path, the_file)
try:
os.unlink(file_path)
except Exception, e:
raise e
def test_unknown_more_id_url(self):
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 404)
def test_not_full_page_stmts(self):
sincePostResponse = self.client.post(reverse('lrs:statements'), {"until": self.secondTime},
content_type="application/x-www-form-urlencoded", X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sincePostResponse.status_code, 200)
rsp = sincePostResponse.content
self.assertIn(self.guid5, rsp)
self.assertIn(self.guid4, rsp)
self.assertIn(self.guid3, rsp)
self.assertIn(self.guid2, rsp)
self.assertIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
self.assertNotIn(self.guid24, rsp)
self.assertNotIn(self.guid23, rsp)
self.assertNotIn(self.guid22, rsp)
self.assertNotIn(self.guid21, rsp)
self.assertNotIn(self.guid20, rsp)
self.assertNotIn(self.guid19, rsp)
self.assertNotIn(self.guid18, rsp)
self.assertNotIn(self.guid17, rsp)
self.assertNotIn(self.guid16, rsp)
self.assertNotIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid6, rsp)
def test_single_full_page_stmts(self):
sincePostResponse = self.client.post(reverse('lrs:statements'),
{"until": self.thirdTime},
content_type="application/x-www-form-urlencoded", X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sincePostResponse.status_code, 200)
rsp = sincePostResponse.content
self.assertIn(self.guid10, rsp)
self.assertIn(self.guid9, rsp)
self.assertIn(self.guid8, rsp)
self.assertIn(self.guid7, rsp)
self.assertIn(self.guid6, rsp)
self.assertIn(self.guid5, rsp)
self.assertIn(self.guid4, rsp)
self.assertIn(self.guid3, rsp)
self.assertIn(self.guid2, rsp)
self.assertIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
self.assertNotIn(self.guid24, rsp)
self.assertNotIn(self.guid23, rsp)
self.assertNotIn(self.guid22, rsp)
self.assertNotIn(self.guid21, rsp)
self.assertNotIn(self.guid20, rsp)
self.assertNotIn(self.guid19, rsp)
self.assertNotIn(self.guid18, rsp)
self.assertNotIn(self.guid17, rsp)
self.assertNotIn(self.guid16, rsp)
self.assertNotIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
def test_single_full_second_not_full_more_stmts_url(self):
sincePostResponse = self.client.post(reverse('lrs:statements'), {"until": self.fourthTime},
content_type="application/x-www-form-urlencoded", X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sincePostResponse.status_code, 200)
rsp = sincePostResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertIn(self.guid15, rsp)
self.assertIn(self.guid14, rsp)
self.assertIn(self.guid13, rsp)
self.assertIn(self.guid12, rsp)
self.assertIn(self.guid11, rsp)
self.assertIn(self.guid10, rsp)
self.assertIn(self.guid9, rsp)
self.assertIn(self.guid8, rsp)
self.assertIn(self.guid7, rsp)
self.assertIn(self.guid6, rsp)
self.assertNotIn(self.guid25, rsp)
self.assertNotIn(self.guid24, rsp)
self.assertNotIn(self.guid23, rsp)
self.assertNotIn(self.guid22, rsp)
self.assertNotIn(self.guid21, rsp)
self.assertNotIn(self.guid20, rsp)
self.assertNotIn(self.guid19, rsp)
self.assertNotIn(self.guid18, rsp)
self.assertNotIn(self.guid17, rsp)
self.assertNotIn(self.guid16, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
# Simulate user clicking returned 'more' URL
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
self.assertIn(self.guid5, more_rsp)
self.assertIn(self.guid4, more_rsp)
self.assertIn(self.guid3, more_rsp)
self.assertIn(self.guid2, more_rsp)
self.assertIn(self.guid1, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid14, more_rsp)
self.assertNotIn(self.guid13, more_rsp)
self.assertNotIn(self.guid12, more_rsp)
self.assertNotIn(self.guid11, more_rsp)
self.assertNotIn(self.guid10, more_rsp)
self.assertNotIn(self.guid9, more_rsp)
self.assertNotIn(self.guid8, more_rsp)
self.assertNotIn(self.guid7, more_rsp)
self.assertNotIn(self.guid6, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
def test_two_pages_full_more_stmts_url(self):
sincePostResponse = self.client.post(reverse('lrs:statements'), {"until": self.fifthTime},
content_type="application/x-www-form-urlencoded", X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sincePostResponse.status_code, 200)
rsp = sincePostResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertIn(self.guid16, rsp)
self.assertIn(self.guid15, rsp)
self.assertIn(self.guid14, rsp)
self.assertIn(self.guid13, rsp)
self.assertIn(self.guid12, rsp)
self.assertIn(self.guid11, rsp)
self.assertNotIn(self.guid25, rsp)
self.assertNotIn(self.guid24, rsp)
self.assertNotIn(self.guid23, rsp)
self.assertNotIn(self.guid22, rsp)
self.assertNotIn(self.guid21, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
# Simulate user clicking returned 'more' URL
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertIn(self.guid8, more_rsp)
self.assertIn(self.guid7, more_rsp)
self.assertIn(self.guid6, more_rsp)
self.assertIn(self.guid5, more_rsp)
self.assertIn(self.guid4, more_rsp)
self.assertIn(self.guid3, more_rsp)
self.assertIn(self.guid2, more_rsp)
self.assertIn(self.guid1, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid14, more_rsp)
self.assertNotIn(self.guid13, more_rsp)
self.assertNotIn(self.guid12, more_rsp)
self.assertNotIn(self.guid11, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
def test_two_pages_full_third_not_full_more_stmts_url(self):
sinceGetResponse = self.client.get(reverse('lrs:statements'), {"until": self.sixthTime, "limit": 10},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sinceGetResponse.status_code, 200)
rsp = sinceGetResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertEqual(len(resp_json['statements']), 10)
self.assertIn(self.guid24, rsp)
self.assertIn(self.guid23, rsp)
self.assertIn(self.guid22, rsp)
self.assertIn(self.guid21, rsp)
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertIn(self.guid16, rsp)
self.assertIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
more_json = json.loads(more_rsp)
more_resp_url = more_json['more']
more_resp_id = more_resp_url[-32:]
self.assertIn(self.guid14, more_rsp)
self.assertIn(self.guid13, more_rsp)
self.assertIn(self.guid12, more_rsp)
self.assertIn(self.guid11, more_rsp)
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertIn(self.guid8, more_rsp)
self.assertIn(self.guid7, more_rsp)
self.assertIn(self.guid6, more_rsp)
self.assertIn(self.guid5, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid4, more_rsp)
self.assertNotIn(self.guid3, more_rsp)
self.assertNotIn(self.guid2, more_rsp)
self.assertNotIn(self.guid1, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
anotherURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(anotherURLGet.status_code, 200)
another_rsp = anotherURLGet.content
self.assertIn(self.guid4, another_rsp)
self.assertIn(self.guid3, another_rsp)
self.assertIn(self.guid2, another_rsp)
self.assertIn(self.guid1, another_rsp)
self.assertNotIn(self.guid24, another_rsp)
self.assertNotIn(self.guid23, another_rsp)
self.assertNotIn(self.guid22, another_rsp)
self.assertNotIn(self.guid21, another_rsp)
self.assertNotIn(self.guid20, another_rsp)
self.assertNotIn(self.guid19, another_rsp)
self.assertNotIn(self.guid18, another_rsp)
self.assertNotIn(self.guid17, another_rsp)
self.assertNotIn(self.guid16, another_rsp)
self.assertNotIn(self.guid15, another_rsp)
self.assertNotIn(self.guid14, another_rsp)
self.assertNotIn(self.guid13, another_rsp)
self.assertNotIn(self.guid12, another_rsp)
self.assertNotIn(self.guid11, another_rsp)
self.assertNotIn(self.guid10, another_rsp)
self.assertNotIn(self.guid9, another_rsp)
self.assertNotIn(self.guid8, another_rsp)
self.assertNotIn(self.guid7, another_rsp)
self.assertNotIn(self.guid6, another_rsp)
self.assertNotIn(self.guid5, another_rsp)
self.assertNotIn(self.guid25, another_rsp)
def test_limit_less_than_server_limit(self):
sinceGetResponse = self.client.get(reverse('lrs:statements'), {"until": self.sixthTime, "limit": 8},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sinceGetResponse.status_code, 200)
rsp = sinceGetResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertEqual(len(resp_json['statements']), 8)
self.assertIn(self.guid24, rsp)
self.assertIn(self.guid23, rsp)
self.assertIn(self.guid22, rsp)
self.assertIn(self.guid21, rsp)
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertNotIn(self.guid16, rsp)
self.assertNotIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
more_json = json.loads(more_rsp)
more_resp_url = more_json['more']
more_resp_id = more_resp_url[-32:]
self.assertIn(self.guid16, more_rsp)
self.assertIn(self.guid15, more_rsp)
self.assertIn(self.guid14, more_rsp)
self.assertIn(self.guid13, more_rsp)
self.assertIn(self.guid12, more_rsp)
self.assertIn(self.guid11, more_rsp)
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid8, more_rsp)
self.assertNotIn(self.guid7, more_rsp)
self.assertNotIn(self.guid6, more_rsp)
self.assertNotIn(self.guid5, more_rsp)
self.assertNotIn(self.guid4, more_rsp)
self.assertNotIn(self.guid3, more_rsp)
self.assertNotIn(self.guid2, more_rsp)
self.assertNotIn(self.guid1, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
anotherURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(anotherURLGet.status_code, 200)
another_rsp = anotherURLGet.content
self.assertIn(self.guid8, another_rsp)
self.assertIn(self.guid7, another_rsp)
self.assertIn(self.guid6, another_rsp)
self.assertIn(self.guid5, another_rsp)
self.assertIn(self.guid4, another_rsp)
self.assertIn(self.guid3, another_rsp)
self.assertIn(self.guid2, another_rsp)
self.assertIn(self.guid1, another_rsp)
self.assertNotIn(self.guid24, another_rsp)
self.assertNotIn(self.guid23, another_rsp)
self.assertNotIn(self.guid22, another_rsp)
self.assertNotIn(self.guid21, another_rsp)
self.assertNotIn(self.guid20, another_rsp)
self.assertNotIn(self.guid19, another_rsp)
self.assertNotIn(self.guid18, another_rsp)
self.assertNotIn(self.guid17, another_rsp)
self.assertNotIn(self.guid16, another_rsp)
self.assertNotIn(self.guid15, another_rsp)
self.assertNotIn(self.guid14, another_rsp)
self.assertNotIn(self.guid13, another_rsp)
self.assertNotIn(self.guid12, another_rsp)
self.assertNotIn(self.guid11, another_rsp)
self.assertNotIn(self.guid10, another_rsp)
self.assertNotIn(self.guid9, another_rsp)
self.assertNotIn(self.guid25, another_rsp)
def test_limit_same_as_server_limit(self):
sinceGetResponse = self.client.get(reverse('lrs:statements'), {"until": self.sixthTime, "limit": 10},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sinceGetResponse.status_code, 200)
rsp = sinceGetResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertEqual(len(resp_json['statements']), 10)
self.assertIn(self.guid24, rsp)
self.assertIn(self.guid23, rsp)
self.assertIn(self.guid22, rsp)
self.assertIn(self.guid21, rsp)
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertIn(self.guid16, rsp)
self.assertIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
more_json = json.loads(more_rsp)
more_resp_url = more_json['more']
more_resp_id = more_resp_url[-32:]
self.assertIn(self.guid14, more_rsp)
self.assertIn(self.guid13, more_rsp)
self.assertIn(self.guid12, more_rsp)
self.assertIn(self.guid11, more_rsp)
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertIn(self.guid8, more_rsp)
self.assertIn(self.guid7, more_rsp)
self.assertIn(self.guid6, more_rsp)
self.assertIn(self.guid5, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid4, more_rsp)
self.assertNotIn(self.guid3, more_rsp)
self.assertNotIn(self.guid2, more_rsp)
self.assertNotIn(self.guid1, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
anotherURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(anotherURLGet.status_code, 200)
another_rsp = anotherURLGet.content
self.assertIn(self.guid4, another_rsp)
self.assertIn(self.guid3, another_rsp)
self.assertIn(self.guid2, another_rsp)
self.assertIn(self.guid1, another_rsp)
self.assertNotIn(self.guid24, another_rsp)
self.assertNotIn(self.guid23, another_rsp)
self.assertNotIn(self.guid22, another_rsp)
self.assertNotIn(self.guid21, another_rsp)
self.assertNotIn(self.guid20, another_rsp)
self.assertNotIn(self.guid19, another_rsp)
self.assertNotIn(self.guid18, another_rsp)
self.assertNotIn(self.guid17, another_rsp)
self.assertNotIn(self.guid16, another_rsp)
self.assertNotIn(self.guid15, another_rsp)
self.assertNotIn(self.guid14, another_rsp)
self.assertNotIn(self.guid13, another_rsp)
self.assertNotIn(self.guid12, another_rsp)
self.assertNotIn(self.guid11, another_rsp)
self.assertNotIn(self.guid10, another_rsp)
self.assertNotIn(self.guid9, another_rsp)
self.assertNotIn(self.guid8, another_rsp)
self.assertNotIn(self.guid7, another_rsp)
self.assertNotIn(self.guid6, another_rsp)
self.assertNotIn(self.guid5, another_rsp)
self.assertNotIn(self.guid25, another_rsp)
def test_limit_more_than_server_limit(self):
sinceGetResponse = self.client.get(reverse('lrs:statements'), {"until": self.sixthTime, "limit": 12},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sinceGetResponse.status_code, 200)
rsp = sinceGetResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertEqual(len(resp_json['statements']), 10)
self.assertIn(self.guid24, rsp)
self.assertIn(self.guid23, rsp)
self.assertIn(self.guid22, rsp)
self.assertIn(self.guid21, rsp)
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertIn(self.guid16, rsp)
self.assertIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(moreURLGet.status_code, 200)
more_rsp = moreURLGet.content
more_json = json.loads(more_rsp)
more_resp_url = more_json['more']
more_resp_id = more_resp_url[-32:]
self.assertIn(self.guid14, more_rsp)
self.assertIn(self.guid13, more_rsp)
self.assertIn(self.guid12, more_rsp)
self.assertIn(self.guid11, more_rsp)
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertIn(self.guid8, more_rsp)
self.assertIn(self.guid7, more_rsp)
self.assertIn(self.guid6, more_rsp)
self.assertIn(self.guid5, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid4, more_rsp)
self.assertNotIn(self.guid3, more_rsp)
self.assertNotIn(self.guid2, more_rsp)
self.assertNotIn(self.guid1, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
anotherURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(anotherURLGet.status_code, 200)
another_rsp = anotherURLGet.content
self.assertIn(self.guid4, another_rsp)
self.assertIn(self.guid3, another_rsp)
self.assertIn(self.guid2, another_rsp)
self.assertIn(self.guid1, another_rsp)
self.assertNotIn(self.guid24, another_rsp)
self.assertNotIn(self.guid23, another_rsp)
self.assertNotIn(self.guid22, another_rsp)
self.assertNotIn(self.guid21, another_rsp)
self.assertNotIn(self.guid20, another_rsp)
self.assertNotIn(self.guid19, another_rsp)
self.assertNotIn(self.guid18, another_rsp)
self.assertNotIn(self.guid17, another_rsp)
self.assertNotIn(self.guid16, another_rsp)
self.assertNotIn(self.guid15, another_rsp)
self.assertNotIn(self.guid14, another_rsp)
self.assertNotIn(self.guid13, another_rsp)
self.assertNotIn(self.guid12, another_rsp)
self.assertNotIn(self.guid11, another_rsp)
self.assertNotIn(self.guid10, another_rsp)
self.assertNotIn(self.guid9, another_rsp)
self.assertNotIn(self.guid8, another_rsp)
self.assertNotIn(self.guid7, another_rsp)
self.assertNotIn(self.guid6, another_rsp)
self.assertNotIn(self.guid5, another_rsp)
self.assertNotIn(self.guid25, another_rsp)
def test_two_pages_full_third_not_full_more_stmts_multiple_hits(self):
# Make initial complex get so 'more' will be required
sinceGetResponse = self.client.get(reverse('lrs:statements'), {"until": self.sixthTime},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(sinceGetResponse.status_code, 200)
rsp = sinceGetResponse.content
resp_json = json.loads(rsp)
resp_url = resp_json['more']
resp_id = resp_url[-32:]
self.assertIn(self.guid24, rsp)
self.assertIn(self.guid23, rsp)
self.assertIn(self.guid22, rsp)
self.assertIn(self.guid21, rsp)
self.assertIn(self.guid20, rsp)
self.assertIn(self.guid19, rsp)
self.assertIn(self.guid18, rsp)
self.assertIn(self.guid17, rsp)
self.assertIn(self.guid16, rsp)
self.assertIn(self.guid15, rsp)
self.assertNotIn(self.guid14, rsp)
self.assertNotIn(self.guid13, rsp)
self.assertNotIn(self.guid12, rsp)
self.assertNotIn(self.guid11, rsp)
self.assertNotIn(self.guid10, rsp)
self.assertNotIn(self.guid9, rsp)
self.assertNotIn(self.guid8, rsp)
self.assertNotIn(self.guid7, rsp)
self.assertNotIn(self.guid6, rsp)
self.assertNotIn(self.guid5, rsp)
self.assertNotIn(self.guid4, rsp)
self.assertNotIn(self.guid3, rsp)
self.assertNotIn(self.guid2, rsp)
self.assertNotIn(self.guid1, rsp)
self.assertNotIn(self.guid25, rsp)
# Simulate user clicking returned 'more' URL
moreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
more_rsp = moreURLGet.content
more_json = json.loads(more_rsp)
more_resp_url = more_json['more']
more_resp_id = more_resp_url[-32:]
self.assertEqual(moreURLGet.status_code, 200)
self.assertIn(self.guid14, more_rsp)
self.assertIn(self.guid13, more_rsp)
self.assertIn(self.guid12, more_rsp)
self.assertIn(self.guid11, more_rsp)
self.assertIn(self.guid10, more_rsp)
self.assertIn(self.guid9, more_rsp)
self.assertIn(self.guid8, more_rsp)
self.assertIn(self.guid7, more_rsp)
self.assertIn(self.guid6, more_rsp)
self.assertIn(self.guid5, more_rsp)
self.assertNotIn(self.guid24, more_rsp)
self.assertNotIn(self.guid23, more_rsp)
self.assertNotIn(self.guid22, more_rsp)
self.assertNotIn(self.guid21, more_rsp)
self.assertNotIn(self.guid20, more_rsp)
self.assertNotIn(self.guid19, more_rsp)
self.assertNotIn(self.guid18, more_rsp)
self.assertNotIn(self.guid17, more_rsp)
self.assertNotIn(self.guid16, more_rsp)
self.assertNotIn(self.guid15, more_rsp)
self.assertNotIn(self.guid4, more_rsp)
self.assertNotIn(self.guid3, more_rsp)
self.assertNotIn(self.guid2, more_rsp)
self.assertNotIn(self.guid1, more_rsp)
self.assertNotIn(self.guid25, more_rsp)
more2URLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(more2URLGet.status_code, 200)
more2_rsp = more2URLGet.content
self.assertIn(self.guid4, more2_rsp)
self.assertIn(self.guid3, more2_rsp)
self.assertIn(self.guid2, more2_rsp)
self.assertIn(self.guid1, more2_rsp)
self.assertNotIn(self.guid25, more2_rsp)
self.assertNotIn(self.guid24, more2_rsp)
self.assertNotIn(self.guid23, more2_rsp)
self.assertNotIn(self.guid22, more2_rsp)
self.assertNotIn(self.guid21, more2_rsp)
self.assertNotIn(self.guid20, more2_rsp)
self.assertNotIn(self.guid19, more2_rsp)
self.assertNotIn(self.guid18, more2_rsp)
self.assertNotIn(self.guid17, more2_rsp)
self.assertNotIn(self.guid16, more2_rsp)
self.assertNotIn(self.guid15, more2_rsp)
self.assertNotIn(self.guid14, more2_rsp)
self.assertNotIn(self.guid13, more2_rsp)
self.assertNotIn(self.guid12, more2_rsp)
self.assertNotIn(self.guid11, more2_rsp)
self.assertNotIn(self.guid10, more2_rsp)
self.assertNotIn(self.guid9, more2_rsp)
self.assertNotIn(self.guid8, more2_rsp)
self.assertNotIn(self.guid7, more2_rsp)
self.assertNotIn(self.guid6, more2_rsp)
self.assertNotIn(self.guid5, more2_rsp)
# Simulate user clicking returned 'more' URL
anotherMoreURLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
another_more_rsp = anotherMoreURLGet.content
another_more_json = json.loads(another_more_rsp)
another_more_resp_url = another_more_json['more']
another_more_resp_id = another_more_resp_url[-32:]
self.assertEqual(anotherMoreURLGet.status_code, 200)
self.assertIn(self.guid14, another_more_rsp)
self.assertIn(self.guid13, another_more_rsp)
self.assertIn(self.guid12, another_more_rsp)
self.assertIn(self.guid11, another_more_rsp)
self.assertIn(self.guid10, another_more_rsp)
self.assertIn(self.guid9, another_more_rsp)
self.assertIn(self.guid8, another_more_rsp)
self.assertIn(self.guid7, another_more_rsp)
self.assertIn(self.guid6, another_more_rsp)
self.assertIn(self.guid5, another_more_rsp)
self.assertNotIn(self.guid24, another_more_rsp)
self.assertNotIn(self.guid23, another_more_rsp)
self.assertNotIn(self.guid22, another_more_rsp)
self.assertNotIn(self.guid21, another_more_rsp)
self.assertNotIn(self.guid20, another_more_rsp)
self.assertNotIn(self.guid19, another_more_rsp)
self.assertNotIn(self.guid18, another_more_rsp)
self.assertNotIn(self.guid17, another_more_rsp)
self.assertNotIn(self.guid16, another_more_rsp)
self.assertNotIn(self.guid15, another_more_rsp)
self.assertNotIn(self.guid4, another_more_rsp)
self.assertNotIn(self.guid3, another_more_rsp)
self.assertNotIn(self.guid2, another_more_rsp)
self.assertNotIn(self.guid1, another_more_rsp)
self.assertNotIn(self.guid25, another_more_rsp)
# Simulate user clicking returned 'more' URL
anotherMore2URLGet = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': another_more_resp_id}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(anotherMore2URLGet.status_code, 200)
another_more2_rsp = anotherMore2URLGet.content
self.assertIn(self.guid4, another_more2_rsp)
self.assertIn(self.guid3, another_more2_rsp)
self.assertIn(self.guid2, another_more2_rsp)
self.assertIn(self.guid1, another_more2_rsp)
self.assertNotIn(self.guid25, another_more2_rsp)
self.assertNotIn(self.guid24, another_more2_rsp)
self.assertNotIn(self.guid23, another_more2_rsp)
self.assertNotIn(self.guid22, another_more2_rsp)
self.assertNotIn(self.guid21, another_more2_rsp)
self.assertNotIn(self.guid20, another_more2_rsp)
self.assertNotIn(self.guid19, another_more2_rsp)
self.assertNotIn(self.guid18, another_more2_rsp)
self.assertNotIn(self.guid17, another_more2_rsp)
self.assertNotIn(self.guid16, another_more2_rsp)
self.assertNotIn(self.guid15, another_more2_rsp)
self.assertNotIn(self.guid14, another_more2_rsp)
self.assertNotIn(self.guid13, another_more2_rsp)
self.assertNotIn(self.guid12, another_more2_rsp)
self.assertNotIn(self.guid11, another_more2_rsp)
self.assertNotIn(self.guid10, another_more2_rsp)
self.assertNotIn(self.guid9, another_more2_rsp)
self.assertNotIn(self.guid8, another_more2_rsp)
self.assertNotIn(self.guid7, another_more2_rsp)
self.assertNotIn(self.guid6, another_more2_rsp)
self.assertNotIn(self.guid5, another_more2_rsp)
def test_get_order(self):
r = self.client.get(reverse('lrs:statements'), {"limit": 10},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
more = sresults['more'][-32:]
stmts = sresults['statements']
self.assertEqual(len(stmts), 10)
self.assertEqual(stmts[0]['id'], self.guid25)
self.assertEqual(stmts[1]['id'], self.guid24)
self.assertEqual(stmts[2]['id'], self.guid23)
self.assertEqual(stmts[3]['id'], self.guid22)
self.assertEqual(stmts[4]['id'], self.guid21)
self.assertEqual(stmts[5]['id'], self.guid20)
self.assertEqual(stmts[6]['id'], self.guid19)
self.assertEqual(stmts[7]['id'], self.guid18)
self.assertEqual(stmts[8]['id'], self.guid17)
self.assertEqual(stmts[9]['id'], self.guid16)
r = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
more = sresults['more'][-32:]
stmts = sresults['statements']
self.assertEqual(len(stmts), 10)
self.assertEqual(stmts[0]['id'], self.guid15)
self.assertEqual(stmts[1]['id'], self.guid14)
self.assertEqual(stmts[2]['id'], self.guid13)
self.assertEqual(stmts[3]['id'], self.guid12)
self.assertEqual(stmts[4]['id'], self.guid11)
self.assertEqual(stmts[5]['id'], self.guid10)
self.assertEqual(stmts[6]['id'], self.guid9)
self.assertEqual(stmts[7]['id'], self.guid8)
self.assertEqual(stmts[8]['id'], self.guid7)
self.assertEqual(stmts[9]['id'], self.guid6)
r = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
stmts = sresults['statements']
self.assertEqual(len(stmts), 5)
self.assertEqual(stmts[0]['id'], self.guid5)
self.assertEqual(stmts[1]['id'], self.guid4)
self.assertEqual(stmts[2]['id'], self.guid3)
self.assertEqual(stmts[3]['id'], self.guid2)
self.assertEqual(stmts[4]['id'], self.guid1)
def test_get_rev_order(self):
r = self.client.get(reverse('lrs:statements'), {"limit": 10, "ascending": True},
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
more = sresults['more'][-32:]
stmts = sresults['statements']
self.assertEqual(len(stmts), 10)
self.assertEqual(stmts[0]['id'], self.guid1)
self.assertEqual(stmts[1]['id'], self.guid2)
self.assertEqual(stmts[2]['id'], self.guid3)
self.assertEqual(stmts[3]['id'], self.guid4)
self.assertEqual(stmts[4]['id'], self.guid5)
self.assertEqual(stmts[5]['id'], self.guid6)
self.assertEqual(stmts[6]['id'], self.guid7)
self.assertEqual(stmts[7]['id'], self.guid8)
self.assertEqual(stmts[8]['id'], self.guid9)
self.assertEqual(stmts[9]['id'], self.guid10)
r = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
more = sresults['more'][-32:]
stmts = sresults['statements']
self.assertEqual(len(stmts), 10)
self.assertEqual(stmts[0]['id'], self.guid11)
self.assertEqual(stmts[1]['id'], self.guid12)
self.assertEqual(stmts[2]['id'], self.guid13)
self.assertEqual(stmts[3]['id'], self.guid14)
self.assertEqual(stmts[4]['id'], self.guid15)
self.assertEqual(stmts[5]['id'], self.guid16)
self.assertEqual(stmts[6]['id'], self.guid17)
self.assertEqual(stmts[7]['id'], self.guid18)
self.assertEqual(stmts[8]['id'], self.guid19)
self.assertEqual(stmts[9]['id'], self.guid20)
r = self.client.get(reverse('lrs:statements_more', kwargs={'more_id': more}),
X_Experience_API_Version=settings.XAPI_VERSION, HTTP_AUTHORIZATION=self.auth)
self.assertEqual(r.status_code, 200)
c = r.content
sresults = json.loads(c)
stmts = sresults['statements']
self.assertEqual(len(stmts), 5)
self.assertEqual(stmts[0]['id'], self.guid21)
self.assertEqual(stmts[1]['id'], self.guid22)
self.assertEqual(stmts[2]['id'], self.guid23)
self.assertEqual(stmts[3]['id'], self.guid24)
self.assertEqual(stmts[4]['id'], self.guid25)
| 54.015456
| 399
| 0.590992
| 7,551
| 69,896
| 5.337306
| 0.051516
| 0.095876
| 0.174632
| 0.213439
| 0.888492
| 0.878691
| 0.787976
| 0.781773
| 0.781773
| 0.778001
| 0
| 0.036236
| 0.276668
| 69,896
| 1,293
| 400
| 54.057231
| 0.760908
| 0.004235
| 0
| 0.639648
| 0
| 0
| 0.102829
| 0.005058
| 0
| 0
| 0
| 0
| 0.586784
| 0
| null | null | 0.039648
| 0.010573
| null | null | 0.000881
| 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
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 9
|
7c559131b96fcace2e28407361922a3339599196
| 6,117
|
py
|
Python
|
python/test/reader_test.py
|
jayholman/vmaf
|
0bba4faf68ab89e38314cc596e6908b4fb83984d
|
[
"Apache-2.0"
] | 2
|
2019-07-26T03:49:07.000Z
|
2021-06-17T12:16:46.000Z
|
python/test/reader_test.py
|
jayholman/vmaf
|
0bba4faf68ab89e38314cc596e6908b4fb83984d
|
[
"Apache-2.0"
] | null | null | null |
python/test/reader_test.py
|
jayholman/vmaf
|
0bba4faf68ab89e38314cc596e6908b4fb83984d
|
[
"Apache-2.0"
] | null | null | null |
__copyright__ = "Copyright 2016-2019, Netflix, Inc."
__license__ = "Apache, Version 2.0"
import unittest
import numpy as np
from vmaf.config import VmafConfig
from vmaf.tools.reader import YuvReader
class YuvReaderTest(unittest.TestCase):
def test_yuv_reader(self):
yuv_reader = YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv"),
width=576,
height=324,
yuv_type='yuv420p'
)
self.assertEquals(yuv_reader.num_bytes, 13436928)
self.assertEquals(yuv_reader.num_frms, 48)
self.assertEquals(yuv_reader._get_uv_width_height_multiplier(), (0.5, 0.5))
def test_with(self):
with YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv"),
width=576,
height=324,
yuv_type='yuv420p'
) as yuv_reader:
assert hasattr(yuv_reader.file, "read")
def test_next_y_u_v(self):
with YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv"),
width=576,
height=324,
yuv_type='yuv420p'
) as yuv_reader:
y, u, v = yuv_reader.__next__()
self.assertEquals(y[0][0], 87)
self.assertEquals(y[0][1], 131)
self.assertEquals(y[1][0], 95)
self.assertEquals(u[0][0], 92)
self.assertEquals(u[0][1], 97)
self.assertEquals(u[1][0], 90)
self.assertEquals(v[0][0], 121)
self.assertEquals(v[0][1], 126)
self.assertEquals(v[1][0], 122)
self.assertAlmostEquals(y.mean(), 61.928749785665296, places=4)
self.assertAlmostEquals(u.mean(), 114.6326517489712, places=4)
self.assertAlmostEquals(v.mean(), 122.05084019204389, places=4)
y, u, v = yuv_reader.__next__()
self.assertEquals(y[0][0], 142)
self.assertEquals(y[0][1], 128)
self.assertEquals(y[1][0], 134)
self.assertEquals(u[0][0], 93)
self.assertEquals(u[0][1], 102)
self.assertEquals(u[1][0], 91)
self.assertEquals(v[0][0], 128)
self.assertEquals(v[0][1], 126)
self.assertEquals(v[1][0], 124)
self.assertAlmostEquals(y.mean(), 61.265260631001375, places=4)
self.assertAlmostEquals(u.mean(), 114.72515860768175, places=4)
self.assertAlmostEquals(v.mean(), 122.12022033607681, places=4)
def test_iteration(self):
y_1stmoments = []
y_2ndmoments = []
with YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv"),
width=576, height=324, yuv_type='yuv420p') as yuv_reader:
for y, u, v in yuv_reader:
y_1stmoments.append(y.mean())
y_2ndmoments.append(y.var() + y.mean() * y.mean())
self.assertEquals(len(y_1stmoments), 48)
self.assertEquals(len(y_2ndmoments), 48)
self.assertAlmostEquals(np.mean(y_1stmoments), 61.332006624999984, places=4)
self.assertAlmostEquals(np.mean(y_2ndmoments), 4798.659574041666, places=4)
class YuvReaderTest10le(unittest.TestCase):
def test_yuv_reader(self):
yuv_reader = YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv422p10le.yuv"),
width=576,
height=324,
yuv_type='yuv422p10le'
)
self.assertEquals(yuv_reader.num_bytes, 35831808)
self.assertEquals(yuv_reader.num_frms, 48)
self.assertEquals(yuv_reader._get_uv_width_height_multiplier(), (0.5, 1.0))
def test_with(self):
with YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc00_576x324.yuv422p10le.yuv"),
width=576,
height=324,
yuv_type='yuv422p10le'
) as yuv_reader:
y, u, v = yuv_reader.__next__()
self.assertEquals(y[0][0], 87)
self.assertEquals(y[0][1], 131)
self.assertEquals(y[1][0], 95)
self.assertEquals(u[0][0], 92.25)
self.assertEquals(u[0][1], 97.5)
self.assertEquals(u[1][0], 91.75)
self.assertEquals(v[0][0], 121)
self.assertEquals(v[0][1], 126.25)
self.assertEquals(v[1][0], 121.25)
self.assertAlmostEquals(y.mean(), 61.928749785665296, places=4)
self.assertAlmostEquals(u.mean(), 114.63283661265432, places=4)
self.assertAlmostEquals(v.mean(), 122.05113490226337, places=4)
y, u, v = yuv_reader.__next__()
self.assertEquals(y[0][0], 142)
self.assertEquals(y[0][1], 128)
self.assertEquals(y[1][0], 134)
self.assertEquals(u[0][0], 93.25)
self.assertEquals(u[0][1], 102.75)
self.assertEquals(u[1][0], 92.75)
self.assertEquals(v[0][0], 128.25)
self.assertEquals(v[0][1], 126.5)
self.assertEquals(v[1][0], 127.25)
self.assertAlmostEquals(y.mean(), 61.265260631001375, places=4)
self.assertAlmostEquals(u.mean(), 114.72527917095336, places=4)
self.assertAlmostEquals(v.mean(), 122.12047217935527, places=4)
def test_iteration(self):
y_1stmoments = []
y_2ndmoments = []
with YuvReader(
filepath=VmafConfig.test_resource_path("yuv", "src01_hrc01_576x324.yuv422p10le.yuv"),
width=576, height=324, yuv_type='yuv422p10le') as yuv_reader:
for y, u, v in yuv_reader:
y_1stmoments.append(y.mean())
y_2ndmoments.append(y.var() + y.mean() * y.mean())
self.assertEquals(len(y_1stmoments), 48)
self.assertEquals(len(y_2ndmoments), 48)
self.assertAlmostEquals(np.mean(y_1stmoments), 61.332006624999984, places=4)
self.assertAlmostEquals(np.mean(y_2ndmoments), 4798.659574041666, places=4)
if __name__ == '__main__':
unittest.main()
| 35.563953
| 101
| 0.595717
| 748
| 6,117
| 4.699198
| 0.152406
| 0.209388
| 0.058037
| 0.082504
| 0.882788
| 0.861166
| 0.783784
| 0.741679
| 0.741679
| 0.741679
| 0
| 0.15445
| 0.270721
| 6,117
| 171
| 102
| 35.77193
| 0.63349
| 0
| 0
| 0.615385
| 0
| 0
| 0.056237
| 0.032205
| 0
| 0
| 0
| 0
| 0.484615
| 1
| 0.053846
| false
| 0
| 0.030769
| 0
| 0.1
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 8
|
7c5cbf95f846b8ebaed767b90d9a1717da1a5d4d
| 626
|
py
|
Python
|
t_5_data_structures/t_5_8_comparing_sequences_and_other_types/__init__.py
|
naokiur/Python-tutorial
|
7b03dc8fd2e5992859fde00bfe2873b4fb7ca5e5
|
[
"Apache-2.0"
] | null | null | null |
t_5_data_structures/t_5_8_comparing_sequences_and_other_types/__init__.py
|
naokiur/Python-tutorial
|
7b03dc8fd2e5992859fde00bfe2873b4fb7ca5e5
|
[
"Apache-2.0"
] | null | null | null |
t_5_data_structures/t_5_8_comparing_sequences_and_other_types/__init__.py
|
naokiur/Python-tutorial
|
7b03dc8fd2e5992859fde00bfe2873b4fb7ca5e5
|
[
"Apache-2.0"
] | null | null | null |
print("(1, 2, 3) < (1, 2, 4) :", (1, 2, 3) < (1, 2, 4))
print("[1, 2, 3] < [1, 2, 4] :", [1, 2, 3] < [1, 2, 4])
print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python')
print("(1, 2, 3, 4) < (1, 2, 4) :", (1, 2, 3, 4) < (1, 2, 4))
print("(1, 2) < (1, 2, -1) :", (1, 2) < (1, 2, -1))
print("(1, 2, 3) == (1.0, 2.0, 3.0) :", (1, 2, 3) == (1.0, 2.0, 3.0))
print("(1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4) :", (1, 2, ('aa', 'bb')) < (1, 2, ('abc', 'a'), 4))
| 78.25
| 107
| 0.253994
| 99
| 626
| 1.606061
| 0.131313
| 0.27673
| 0.150943
| 0.150943
| 0.735849
| 0.654088
| 0.610063
| 0.522013
| 0.522013
| 0.245283
| 0
| 0.204852
| 0.407348
| 626
| 7
| 108
| 89.428571
| 0.22372
| 0
| 0
| 0
| 0
| 0.285714
| 0.597444
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 8
|
7c603619c35b5c757409eb7e9b46b2458f764147
| 6,755
|
py
|
Python
|
optimtool/example/Lasso.py
|
linjing-lab/optimtool
|
9ca298b91ba755b4dab4028879af2c5a06c2e6d6
|
[
"MIT"
] | 3
|
2022-01-24T14:16:07.000Z
|
2022-02-18T20:02:50.000Z
|
optimtool/example/Lasso.py
|
linjing-lab/optimtool
|
9ca298b91ba755b4dab4028879af2c5a06c2e6d6
|
[
"MIT"
] | null | null | null |
optimtool/example/Lasso.py
|
linjing-lab/optimtool
|
9ca298b91ba755b4dab4028879af2c5a06c2e6d6
|
[
"MIT"
] | null | null | null |
def gradient_descent(A, b, mu, args, x_0, draw=True, output_f=False, delta=10, alp=1e-3, epsilon=1e-2, k=0):
'''
Parameters
----------
A : numpy.array
m*n维数 参数矩阵
b : 系数矩阵
m*1维数 参数矩阵
mu : float
正则化参数
args : sympy.matrices.dense.MutableDenseMatrix
参数列表
x_0 : list
初始迭代点列表
draw : bool
绘图接口参数
output_f : bool
输出迭代函数值列表
delta : float
常数
alp : float
步长阈值
epsilon : float
迭代停机准则
k : int
迭代次数
Returns
-------
tuple
最终收敛点, 迭代次数, (迭代函数值列表)
'''
import numpy as np
import sympy as sp
from optimtool.functions.tools import function_f_x_k, function_plot_iteration, function_get_f_delta_gradient, function_data_convert
_, args, _, _ = function_data_convert(None, args)
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
res = funcs.jacobian(args)
L = np.linalg.norm((A.T).dot(A)) + mu / delta
point = []
f = []
while 1:
reps = dict(zip(args, x_0))
point.append(np.array(x_0))
f.append(function_f_x_k(funcs, args, x_0, mu))
resv = np.array(res.subs(reps)).astype(np.float64)
argsv = np.array(args.subs(reps)).astype(np.float64)
g = function_get_f_delta_gradient(resv, argsv, mu, delta)
alpha = alp
assert alpha <= 1 / L
x_0 = x_0 - alpha * g
k = k + 1
if np.linalg.norm(x_0 - point[k - 1]) <= epsilon:
point.append(np.array(x_0))
f.append(function_f_x_k(funcs, args, x_0, mu))
break
function_plot_iteration(f, draw, "Lasso_gradient_decent")
if output_f is True:
return x_0, k, f
else:
return x_0, k
'''
次梯度算法
'''
def subgradient(A, b, mu, args, x_0, draw=True, output_f=False, alphak=2e-2, epsilon=1e-3, k=0):
'''
Parameters
----------
A : numpy.array
m*n维数 参数矩阵
b : 系数矩阵
m*1维数 参数矩阵
mu : float
正则化参数
args : sympy.matrices.dense.MutableDenseMatrix
参数列表
x_0 : list
初始迭代点列表
draw : bool
绘图接口参数
output_f : bool
输出迭代函数值列表
alphak : float
自适应步长参数
epsilon : float
迭代停机准则
k : int
迭代次数
Returns
-------
tuple
最终收敛点, 迭代次数, (迭代函数值列表)
'''
import numpy as np
import sympy as sp
from optimtool.functions.tools import function_f_x_k, function_plot_iteration, function_get_subgradient, function_data_convert
_, args, _, _ = function_data_convert(None, args)
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
res = funcs.jacobian(args)
point = []
f = []
while 1:
reps = dict(zip(args, x_0))
point.append(np.array(x_0))
f.append(function_f_x_k(funcs, args, x_0, mu))
resv = np.array(res.subs(reps)).astype(np.float64)
argsv = np.array(args.subs(reps)).astype(np.float64)
g = function_get_subgradient(resv, argsv, mu)
alpha = alphak / np.sqrt(k + 1)
x_0 = x_0 - alpha * g
k = k + 1
if np.linalg.norm(x_0 - point[k - 1]) <= epsilon:
point.append(np.array(x_0))
f.append(function_f_x_k(funcs, args, x_0, mu))
break
function_plot_iteration(f, draw, "Lasso_subgradient")
if output_f is True:
return x_0, k, f
else:
return x_0, k
'''
罚函数法
'''
def penalty(A, b, mu, args, x_0, draw=True, output_f=False, gamma=0.1, epsilon=1e-6, k=0):
'''
Parameters
----------
A : numpy.array
m*n维数 参数矩阵
b : 系数矩阵
m*1维数 参数矩阵
mu : float
正则化参数
args : sympy.matrices.dense.MutableDenseMatrix
参数列表
x_0 : list
初始迭代点列表
draw : bool
绘图接口参数
output_f : bool
输出迭代函数值列表
gamma : float
因子
epsilon : float
迭代停机准则
k : int
迭代次数
Returns
-------
tuple
最终收敛点, 迭代次数, (迭代函数值列表)
'''
import numpy as np
import sympy as sp
from optimtool.functions.tools import function_f_x_k, function_plot_iteration, function_data_convert
assert gamma < 1
assert gamma > 0
_, args, _, _ = function_data_convert(None, args)
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
f = []
while mu >= epsilon:
f.append(function_f_x_k(funcs, args, x_0, mu))
x_0, _ = subgradient(A, b, mu, args, x_0, False)
if mu > epsilon:
mu = max(epsilon, gamma * mu)
k = k + 1
else:
break
function_plot_iteration(f, draw, "Lasso_penalty")
if output_f is True:
return x_0, k, f
else:
return x_0, k
'''
近似点梯度法
'''
def approximate_point_gradient(A, b, mu, args, x_0, draw=True, output_f=False, epsilon=1e-6, k=0):
'''
Parameters
----------
A : numpy.array
m*n维数 参数矩阵
b : 系数矩阵
m*1维数 参数矩阵
mu : float
正则化参数
args : sympy.matrices.dense.MutableDenseMatrix
参数列表
x_0 : list
初始迭代点列表
draw : bool
绘图接口参数
output_f : bool
输出迭代函数值列表
epsilon : float
迭代停机准则
k : int
迭代次数
Returns
-------
tuple
最终收敛点, 迭代次数, (迭代函数值列表)
'''
import numpy as np
import sympy as sp
from optimtool.functions.tools import function_f_x_k, function_plot_iteration, function_data_convert
_, args, _, _ = function_data_convert(None, args)
values, _ = np.linalg.eig((A.T).dot(A))
lambda_ma = max(values)
if isinstance(lambda_ma, complex):
tk = 1 / np.real(lambda_ma)
else:
tk = 1 / lambda_ma
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
res = funcs.jacobian(args)
f = []
point = []
while 1:
reps = dict(zip(args, x_0))
f.append(function_f_x_k(funcs, args, x_0, mu))
point.append(x_0)
grad = np.array(res.subs(reps)).astype(np.float64)
x_0 = np.sign(x_0 - tk * grad[0]) * [max(i, 0) for i in np.abs(x_0 - tk * grad[0]) - tk * mu]
k = k + 1
if np.linalg.norm(x_0 - point[k - 1]) < epsilon:
point.append(x_0)
f.append(function_f_x_k(funcs, args, x_0, mu))
break
function_plot_iteration(f, draw, "Lasso_approximate_point_gradient")
if output_f is True:
return x_0, k, f
else:
return x_0, k
| 23.869258
| 135
| 0.525833
| 910
| 6,755
| 3.726374
| 0.138462
| 0.025951
| 0.026541
| 0.035683
| 0.828959
| 0.815394
| 0.815394
| 0.795341
| 0.779416
| 0.770274
| 0
| 0.024227
| 0.358401
| 6,755
| 283
| 136
| 23.869258
| 0.758191
| 0.236862
| 0
| 0.72973
| 0
| 0
| 0.018547
| 0.011844
| 0
| 0
| 0
| 0
| 0.027027
| 1
| 0.036036
| false
| 0
| 0.108108
| 0
| 0.216216
| 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
|
7c88a80f357bab0379d1c6349c5747076079f46f
| 174
|
py
|
Python
|
temboo/core/Library/Utilities/Formatting/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | 7
|
2016-03-07T02:07:21.000Z
|
2022-01-21T02:22:41.000Z
|
temboo/core/Library/Utilities/Formatting/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | null | null | null |
temboo/core/Library/Utilities/Formatting/__init__.py
|
jordanemedlock/psychtruths
|
52e09033ade9608bd5143129f8a1bfac22d634dd
|
[
"Apache-2.0"
] | 8
|
2016-06-14T06:01:11.000Z
|
2020-04-22T09:21:44.000Z
|
from temboo.Library.Utilities.Formatting.RemoveWhiteSpace import RemoveWhiteSpace, RemoveWhiteSpaceInputSet, RemoveWhiteSpaceResultSet, RemoveWhiteSpaceChoreographyExecution
| 87
| 173
| 0.91954
| 11
| 174
| 14.545455
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04023
| 174
| 1
| 174
| 174
| 0.958084
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.