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
7759aa31b975fb7ecaff6f22c48dd6e5db87d394
9,662
py
Python
python/test/cambi_test.py
lance-lmwang/vmaf
aa1dd0b3b2c3bfc324f91911197dfa9d42a3e3da
[ "BSD-2-Clause-Patent" ]
1
2022-01-10T10:14:01.000Z
2022-01-10T10:14:01.000Z
python/test/cambi_test.py
REO-RAO/vmaf
e768a2be57116c76bf33be7f8ee3566d8b774664
[ "BSD-2-Clause-Patent" ]
null
null
null
python/test/cambi_test.py
REO-RAO/vmaf
e768a2be57116c76bf33be7f8ee3566d8b774664
[ "BSD-2-Clause-Patent" ]
null
null
null
import unittest from test.testutil import set_default_576_324_videos_for_testing, \ set_default_576_324_videos_for_testing_scaled, \ set_default_cambi_video_for_testing_b, \ set_default_cambi_video_for_testing_10b from vmaf.core.cambi_feature_extractor import CambiFeatureExtractor, CambiFullReferenceFeatureExtractor from vmaf.core.cambi_quality_runner import CambiQualityRunner, CambiFullReferenceQualityRunner from vmaf.tools.misc import MyTestCase class CambiFeatureExtractorTest(MyTestCase): def tearDown(self): if hasattr(self, 'fextractor'): self.fextractor.remove_results() super().tearDown() def test_run_cambi_fextractor(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 0.6892500624999999, places=4) self.assertAlmostEqual(results[1]['Cambi_feature_cambi_score'], 0.0014658541666666667, places=4) def test_run_cambi_fextractor_scaled(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing_scaled() self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 0.9204257916666666, places=4) self.assertAlmostEqual(results[1]['Cambi_feature_cambi_score'], 0.004251791666666667, places=4) def test_run_cambi_fextractor_scaled_b(self): _, _, asset, asset_original = set_default_cambi_video_for_testing_b() self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 1.218365, places=4) def test_run_cambi_fextractor_10b(self): _, _, asset, asset_original = set_default_cambi_video_for_testing_10b() self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 0.01451, places=4) def test_run_cambi_fextractor_max_log_contrast(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={'max_log_contrast': 4} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 0.9182153958333333, places=4) self.assertAlmostEqual(results[1]['Cambi_feature_cambi_score'], 0.0024499791666667, places=4) self.fextractor = CambiFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={'max_log_contrast': 0} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_feature_cambi_score'], 0.015840666666666666, places=4) self.assertAlmostEqual(results[1]['Cambi_feature_cambi_score'], 0.000671125, places=4) def test_run_cambi_fextractor_full_reference(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.fextractor = CambiFullReferenceFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_score'], 0.689250, places=4) self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_source_score'], 0.00146585416, places=4) self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_full_reference_score'], 0.687784, places=4) def test_run_cambi_fextractor_full_reference_scaled_ref(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.fextractor = CambiFullReferenceFeatureExtractor( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={'src_width': 480, 'src_height': 270} ) self.fextractor.run(parallelize=True) results = self.fextractor.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_score'], 0.689250, places=4) self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_source_score'], 0.0042517916, places=4) self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_full_reference_score'], 0.6849983125, places=4) class CambiQualityRunnerTest(MyTestCase): def test_run_cambi_runner(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.qrunner = CambiQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_score'], 0.6892500624999999, places=4) self.assertAlmostEqual(results[1]['Cambi_score'], 0.0014658541666666667, places=4) def test_run_cambi_runner_scale(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing_scaled() self.qrunner = CambiQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_score'], 0.9204257916666666, places=4) self.assertAlmostEqual(results[1]['Cambi_score'], 0.004251791666666667, places=4) def test_run_cambi_runner_scale_b(self): _, _, asset, asset_original = set_default_cambi_video_for_testing_b() self.qrunner = CambiQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_score'], 1.218365, places=4) def test_run_cambi_runner_10b(self): _, _, asset, asset_original = set_default_cambi_video_for_testing_10b() self.qrunner = CambiQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None, optional_dict={} ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_score'], 0.01451, places=4) def test_run_cambi_runner_fullref(self): _, _, asset, asset_original = set_default_576_324_videos_for_testing() self.qrunner = CambiFullReferenceQualityRunner( [asset, asset_original], None, fifo_mode=False, result_store=None, ) self.qrunner.run(parallelize=True) results = self.qrunner.results # score: arithmetic mean score over all frames self.assertAlmostEqual(results[0]['Cambi_FR_score'], 0.687784125, places=4) self.assertAlmostEqual(results[0]['Cambi_FR_feature_cambi_score'], 0.68925006249, places=4) if __name__ == '__main__': unittest.main(verbosity=2)
41.114894
103
0.63165
994
9,662
5.809859
0.103622
0.06303
0.077922
0.09039
0.885022
0.877056
0.877056
0.854892
0.838961
0.823377
0
0.06355
0.285034
9,662
235
104
41.114894
0.772438
0.060443
0
0.702128
0
0
0.070491
0.054054
0
0
0
0
0.12766
1
0.069149
false
0
0.026596
0
0.106383
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
62186034110bd0dc841c03d284ea0e41559f6a04
13,009
py
Python
analysis_engine/td/fetch_api.py
virdesai/stock-analysis-engine
0ca501277c632150717ca499121a34f8f8c71ccb
[ "Apache-2.0" ]
819
2018-09-16T20:33:11.000Z
2022-03-30T21:18:23.000Z
analysis_engine/td/fetch_api.py
gvpathi/stock-analysis-engine
0ca501277c632150717ca499121a34f8f8c71ccb
[ "Apache-2.0" ]
14
2018-09-16T20:52:25.000Z
2020-09-06T12:36:36.000Z
analysis_engine/td/fetch_api.py
gvpathi/stock-analysis-engine
0ca501277c632150717ca499121a34f8f8c71ccb
[ "Apache-2.0" ]
226
2018-09-16T20:04:32.000Z
2022-03-31T01:41:14.000Z
""" Fetch API calls wrapping Tradier Supported environment variables: :: # verbose logging in this module export DEBUG_FETCH=1 """ import json import datetime import requests import pandas as pd import analysis_engine.consts as ae_consts import analysis_engine.utils as ae_utils import analysis_engine.options_dates as opt_dates import analysis_engine.url_helper as url_helper import analysis_engine.dataset_scrub_utils as scrub_utils import analysis_engine.td.consts as td_consts import spylunking.log.setup_logging as log_utils log = log_utils.build_colorized_logger(name=__name__) def fetch_calls( ticker=None, work_dict=None, scrub_mode='sort-by-date', verbose=False): """fetch_calls Fetch Tradier option calls for a ticker and return a tuple: (status, ``pandas.DataFrame``) .. code-block:: python import analysis_engine.td.fetch_api as td_fetch # Please set the TD_TOKEN environment variable to your token calls_status, calls_df = td_fetch.fetch_calls( ticker='SPY') print(f'Fetched SPY Option Calls from Tradier status={calls_status}:') print(calls_df) :param ticker: string ticker to fetch :param work_dict: dictionary of args used by the automation :param scrub_mode: optional - string type of scrubbing handler to run :param verbose: optional - bool for debugging """ label = 'fetch_calls' datafeed_type = td_consts.DATAFEED_TD_CALLS exp_date = None latest_pricing = {} latest_close = None if work_dict: ticker = work_dict.get( 'ticker', ticker) label = work_dict.get( 'label', label) exp_date = work_dict.get( 'exp_date', exp_date) latest_pricing = work_dict.get( 'latest_pricing', latest_pricing) latest_close = latest_pricing.get( 'close', latest_close) log.debug( f'{label} - calls - close={latest_close} ' f'ticker={ticker}') exp_date = opt_dates.option_expiration().strftime( ae_consts.COMMON_DATE_FORMAT) use_url = td_consts.TD_URLS['options'].format( ticker, exp_date) headers = td_consts.get_auth_headers() session = requests.Session() session.headers = headers res = url_helper.url_helper(sess=session).get( use_url ) if res.status_code != requests.codes.OK: if res.status_code in [401, 403]: log.critical( 'Please check the TD_TOKEN is correct ' f'received {res.status_code} during ' 'fetch for: calls') else: log.info( f'failed to get call with response={res} ' f'code={res.status_code} ' f'text={res.text}') return ae_consts.EMPTY, pd.DataFrame([{}]) records = json.loads(res.text) org_records = records.get( 'options', {}).get( 'option', []) if len(org_records) == 0: log.info( 'failed to get call records ' 'text={}'.format( res.text)) return ae_consts.EMPTY, pd.DataFrame([{}]) options_list = [] # assumes UTC conversion will work with the system clock created_minute = ( datetime.datetime.utcnow() - datetime.timedelta(hours=5)).strftime( '%Y-%m-%d %H:%M:00') last_close_date = ae_utils.get_last_close_str( fmt='%Y-%m-%d %H:%M:00') # hit bug where dates were None if not last_close_date: last_close_date = created_minute for node in org_records: node['date'] = last_close_date node['created'] = created_minute node['ticker'] = ticker if ( node['option_type'] == 'call' and node['expiration_type'] == 'standard' and float(node['bid']) > 0.01): node['opt_type'] = int(ae_consts.OPTION_CALL) node['exp_date'] = node['expiration_date'] new_node = {} for col in td_consts.TD_OPTION_COLUMNS: if col in node: if col in td_consts.TD_EPOCH_COLUMNS: # trade_date can be None if node[col] == 0: new_node[col] = None else: new_node[col] = ae_utils.epoch_to_dt( epoch=node[col]/1000, use_utc=False, convert_to_est=True).strftime( ae_consts.COMMON_TICK_DATE_FORMAT) """ Debug epoch ms converter: """ """ print('-----------') print(col) print(node[col]) print(new_node[col]) print('===========') """ # if/else valid date else: new_node[col] = node[col] # if date column to convert # if column is in the row # convert all columns options_list.append(new_node) # end of records full_df = pd.DataFrame(options_list).sort_values( by=[ 'strike' ], ascending=True) num_chains = len(full_df.index) df = None if latest_close: df_filter = ( (full_df['strike'] >= (latest_close - ae_consts.OPTIONS_LOWER_STRIKE)) & (full_df['strike'] <= (latest_close + ae_consts.OPTIONS_UPPER_STRIKE))) df = full_df[df_filter].copy().sort_values( by=[ 'date', 'strike' ]).reset_index() else: mid_chain_idx = int(num_chains / 2) low_idx = int( mid_chain_idx - ae_consts.MAX_OPTIONS_LOWER_STRIKE) high_idx = int( mid_chain_idx + ae_consts.MAX_OPTIONS_UPPER_STRIKE) if low_idx < 0: low_idx = 0 if high_idx > num_chains: high_idx = num_chains df = full_df[low_idx:high_idx].copy().sort_values( by=[ 'date', 'strike' ]).reset_index() scrubbed_df = scrub_utils.ingress_scrub_dataset( label=label, scrub_mode=scrub_mode, datafeed_type=datafeed_type, msg_format='df={} date_str={}', ds_id=ticker, date_str=exp_date, df=df) return ae_consts.SUCCESS, scrubbed_df # end of fetch_calls def fetch_puts( ticker=None, work_dict=None, scrub_mode='sort-by-date', verbose=False): """fetch_puts Fetch Tradier option puts for a ticker and return a tuple: (status, ``pandas.DataFrame``) .. code-block:: python import analysis_engine.td.fetch_api as td_fetch puts_status, puts_df = td_fetch.fetch_puts( ticker='SPY') print(f'Fetched SPY Option Puts from Tradier status={puts_status}:') print(puts_df) :param ticker: string ticker to fetch :param work_dict: dictionary of args used by the automation :param scrub_mode: optional - string type of scrubbing handler to run :param verbose: optional - bool for debugging """ label = 'fetch_calls' datafeed_type = td_consts.DATAFEED_TD_PUTS exp_date = None latest_pricing = {} latest_close = None if work_dict: ticker = work_dict.get( 'ticker', ticker) label = work_dict.get( 'label', label) exp_date = work_dict.get( 'exp_date', exp_date) latest_pricing = work_dict.get( 'latest_pricing', latest_pricing) latest_close = latest_pricing.get( 'close', latest_close) if verbose: log.info( f'{label} - puts - close={latest_close} ' f'ticker={ticker}') exp_date = opt_dates.option_expiration().strftime( ae_consts.COMMON_DATE_FORMAT) use_url = td_consts.TD_URLS['options'].format( ticker, exp_date) headers = td_consts.get_auth_headers() session = requests.Session() session.headers = headers res = url_helper.url_helper(sess=session).get( use_url ) if res.status_code != requests.codes.OK: if res.status_code in [401, 403]: log.critical( 'Please check the TD_TOKEN is correct ' f'received {res.status_code} during ' 'fetch for: puts') else: log.info( f'failed to get put with response={res} ' f'code={res.status_code} ' f'text={res.text}') return ae_consts.EMPTY, pd.DataFrame([{}]) records = json.loads(res.text) org_records = records.get( 'options', {}).get( 'option', []) if len(org_records) == 0: log.info( 'failed to get put records ' 'text={}'.format( res.text)) return ae_consts.EMPTY, pd.DataFrame([{}]) options_list = [] # assumes UTC conversion will work with the system clock created_minute = ( datetime.datetime.utcnow() - datetime.timedelta(hours=5)).strftime( '%Y-%m-%d %H:%M:00') last_close_date = ae_utils.get_last_close_str( fmt='%Y-%m-%d %H:%M:00') # hit bug where dates were None if not last_close_date: last_close_date = created_minute for node in org_records: node['date'] = last_close_date node['created'] = created_minute node['ticker'] = ticker if ( node['option_type'] == 'put' and node['expiration_type'] == 'standard' and float(node['bid']) > 0.01): node['opt_type'] = int(ae_consts.OPTION_PUT) node['exp_date'] = node['expiration_date'] new_node = {} for col in td_consts.TD_OPTION_COLUMNS: if col in node: if col in td_consts.TD_EPOCH_COLUMNS: # trade_date can be None if node[col] == 0: new_node[col] = None else: new_node[col] = ae_utils.epoch_to_dt( epoch=node[col]/1000, use_utc=False, convert_to_est=True).strftime( ae_consts.COMMON_TICK_DATE_FORMAT) """ Debug epoch ms converter: """ """ print('-----------') print(col) print(node[col]) print(new_node[col]) print('===========') """ # if/else valid date else: new_node[col] = node[col] # if date column to convert # if column is in the row # convert all columns options_list.append(new_node) # end of records full_df = pd.DataFrame(options_list).sort_values( by=[ 'strike' ], ascending=True) num_chains = len(full_df.index) df = None if latest_close: df_filter = ( (full_df['strike'] >= (latest_close - ae_consts.OPTIONS_LOWER_STRIKE)) & (full_df['strike'] <= (latest_close + ae_consts.OPTIONS_UPPER_STRIKE))) df = full_df[df_filter].copy().sort_values( by=[ 'date', 'strike' ]).reset_index() else: mid_chain_idx = int(num_chains / 2) low_idx = int( mid_chain_idx - ae_consts.MAX_OPTIONS_LOWER_STRIKE) high_idx = int( mid_chain_idx + ae_consts.MAX_OPTIONS_UPPER_STRIKE) if low_idx < 0: low_idx = 0 if high_idx > num_chains: high_idx = num_chains df = full_df[low_idx:high_idx].copy().sort_values( by=[ 'date', 'strike' ]).reset_index() scrubbed_df = scrub_utils.ingress_scrub_dataset( label=label, scrub_mode=scrub_mode, datafeed_type=datafeed_type, msg_format='df={} date_str={}', ds_id=ticker, date_str=exp_date, df=df) return ae_consts.SUCCESS, scrubbed_df # end of fetch_puts
30.97381
78
0.52456
1,470
13,009
4.384354
0.144898
0.026067
0.024825
0.014895
0.86796
0.86796
0.86796
0.851202
0.851202
0.851202
0
0.005812
0.378353
13,009
419
79
31.047733
0.791146
0.138366
0
0.888502
0
0
0.098384
0.004257
0
0
0
0
0
1
0.006969
false
0
0.038328
0
0.066202
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
6245bf4253a638bf3f0f95b06c950d30bace556e
2,800
py
Python
src/genie/libs/parser/iosxe/tests/ShowL2vpnEvpnDefaultGatewayDetail/cli/equal/golden_output_expected.py
balmasea/genieparser
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
[ "Apache-2.0" ]
null
null
null
src/genie/libs/parser/iosxe/tests/ShowL2vpnEvpnDefaultGatewayDetail/cli/equal/golden_output_expected.py
balmasea/genieparser
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
[ "Apache-2.0" ]
null
null
null
src/genie/libs/parser/iosxe/tests/ShowL2vpnEvpnDefaultGatewayDetail/cli/equal/golden_output_expected.py
balmasea/genieparser
d1e71a96dfb081e0a8591707b9d4872decd5d9d3
[ "Apache-2.0" ]
null
null
null
expected_output = { 'evi': { 103: { 'bd_id': { 103: { 'dg_addr': { '10.3.1.254': { 'source': { 'V:2000103 Vlan103': { 'eth_tag': 0, 'mac_addr': '549f.c6f4.53bf', 'valid': True }, 'V:2000103 20.0.101.1': { 'eth_tag': 0, 'mac_addr': '0000.1111.2222', 'valid': True } } }, '10:3:1::254': { 'source': { 'V:2000103 Vlan103': { 'eth_tag': 0, 'mac_addr': '549f.c6f4.53bf', 'valid': True }, 'V:2000103 20.0.101.1': { 'eth_tag': 0, 'mac_addr': '0000.1111.2222', 'valid': True } } }, '2000::10': { 'source': { 'V:2000103 Vlan103': { 'eth_tag': 0, 'mac_addr': '549f.c6f4.53bf', 'valid': True }, 'V:2000103 20.0.101.1': { 'eth_tag': 0, 'mac_addr': '0000.1111.2222', 'valid': True } } }, '2000::11': { 'source': { 'V:2000103 Vlan103': { 'eth_tag': 0, 'mac_addr': '549f.c6f4.53bf', 'valid': True }, 'V:2000103 20.0.101.1': { 'eth_tag': 0, 'mac_addr': '0000.1111.2222', 'valid': False } } } } } } } } }
40.57971
65
0.179643
141
2,800
3.432624
0.234043
0.132231
0.115702
0.165289
0.913223
0.913223
0.913223
0.913223
0.913223
0.913223
0
0.277124
0.726786
2,800
68
66
41.176471
0.355556
0
0
0.544118
0
0
0.177143
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
10
624ab486d3696f1c0b52955f795aff0fc7862674
13,040
py
Python
lang/python/github/com/metaprov/modelaapi/services/featurehistogram/v1/featurehistogram_pb2_grpc.py
metaprov/modeldapi
ee05693832051dcd990ee4f061715d7ae0787340
[ "Apache-2.0" ]
5
2022-02-18T03:40:10.000Z
2022-03-01T16:11:24.000Z
lang/python/github/com/metaprov/modelaapi/services/featurehistogram/v1/featurehistogram_pb2_grpc.py
metaprov/modeldapi
ee05693832051dcd990ee4f061715d7ae0787340
[ "Apache-2.0" ]
1
2022-01-07T19:59:25.000Z
2022-02-04T01:21:14.000Z
lang/python/github/com/metaprov/modelaapi/services/featurehistogram/v1/featurehistogram_pb2_grpc.py
metaprov/modeldapi
ee05693832051dcd990ee4f061715d7ae0787340
[ "Apache-2.0" ]
1
2022-03-25T10:21:43.000Z
2022-03-25T10:21:43.000Z
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc from github.com.metaprov.modelaapi.services.featurehistogram.v1 import featurehistogram_pb2 as github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2 class FeatureHistogramServiceStub(object): """Missing associated documentation comment in .proto file.""" def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.ListFeatureHistograms = channel.unary_unary( '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/ListFeatureHistograms', request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsRequest.SerializeToString, response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsResponse.FromString, ) self.CreateFeatureHistogram = channel.unary_unary( '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/CreateFeatureHistogram', request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramRequest.SerializeToString, response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramResponse.FromString, ) self.GetFeatureHistogram = channel.unary_unary( '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/GetFeatureHistogram', request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramRequest.SerializeToString, response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramResponse.FromString, ) self.UpdateFeatureHistogram = channel.unary_unary( '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/UpdateFeatureHistogram', request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramRequest.SerializeToString, response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramResponse.FromString, ) self.DeleteFeatureHistogram = channel.unary_unary( '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/DeleteFeatureHistogram', request_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramRequest.SerializeToString, response_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramResponse.FromString, ) class FeatureHistogramServiceServicer(object): """Missing associated documentation comment in .proto file.""" def ListFeatureHistograms(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def CreateFeatureHistogram(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def GetFeatureHistogram(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def UpdateFeatureHistogram(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def DeleteFeatureHistogram(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def add_FeatureHistogramServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'ListFeatureHistograms': grpc.unary_unary_rpc_method_handler( servicer.ListFeatureHistograms, request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsRequest.FromString, response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsResponse.SerializeToString, ), 'CreateFeatureHistogram': grpc.unary_unary_rpc_method_handler( servicer.CreateFeatureHistogram, request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramRequest.FromString, response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramResponse.SerializeToString, ), 'GetFeatureHistogram': grpc.unary_unary_rpc_method_handler( servicer.GetFeatureHistogram, request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramRequest.FromString, response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramResponse.SerializeToString, ), 'UpdateFeatureHistogram': grpc.unary_unary_rpc_method_handler( servicer.UpdateFeatureHistogram, request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramRequest.FromString, response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramResponse.SerializeToString, ), 'DeleteFeatureHistogram': grpc.unary_unary_rpc_method_handler( servicer.DeleteFeatureHistogram, request_deserializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramRequest.FromString, response_serializer=github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) # This class is part of an EXPERIMENTAL API. class FeatureHistogramService(object): """Missing associated documentation comment in .proto file.""" @staticmethod def ListFeatureHistograms(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/ListFeatureHistograms', github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsRequest.SerializeToString, github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.ListFeatureHistogramsResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def CreateFeatureHistogram(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/CreateFeatureHistogram', github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramRequest.SerializeToString, github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.CreateFeatureHistogramResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def GetFeatureHistogram(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/GetFeatureHistogram', github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramRequest.SerializeToString, github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.GetFeatureHistogramResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def UpdateFeatureHistogram(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/UpdateFeatureHistogram', github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramRequest.SerializeToString, github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.UpdateFeatureHistogramResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod def DeleteFeatureHistogram(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/github.com.metaprov.modelaapi.services.featurehistogram.v1.FeatureHistogramService/DeleteFeatureHistogram', github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramRequest.SerializeToString, github_dot_com_dot_metaprov_dot_modelaapi_dot_services_dot_featurehistogram_dot_v1_dot_featurehistogram__pb2.DeleteFeatureHistogramResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
65.527638
203
0.768635
1,233
13,040
7.629359
0.089213
0.125226
0.039545
0.049431
0.876475
0.876475
0.876475
0.850749
0.837036
0.802381
0
0.006982
0.176227
13,040
198
204
65.858586
0.86874
0.052607
0
0.493827
1
0
0.119736
0.099454
0
0
0
0
0
1
0.074074
false
0
0.012346
0.030864
0.135802
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
627e832b23dee0b70fbc890f1cefe047d99bb161
9,951
py
Python
src/gmapscrawler/gmapscrawler.py
MindaugasVaitkus2/GMapsCrawler-DataCrawlerForGoogleMapsSearches
e39e125f2e746e2fd5e98ec186e63b89172ae3a4
[ "MIT" ]
1
2020-12-26T20:47:25.000Z
2020-12-26T20:47:25.000Z
src/gmapscrawler/gmapscrawler.py
MindaugasVaitkus2/GMapsCrawler-DataCrawlerForGoogleMapsSearches
e39e125f2e746e2fd5e98ec186e63b89172ae3a4
[ "MIT" ]
null
null
null
src/gmapscrawler/gmapscrawler.py
MindaugasVaitkus2/GMapsCrawler-DataCrawlerForGoogleMapsSearches
e39e125f2e746e2fd5e98ec186e63b89172ae3a4
[ "MIT" ]
null
null
null
import os import time from . browserhandler import BrowserHandler from . gmapshandler import GMapsHandler from . gmapsurlassembler import GMapsURLAssembler from selenium import webdriver from selenium.common import exceptions from selenium.webdriver.chrome.options import Options from selenium.common import exceptions import pandas as pd class GMapsCrawler(): def __init__(self, debug=False, delay=2): self.GMAPS_URL = 'https://www.google.com/maps/' self.DEBUG_MODE = debug self.DEFAULT_DELAY = delay self.CORRECTION_FACTOR = 0.0001364 def get_titles(self, search_str): STATE = 'CREATING_SESSION' titles = [] while(True): if(STATE == 'CREATING_SESSION'): # STATE behavior if(self.DEBUG_MODE): CHROMEDRIVER_PATH = os.environ['CHROMEDRIVER_PATH'] CHROME_OPTIONS = Options() #CHROME_OPTIONS.add_argument("--user-data-dir=.\chrome-data") CHROME_OPTIONS.add_argument("--enable-automation"); self.DRIVER = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=CHROME_OPTIONS) else: CHROMEDRIVER_PATH = os.environ['CHROMEDRIVER_PATH'] CHROME_OPTIONS = Options() CHROME_OPTIONS.add_argument('--headless') CHROME_OPTIONS.add_argument('--disable-gpu') # Last I checked this was necessary. self.DRIVER = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=CHROME_OPTIONS) # transition logic STATE = 'ACCESSING_GMAPS_URL' elif(STATE == 'ACCESSING_GMAPS_URL'): if(self.DEBUG_MODE): print(STATE) # STATE behavior url = GMapsURLAssembler.set_search_str(self.GMAPS_URL, search_str) BrowserHandler.set_url(self.DRIVER, url) time.sleep(self.DEFAULT_DELAY) # transition logic url = BrowserHandler.get_url(self.DRIVER) if(GMapsHandler.has_title(self.DRIVER)): STATE = 'COLLECTING_SINGLE_RESULT' elif(GMapsURLAssembler.is_search_page(url)): STATE = 'COLLECTING_PAGE_RESULTS' else: STATE = 'FAIL' elif(STATE == 'COLLECTING_PAGE_RESULTS'): if(self.DEBUG_MODE): print(STATE) # STATE behavior search_page_results = GMapsHandler.collect_search_page_results(self.DRIVER) for search_page_result in search_page_results: titles.append(search_page_result) time.sleep(self.DEFAULT_DELAY) # transition logic STATE = 'GOING_TO_NEXT_PAGE' elif(STATE == 'COLLECTING_SINGLE_RESULT'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.hit_searchbox_button(self.DRIVER) time.sleep(self.DEFAULT_DELAY) for _ in range(21): GMapsHandler.hit_zoom_in(self.DRIVER) time.sleep(self.DEFAULT_DELAY) url = BrowserHandler.get_url(self.DRIVER) title = { "title": GMapsHandler.collect_title(self.DRIVER)['value'] } titles.append(title) if(self.DEBUG_MODE): print(titles) # transition logic STATE = 'FINISH' elif(STATE == 'GOING_TO_NEXT_PAGE'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.access_search_back_to_results(self.DRIVER) time.sleep(self.DEFAULT_DELAY) has_next_page = GMapsHandler.access_search_next_page(self.DRIVER) time.sleep(self.DEFAULT_DELAY) # transition logic if(has_next_page): STATE = 'COLLECTING_PAGE_RESULTS' else: STATE = 'FINISH' elif(STATE == 'FINISH'): if(self.DEBUG_MODE): print('FINISH') # do something for FINISH STATE break elif(STATE == 'FAIL'): if(self.DEBUG_MODE): print('FAIL') # do something for FAIL STATE break BrowserHandler.quit(self.DRIVER) return titles def get_places(self, search_str): STATE = 'CREATING_SESSION' PAGE_CURSOR = 0 PAGE_CURSOR_LIMIT = None places = [] while(True): if(STATE == 'CREATING_SESSION'): # STATE behavior if(self.DEBUG_MODE): CHROMEDRIVER_PATH = os.environ['CHROMEDRIVER_PATH'] CHROME_OPTIONS = Options() #CHROME_OPTIONS.add_argument("--user-data-dir=.\chrome-data") CHROME_OPTIONS.add_argument("--enable-automation"); self.DRIVER = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=CHROME_OPTIONS) else: CHROMEDRIVER_PATH = os.environ['CHROMEDRIVER_PATH'] CHROME_OPTIONS = Options() CHROME_OPTIONS.add_argument('--headless') CHROME_OPTIONS.add_argument('--disable-gpu') # Last I checked this was necessary. self.DRIVER = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=CHROME_OPTIONS) # transition logic STATE = 'ACCESSING_GMAPS_URL' elif(STATE == 'ACCESSING_GMAPS_URL'): if(self.DEBUG_MODE): print(STATE) # STATE behavior url = GMapsURLAssembler.set_search_str(self.GMAPS_URL, search_str) BrowserHandler.set_url(self.DRIVER, url) time.sleep(self.DEFAULT_DELAY) # transition logic url = BrowserHandler.get_url(self.DRIVER) if(GMapsHandler.has_title(self.DRIVER)): STATE = 'COLLECTING_SINGLE_RESULT' elif(GMapsURLAssembler.is_search_page(url)): STATE = 'COLLECTING_PAGE_RESULTS' else: STATE = 'FAIL' elif(STATE == 'COLLECTING_PAGE_RESULTS'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.access_search_page_result_by_index(self.DRIVER, PAGE_CURSOR) PAGE_CURSOR_LIMIT = GMapsHandler.get_results_n(self.DRIVER) - 1 #print(PAGE_CURSOR_LIMIT) #print(PAGE_CURSOR) #print('') time.sleep(self.DEFAULT_DELAY) # transition logic if(PAGE_CURSOR <= PAGE_CURSOR_LIMIT): STATE = 'COLLECTING_CURSOR_RESULT' else: STATE = 'GOING_TO_NEXT_PAGE' elif(STATE == 'COLLECTING_CURSOR_RESULT'): if(self.DEBUG_MODE): print(STATE) # STATE behavior url = BrowserHandler.get_url(self.DRIVER) place = GMapsHandler.collect_place(self.DRIVER, url, self.CORRECTION_FACTOR) places.append(place) time.sleep(self.DEFAULT_DELAY) if(self.DEBUG_MODE): print(place) # transition logic PAGE_CURSOR += 1 STATE = 'RETURNING_TO_LIST' elif(STATE == 'COLLECTING_SINGLE_RESULT'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.hit_searchbox_button(self.DRIVER) time.sleep(self.DEFAULT_DELAY) for _ in range(21): GMapsHandler.hit_zoom_in(self.DRIVER) time.sleep(self.DEFAULT_DELAY) url = BrowserHandler.get_url(self.DRIVER) place = GMapsHandler.collect_place(self.DRIVER, url, self.CORRECTION_FACTOR) places.append(place) if(self.DEBUG_MODE): print(places) # transition logic STATE = 'FINISH' elif(STATE == 'RETURNING_TO_LIST'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.access_search_back_to_results(self.DRIVER) time.sleep(self.DEFAULT_DELAY) for _ in range(21): GMapsHandler.hit_zoom_in(self.DRIVER) time.sleep(self.DEFAULT_DELAY) # transition logic STATE = 'COLLECTING_PAGE_RESULTS' elif(STATE == 'GOING_TO_NEXT_PAGE'): if(self.DEBUG_MODE): print(STATE) # STATE behavior GMapsHandler.access_search_back_to_results(self.DRIVER) time.sleep(self.DEFAULT_DELAY) has_next_page = GMapsHandler.access_search_next_page(self.DRIVER) time.sleep(self.DEFAULT_DELAY) # transition logic if(has_next_page): STATE = 'COLLECTING_PAGE_RESULTS' PAGE_CURSOR = 1 else: STATE = 'FINISH' elif(STATE == 'FINISH'): if(self.DEBUG_MODE): print('FINISH') # do something for FINISH STATE break elif(STATE == 'FAIL'): if(self.DEBUG_MODE): print('FAIL') # do something for FAIL STATE break BrowserHandler.quit(self.DRIVER) return places def get_titles_df(): pass def get_places_df(): pass
37.130597
109
0.544468
951
9,951
5.443743
0.128286
0.05988
0.050222
0.055051
0.821325
0.782113
0.757582
0.757582
0.72938
0.717983
0
0.003048
0.37353
9,951
268
110
37.130597
0.827398
0.076374
0
0.755682
0
0
0.088804
0.033315
0
0
0
0
0
1
0.028409
false
0.011364
0.056818
0
0.102273
0.096591
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
655f3c469264ced3d7bfad8f26b34c67942d97b9
52
py
Python
timefred/_dev/__init__.py
giladbarnea/timefred
36cc8b0f09d38c0ed7b3e659ce337a75cd8b0c60
[ "MIT" ]
null
null
null
timefred/_dev/__init__.py
giladbarnea/timefred
36cc8b0f09d38c0ed7b3e659ce337a75cd8b0c60
[ "MIT" ]
null
null
null
timefred/_dev/__init__.py
giladbarnea/timefred
36cc8b0f09d38c0ed7b3e659ce337a75cd8b0c60
[ "MIT" ]
null
null
null
from .generate_completion import generate_completion
52
52
0.923077
6
52
7.666667
0.666667
0.782609
0
0
0
0
0
0
0
0
0
0
0.057692
52
1
52
52
0.938776
0
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
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
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
7
65c366f37b482b122ba32d1d98c323c67fe734f2
206
py
Python
hTools2.roboFontExt/lib/Scripts/current font/groups/print.py
frankrolf/hTools2_extension
9d73b8640c85209853a72f8d4b167768de5e0d60
[ "BSD-3-Clause" ]
2
2019-12-18T16:12:07.000Z
2019-12-21T01:19:23.000Z
hTools2.roboFontExt/lib/Scripts/current font/groups/print.py
frankrolf/hTools2_extension
9d73b8640c85209853a72f8d4b167768de5e0d60
[ "BSD-3-Clause" ]
null
null
null
hTools2.roboFontExt/lib/Scripts/current font/groups/print.py
frankrolf/hTools2_extension
9d73b8640c85209853a72f8d4b167768de5e0d60
[ "BSD-3-Clause" ]
null
null
null
# [h] print groups in different formats import hTools2.dialogs.font.groups_print import importlib importlib.reload(hTools2.dialogs.font.groups_print) hTools2.dialogs.font.groups_print.printGroupsDialog()
25.75
53
0.839806
27
206
6.296296
0.481481
0.247059
0.317647
0.423529
0.511765
0
0
0
0
0
0
0.015707
0.072816
206
7
54
29.428571
0.874346
0.179612
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0.75
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
1
0
9
0292a35916da2086b366f62a33975468098cbec7
12,339
py
Python
oeshoot/neuralnetwork/test/test_feedforward_network.py
antonior92/oe-multiple-shooting
49479d13fbb618097a3f881bb01b1a6d61d8c3db
[ "MIT" ]
2
2019-03-05T16:46:45.000Z
2020-05-02T15:33:02.000Z
oeshoot/neuralnetwork/test/test_feedforward_network.py
antonior92/oe-multiple-shooting
49479d13fbb618097a3f881bb01b1a6d61d8c3db
[ "MIT" ]
1
2019-03-26T11:25:38.000Z
2019-12-27T08:43:50.000Z
oeshoot/neuralnetwork/test/test_feedforward_network.py
antonior92/oe-multiple-shooting
49479d13fbb618097a3f881bb01b1a6d61d8c3db
[ "MIT" ]
1
2019-03-05T08:54:40.000Z
2019-03-05T08:54:40.000Z
from __future__ import division, print_function, absolute_import import numpy as np from oeshoot.neuralnetwork import (FeedforwardNetwork, Logistic, HyperbolicTangent, Identity) from numpy.testing import (TestCase, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_raises, assert_equal, assert_, run_module_suite, assert_allclose, assert_warns, dec) import numdifftools as nd class TestFeedforwardNetworkInit(TestCase): def test_single_activation_function(self): activ_func = Logistic() net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=activ_func) assert_equal(net.ninput, 3) assert_equal(net.noutput, 2) assert_equal(net.nhidden, [2, 3]) assert_equal(net.weights_shape, [(2, 3), (3, 2), (2, 3)]) assert_equal(net.bias_shape, [(2, 1), (3, 1), (2, 1)]) assert_equal(net.nparams, 25) assert_equal(net.nlayers, 3) assert_equal(isinstance(net.activ_func[0], Logistic), True) assert_equal(isinstance(net.activ_func[1], Logistic), True) assert_equal(isinstance(net.activ_func[2], Identity), True) def test_listof_activation_function(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3, 4], activ_func=[Logistic(), HyperbolicTangent(), Identity(), Logistic()]) assert_equal(net.ninput, 3) assert_equal(net.noutput, 2) assert_equal(net.nhidden, [2, 3, 4]) assert_equal(net.weights_shape, [(2, 3), (3, 2), (4, 3), (2, 4)]) assert_equal(net.bias_shape, [(2, 1), (3, 1), (4, 1), (2, 1)]) assert_equal(net.nlayers, 4) assert_equal(net.nparams, 43) assert_equal(isinstance(net.activ_func[0], Logistic), True) assert_equal(isinstance(net.activ_func[1], HyperbolicTangent), True) assert_equal(isinstance(net.activ_func[2], Identity), True) assert_equal(isinstance(net.activ_func[3], Logistic), True) def test_raise_exception(self): assert_raises(ValueError, FeedforwardNetwork, ninput=3, noutput=2, nhidden=[2, 3], activ_func=[Logistic(), "bsdfad"]) assert_raises(ValueError, FeedforwardNetwork, ninput=3, noutput=2, nhidden=[2, 3], activ_func=[Logistic()]) class TestDisassembleParams(TestCase): def test_disassemble_params(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] w, b = net.disassemble_params(params) W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] assert_array_almost_equal(w[0], W0) assert_array_almost_equal(w[1], W1) assert_array_almost_equal(w[2], W2) assert_array_almost_equal(b[0], B0) assert_array_almost_equal(b[1], B1) assert_array_almost_equal(b[2], B2) def test_disassemble_params_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = [1111] assert_raises(ValueError, net.disassemble_params, params) class TestAssembleParams(TestCase): def test_assemble_params(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) expected_params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] params = net.assemble_params([W0, W1, W2], [B0, B1, B2]) assert_array_almost_equal(params, expected_params) def test_assemble_params_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) expected_params = [1111, 1112, 1113, 1121, 1122, 1123, 121, 122, 2111, 2112, 2121, 2122, 2131, 2132, 221, 222, 223, 3111, 3112, 3113, 3121, 3122, 3123, 321, 322] W0 = [[1111, 1112, 1113], [1121, 1122, 1123]] W1 = [[2111, 2112], [2121, 2122], [2131, 2132]] W2 = [[3111, 3112, 3113], [3121, 3122, 3123]] B0 = [[121], [122]] B1 = [[221], [222], [223]] B2 = [[321], [322]] assert_raises(ValueError, net.assemble_params, [W0, W1], [B0, B1, B2]) assert_raises(ValueError, net.assemble_params, [W0, W1, W2], [B1, B2]) assert_raises(ValueError, net.assemble_params, [W0, W1, W2], [[1, 2, 3], B1, B2]) assert_raises(ValueError, net.assemble_params, [[1, 2, 3], W1, W2], [B0, B1, B2]) class TestFeedforwardNetworkCall(TestCase): def test_two_hiddenlayer_three_input_two_output(self): l = Logistic() i = Identity() net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 112.1, 0.1122, 1123, 12.1, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) w, b = net.disassemble_params(params) innet = np.asarray([1, 2, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) innet = np.asarray([1.78, -2, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) innet = np.asarray([1, 25, 3]).reshape(3, 1) expected = i(np.dot(w[2], l(np.dot(w[1], l(np.dot(w[0], innet)+b[0]))+b[1]))+b[2]).flatten() assert_array_almost_equal(net(innet, params), expected, decimal=3) def test_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 112.1, 0.1122, 1123, 12.1, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) assert_raises(ValueError, net, [1, 2, 3, 4], params) assert_raises(ValueError, net, [1, 2, 3], params[:-1]) class TestFeedforwardNetworkDerivatives(TestCase): def test_two_hiddenlayer_three_input_two_output(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 1.121, 0.1122, 1123, 1.21, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) x = [0.1, 2.2, 0.34] def call_x(y): return net(y, params) def call_params(theta): return net(x, theta) dx_numeric = nd.Jacobian(call_x)(x) dparams_numeric = nd.Jacobian(call_params)(params) dx, dparams = net.derivatives(x, params) assert_array_almost_equal(dx, dx_numeric) assert_array_almost_equal(dparams, dparams_numeric) def test_three_hiddenlayer_three_input_two_output(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3, 4], activ_func=[Logistic(), HyperbolicTangent(), Identity(), Logistic()]) for i in range(5): params = np.random.normal(size=(net.nparams,)) x = np.random.normal(size=(net.ninput,)) def call_x(y): return net(y, params) def call_params(theta): return net(x, theta) dx_numeric = nd.Jacobian(call_x)(x) dparams_numeric = nd.Jacobian(call_params)(params) dx, dparams = net.derivatives(x, params) assert_array_almost_equal(dx, dx_numeric) assert_array_almost_equal(dparams, dparams_numeric) def test_raise_exception(self): net = FeedforwardNetwork(ninput=3, noutput=2, nhidden=[2, 3], activ_func=Logistic()) params = np.array([1.111, 1.112, 11.13, 112.1, 0.1122, 1123, 12.1, 1.22, 0.2111, 0.2112, 2.121, 2.122, 0.2131, 0.2132, 2.21, 2.22, 0.223, 3.111, 0.3112, 3.113, 0.3121, 0.3122, 0.3123, 0.321, 3.22]) assert_raises(ValueError, net.derivatives, [1, 2, 3, 4], params) assert_raises(ValueError, net.derivatives, [1, 2, 3], params[:-1])
36.291176
100
0.444282
1,291
12,339
4.099923
0.112316
0.009824
0.048177
0.062347
0.815228
0.771585
0.750425
0.743624
0.722275
0.687512
0
0.174498
0.43942
12,339
339
101
36.39823
0.590719
0
0
0.731061
0
0
0.000486
0
0
0
0
0
0.189394
1
0.060606
false
0
0.018939
0.015152
0.113636
0.003788
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
02a53590347033ae9130fd4f499d43a20da025ff
117,806
py
Python
pyidf/pumps.py
marcelosalles/pyidf
c2f744211572b5e14e29522aac1421ba88addb0e
[ "Apache-2.0" ]
19
2015-12-08T23:33:51.000Z
2022-01-31T04:41:10.000Z
pyidf/pumps.py
marcelosalles/pyidf
c2f744211572b5e14e29522aac1421ba88addb0e
[ "Apache-2.0" ]
2
2019-10-04T10:57:00.000Z
2021-10-01T06:46:17.000Z
pyidf/pumps.py
marcelosalles/pyidf
c2f744211572b5e14e29522aac1421ba88addb0e
[ "Apache-2.0" ]
7
2015-11-04T02:25:01.000Z
2021-12-08T03:14:28.000Z
""" Data objects in group "Pumps" """ from collections import OrderedDict import logging from pyidf.helper import DataObject logger = logging.getLogger("pyidf") logger.addHandler(logging.NullHandler()) class PumpVariableSpeed(DataObject): """ Corresponds to IDD object `Pump:VariableSpeed` This pump model is described in the ASHRAE secondary HVAC toolkit. """ _schema = {'extensible-fields': OrderedDict(), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'}), (u'inlet node name', {'name': u'Inlet Node Name', 'pyname': u'inlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'outlet node name', {'name': u'Outlet Node Name', 'pyname': u'outlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'rated flow rate', {'name': u'Rated Flow Rate', 'pyname': u'rated_flow_rate', 'minimum>': 0.0, 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'rated pump head', {'name': u'Rated Pump Head', 'pyname': u'rated_pump_head', 'default': 179352.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'Pa'}), (u'rated power consumption', {'name': u'Rated Power Consumption', 'pyname': u'rated_power_consumption', 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'W'}), (u'motor efficiency', {'name': u'Motor Efficiency', 'pyname': u'motor_efficiency', 'default': 0.9, 'minimum>': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real'}), (u'fraction of motor inefficiencies to fluid stream', {'name': u'Fraction of Motor Inefficiencies to Fluid Stream', 'pyname': u'fraction_of_motor_inefficiencies_to_fluid_stream', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 1 of the part load performance curve', {'name': u'Coefficient 1 of the Part Load Performance Curve', 'pyname': u'coefficient_1_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 2 of the part load performance curve', {'name': u'Coefficient 2 of the Part Load Performance Curve', 'pyname': u'coefficient_2_of_the_part_load_performance_curve', 'default': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 3 of the part load performance curve', {'name': u'Coefficient 3 of the Part Load Performance Curve', 'pyname': u'coefficient_3_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 4 of the part load performance curve', {'name': u'Coefficient 4 of the Part Load Performance Curve', 'pyname': u'coefficient_4_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'minimum flow rate', {'name': u'Minimum Flow Rate', 'pyname': u'minimum_flow_rate', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'pump control type', {'name': u'Pump Control Type', 'pyname': u'pump_control_type', 'default': u'Continuous', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Continuous', u'Intermittent'], 'autocalculatable': False, 'type': 'alpha'}), (u'pump flow rate schedule name', {'name': u'Pump Flow Rate Schedule Name', 'pyname': u'pump_flow_rate_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'pump curve name', {'name': u'Pump Curve Name', 'pyname': u'pump_curve_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'impeller diameter', {'name': u'Impeller Diameter', 'pyname': u'impeller_diameter', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real', 'unit': u'm'}), (u'vfd control type', {'name': u'VFD Control Type', 'pyname': u'vfd_control_type', 'required-field': False, 'autosizable': False, 'accepted-values': [u'ManualControl', u'PressureSetpointControl'], 'autocalculatable': False, 'type': 'alpha'}), (u'pump rpm schedule name', {'name': u'Pump rpm Schedule Name', 'pyname': u'pump_rpm_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'minimum pressure schedule', {'name': u'Minimum Pressure Schedule', 'pyname': u'minimum_pressure_schedule', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list', 'unit': u'Pa'}), (u'maximum pressure schedule', {'name': u'Maximum Pressure Schedule', 'pyname': u'maximum_pressure_schedule', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list', 'unit': u'Pa'}), (u'minimum rpm schedule', {'name': u'Minimum RPM Schedule', 'pyname': u'minimum_rpm_schedule', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list', 'unit': u'Rotations Per Minute'}), (u'maximum rpm schedule', {'name': u'Maximum RPM Schedule', 'pyname': u'maximum_rpm_schedule', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list', 'unit': u'Rotations Per Minute'}), (u'zone name', {'name': u'Zone Name', 'pyname': u'zone_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'skin loss radiative fraction', {'name': u'Skin Loss Radiative Fraction', 'pyname': u'skin_loss_radiative_fraction', 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': u'real'})]), 'format': None, 'group': u'Pumps', 'min-fields': 14, 'name': u'Pump:VariableSpeed', 'pyname': u'PumpVariableSpeed', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value @property def inlet_node_name(self): """field `Inlet Node Name` Args: value (str): value for IDD Field `Inlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `inlet_node_name` or None if not set """ return self["Inlet Node Name"] @inlet_node_name.setter def inlet_node_name(self, value=None): """Corresponds to IDD field `Inlet Node Name`""" self["Inlet Node Name"] = value @property def outlet_node_name(self): """field `Outlet Node Name` Args: value (str): value for IDD Field `Outlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `outlet_node_name` or None if not set """ return self["Outlet Node Name"] @outlet_node_name.setter def outlet_node_name(self, value=None): """Corresponds to IDD field `Outlet Node Name`""" self["Outlet Node Name"] = value @property def rated_flow_rate(self): """field `Rated Flow Rate` | Units: m3/s | IP-Units: gal/min Args: value (float or "Autosize"): value for IDD Field `Rated Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_flow_rate` or None if not set """ return self["Rated Flow Rate"] @rated_flow_rate.setter def rated_flow_rate(self, value=None): """Corresponds to IDD field `Rated Flow Rate`""" self["Rated Flow Rate"] = value @property def rated_pump_head(self): """field `Rated Pump Head` | default head is 60 feet | Units: Pa | IP-Units: ftH2O | Default value: 179352.0 Args: value (float): value for IDD Field `Rated Pump Head` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rated_pump_head` or None if not set """ return self["Rated Pump Head"] @rated_pump_head.setter def rated_pump_head(self, value=179352.0): """Corresponds to IDD field `Rated Pump Head`""" self["Rated Pump Head"] = value @property def rated_power_consumption(self): """field `Rated Power Consumption` | If this field is autosized, an impeller efficiency of 0.78 is assumed. | autosized Rated Power Consumption = Rated Flow Rate * Rated Pump Head / (0.78 * Motor Efficiency) | Units: W | IP-Units: W Args: value (float or "Autosize"): value for IDD Field `Rated Power Consumption` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_power_consumption` or None if not set """ return self["Rated Power Consumption"] @rated_power_consumption.setter def rated_power_consumption(self, value=None): """Corresponds to IDD field `Rated Power Consumption`""" self["Rated Power Consumption"] = value @property def motor_efficiency(self): """field `Motor Efficiency` | This is the motor efficiency only. When the Rated Power Consumption if autosized, | an impeller efficiency of 0.78 is assumed in addition to the motor efficiency. | Default value: 0.9 | value <= 1.0 Args: value (float): value for IDD Field `Motor Efficiency` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `motor_efficiency` or None if not set """ return self["Motor Efficiency"] @motor_efficiency.setter def motor_efficiency(self, value=0.9): """Corresponds to IDD field `Motor Efficiency`""" self["Motor Efficiency"] = value @property def fraction_of_motor_inefficiencies_to_fluid_stream(self): """field `Fraction of Motor Inefficiencies to Fluid Stream` | value <= 1.0 Args: value (float): value for IDD Field `Fraction of Motor Inefficiencies to Fluid Stream` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `fraction_of_motor_inefficiencies_to_fluid_stream` or None if not set """ return self["Fraction of Motor Inefficiencies to Fluid Stream"] @fraction_of_motor_inefficiencies_to_fluid_stream.setter def fraction_of_motor_inefficiencies_to_fluid_stream(self, value=None): """Corresponds to IDD field `Fraction of Motor Inefficiencies to Fluid Stream`""" self["Fraction of Motor Inefficiencies to Fluid Stream"] = value @property def coefficient_1_of_the_part_load_performance_curve(self): """field `Coefficient 1 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 1 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_1_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 1 of the Part Load Performance Curve"] @coefficient_1_of_the_part_load_performance_curve.setter def coefficient_1_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 1 of the Part Load Performance Curve`""" self["Coefficient 1 of the Part Load Performance Curve"] = value @property def coefficient_2_of_the_part_load_performance_curve(self): """field `Coefficient 2 of the Part Load Performance Curve` | Default value: 1.0 Args: value (float): value for IDD Field `Coefficient 2 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_2_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 2 of the Part Load Performance Curve"] @coefficient_2_of_the_part_load_performance_curve.setter def coefficient_2_of_the_part_load_performance_curve(self, value=1.0): """Corresponds to IDD field `Coefficient 2 of the Part Load Performance Curve`""" self["Coefficient 2 of the Part Load Performance Curve"] = value @property def coefficient_3_of_the_part_load_performance_curve(self): """field `Coefficient 3 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 3 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_3_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 3 of the Part Load Performance Curve"] @coefficient_3_of_the_part_load_performance_curve.setter def coefficient_3_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 3 of the Part Load Performance Curve`""" self["Coefficient 3 of the Part Load Performance Curve"] = value @property def coefficient_4_of_the_part_load_performance_curve(self): """field `Coefficient 4 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 4 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_4_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 4 of the Part Load Performance Curve"] @coefficient_4_of_the_part_load_performance_curve.setter def coefficient_4_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 4 of the Part Load Performance Curve`""" self["Coefficient 4 of the Part Load Performance Curve"] = value @property def minimum_flow_rate(self): """field `Minimum Flow Rate` | This value can be zero and will be defaulted to that if not specified. | Units: m3/s | IP-Units: gal/min Args: value (float): value for IDD Field `Minimum Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `minimum_flow_rate` or None if not set """ return self["Minimum Flow Rate"] @minimum_flow_rate.setter def minimum_flow_rate(self, value=None): """Corresponds to IDD field `Minimum Flow Rate`""" self["Minimum Flow Rate"] = value @property def pump_control_type(self): """field `Pump Control Type` | Default value: Continuous Args: value (str): value for IDD Field `Pump Control Type` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_control_type` or None if not set """ return self["Pump Control Type"] @pump_control_type.setter def pump_control_type(self, value="Continuous"): """Corresponds to IDD field `Pump Control Type`""" self["Pump Control Type"] = value @property def pump_flow_rate_schedule_name(self): """field `Pump Flow Rate Schedule Name` | Modifies the rated flow rate of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump Flow Rate Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_flow_rate_schedule_name` or None if not set """ return self["Pump Flow Rate Schedule Name"] @pump_flow_rate_schedule_name.setter def pump_flow_rate_schedule_name(self, value=None): """Corresponds to IDD field `Pump Flow Rate Schedule Name`""" self["Pump Flow Rate Schedule Name"] = value @property def pump_curve_name(self): """field `Pump Curve Name` | This references any single independent variable polynomial curve in order to | do pressure vs. flow calculations for this pump. The available types are then: | Linear, Quadratic, Cubic, and Quartic | The non-dimensional pump pressure relationship is of the following form: | (psi = C4*phi^4 + C3*phi^3 + C2*phi^2 + C1*phi + C0) | Where the non-dimensional variables are defined as: | delP = rho * ((N/60)^2) * (D^2) * psi | mdot = rho * (N/60) * (D^3) * phi Args: value (str): value for IDD Field `Pump Curve Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_curve_name` or None if not set """ return self["Pump Curve Name"] @pump_curve_name.setter def pump_curve_name(self, value=None): """Corresponds to IDD field `Pump Curve Name`""" self["Pump Curve Name"] = value @property def impeller_diameter(self): """field `Impeller Diameter` | "D" in above expression in field A6 | Units: m Args: value (float): value for IDD Field `Impeller Diameter` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `impeller_diameter` or None if not set """ return self["Impeller Diameter"] @impeller_diameter.setter def impeller_diameter(self, value=None): """Corresponds to IDD field `Impeller Diameter`""" self["Impeller Diameter"] = value @property def vfd_control_type(self): """field `VFD Control Type` Args: value (str): value for IDD Field `VFD Control Type` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `vfd_control_type` or None if not set """ return self["VFD Control Type"] @vfd_control_type.setter def vfd_control_type(self, value=None): """Corresponds to IDD field `VFD Control Type`""" self["VFD Control Type"] = value @property def pump_rpm_schedule_name(self): """field `Pump rpm Schedule Name` | Modifies the rpm of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump rpm Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_rpm_schedule_name` or None if not set """ return self["Pump rpm Schedule Name"] @pump_rpm_schedule_name.setter def pump_rpm_schedule_name(self, value=None): """Corresponds to IDD field `Pump rpm Schedule Name`""" self["Pump rpm Schedule Name"] = value @property def minimum_pressure_schedule(self): """field `Minimum Pressure Schedule` | Units: Pa Args: value (str): value for IDD Field `Minimum Pressure Schedule` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `minimum_pressure_schedule` or None if not set """ return self["Minimum Pressure Schedule"] @minimum_pressure_schedule.setter def minimum_pressure_schedule(self, value=None): """Corresponds to IDD field `Minimum Pressure Schedule`""" self["Minimum Pressure Schedule"] = value @property def maximum_pressure_schedule(self): """field `Maximum Pressure Schedule` | Units: Pa Args: value (str): value for IDD Field `Maximum Pressure Schedule` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `maximum_pressure_schedule` or None if not set """ return self["Maximum Pressure Schedule"] @maximum_pressure_schedule.setter def maximum_pressure_schedule(self, value=None): """Corresponds to IDD field `Maximum Pressure Schedule`""" self["Maximum Pressure Schedule"] = value @property def minimum_rpm_schedule(self): """field `Minimum RPM Schedule` | Units: Rotations Per Minute Args: value (str): value for IDD Field `Minimum RPM Schedule` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `minimum_rpm_schedule` or None if not set """ return self["Minimum RPM Schedule"] @minimum_rpm_schedule.setter def minimum_rpm_schedule(self, value=None): """Corresponds to IDD field `Minimum RPM Schedule`""" self["Minimum RPM Schedule"] = value @property def maximum_rpm_schedule(self): """field `Maximum RPM Schedule` | Units: Rotations Per Minute Args: value (str): value for IDD Field `Maximum RPM Schedule` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `maximum_rpm_schedule` or None if not set """ return self["Maximum RPM Schedule"] @maximum_rpm_schedule.setter def maximum_rpm_schedule(self, value=None): """Corresponds to IDD field `Maximum RPM Schedule`""" self["Maximum RPM Schedule"] = value @property def zone_name(self): """field `Zone Name` | optional, if used pump losses transfered to zone as internal gains Args: value (str): value for IDD Field `Zone Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `zone_name` or None if not set """ return self["Zone Name"] @zone_name.setter def zone_name(self, value=None): """Corresponds to IDD field `Zone Name`""" self["Zone Name"] = value @property def skin_loss_radiative_fraction(self): """field `Skin Loss Radiative Fraction` | optional. If zone identified in previous field then this determines | the split between convection and radiation for the skin losses | value <= 1.0 Args: value (float): value for IDD Field `Skin Loss Radiative Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `skin_loss_radiative_fraction` or None if not set """ return self["Skin Loss Radiative Fraction"] @skin_loss_radiative_fraction.setter def skin_loss_radiative_fraction(self, value=None): """Corresponds to IDD field `Skin Loss Radiative Fraction`""" self["Skin Loss Radiative Fraction"] = value class PumpConstantSpeed(DataObject): """ Corresponds to IDD object `Pump:ConstantSpeed` This pump model is described in the ASHRAE secondary HVAC toolkit. """ _schema = {'extensible-fields': OrderedDict(), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'}), (u'inlet node name', {'name': u'Inlet Node Name', 'pyname': u'inlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'outlet node name', {'name': u'Outlet Node Name', 'pyname': u'outlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'rated flow rate', {'name': u'Rated Flow Rate', 'pyname': u'rated_flow_rate', 'minimum>': 0.0, 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'rated pump head', {'name': u'Rated Pump Head', 'pyname': u'rated_pump_head', 'default': 179352.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'Pa'}), (u'rated power consumption', {'name': u'Rated Power Consumption', 'pyname': u'rated_power_consumption', 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'W'}), (u'motor efficiency', {'name': u'Motor Efficiency', 'pyname': u'motor_efficiency', 'default': 0.9, 'minimum>': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real'}), (u'fraction of motor inefficiencies to fluid stream', {'name': u'Fraction of Motor Inefficiencies to Fluid Stream', 'pyname': u'fraction_of_motor_inefficiencies_to_fluid_stream', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'pump control type', {'name': u'Pump Control Type', 'pyname': u'pump_control_type', 'default': u'Continuous', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Continuous', u'Intermittent'], 'autocalculatable': False, 'type': 'alpha'}), (u'pump flow rate schedule name', {'name': u'Pump Flow Rate Schedule Name', 'pyname': u'pump_flow_rate_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'pump curve name', {'name': u'Pump Curve Name', 'pyname': u'pump_curve_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'impeller diameter', {'name': u'Impeller Diameter', 'pyname': u'impeller_diameter', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real', 'unit': u'm'}), (u'rotational speed', {'name': u'Rotational Speed', 'pyname': u'rotational_speed', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real', 'unit': u'rev/min'}), (u'zone name', {'name': u'Zone Name', 'pyname': u'zone_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'skin loss radiative fraction', {'name': u'Skin Loss Radiative Fraction', 'pyname': u'skin_loss_radiative_fraction', 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': u'real'})]), 'format': None, 'group': u'Pumps', 'min-fields': 9, 'name': u'Pump:ConstantSpeed', 'pyname': u'PumpConstantSpeed', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value @property def inlet_node_name(self): """field `Inlet Node Name` Args: value (str): value for IDD Field `Inlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `inlet_node_name` or None if not set """ return self["Inlet Node Name"] @inlet_node_name.setter def inlet_node_name(self, value=None): """Corresponds to IDD field `Inlet Node Name`""" self["Inlet Node Name"] = value @property def outlet_node_name(self): """field `Outlet Node Name` Args: value (str): value for IDD Field `Outlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `outlet_node_name` or None if not set """ return self["Outlet Node Name"] @outlet_node_name.setter def outlet_node_name(self, value=None): """Corresponds to IDD field `Outlet Node Name`""" self["Outlet Node Name"] = value @property def rated_flow_rate(self): """field `Rated Flow Rate` | Units: m3/s | IP-Units: gal/min Args: value (float or "Autosize"): value for IDD Field `Rated Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_flow_rate` or None if not set """ return self["Rated Flow Rate"] @rated_flow_rate.setter def rated_flow_rate(self, value=None): """Corresponds to IDD field `Rated Flow Rate`""" self["Rated Flow Rate"] = value @property def rated_pump_head(self): """field `Rated Pump Head` | default head is 60 feet | Units: Pa | IP-Units: ftH2O | Default value: 179352.0 Args: value (float): value for IDD Field `Rated Pump Head` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rated_pump_head` or None if not set """ return self["Rated Pump Head"] @rated_pump_head.setter def rated_pump_head(self, value=179352.0): """Corresponds to IDD field `Rated Pump Head`""" self["Rated Pump Head"] = value @property def rated_power_consumption(self): """field `Rated Power Consumption` | If this field is autosized, an impeller efficiency of 0.78 is assumed. | autosized Rated Power Consumption = Rated Flow Rate * Rated Pump Head / (0.78 * Motor Efficiency) | Units: W | IP-Units: W Args: value (float or "Autosize"): value for IDD Field `Rated Power Consumption` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_power_consumption` or None if not set """ return self["Rated Power Consumption"] @rated_power_consumption.setter def rated_power_consumption(self, value=None): """Corresponds to IDD field `Rated Power Consumption`""" self["Rated Power Consumption"] = value @property def motor_efficiency(self): """field `Motor Efficiency` | This is the motor efficiency only. When the Rated Power Consumption if autosized, | an impeller efficiency of 0.78 is assumed in addition to the motor efficiency. | Default value: 0.9 | value <= 1.0 Args: value (float): value for IDD Field `Motor Efficiency` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `motor_efficiency` or None if not set """ return self["Motor Efficiency"] @motor_efficiency.setter def motor_efficiency(self, value=0.9): """Corresponds to IDD field `Motor Efficiency`""" self["Motor Efficiency"] = value @property def fraction_of_motor_inefficiencies_to_fluid_stream(self): """field `Fraction of Motor Inefficiencies to Fluid Stream` | value <= 1.0 Args: value (float): value for IDD Field `Fraction of Motor Inefficiencies to Fluid Stream` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `fraction_of_motor_inefficiencies_to_fluid_stream` or None if not set """ return self["Fraction of Motor Inefficiencies to Fluid Stream"] @fraction_of_motor_inefficiencies_to_fluid_stream.setter def fraction_of_motor_inefficiencies_to_fluid_stream(self, value=None): """Corresponds to IDD field `Fraction of Motor Inefficiencies to Fluid Stream`""" self["Fraction of Motor Inefficiencies to Fluid Stream"] = value @property def pump_control_type(self): """field `Pump Control Type` | Default value: Continuous Args: value (str): value for IDD Field `Pump Control Type` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_control_type` or None if not set """ return self["Pump Control Type"] @pump_control_type.setter def pump_control_type(self, value="Continuous"): """Corresponds to IDD field `Pump Control Type`""" self["Pump Control Type"] = value @property def pump_flow_rate_schedule_name(self): """field `Pump Flow Rate Schedule Name` | Modifies the rated flow rate of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump Flow Rate Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_flow_rate_schedule_name` or None if not set """ return self["Pump Flow Rate Schedule Name"] @pump_flow_rate_schedule_name.setter def pump_flow_rate_schedule_name(self, value=None): """Corresponds to IDD field `Pump Flow Rate Schedule Name`""" self["Pump Flow Rate Schedule Name"] = value @property def pump_curve_name(self): """field `Pump Curve Name` | This references any single independent variable polynomial curve in order to | do pressure vs. flow calculations for this pump. The available types are then: | Linear, Quadratic, Cubic, and Quartic | The non-dimensional pump pressure relationship is of the following form: | (psi = C4*phi^4 + C3*phi^3 + C2*phi^2 + C1*phi + C0) | Where the non-dimensional variables are defined as: | delP = rho * ((N/60)^2) * (D^2) * psi | mdot = rho * (N/60) * (D^3) * phi Args: value (str): value for IDD Field `Pump Curve Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_curve_name` or None if not set """ return self["Pump Curve Name"] @pump_curve_name.setter def pump_curve_name(self, value=None): """Corresponds to IDD field `Pump Curve Name`""" self["Pump Curve Name"] = value @property def impeller_diameter(self): """field `Impeller Diameter` | "D" in above expression in field A6 | Units: m Args: value (float): value for IDD Field `Impeller Diameter` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `impeller_diameter` or None if not set """ return self["Impeller Diameter"] @impeller_diameter.setter def impeller_diameter(self, value=None): """Corresponds to IDD field `Impeller Diameter`""" self["Impeller Diameter"] = value @property def rotational_speed(self): """field `Rotational Speed` | "N" in above expression in field A6 | Units: rev/min Args: value (float): value for IDD Field `Rotational Speed` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rotational_speed` or None if not set """ return self["Rotational Speed"] @rotational_speed.setter def rotational_speed(self, value=None): """Corresponds to IDD field `Rotational Speed`""" self["Rotational Speed"] = value @property def zone_name(self): """field `Zone Name` | optional, if used pump losses transfered to zone as internal gains Args: value (str): value for IDD Field `Zone Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `zone_name` or None if not set """ return self["Zone Name"] @zone_name.setter def zone_name(self, value=None): """Corresponds to IDD field `Zone Name`""" self["Zone Name"] = value @property def skin_loss_radiative_fraction(self): """field `Skin Loss Radiative Fraction` | optional. If zone identified in previous field then this determines | the split between convection and radiation for the skin losses | value <= 1.0 Args: value (float): value for IDD Field `Skin Loss Radiative Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `skin_loss_radiative_fraction` or None if not set """ return self["Skin Loss Radiative Fraction"] @skin_loss_radiative_fraction.setter def skin_loss_radiative_fraction(self, value=None): """Corresponds to IDD field `Skin Loss Radiative Fraction`""" self["Skin Loss Radiative Fraction"] = value class PumpVariableSpeedCondensate(DataObject): """ Corresponds to IDD object `Pump:VariableSpeed:Condensate` This pump model is described in the ASHRAE secondary HVAC toolkit. Variable Speed Condensate pump for Steam Systems """ _schema = {'extensible-fields': OrderedDict(), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'}), (u'inlet node name', {'name': u'Inlet Node Name', 'pyname': u'inlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'outlet node name', {'name': u'Outlet Node Name', 'pyname': u'outlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'rated flow rate', {'name': u'Rated Flow Rate', 'pyname': u'rated_flow_rate', 'minimum>': 0.0, 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'rated pump head', {'name': u'Rated Pump Head', 'pyname': u'rated_pump_head', 'default': 179352.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'Pa'}), (u'rated power consumption', {'name': u'Rated Power Consumption', 'pyname': u'rated_power_consumption', 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'W'}), (u'motor efficiency', {'name': u'Motor Efficiency', 'pyname': u'motor_efficiency', 'default': 0.9, 'minimum>': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real'}), (u'fraction of motor inefficiencies to fluid stream', {'name': u'Fraction of Motor Inefficiencies to Fluid Stream', 'pyname': u'fraction_of_motor_inefficiencies_to_fluid_stream', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 1 of the part load performance curve', {'name': u'Coefficient 1 of the Part Load Performance Curve', 'pyname': u'coefficient_1_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 2 of the part load performance curve', {'name': u'Coefficient 2 of the Part Load Performance Curve', 'pyname': u'coefficient_2_of_the_part_load_performance_curve', 'default': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 3 of the part load performance curve', {'name': u'Coefficient 3 of the Part Load Performance Curve', 'pyname': u'coefficient_3_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 4 of the part load performance curve', {'name': u'Coefficient 4 of the Part Load Performance Curve', 'pyname': u'coefficient_4_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'pump flow rate schedule name', {'name': u'Pump Flow Rate Schedule Name', 'pyname': u'pump_flow_rate_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'zone name', {'name': u'Zone Name', 'pyname': u'zone_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'skin loss radiative fraction', {'name': u'Skin Loss Radiative Fraction', 'pyname': u'skin_loss_radiative_fraction', 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': u'real'})]), 'format': None, 'group': u'Pumps', 'min-fields': 13, 'name': u'Pump:VariableSpeed:Condensate', 'pyname': u'PumpVariableSpeedCondensate', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value @property def inlet_node_name(self): """field `Inlet Node Name` Args: value (str): value for IDD Field `Inlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `inlet_node_name` or None if not set """ return self["Inlet Node Name"] @inlet_node_name.setter def inlet_node_name(self, value=None): """Corresponds to IDD field `Inlet Node Name`""" self["Inlet Node Name"] = value @property def outlet_node_name(self): """field `Outlet Node Name` Args: value (str): value for IDD Field `Outlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `outlet_node_name` or None if not set """ return self["Outlet Node Name"] @outlet_node_name.setter def outlet_node_name(self, value=None): """Corresponds to IDD field `Outlet Node Name`""" self["Outlet Node Name"] = value @property def rated_flow_rate(self): """field `Rated Flow Rate` | Units: m3/s | IP-Units: gal/min Args: value (float or "Autosize"): value for IDD Field `Rated Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_flow_rate` or None if not set """ return self["Rated Flow Rate"] @rated_flow_rate.setter def rated_flow_rate(self, value=None): """Corresponds to IDD field `Rated Flow Rate`""" self["Rated Flow Rate"] = value @property def rated_pump_head(self): """field `Rated Pump Head` | default head is 60 feet | Units: Pa | IP-Units: ftH2O | Default value: 179352.0 Args: value (float): value for IDD Field `Rated Pump Head` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rated_pump_head` or None if not set """ return self["Rated Pump Head"] @rated_pump_head.setter def rated_pump_head(self, value=179352.0): """Corresponds to IDD field `Rated Pump Head`""" self["Rated Pump Head"] = value @property def rated_power_consumption(self): """field `Rated Power Consumption` | If this field is autosized, an impeller efficiency of 0.78 is assumed. | autosized Rated Power Consumption = Rated Flow Rate * Rated Pump Head / (0.78 * Motor Efficiency) | Units: W | IP-Units: W Args: value (float or "Autosize"): value for IDD Field `Rated Power Consumption` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_power_consumption` or None if not set """ return self["Rated Power Consumption"] @rated_power_consumption.setter def rated_power_consumption(self, value=None): """Corresponds to IDD field `Rated Power Consumption`""" self["Rated Power Consumption"] = value @property def motor_efficiency(self): """field `Motor Efficiency` | This is the motor efficiency only. When the Rated Power Consumption if autosized, | an impeller efficiency of 0.78 is assumed in addition to the motor efficiency. | Default value: 0.9 | value <= 1.0 Args: value (float): value for IDD Field `Motor Efficiency` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `motor_efficiency` or None if not set """ return self["Motor Efficiency"] @motor_efficiency.setter def motor_efficiency(self, value=0.9): """Corresponds to IDD field `Motor Efficiency`""" self["Motor Efficiency"] = value @property def fraction_of_motor_inefficiencies_to_fluid_stream(self): """field `Fraction of Motor Inefficiencies to Fluid Stream` | value <= 1.0 Args: value (float): value for IDD Field `Fraction of Motor Inefficiencies to Fluid Stream` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `fraction_of_motor_inefficiencies_to_fluid_stream` or None if not set """ return self["Fraction of Motor Inefficiencies to Fluid Stream"] @fraction_of_motor_inefficiencies_to_fluid_stream.setter def fraction_of_motor_inefficiencies_to_fluid_stream(self, value=None): """Corresponds to IDD field `Fraction of Motor Inefficiencies to Fluid Stream`""" self["Fraction of Motor Inefficiencies to Fluid Stream"] = value @property def coefficient_1_of_the_part_load_performance_curve(self): """field `Coefficient 1 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 1 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_1_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 1 of the Part Load Performance Curve"] @coefficient_1_of_the_part_load_performance_curve.setter def coefficient_1_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 1 of the Part Load Performance Curve`""" self["Coefficient 1 of the Part Load Performance Curve"] = value @property def coefficient_2_of_the_part_load_performance_curve(self): """field `Coefficient 2 of the Part Load Performance Curve` | Default value: 1.0 Args: value (float): value for IDD Field `Coefficient 2 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_2_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 2 of the Part Load Performance Curve"] @coefficient_2_of_the_part_load_performance_curve.setter def coefficient_2_of_the_part_load_performance_curve(self, value=1.0): """Corresponds to IDD field `Coefficient 2 of the Part Load Performance Curve`""" self["Coefficient 2 of the Part Load Performance Curve"] = value @property def coefficient_3_of_the_part_load_performance_curve(self): """field `Coefficient 3 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 3 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_3_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 3 of the Part Load Performance Curve"] @coefficient_3_of_the_part_load_performance_curve.setter def coefficient_3_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 3 of the Part Load Performance Curve`""" self["Coefficient 3 of the Part Load Performance Curve"] = value @property def coefficient_4_of_the_part_load_performance_curve(self): """field `Coefficient 4 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 4 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_4_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 4 of the Part Load Performance Curve"] @coefficient_4_of_the_part_load_performance_curve.setter def coefficient_4_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 4 of the Part Load Performance Curve`""" self["Coefficient 4 of the Part Load Performance Curve"] = value @property def pump_flow_rate_schedule_name(self): """field `Pump Flow Rate Schedule Name` | Modifies the rated flow rate of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump Flow Rate Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_flow_rate_schedule_name` or None if not set """ return self["Pump Flow Rate Schedule Name"] @pump_flow_rate_schedule_name.setter def pump_flow_rate_schedule_name(self, value=None): """Corresponds to IDD field `Pump Flow Rate Schedule Name`""" self["Pump Flow Rate Schedule Name"] = value @property def zone_name(self): """field `Zone Name` | optional, if used pump losses transfered to zone as internal gains Args: value (str): value for IDD Field `Zone Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `zone_name` or None if not set """ return self["Zone Name"] @zone_name.setter def zone_name(self, value=None): """Corresponds to IDD field `Zone Name`""" self["Zone Name"] = value @property def skin_loss_radiative_fraction(self): """field `Skin Loss Radiative Fraction` | optional. If zone identified in previous field then this determines | the split between convection and radiation for the skin losses | value <= 1.0 Args: value (float): value for IDD Field `Skin Loss Radiative Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `skin_loss_radiative_fraction` or None if not set """ return self["Skin Loss Radiative Fraction"] @skin_loss_radiative_fraction.setter def skin_loss_radiative_fraction(self, value=None): """Corresponds to IDD field `Skin Loss Radiative Fraction`""" self["Skin Loss Radiative Fraction"] = value class HeaderedPumpsConstantSpeed(DataObject): """ Corresponds to IDD object `HeaderedPumps:ConstantSpeed` This Headered pump object describes a pump bank with more than 1 pump in parallel """ _schema = {'extensible-fields': OrderedDict(), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'}), (u'inlet node name', {'name': u'Inlet Node Name', 'pyname': u'inlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'outlet node name', {'name': u'Outlet Node Name', 'pyname': u'outlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'total rated flow rate', {'name': u'Total Rated Flow Rate', 'pyname': u'total_rated_flow_rate', 'minimum>': 0.0, 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'number of pumps in bank', {'name': u'Number of Pumps in Bank', 'pyname': u'number_of_pumps_in_bank', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'integer'}), (u'flow sequencing control scheme', {'name': u'Flow Sequencing Control Scheme', 'pyname': u'flow_sequencing_control_scheme', 'default': u'Sequential', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Sequential'], 'autocalculatable': False, 'type': 'alpha'}), (u'rated pump head', {'name': u'Rated Pump Head', 'pyname': u'rated_pump_head', 'default': 179352.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'Pa'}), (u'rated power consumption', {'name': u'Rated Power Consumption', 'pyname': u'rated_power_consumption', 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'W'}), (u'motor efficiency', {'name': u'Motor Efficiency', 'pyname': u'motor_efficiency', 'default': 0.9, 'minimum>': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real'}), (u'fraction of motor inefficiencies to fluid stream', {'name': u'Fraction of Motor Inefficiencies to Fluid Stream', 'pyname': u'fraction_of_motor_inefficiencies_to_fluid_stream', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'pump control type', {'name': u'Pump Control Type', 'pyname': u'pump_control_type', 'default': u'Continuous', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Continuous', u'Intermittent'], 'autocalculatable': False, 'type': 'alpha'}), (u'pump flow rate schedule name', {'name': u'Pump Flow Rate Schedule Name', 'pyname': u'pump_flow_rate_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'zone name', {'name': u'Zone Name', 'pyname': u'zone_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'skin loss radiative fraction', {'name': u'Skin Loss Radiative Fraction', 'pyname': u'skin_loss_radiative_fraction', 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': u'real'})]), 'format': None, 'group': u'Pumps', 'min-fields': 9, 'name': u'HeaderedPumps:ConstantSpeed', 'pyname': u'HeaderedPumpsConstantSpeed', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value @property def inlet_node_name(self): """field `Inlet Node Name` Args: value (str): value for IDD Field `Inlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `inlet_node_name` or None if not set """ return self["Inlet Node Name"] @inlet_node_name.setter def inlet_node_name(self, value=None): """Corresponds to IDD field `Inlet Node Name`""" self["Inlet Node Name"] = value @property def outlet_node_name(self): """field `Outlet Node Name` Args: value (str): value for IDD Field `Outlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `outlet_node_name` or None if not set """ return self["Outlet Node Name"] @outlet_node_name.setter def outlet_node_name(self, value=None): """Corresponds to IDD field `Outlet Node Name`""" self["Outlet Node Name"] = value @property def total_rated_flow_rate(self): """field `Total Rated Flow Rate` | If the field is not autosized set to the flow rate to | the total flow when all pumps are running at full load | Units: m3/s | IP-Units: gal/min Args: value (float or "Autosize"): value for IDD Field `Total Rated Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `total_rated_flow_rate` or None if not set """ return self["Total Rated Flow Rate"] @total_rated_flow_rate.setter def total_rated_flow_rate(self, value=None): """Corresponds to IDD field `Total Rated Flow Rate`""" self["Total Rated Flow Rate"] = value @property def number_of_pumps_in_bank(self): """field `Number of Pumps in Bank` Args: value (int): value for IDD Field `Number of Pumps in Bank` Raises: ValueError: if `value` is not a valid value Returns: int: the value of `number_of_pumps_in_bank` or None if not set """ return self["Number of Pumps in Bank"] @number_of_pumps_in_bank.setter def number_of_pumps_in_bank(self, value=None): """Corresponds to IDD field `Number of Pumps in Bank`""" self["Number of Pumps in Bank"] = value @property def flow_sequencing_control_scheme(self): """field `Flow Sequencing Control Scheme` | Default value: Sequential Args: value (str): value for IDD Field `Flow Sequencing Control Scheme` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `flow_sequencing_control_scheme` or None if not set """ return self["Flow Sequencing Control Scheme"] @flow_sequencing_control_scheme.setter def flow_sequencing_control_scheme(self, value="Sequential"): """Corresponds to IDD field `Flow Sequencing Control Scheme`""" self["Flow Sequencing Control Scheme"] = value @property def rated_pump_head(self): """field `Rated Pump Head` | default head is 60 feet | Units: Pa | IP-Units: ftH2O | Default value: 179352.0 Args: value (float): value for IDD Field `Rated Pump Head` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rated_pump_head` or None if not set """ return self["Rated Pump Head"] @rated_pump_head.setter def rated_pump_head(self, value=179352.0): """Corresponds to IDD field `Rated Pump Head`""" self["Rated Pump Head"] = value @property def rated_power_consumption(self): """field `Rated Power Consumption` | If the field is not autosized set to the power consumed by the pump bank | when all the pumps are running at nominal flow | If this field is autosized, an impeller efficiency of 0.78 is assumed. | autosized Rated Power Consumption = Total Rated Flow Rate * Rated Pump Head / (0.78 * Motor Efficiency) | Units: W | IP-Units: W Args: value (float or "Autosize"): value for IDD Field `Rated Power Consumption` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_power_consumption` or None if not set """ return self["Rated Power Consumption"] @rated_power_consumption.setter def rated_power_consumption(self, value=None): """Corresponds to IDD field `Rated Power Consumption`""" self["Rated Power Consumption"] = value @property def motor_efficiency(self): """field `Motor Efficiency` | This is the motor efficiency only. When the Rated Power Consumption if autosized, | an impeller efficiency of 0.78 is assumed in addition to the motor efficiency. | Default value: 0.9 | value <= 1.0 Args: value (float): value for IDD Field `Motor Efficiency` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `motor_efficiency` or None if not set """ return self["Motor Efficiency"] @motor_efficiency.setter def motor_efficiency(self, value=0.9): """Corresponds to IDD field `Motor Efficiency`""" self["Motor Efficiency"] = value @property def fraction_of_motor_inefficiencies_to_fluid_stream(self): """field `Fraction of Motor Inefficiencies to Fluid Stream` | value <= 1.0 Args: value (float): value for IDD Field `Fraction of Motor Inefficiencies to Fluid Stream` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `fraction_of_motor_inefficiencies_to_fluid_stream` or None if not set """ return self["Fraction of Motor Inefficiencies to Fluid Stream"] @fraction_of_motor_inefficiencies_to_fluid_stream.setter def fraction_of_motor_inefficiencies_to_fluid_stream(self, value=None): """Corresponds to IDD field `Fraction of Motor Inefficiencies to Fluid Stream`""" self["Fraction of Motor Inefficiencies to Fluid Stream"] = value @property def pump_control_type(self): """field `Pump Control Type` | Default value: Continuous Args: value (str): value for IDD Field `Pump Control Type` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_control_type` or None if not set """ return self["Pump Control Type"] @pump_control_type.setter def pump_control_type(self, value="Continuous"): """Corresponds to IDD field `Pump Control Type`""" self["Pump Control Type"] = value @property def pump_flow_rate_schedule_name(self): """field `Pump Flow Rate Schedule Name` | Modifies the rated flow rate of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump Flow Rate Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_flow_rate_schedule_name` or None if not set """ return self["Pump Flow Rate Schedule Name"] @pump_flow_rate_schedule_name.setter def pump_flow_rate_schedule_name(self, value=None): """Corresponds to IDD field `Pump Flow Rate Schedule Name`""" self["Pump Flow Rate Schedule Name"] = value @property def zone_name(self): """field `Zone Name` | optional, if used pump losses transfered to zone as internal gains Args: value (str): value for IDD Field `Zone Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `zone_name` or None if not set """ return self["Zone Name"] @zone_name.setter def zone_name(self, value=None): """Corresponds to IDD field `Zone Name`""" self["Zone Name"] = value @property def skin_loss_radiative_fraction(self): """field `Skin Loss Radiative Fraction` | optional. If zone identified in previous field then this determines | the split between convection and radiation for the skin losses | value <= 1.0 Args: value (float): value for IDD Field `Skin Loss Radiative Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `skin_loss_radiative_fraction` or None if not set """ return self["Skin Loss Radiative Fraction"] @skin_loss_radiative_fraction.setter def skin_loss_radiative_fraction(self, value=None): """Corresponds to IDD field `Skin Loss Radiative Fraction`""" self["Skin Loss Radiative Fraction"] = value class HeaderedPumpsVariableSpeed(DataObject): """ Corresponds to IDD object `HeaderedPumps:VariableSpeed` This Headered pump object describes a pump bank with more than 1 pump in parallel """ _schema = {'extensible-fields': OrderedDict(), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'}), (u'inlet node name', {'name': u'Inlet Node Name', 'pyname': u'inlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'outlet node name', {'name': u'Outlet Node Name', 'pyname': u'outlet_node_name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': u'node'}), (u'total rated flow rate', {'name': u'Total Rated Flow Rate', 'pyname': u'total_rated_flow_rate', 'minimum>': 0.0, 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'm3/s'}), (u'number of pumps in bank', {'name': u'Number of Pumps in Bank', 'pyname': u'number_of_pumps_in_bank', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'integer'}), (u'flow sequencing control scheme', {'name': u'Flow Sequencing Control Scheme', 'pyname': u'flow_sequencing_control_scheme', 'default': u'Sequential', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Sequential'], 'autocalculatable': False, 'type': 'alpha'}), (u'rated pump head', {'name': u'Rated Pump Head', 'pyname': u'rated_pump_head', 'default': 179352.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real', 'unit': u'Pa'}), (u'rated power consumption', {'name': u'Rated Power Consumption', 'pyname': u'rated_power_consumption', 'required-field': False, 'autosizable': True, 'autocalculatable': False, 'type': 'real', 'unit': u'W'}), (u'motor efficiency', {'name': u'Motor Efficiency', 'pyname': u'motor_efficiency', 'default': 0.9, 'minimum>': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'real'}), (u'fraction of motor inefficiencies to fluid stream', {'name': u'Fraction of Motor Inefficiencies to Fluid Stream', 'pyname': u'fraction_of_motor_inefficiencies_to_fluid_stream', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 1 of the part load performance curve', {'name': u'Coefficient 1 of the Part Load Performance Curve', 'pyname': u'coefficient_1_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 2 of the part load performance curve', {'name': u'Coefficient 2 of the Part Load Performance Curve', 'pyname': u'coefficient_2_of_the_part_load_performance_curve', 'default': 1.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 3 of the part load performance curve', {'name': u'Coefficient 3 of the Part Load Performance Curve', 'pyname': u'coefficient_3_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'coefficient 4 of the part load performance curve', {'name': u'Coefficient 4 of the Part Load Performance Curve', 'pyname': u'coefficient_4_of_the_part_load_performance_curve', 'default': 0.0, 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': 'real'}), (u'minimum flow rate fraction', {'name': u'Minimum Flow Rate Fraction', 'pyname': u'minimum_flow_rate_fraction', 'default': 0.0, 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': 'real'}), (u'pump control type', {'name': u'Pump Control Type', 'pyname': u'pump_control_type', 'default': u'Continuous', 'required-field': False, 'autosizable': False, 'accepted-values': [u'Continuous', u'Intermittent'], 'autocalculatable': False, 'type': 'alpha'}), (u'pump flow rate schedule name', {'name': u'Pump Flow Rate Schedule Name', 'pyname': u'pump_flow_rate_schedule_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'zone name', {'name': u'Zone Name', 'pyname': u'zone_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'}), (u'skin loss radiative fraction', {'name': u'Skin Loss Radiative Fraction', 'pyname': u'skin_loss_radiative_fraction', 'maximum': 1.0, 'required-field': False, 'autosizable': False, 'minimum': 0.0, 'autocalculatable': False, 'type': u'real'})]), 'format': None, 'group': u'Pumps', 'min-fields': 14, 'name': u'HeaderedPumps:VariableSpeed', 'pyname': u'HeaderedPumpsVariableSpeed', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value @property def inlet_node_name(self): """field `Inlet Node Name` Args: value (str): value for IDD Field `Inlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `inlet_node_name` or None if not set """ return self["Inlet Node Name"] @inlet_node_name.setter def inlet_node_name(self, value=None): """Corresponds to IDD field `Inlet Node Name`""" self["Inlet Node Name"] = value @property def outlet_node_name(self): """field `Outlet Node Name` Args: value (str): value for IDD Field `Outlet Node Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `outlet_node_name` or None if not set """ return self["Outlet Node Name"] @outlet_node_name.setter def outlet_node_name(self, value=None): """Corresponds to IDD field `Outlet Node Name`""" self["Outlet Node Name"] = value @property def total_rated_flow_rate(self): """field `Total Rated Flow Rate` | If the field is not autosized set to the flow rate to | the total flow when all pumps are running at full load | Units: m3/s | IP-Units: gal/min Args: value (float or "Autosize"): value for IDD Field `Total Rated Flow Rate` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `total_rated_flow_rate` or None if not set """ return self["Total Rated Flow Rate"] @total_rated_flow_rate.setter def total_rated_flow_rate(self, value=None): """Corresponds to IDD field `Total Rated Flow Rate`""" self["Total Rated Flow Rate"] = value @property def number_of_pumps_in_bank(self): """field `Number of Pumps in Bank` Args: value (int): value for IDD Field `Number of Pumps in Bank` Raises: ValueError: if `value` is not a valid value Returns: int: the value of `number_of_pumps_in_bank` or None if not set """ return self["Number of Pumps in Bank"] @number_of_pumps_in_bank.setter def number_of_pumps_in_bank(self, value=None): """Corresponds to IDD field `Number of Pumps in Bank`""" self["Number of Pumps in Bank"] = value @property def flow_sequencing_control_scheme(self): """field `Flow Sequencing Control Scheme` | Default value: Sequential Args: value (str): value for IDD Field `Flow Sequencing Control Scheme` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `flow_sequencing_control_scheme` or None if not set """ return self["Flow Sequencing Control Scheme"] @flow_sequencing_control_scheme.setter def flow_sequencing_control_scheme(self, value="Sequential"): """Corresponds to IDD field `Flow Sequencing Control Scheme`""" self["Flow Sequencing Control Scheme"] = value @property def rated_pump_head(self): """field `Rated Pump Head` | default head is 60 feet | Units: Pa | IP-Units: ftH2O | Default value: 179352.0 Args: value (float): value for IDD Field `Rated Pump Head` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `rated_pump_head` or None if not set """ return self["Rated Pump Head"] @rated_pump_head.setter def rated_pump_head(self, value=179352.0): """Corresponds to IDD field `Rated Pump Head`""" self["Rated Pump Head"] = value @property def rated_power_consumption(self): """field `Rated Power Consumption` | If the field is not autosized set to the power consumed by the pump bank | when all the pumps are running at nominal flow | If this field is autosized, an impeller efficiency of 0.78 is assumed. | autosized Rated Power Consumption = Total Rated Flow Rate * Rated Pump Head / (0.78 * Motor Efficiency) | Units: W | IP-Units: W Args: value (float or "Autosize"): value for IDD Field `Rated Power Consumption` Raises: ValueError: if `value` is not a valid value Returns: float or "Autosize": the value of `rated_power_consumption` or None if not set """ return self["Rated Power Consumption"] @rated_power_consumption.setter def rated_power_consumption(self, value=None): """Corresponds to IDD field `Rated Power Consumption`""" self["Rated Power Consumption"] = value @property def motor_efficiency(self): """field `Motor Efficiency` | This is the motor efficiency only. When the Rated Power Consumption if autosized, | an impeller efficiency of 0.78 is assumed in addition to the motor efficiency. | Default value: 0.9 | value <= 1.0 Args: value (float): value for IDD Field `Motor Efficiency` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `motor_efficiency` or None if not set """ return self["Motor Efficiency"] @motor_efficiency.setter def motor_efficiency(self, value=0.9): """Corresponds to IDD field `Motor Efficiency`""" self["Motor Efficiency"] = value @property def fraction_of_motor_inefficiencies_to_fluid_stream(self): """field `Fraction of Motor Inefficiencies to Fluid Stream` | value <= 1.0 Args: value (float): value for IDD Field `Fraction of Motor Inefficiencies to Fluid Stream` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `fraction_of_motor_inefficiencies_to_fluid_stream` or None if not set """ return self["Fraction of Motor Inefficiencies to Fluid Stream"] @fraction_of_motor_inefficiencies_to_fluid_stream.setter def fraction_of_motor_inefficiencies_to_fluid_stream(self, value=None): """Corresponds to IDD field `Fraction of Motor Inefficiencies to Fluid Stream`""" self["Fraction of Motor Inefficiencies to Fluid Stream"] = value @property def coefficient_1_of_the_part_load_performance_curve(self): """field `Coefficient 1 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 1 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_1_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 1 of the Part Load Performance Curve"] @coefficient_1_of_the_part_load_performance_curve.setter def coefficient_1_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 1 of the Part Load Performance Curve`""" self["Coefficient 1 of the Part Load Performance Curve"] = value @property def coefficient_2_of_the_part_load_performance_curve(self): """field `Coefficient 2 of the Part Load Performance Curve` | Default value: 1.0 Args: value (float): value for IDD Field `Coefficient 2 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_2_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 2 of the Part Load Performance Curve"] @coefficient_2_of_the_part_load_performance_curve.setter def coefficient_2_of_the_part_load_performance_curve(self, value=1.0): """Corresponds to IDD field `Coefficient 2 of the Part Load Performance Curve`""" self["Coefficient 2 of the Part Load Performance Curve"] = value @property def coefficient_3_of_the_part_load_performance_curve(self): """field `Coefficient 3 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 3 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_3_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 3 of the Part Load Performance Curve"] @coefficient_3_of_the_part_load_performance_curve.setter def coefficient_3_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 3 of the Part Load Performance Curve`""" self["Coefficient 3 of the Part Load Performance Curve"] = value @property def coefficient_4_of_the_part_load_performance_curve(self): """field `Coefficient 4 of the Part Load Performance Curve` Args: value (float): value for IDD Field `Coefficient 4 of the Part Load Performance Curve` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `coefficient_4_of_the_part_load_performance_curve` or None if not set """ return self["Coefficient 4 of the Part Load Performance Curve"] @coefficient_4_of_the_part_load_performance_curve.setter def coefficient_4_of_the_part_load_performance_curve(self, value=None): """Corresponds to IDD field `Coefficient 4 of the Part Load Performance Curve`""" self["Coefficient 4 of the Part Load Performance Curve"] = value @property def minimum_flow_rate_fraction(self): """field `Minimum Flow Rate Fraction` | This value can be zero and will be defaulted to that if not specified. | value <= 1.0 Args: value (float): value for IDD Field `Minimum Flow Rate Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `minimum_flow_rate_fraction` or None if not set """ return self["Minimum Flow Rate Fraction"] @minimum_flow_rate_fraction.setter def minimum_flow_rate_fraction(self, value=None): """Corresponds to IDD field `Minimum Flow Rate Fraction`""" self["Minimum Flow Rate Fraction"] = value @property def pump_control_type(self): """field `Pump Control Type` | Default value: Continuous Args: value (str): value for IDD Field `Pump Control Type` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_control_type` or None if not set """ return self["Pump Control Type"] @pump_control_type.setter def pump_control_type(self, value="Continuous"): """Corresponds to IDD field `Pump Control Type`""" self["Pump Control Type"] = value @property def pump_flow_rate_schedule_name(self): """field `Pump Flow Rate Schedule Name` | Modifies the rated flow rate of the pump on a time basis. Default is | that the pump is on and runs according to its other operational requirements | specified above. The schedule is for special pump operations. Args: value (str): value for IDD Field `Pump Flow Rate Schedule Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `pump_flow_rate_schedule_name` or None if not set """ return self["Pump Flow Rate Schedule Name"] @pump_flow_rate_schedule_name.setter def pump_flow_rate_schedule_name(self, value=None): """Corresponds to IDD field `Pump Flow Rate Schedule Name`""" self["Pump Flow Rate Schedule Name"] = value @property def zone_name(self): """field `Zone Name` | optional, if used pump losses transfered to zone as internal gains Args: value (str): value for IDD Field `Zone Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `zone_name` or None if not set """ return self["Zone Name"] @zone_name.setter def zone_name(self, value=None): """Corresponds to IDD field `Zone Name`""" self["Zone Name"] = value @property def skin_loss_radiative_fraction(self): """field `Skin Loss Radiative Fraction` | optional. If zone identified in previous field then this determines | the split between convection and radiation for the skin losses | value <= 1.0 Args: value (float): value for IDD Field `Skin Loss Radiative Fraction` Raises: ValueError: if `value` is not a valid value Returns: float: the value of `skin_loss_radiative_fraction` or None if not set """ return self["Skin Loss Radiative Fraction"] @skin_loss_radiative_fraction.setter def skin_loss_radiative_fraction(self, value=None): """Corresponds to IDD field `Skin Loss Radiative Fraction`""" self["Skin Loss Radiative Fraction"] = value class BranchList(DataObject): """ Corresponds to IDD object `BranchList` Branches MUST be listed in Flow order: Inlet branch, then parallel branches, then Outlet branch. Branches are simulated in the order listed. Branch names cannot be duplicated within a single branch list. """ _schema = {'extensible-fields': OrderedDict([(u'branch name', {'name': u'Branch Name', 'pyname': u'branch_name', 'required-field': False, 'autosizable': False, 'autocalculatable': False, 'type': u'object-list'})]), 'fields': OrderedDict([(u'name', {'name': u'Name', 'pyname': u'name', 'required-field': True, 'autosizable': False, 'autocalculatable': False, 'type': 'alpha'})]), 'format': None, 'group': u'Pumps', 'min-fields': 2, 'name': u'BranchList', 'pyname': u'BranchList', 'required-object': False, 'unique-object': False} @property def name(self): """field `Name` Args: value (str): value for IDD Field `Name` Raises: ValueError: if `value` is not a valid value Returns: str: the value of `name` or None if not set """ return self["Name"] @name.setter def name(self, value=None): """Corresponds to IDD field `Name`""" self["Name"] = value def add_extensible(self, branch_name=None, ): """Add values for extensible fields. Args: branch_name (str): value for IDD Field `Branch Name` if `value` is None it will not be checked against the specification and is assumed to be a missing value """ vals = [] branch_name = self.check_value("Branch Name", branch_name) vals.append(branch_name) self._extdata.append(vals) @property def extensibles(self): """Get list of all extensibles.""" return self._extdata @extensibles.setter def extensibles(self, extensibles): """Replaces extensible fields with `extensibles` Args: extensibles (list): nested list of extensible values """ self._extdata = [] for ext in extensibles: self.add_extensible(*ext)
39.360508
115
0.477777
11,338
117,806
4.848915
0.024608
0.026047
0.023573
0.034051
0.956764
0.94274
0.937701
0.932626
0.930335
0.922295
0
0.008368
0.44103
117,806
2,992
116
39.373663
0.826515
0.295885
0
0.911458
0
0
0.237276
0.021821
0
0
0
0
0
1
0.134673
false
0
0.002232
0
0.212798
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
02cbe3f934ab93c9990e763d5d1665f1199b12b8
41,466
py
Python
axes/tests.py
seatme/django-axes
5bfa1601e0853f8d970f281485ca55ca7fedd3b0
[ "MIT" ]
null
null
null
axes/tests.py
seatme/django-axes
5bfa1601e0853f8d970f281485ca55ca7fedd3b0
[ "MIT" ]
1
2018-05-29T23:29:43.000Z
2018-05-29T23:29:43.000Z
axes/tests.py
seatme/django-axes
5bfa1601e0853f8d970f281485ca55ca7fedd3b0
[ "MIT" ]
null
null
null
import random import string import time import json import datetime from hashlib import md5 from mock import patch from django.conf import settings from django.test import TestCase from django.contrib.auth.models import User from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import reverse from django.utils import six from django.test.client import RequestFactory from axes.settings import FAILURE_LIMIT from axes.models import AccessAttempt, AccessLog from axes.signals import user_locked_out from axes.utils import reset, iso8601, get_client_str, get_ip, get_cache_key, LOGIN_FORM_KEY TEST_COOLOFF_TIME = datetime.timedelta(seconds=2) from axes.models import AccessLog class MockRequest: def __init__(self): self.META = dict() class AccessAttemptTest(TestCase): """Test case using custom settings for testing """ VALID_USERNAME = 'valid-username' VALID_PASSWORD = 'valid-password' LOCKED_MESSAGE = 'Account locked: too many login attempts.' LOGIN_FORM_KEY = '<input type="submit" value="Log in" />' def _login(self, is_valid_username=False, is_valid_password=False, is_json=False, **kwargs): """Login a user. A valid credential is used when is_valid_username is True, otherwise it will use a random string to make a failed login. """ try: admin_login = reverse('admin:login') except NoReverseMatch: admin_login = reverse('admin:index') if is_valid_username: # Use a valid username username = self.VALID_USERNAME else: # Generate a wrong random username chars = string.ascii_uppercase + string.digits username = ''.join(random.choice(chars) for x in range(10)) if is_valid_password: password = self.VALID_PASSWORD else: password = 'invalid-password' headers = { 'user_agent': 'test-browser' } post_data = { 'username': username, 'password': password, 'this_is_the_login_form': 1, } post_data.update(kwargs) if is_json: headers.update({ 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'content_type': 'application/json', }) post_data = json.dumps(post_data) response = self.client.post(admin_login, post_data, **headers) return response def setUp(self): """Create a valid user for login """ self.user = User.objects.create_superuser( username=self.VALID_USERNAME, email='test@example.com', password=self.VALID_PASSWORD, ) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_failure_limit_once(self, cache_get_mock, cache_set_mock): """Tests the login lock trying to login one more time than failure limit """ # test until one try before the limit for i in range(1, FAILURE_LIMIT): response = self._login() # Check if we are in the same login page self.assertContains(response, self.LOGIN_FORM_KEY) # So, we shouldn't have gotten a lock-out yet. # But we should get one now response = self._login() self.assertContains(response, self.LOCKED_MESSAGE, status_code=403) def test_failure_limit_many(self): """Tests the login lock trying to login a lot of times more than failure limit """ for i in range(1, FAILURE_LIMIT): response = self._login() # Check if we are in the same login page self.assertContains(response, self.LOGIN_FORM_KEY) # So, we shouldn't have gotten a lock-out yet. # We should get a locked message each time we try again for i in range(0, random.randrange(1, FAILURE_LIMIT)): response = self._login() self.assertContains(response, self.LOCKED_MESSAGE, status_code=403) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_valid_login(self, cache_set_mock, cache_get_mock): """Tests a valid login for a real username """ response = self._login(is_valid_username=True, is_valid_password=True) self.assertNotContains(response, self.LOGIN_FORM_KEY, status_code=302) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_valid_logout(self, cache_set_mock, cache_get_mock): """Tests a valid logout and make sure the logout_time is updated """ response = self._login(is_valid_username=True, is_valid_password=True) self.assertEquals(AccessLog.objects.latest('id').logout_time, None) response = self.client.get(reverse('admin:logout')) self.assertNotEquals(AccessLog.objects.latest('id').logout_time, None) self.assertContains(response, 'Logged out') @patch('axes.settings.COOLOFF_TIME', TEST_COOLOFF_TIME) def test_cooling_off(self): """Tests if the cooling time allows a user to login """ self.test_failure_limit_once() # Wait for the cooling off period time.sleep(TEST_COOLOFF_TIME.total_seconds()) # It should be possible to login again, make sure it is. self.test_valid_login() @patch('axes.settings.COOLOFF_TIME', TEST_COOLOFF_TIME) def test_cooling_off_for_trusted_user(self): """Test the cooling time for a trusted user """ # Test successful login-logout, this makes the user trusted. self.test_valid_logout() # Try the cooling off time self.test_cooling_off() @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_long_user_agent_valid(self, cache_set_mock, cache_get_mock): """Tests if can handle a long user agent """ long_user_agent = 'ie6' * 1024 response = self._login( is_valid_username=True, is_valid_password=True, user_agent=long_user_agent, ) self.assertNotContains(response, self.LOGIN_FORM_KEY, status_code=302) def test_long_user_agent_not_valid(self): """Tests if can handle a long user agent with failure """ long_user_agent = 'ie6' * 1024 for i in range(0, FAILURE_LIMIT + 1): response = self._login(user_agent=long_user_agent) self.assertContains(response, self.LOCKED_MESSAGE, status_code=403) def test_reset_ip(self): """Tests if can reset an ip address """ # Make a lockout self.test_failure_limit_once() # Reset the ip so we can try again reset(ip='127.0.0.1') # Make a login attempt again self.test_valid_login() def test_reset_all(self): """Tests if can reset all attempts """ # Make a lockout self.test_failure_limit_once() # Reset all attempts so we can try again reset() # Make a login attempt again self.test_valid_login() @patch('axes.utils.get_ip', return_value='127.0.0.1') def test_get_cache_key(self, get_ip_mock): """ Test the cache key format""" # Getting cache key from request ip = '127.0.0.1'.encode('utf-8') cache_hash_key_checker = 'axes-{}'.format(md5((ip)).hexdigest()) request_factory = RequestFactory() request = request_factory.post('/admin/login/', data={ 'username': self.VALID_USERNAME, 'password': 'test' }) cache_hash_key = get_cache_key(request) self.assertEqual(cache_hash_key_checker, cache_hash_key) # Getting cache key from AccessAttempt Object attempt = AccessAttempt( user_agent='<unknown>', ip_address='127.0.0.1', username=self.VALID_USERNAME, get_data='', post_data='', http_accept=request.META.get('HTTP_ACCEPT', '<unknown>'), path_info=request.META.get('PATH_INFO', '<unknown>'), failures_since_start=0, ) cache_hash_key = get_cache_key(attempt) self.assertEqual(cache_hash_key_checker, cache_hash_key) def test_send_lockout_signal(self): """Test if the lockout signal is emitted """ class Scope(object): pass # this "hack" is needed so we don't have to use global variables or python3 features scope = Scope() scope.signal_received = 0 def signal_handler(request, username, ip_address, *args, **kwargs): scope.signal_received += 1 self.assertIsNotNone(request) # Connect signal handler user_locked_out.connect(signal_handler) # Make a lockout self.test_failure_limit_once() self.assertEquals(scope.signal_received, 1) reset() # Make another lockout self.test_failure_limit_once() self.assertEquals(scope.signal_received, 2) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_combination_user_and_ip(self, cache_set_mock, cache_get_mock): """Tests the login lock with a valid username and invalid password when AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP is True """ # test until one try before the limit for i in range(1, FAILURE_LIMIT): response = self._login( is_valid_username=True, is_valid_password=False, ) # Check if we are in the same login page self.assertContains(response, self.LOGIN_FORM_KEY) # So, we shouldn't have gotten a lock-out yet. # But we should get one now response = self._login(is_valid_username=True, is_valid_password=False) self.assertContains(response, self.LOCKED_MESSAGE, status_code=403) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_only(self, cache_set_mock, cache_get_mock): """Tests the login lock with a valid username and invalid password when AXES_ONLY_USER_FAILURES is True """ # test until one try before the limit for i in range(1, FAILURE_LIMIT): response = self._login( is_valid_username=True, is_valid_password=False, ) # Check if we are in the same login page self.assertContains(response, self.LOGIN_FORM_KEY) # So, we shouldn't have gotten a lock-out yet. # But we should get one now response = self._login(is_valid_username=True, is_valid_password=False) self.assertContains(response, self.LOCKED_MESSAGE, status_code=403) # reset the username only and make sure we can log in now even though our IP has failed each time reset(username=AccessAttemptTest.VALID_USERNAME) response = self._login( is_valid_username=True, is_valid_password=True, ) # Check if we are still in the login page self.assertNotContains(response, self.LOGIN_FORM_KEY, status_code=302) # now create failure_limit + 1 failed logins and then we should still be able to login with valid_username for i in range(1, FAILURE_LIMIT + 1): response = self._login( is_valid_username=False, is_valid_password=False, ) # Check if we can still log in with valid user response = self._login(is_valid_username=True, is_valid_password=True) self.assertNotContains(response, self.LOGIN_FORM_KEY, status_code=302) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_log_data_truncated(self, cache_set_mock, cache_get_mock): """Tests that query2str properly truncates data to the max_length (default 1024) """ # An impossibly large post dict extra_data = {string.ascii_letters * x: x for x in range(0, 1000)} self._login(**extra_data) self.assertEquals( len(AccessAttempt.objects.latest('id').post_data), 1024 ) def test_json_response(self): """Tests response content type and status code for the ajax request """ self.test_failure_limit_once() response = self._login(is_json=True) self.assertEquals(response.status_code, 403) self.assertEquals(response.get('Content-Type'), 'application/json') @patch('axes.settings.DISABLE_SUCCESS_ACCESS_LOG', True) def test_valid_logout_without_success_log(self): AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=True) response = self.client.get(reverse('admin:logout')) self.assertEquals(AccessLog.objects.all().count(), 0) self.assertContains(response, 'Logged out') @patch('axes.settings.DISABLE_SUCCESS_ACCESS_LOG', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_non_valid_login_without_success_log(self, cache_set_mock, cache_get_mock): """ A non-valid login does generate an AccessLog when `DISABLE_SUCCESS_ACCESS_LOG=True`. """ AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=False) self.assertEquals(response.status_code, 200) self.assertEquals(AccessLog.objects.all().count(), 1) @patch('axes.settings.DISABLE_SUCCESS_ACCESS_LOG', True) def test_valid_login_without_success_log(self): """ A valid login doesn't generate an AccessLog when `DISABLE_SUCCESS_ACCESS_LOG=True`. """ AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=True) self.assertEqual(response.status_code, 302) self.assertEqual(AccessLog.objects.all().count(), 0) @patch('axes.settings.DISABLE_ACCESS_LOG', True) def test_valid_logout_without_log(self): AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=True) response = self.client.get(reverse('admin:logout')) self.assertEquals(AccessLog.objects.all().count(), 0) self.assertContains(response, 'Logged out') @patch('axes.settings.DISABLE_ACCESS_LOG', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_non_valid_login_without_log(self, cache_set_mock, cache_get_mock): """ A non-valid login does generate an AccessLog when `DISABLE_ACCESS_LOG=True`. """ AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=False) self.assertEquals(response.status_code, 200) self.assertEquals(AccessLog.objects.all().count(), 0) @patch('axes.settings.DISABLE_ACCESS_LOG', True) def test_valid_login_without_log(self): """ A valid login doesn't generate an AccessLog when `DISABLE_ACCESS_LOG=True`. """ AccessLog.objects.all().delete() response = self._login(is_valid_username=True, is_valid_password=True) self.assertEqual(response.status_code, 302) self.assertEqual(AccessLog.objects.all().count(), 0) @patch('axes.settings.DISABLE_ACCESS_LOG', True) def test_check_is_not_made_on_GET(self): AccessLog.objects.all().delete() try: admin_login = reverse('admin:login') except NoReverseMatch: admin_login = reverse('admin:index') response = self.client.get(admin_login) self.assertEqual(response.status_code, 200) response = self._login(is_valid_username=True, is_valid_password=True) self.assertEqual(response.status_code, 302) response = self.client.get(reverse('admin:index')) self.assertEqual(response.status_code, 200) class AccessAttemptConfigTest(TestCase): """ This set of tests checks for lockouts under different configurations and circumstances to prevent false positives and false negatives. Always block attempted logins for the same user from the same IP. Always allow attempted logins for a different user from a different IP. """ IP_1 = '10.1.1.1' IP_2 = '10.2.2.2' USER_1 = 'valid-user-1' USER_2 = 'valid-user-2' VALID_PASSWORD = 'valid-password' WRONG_PASSWORD = 'wrong-password' LOCKED_MESSAGE = 'Account locked: too many login attempts.' LOGIN_FORM_KEY = '<input type="submit" value="Log in" />' ALLOWED = 302 BLOCKED = 403 def _login(self, username, password, ip_addr='127.0.0.1', is_json=False, **kwargs): """Login a user and get the response. IP address can be configured to test IP blocking functionality. """ try: admin_login = reverse('admin:login') except NoReverseMatch: admin_login = reverse('admin:index') headers = { 'user_agent': 'test-browser' } post_data = { 'username': username, 'password': password, 'this_is_the_login_form': 1, } post_data.update(kwargs) if is_json: headers.update({ 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'content_type': 'application/json', }) post_data = json.dumps(post_data) response = self.client.post( admin_login, post_data, REMOTE_ADDR=ip_addr, **headers ) return response def _lockout_user1_from_ip1(self): for i in range(1, FAILURE_LIMIT+1): response = self._login( username=self.USER_1, password=self.WRONG_PASSWORD, ip_addr=self.IP_1 ) return response def setUp(self): """Create two valid users for authentication. """ self.user = User.objects.create_superuser( username=self.USER_1, email='test_1@example.com', password=self.VALID_PASSWORD, ) self.user = User.objects.create_superuser( username=self.USER_2, email='test_2@example.com', password=self.VALID_PASSWORD, ) # Test for true and false positives when blocking by IP *OR* user (default). # Cache disabled. Default settings. @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_ip_blocks_when_same_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_ip_allows_when_same_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 can still login from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_ip_blocks_when_diff_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 is also locked out from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_ip_allows_when_diff_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) # Test for true and false positives when blocking by user only. # Cache disabled. When AXES_ONLY_USER_FAILURES = True @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_blocks_when_same_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_blocks_when_same_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is also locked out from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_allows_when_diff_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_allows_when_diff_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) # Test for true and false positives when blocking by user and IP together. # Cache disabled. When LOCK_OUT_BY_COMBINATION_USER_AND_IP = True @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_and_ip_blocks_when_same_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_and_ip_allows_when_same_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 can still login from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_and_ip_allows_when_diff_user_same_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.utils.cache.set', return_value=None) @patch('axes.utils.cache.get', return_value=None) def test_lockout_by_user_and_ip_allows_when_diff_user_diff_ip_without_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) # Test for true and false positives when blocking by IP *OR* user (default). # With cache enabled. Default criteria. def test_lockout_by_ip_blocks_when_same_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) def test_lockout_by_ip_allows_when_same_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 can still login from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) def test_lockout_by_ip_blocks_when_diff_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 is also locked out from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) def test_lockout_by_ip_allows_when_diff_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) # Test for true and false positives when blocking by user only. # With cache enabled. When AXES_ONLY_USER_FAILURES = True @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) def test_lockout_by_user_blocks_when_same_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) def test_lockout_by_user_blocks_when_same_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is also locked out from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) def test_lockout_by_user_allows_when_diff_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) def test_lockout_by_user_allows_when_diff_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) # Test for true and false positives when blocking by user and IP together. # With cache enabled. When LOCK_OUT_BY_COMBINATION_USER_AND_IP = True @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) def test_lockout_by_user_and_ip_blocks_when_same_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 is still blocked from IP 1. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.BLOCKED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) def test_lockout_by_user_and_ip_allows_when_same_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 1 can still login from IP 2. response = self._login( self.USER_1, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) def test_lockout_by_user_and_ip_allows_when_diff_user_same_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 1. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_1 ) self.assertEqual(response.status_code, self.ALLOWED) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) def test_lockout_by_user_and_ip_allows_when_diff_user_diff_ip_using_cache( self, cache_get_mock=None, cache_set_mock=None ): # User 1 is locked out from IP 1. self._lockout_user1_from_ip1() # User 2 can still login from IP 2. response = self._login( self.USER_2, self.VALID_PASSWORD, ip_addr=self.IP_2 ) self.assertEqual(response.status_code, self.ALLOWED) class UtilsTest(TestCase): def test_iso8601(self): """Tests iso8601 correctly translates datetime.timdelta to ISO 8601 formatted duration.""" EXPECTED = { datetime.timedelta(days=1, hours=25, minutes=42, seconds=8): 'P2DT1H42M8S', datetime.timedelta(days=7, seconds=342): 'P7DT5M42S', datetime.timedelta(days=0, hours=2, minutes=42): 'PT2H42M', datetime.timedelta(hours=20, seconds=42): 'PT20H42S', datetime.timedelta(seconds=300): 'PT5M', datetime.timedelta(seconds=9005): 'PT2H30M5S', datetime.timedelta(minutes=9005): 'P6DT6H5M', datetime.timedelta(days=15): 'P15D' } for timedelta, iso_duration in six.iteritems(EXPECTED): self.assertEqual(iso8601(timedelta), iso_duration) def test_is_ipv6(self): from axes.utils import is_ipv6 self.assertTrue(is_ipv6('ff80::220:16ff:fec9:1')) self.assertFalse(is_ipv6('67.255.125.204')) self.assertFalse(is_ipv6('foo')) @patch('axes.settings.VERBOSE', True) def test_verbose_ip_only_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' details = "{{user: '{0}', ip: '{1}', user-agent: '{2}', path: '{3}'}}" expected = details.format(username, ip, user_agent, path_info) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.VERBOSE', False) def test_non_verbose_ip_only_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' expected = ip actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.settings.VERBOSE', True) def test_verbose_user_only_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' details = "{{user: '{0}', ip: '{1}', user-agent: '{2}', path: '{3}'}}" expected = details.format(username, ip, user_agent, path_info) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.AXES_ONLY_USER_FAILURES', True) @patch('axes.settings.VERBOSE', False) def test_non_verbose_user_only_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' expected = username actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.settings.VERBOSE', True) def test_verbose_user_ip_combo_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' details = "{{user: '{0}', ip: '{1}', user-agent: '{2}', path: '{3}'}}" expected = details.format(username, ip, user_agent, path_info) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.LOCK_OUT_BY_COMBINATION_USER_AND_IP', True) @patch('axes.settings.VERBOSE', False) def test_non_verbose_user_ip_combo_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' expected = '{0} from {1}'.format(username, ip) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.USE_USER_AGENT', True) @patch('axes.settings.VERBOSE', True) def test_verbose_user_agent_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' details = "{{user: '{0}', ip: '{1}', user-agent: '{2}', path: '{3}'}}" expected = details.format(username, ip, user_agent, path_info) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) @patch('axes.settings.USE_USER_AGENT', True) @patch('axes.settings.VERBOSE', False) def test_non_verbose_user_agent_client_details(self): username = 'test@example.com' ip = '127.0.0.1' user_agent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)' path_info = '/admin/' expected = ip + '(user-agent={0})'.format(user_agent) actual = get_client_str(username, ip, user_agent, path_info) self.assertEqual(expected, actual) class GetIPProxyTest(TestCase): """Test get_ip returns correct addresses with proxy """ def setUp(self): self.request = MockRequest() def test_iis_ipv4_port_stripping(self): self.ip = '192.168.1.1' valid_headers = [ '192.168.1.1:6112', '192.168.1.1:6033, 192.168.1.2:9001', ] for header in valid_headers: self.request.META['HTTP_X_FORWARDED_FOR'] = header self.assertEqual(self.ip, get_ip(self.request)) def test_valid_ipv4_parsing(self): self.ip = '192.168.1.1' valid_headers = [ '192.168.1.1', '192.168.1.1, 192.168.1.2', ' 192.168.1.1 , 192.168.1.2 ', ' 192.168.1.1 , 2001:db8:cafe::17 ', ] for header in valid_headers: self.request.META['HTTP_X_FORWARDED_FOR'] = header self.assertEqual(self.ip, get_ip(self.request)) def test_valid_ipv6_parsing(self): self.ip = '2001:db8:cafe::17' valid_headers = [ '2001:db8:cafe::17', '2001:db8:cafe::17 , 2001:db8:cafe::18', '2001:db8:cafe::17, 2001:db8:cafe::18, 192.168.1.1', ] for header in valid_headers: self.request.META['HTTP_X_FORWARDED_FOR'] = header self.assertEqual(self.ip, get_ip(self.request)) class GetIPProxyCustomHeaderTest(TestCase): """Test that get_ip returns correct addresses with a custom proxy header """ def setUp(self): self.request = MockRequest() def test_custom_header_parsing(self): self.ip = '2001:db8:cafe::17' valid_headers = [ ' 2001:db8:cafe::17 , 2001:db8:cafe::18', ] for header in valid_headers: self.request.META[settings.AXES_REVERSE_PROXY_HEADER] = header self.assertEqual(self.ip, get_ip(self.request)) class GetIPNumProxiesTest(TestCase): """Test that get_ip returns the correct last IP when NUM_PROXIES is configured """ def setUp(self): self.request = MockRequest() def test_header_ordering(self): self.ip = '2.2.2.2' valid_headers = [ '4.4.4.4, 3.3.3.3, 2.2.2.2, 1.1.1.1', ' 3.3.3.3, 2.2.2.2, 1.1.1.1', ' 2.2.2.2, 1.1.1.1', ] for header in valid_headers: self.request.META[settings.AXES_REVERSE_PROXY_HEADER] = header self.assertEqual(self.ip, get_ip(self.request)) def test_invalid_headers_too_few(self): self.request.META[settings.AXES_REVERSE_PROXY_HEADER] = '1.1.1.1' with self.assertRaises(Warning): get_ip(self.request) def test_invalid_headers_no_ip(self): self.request.META[settings.AXES_REVERSE_PROXY_HEADER] = '' with self.assertRaises(Warning): get_ip(self.request)
36.341805
119
0.639005
5,514
41,466
4.538992
0.072361
0.030206
0.038037
0.031884
0.800384
0.784961
0.760308
0.751199
0.722631
0.703692
0
0.025175
0.262384
41,466
1,140
120
36.373684
0.793108
0.147012
0
0.675225
0
0.008986
0.136184
0.045223
0
0
0
0
0.105263
1
0.094994
false
0.073171
0.025674
0
0.15276
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
7
02df06642c85ea5a6c06f367e217604da5a33a29
19,563
py
Python
parser/fase2/team12/src/VARIABLES/Declaracion_Variable.py
Josue-Zea/tytus
f9e4be9a8c03eb698fade7a748972e4f52d46685
[ "MIT" ]
35
2020-12-07T03:11:43.000Z
2021-04-15T17:38:16.000Z
parser/fase2/team12/src/VARIABLES/Declaracion_Variable.py
Josue-Zea/tytus
f9e4be9a8c03eb698fade7a748972e4f52d46685
[ "MIT" ]
47
2020-12-09T01:29:09.000Z
2021-01-13T05:37:50.000Z
parser/fase2/team12/src/VARIABLES/Declaracion_Variable.py
Josue-Zea/tytus
f9e4be9a8c03eb698fade7a748972e4f52d46685
[ "MIT" ]
556
2020-12-07T03:13:31.000Z
2021-06-17T17:41:10.000Z
import sys, os.path nodo_dir = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + '\\AST\\') sys.path.append(nodo_dir) c3d_dir = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + '\\C3D\\') sys.path.append(c3d_dir) entorno_dir = (os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + '\\ENTORNO\\') sys.path.append(entorno_dir) from Nodo import Nodo from Entorno import * from Tipo_Expresion import * from Tipo import Data_Type from Tipo import Type from Label import * from Temporal import * from Simbolo import * class Declaracion_Variable(Nodo): def __init__(self, nombreNodo, fila = -1, columna = -1, valor = None): Nodo.__init__(self,nombreNodo, fila, columna, valor) def execute(self, enviroment): cantidadHijos = len(self.hijos) if cantidadHijos == 2 : identificador = self.hijos[0] tipoDeclaracion = self.hijos[1].hijos[0] nombreVariable = identificador.valor.lower() if tipoDeclaracion.nombreNodo == 'TEXT': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol(nombreVariable,tipoVariable,'') enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'SMALLINT': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'INTEGER': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'BIGINT': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'DECIMAL': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'NUMERIC': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'REAL': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'MONEY': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol(nombreVariable,tipoVariable,0) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'DATE': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol(nombreVariable,tipoVariable,'2000-10-01') enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if enviroment.existeSimboloEntornoActual(nombreVariable) : print('error') return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol(nombreVariable,tipoVariable,True) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass pass elif cantidadHijos == 3 : identificador = self.hijos[0] nombreVariable = identificador.valor.lower() tipoDeclaracion = self.hijos[1].hijos[0] expresionExecute = self.hijos[2].hijos[0] value = expresionExecute.execute(enviroment) print('vienen tres nodos') if tipoDeclaracion.nombreNodo == 'TEXT': if expresionExecute.tipo.data_type == Data_Type.character : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'SMALLINT': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'INTEGER': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'BIGINT': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'DECIMAL': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'NUMERIC': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'REAL': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'MONEY': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'DATE': if expresionExecute.tipo.data_type == Data_Type.data_time : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if expresionExecute.tipo.data_type == Data_Type.numeric : if enviroment.existeSimboloEntornoActual(nombreVariable) : return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol(nombreVariable,tipoVariable,value) enviroment.ingresar_simbolo(nombreVariable,simboloVariable) pass pass else : return False pass def compile(self, enviroment): codigoCompile = '' cantidadHijos = len(self.hijos) if cantidadHijos == 2 : identificador = self.hijos[0] tipoDeclaracion = self.hijos[1].hijos[0] nombreVariable = identificador.valor.lower() if tipoDeclaracion.nombreNodo == 'TEXT': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'SMALLINT': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'INTEGER': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'BIGINT': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'DECIMAL': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'NUMERIC': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'REAL': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'MONEY': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'DATE': codigoCompile += nombreVariable + ' = None\n' return codigoCompile elif tipoDeclaracion.nombreNodo == 'BOOLEAN': codigoCompile += nombreVariable + ' = None\n' return codigoCompile pass elif cantidadHijos == 3 : identificador = self.hijos[0] nombreVariable = identificador.valor.lower() tipoDeclaracion = self.hijos[1].hijos[0] expresionExecute = self.hijos[2].hijos[0] value = None auxiliar = False if expresionExecute.nombreNodo == 'SENTENCIA_SELECT': value = expresionExecute.execute(enviroment) print('Se ejecuto la sentencia select') print('Tipo result: ',expresionExecute.tipo.data_type) else: value = expresionExecute.compile(enviroment) auxiliar = True if auxiliar == True : codigoCompile += value codigoCompile += nombreVariable + ' = ' + expresionExecute.dir + '\n' return codigoCompile else: if expresionExecute.tipo.data_type == Data_Type.listaDatos : codigoCompile += nombreVariable + ' = None\n' return codigoCompile else : codigoCompile += nombreVariable + ' = ' + str(value) + '\n' return codigoCompile pass def getText(self): pass
37.333969
94
0.477585
1,223
19,563
7.528209
0.077678
0.038232
0.085044
0.112958
0.90214
0.878028
0.866949
0.847833
0.847833
0.769632
0
0.003815
0.463988
19,563
524
95
37.333969
0.874213
0.016306
0
0.882006
0
0
0.029702
0
0
0
0
0
0
1
0.011799
false
0.132743
0.026549
0
0.168142
0.038348
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
8
b82a9211faeaa7341e48b2280d5a0f4571d316c4
168
py
Python
tools/__init__.py
rorschach122/ConvenientCodes
81638273e80e17aefd372500c624830805ccdb7d
[ "MIT" ]
null
null
null
tools/__init__.py
rorschach122/ConvenientCodes
81638273e80e17aefd372500c624830805ccdb7d
[ "MIT" ]
null
null
null
tools/__init__.py
rorschach122/ConvenientCodes
81638273e80e17aefd372500c624830805ccdb7d
[ "MIT" ]
null
null
null
from .pytoune_plugins import TensorboardX # from general import mkdir, seed_everything, submit_to_grid from .general import mkdir, save_dot, cycle from . import pytorch
42
60
0.833333
24
168
5.625
0.666667
0.162963
0.251852
0.325926
0
0
0
0
0
0
0
0
0.119048
168
4
61
42
0.912162
0.345238
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
b83d87e8aa013b31e18831d3445eb3e27a5fda2e
114
py
Python
decrypt/scrape_parse/__init__.py
AndrewWren/decrypt
09cf541665b827aca590a4ea468a9845b6242655
[ "CC-BY-4.0" ]
null
null
null
decrypt/scrape_parse/__init__.py
AndrewWren/decrypt
09cf541665b827aca590a4ea468a9845b6242655
[ "CC-BY-4.0" ]
null
null
null
decrypt/scrape_parse/__init__.py
AndrewWren/decrypt
09cf541665b827aca590a4ea468a9845b6242655
[ "CC-BY-4.0" ]
null
null
null
from .guardian_load import load_guardian_splits, load_guardian_splits_disjoint, load_guardian_splits_disjoint_hash
114
114
0.929825
16
114
6
0.4375
0.375
0.5625
0.541667
0
0
0
0
0
0
0
0
0.04386
114
1
114
114
0.880734
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
9
b85302fc211fbead26b45331437d9eac4ce46653
309,821
py
Python
dlkit/abstract_osid/learning/sessions.py
UOC/dlkit
a9d265db67e81b9e0f405457464e762e2c03f769
[ "MIT" ]
2
2018-02-23T12:16:11.000Z
2020-10-08T17:54:24.000Z
dlkit/abstract_osid/learning/sessions.py
UOC/dlkit
a9d265db67e81b9e0f405457464e762e2c03f769
[ "MIT" ]
87
2017-04-21T18:57:15.000Z
2021-12-13T19:43:57.000Z
dlkit/abstract_osid/learning/sessions.py
UOC/dlkit
a9d265db67e81b9e0f405457464e762e2c03f769
[ "MIT" ]
1
2018-03-01T16:44:25.000Z
2018-03-01T16:44:25.000Z
"""Implementations of learning abstract base class sessions.""" # pylint: disable=invalid-name # Method names comply with OSID specification. # pylint: disable=no-init # Abstract classes do not define __init__. # pylint: disable=too-few-public-methods # Some interfaces are specified as 'markers' and include no methods. # pylint: disable=too-many-public-methods # Number of methods are defined in specification # pylint: disable=too-many-ancestors # Inheritance defined in specification # pylint: disable=too-many-arguments # Argument signature defined in specification. # pylint: disable=duplicate-code # All apparent duplicates have been inspected. They aren't. import abc class ObjectiveLookupSession: """This session provides methods for retrieving ``Objective`` s.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_objectives(self): """Tests if this user can perform ``Objective`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_view(self): """A complete view of the ``Objective`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include objectives in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts lookups to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_objective(self, objective_id): """Gets the ``Objective`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Objective`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to an ``Objective`` and retained for compatibility. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the objective :rtype: ``osid.learning.Objective`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.Objective @abc.abstractmethod def get_objectives_by_ids(self, objective_ids): """Gets an ``ObjectiveList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the objectives specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Objectives`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_ids: the list of ``Ids`` to retrieve :type objective_ids: ``osid.id.IdList`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- an ``Id was`` not found :raise: ``NullArgument`` -- ``objective_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives_by_genus_type(self, objective_genus_type): """Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` which does not include objectives of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known objectives or an error results. Otherwise, the returned list may contain only those objectives that are accessible through this session. :param objective_genus_type: an objective genus type :type objective_genus_type: ``osid.type.Type`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NullArgument`` -- ``objective_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives_by_parent_genus_type(self, objective_genus_type): """Gets an ``ObjectiveList`` corresponding to the given objective genus ``Type`` and include any additional objective with genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known objectives or an error results. Otherwise, the returned list may contain only those objectives that are accessible through this session :param objective_genus_type: an objective genus type :type objective_genus_type: ``osid.type.Type`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NullArgument`` -- ``objective_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives_by_record_type(self, objective_record_type): """Gets an ``ObjectiveList`` containing the given objective record ``Type``. In plenary mode, the returned list contains all known objectives or an error results. Otherwise, the returned list may contain only those objectives that are accessible through this session. :param objective_record_type: an objective record type :type objective_record_type: ``osid.type.Type`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NullArgument`` -- ``objective_record_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives(self): """Gets all ``Objectives``. In plenary mode, the returned list contains all known objectives or an error results. Otherwise, the returned list may contain only those objectives that are accessible through this session. :return: an ``ObjectiveList`` :rtype: ``osid.learning.ObjectiveList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList objectives = property(fget=get_objectives) class ObjectiveQuerySession: """This session provides methods for searching ``Objective`` objects. The search query is constructed using the ``ObjectiveQuery``. The objective record ``Type`` also specifies the record for the objective query. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include objectives in objective banks of which this objective bank is a ancestor in the objective bank hierarchy * isolated objective bank view: searches are restricted to objectives in this objective bank Objectives may have a query record indicated by their respective record types. The query record is accessed via the ``ObjectiveQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_search_objectives(self): """Tests if this user can perform ``Objectives`` searches. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer search operations to unauthorized users. :return: ``false`` if search methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include objectives in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts searches to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_objective_query(self): """Gets an objective query. :return: the objective query :rtype: ``osid.learning.ObjectiveQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveQuery objective_query = property(fget=get_objective_query) @abc.abstractmethod def get_objectives_by_query(self, objective_query): """Gets a list of ``Objectives`` matching the given objective query. :param objective_query: the objective query :type objective_query: ``osid.learning.ObjectiveQuery`` :return: the returned ``ObjectiveList`` :rtype: ``osid.learning.ObjectiveList`` :raise: ``NullArgument`` -- ``objective_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList class ObjectiveSearchSession: """This session provides methods for searching ``Objective`` objects. The search query is constructed using the ``ObjectiveQuery``. The objective record ``Type`` also specifies the record for the objective query. ``get_objectives_by_query()`` is the basic search method and returns a list of ``Objectives``. A more advanced search may be performed with ``getObjectivesBySearch()``. It accepts a ``ObjectiveSearch`` in addition to the query for the purpose of specifying additional options affecting the entire search, such as ordering. ``get_objectives_by_search()`` returns an ``ObjectiveSearchResults`` that can be used to access the resulting ``ObjectiveList`` or be used to perform a search within the result set through ``ObjectiveSearch``. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include objectives in objective banks of which this objective bank is a ancestor in the objective bank hierarchy * isolated objective bank view: searches are restricted to objectives in this objective bank Objectives may have a query record indicated by their respective record types. The query record is accessed via the ``ObjectiveQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_search(self): """Gets an objective search. :return: the objective search :rtype: ``osid.learning.ObjectiveSearch`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveSearch objective_search = property(fget=get_objective_search) @abc.abstractmethod def get_objective_search_order(self): """Gets a n objective search order. The ``ObjectiveSearchOrder`` is supplied to an ``ObjectiveSearch`` to specify the ordering of results. :return: the objective search order :rtype: ``osid.learning.ObjectiveSearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveSearchOrder objective_search_order = property(fget=get_objective_search_order) @abc.abstractmethod def get_objectives_by_search(self, objective_query, objective_search): """Gets the search results matching the given search query using the given search. :param objective_query: the objective search query :type objective_query: ``osid.learning.ObjectiveQuery`` :param objective_search: the objective search :type objective_search: ``osid.learning.ObjectiveSearch`` :return: the returned search results :rtype: ``osid.learning.ObjectiveSearchResults`` :raise: ``NullArgument`` -- ``objective_query`` or ``objective_search`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_search`` or ``objective_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveSearchResults @abc.abstractmethod def get_objective_query_from_inspector(self, objective_query_inspector): """Gets an objective query from an inspector. The inspector is available from an ``ObjectiveSearchResults``. :param objective_query_inspector: an objective bank query inspector :type objective_query_inspector: ``osid.learning.ObjectiveQueryInspector`` :return: the objective query :rtype: ``osid.learning.ObjectiveQuery`` :raise: ``NullArgument`` -- ``objective_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``objective_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveQuery class ObjectiveAdminSession: """This session creates, updates, and deletes ``Objectives``. The data for create and update is provided by the consumer via the form object. ``OsidForms`` are requested for each create or update and may not be reused. Create and update operations differ in their usage. To create an ``Objective,`` a ``ObjectiveForm`` is requested using ``get_objective_form_for_create()`` specifying the desired record ``Types`` or none if no record ``Types`` are needed. The returned ``ObjectiveForm`` will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the ``ObjectiveForm`` is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ``ObjectiveForm`` corresponds to an attempted transaction. For updates, ``ObjectiveForms`` are requested to the ``Objective`` ``Id`` that is to be updated using ``getObjectiveFormForUpdate()``. Similarly, the ``ObjectiveForm`` has metadata about the data that can be updated and it can perform validation before submitting the update. The ``ObjectiveForm`` can only be used once for a successful update and cannot be reused. The delete operations delete ``Objectives``. To unmap an ``Objective`` from the current ``ObjectiveBank,`` the ``ObjectiveObjectiveBankAssignmentSession`` should be used. These delete operations attempt to remove the ``Objective`` itself thus removing it from all known ``ObjectiveBank`` catalogs. This session includes an ``Id`` aliasing mechanism to assign an external ``Id`` to an internally assigned Id. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_create_objectives(self): """Tests if this user can create ``Objectives``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Objective will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user. :return: ``false`` if ``Objective`` creation is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_create_objective_with_record_types(self, objective_record_types): """Tests if this user can create a single ``Objective`` using the desired record types. While ``LearningManager.getObjectiveRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Objective``. Providing an empty array tests if an ``Objective`` can be created with no records. :param objective_record_types: array of objective record types :type objective_record_types: ``osid.type.Type[]`` :return: ``true`` if ``Objective`` creation using the specified record ``Types`` is supported, ``false`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``objective_record_types`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_form_for_create(self, objective_record_types): """Gets the objective form for creating new objectives. A new form should be requested for each create transaction. :param objective_record_types: array of objective record types :type objective_record_types: ``osid.type.Type[]`` :return: the objective form :rtype: ``osid.learning.ObjectiveForm`` :raise: ``NullArgument`` -- ``objective_record_types`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- unable to get form for requested record types *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveForm @abc.abstractmethod def create_objective(self, objective_form): """Creates a new ``Objective``. :param objective_form: the form for this ``Objective`` :type objective_form: ``osid.learning.ObjectiveForm`` :return: the new ``Objective`` :rtype: ``osid.learning.Objective`` :raise: ``IllegalState`` -- ``objective_form`` already used in a create transaction :raise: ``InvalidArgument`` -- one or more of the form elements is invalid :raise: ``NullArgument`` -- ``objective_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_form`` did not originate from ``get_objective_form_for_create()`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.Objective @abc.abstractmethod def can_update_objectives(self): """Tests if this user can update ``Objectives``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``Objective`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user. :return: ``false`` if objective modification is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_form_for_update(self, objective_id): """Gets the objective form for updating an existing objective. A new objective form should be requested for each update transaction. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the objective form :rtype: ``osid.learning.ObjectiveForm`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveForm @abc.abstractmethod def update_objective(self, objective_form): """Updates an existing objective. :param objective_form: the form containing the elements to be updated :type objective_form: ``osid.learning.ObjectiveForm`` :raise: ``IllegalState`` -- ``objective_form`` already used in an update transaction :raise: ``InvalidArgument`` -- the form contains an invalid value :raise: ``NullArgument`` -- ``objective_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_form`` did not originate from ``get_objective_form_for_update()`` *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_delete_objectives(self): """Tests if this user can delete ``Objectives``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``Objective`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user. :return: ``false`` if ``Objective`` deletion is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def delete_objective(self, objective_id): """Deletes the ``Objective`` identified by the given ``Id``. :param objective_id: the ``Id`` of the ``Objective`` to delete :type objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- an ``Objective`` was not found identified by the given ``Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_manage_objective_aliases(self): """Tests if this user can manage ``Id`` aliases for ``Objectives``. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user. :return: ``false`` if ``Objective`` aliasing is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def alias_objective(self, objective_id, alias_id): """Adds an ``Id`` to an ``Objective`` for the purpose of creating compatibility. The primary ``Id`` of the ``Objective`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another objective, it is reassigned to the given objective ``Id``. :param objective_id: the ``Id`` of an ``Objective`` :type objective_id: ``osid.id.Id`` :param alias_id: the alias ``Id`` :type alias_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``alias_id`` is already assigned :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` or ``alias_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveNotificationSession: """This session defines methods to receive asynchronous notifications on adds/changes to ``Objective`` objects. This session is intended for consumers needing to synchronize their state with this service without the use of polling. Notifications are cancelled when this session is closed. The views defined in this session correspond to the views in the ``ObjectiveLookupSession``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_register_for_objective_notifications(self): """Tests if this user can register for ``Objective`` notifications. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer notification operations. :return: ``false`` if notification methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include notifications for objectives in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts notifications to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def reliable_objective_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_objective_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_objective_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_objective_notification(self, notification_id): """Acknowledge an objective notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_objectives(self): """Register for notifications of new objectives. ``ObjectiveReceiver.newObjectives()`` is invoked when a new objective is created. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objectives(self): """Registers for notification of updated objectives. ``ObjectiveReceiver.changedObjectives()`` is invoked when an objective is changed. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective(self, objective_id): """Registers for notification of an updated objective. ``ObjectiveReceiver.changedObjectives()`` is invoked when the specified objective is changed. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_objectives(self): """Registers for notification of deleted objectives. ``ObjectiveReceiver.deletedObjectives()`` is invoked when an objective is removed from this objective bank. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_objective(self, objective_id): """Registers for notification of a deleted objective. ``ObjectiveReceiver.changedObjectives()`` is invoked when the specified objective is removed from this objective bank. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objectiveid is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_hierarchy(self): """Registers for notification of an updated objective hierarchy structure. ``ObjectiveReceiver.changedChildOfObjectives()`` is invoked when a node experiences a change in its children. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_hierarchy_for_ancestors(self, objective_id): """Registers for notification of an updated objective hierarchy structure. ``ObjectiveReceiver.changedChildOfObjectives()`` is invoked when the specified node or any of its ancestors experiences a change in its children. :param objective_id: the ``Id`` of the ``Objective`` node to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_hierarchy_for_descendants(self, objective_id): """Registers for notification of an updated objective hierarchy structure. ``ObjectiveReceiver.changedChildOfObjectives()`` is invoked when the specified node or any of its descendants experiences a change in its children. :param objective_id: the ``Id`` of the ``Objective`` node to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reliable_objective_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_item_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_objective_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_objective_notification(self, notification_id): """Acknowledge an objective notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveHierarchySession: """This session defines methods for traversing a hierarchy of ``Objective`` objects. Each node in the hierarchy is a unique ``Objective that contains its child objectives``. The hierarchy may be traversed recursively to establish the tree structure through ``get_parent_objectives()`` and ``getChildObjectives()``. To relate these ``Ids`` to another OSID, ``get_objective_nodes()`` can be used for retrievals that can be used for bulk lookups in other OSIDs. Any ``Objective`` available in the Learning OSID is known to this hierarchy but does not appear in the hierarchy traversal until added as a root node or a child of another node. A user may not be authorized to traverse the entire hierarchy. Parts of the hierarchy may be made invisible through omission from the returns of ``get_parent_objectives()`` or ``get_child_objectives()`` in lieu of a ``PermissionDenied`` error that may disrupt the traversal through authorized pathways. This session defines views that offer differing behaviors when retrieving multiple objects. * comparative view: objective elements may be silently omitted or re-ordered * plenary view: provides a complete set or is an error condition """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. :return: the hierarchy ``Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_hierarchy_id = property(fget=get_objective_hierarchy_id) @abc.abstractmethod def get_objective_hierarchy(self): """Gets the hierarchy associated with this session. :return: the hierarchy associated with this session :rtype: ``osid.hierarchy.Hierarchy`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Hierarchy objective_hierarchy = property(fget=get_objective_hierarchy) @abc.abstractmethod def can_access_objective_hierarchy(self): """Tests if this user can perform hierarchy queries. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an an application that may not offer traversal functions to unauthorized users. :return: ``false`` if hierarchy traversal methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_view(self): """The returns from the objective methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_view(self): """A complete view of the ``Hierarchy`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_root_objective_ids(self): """Gets the root objective ``Ids`` in this hierarchy. :return: the root objective ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList root_objective_ids = property(fget=get_root_objective_ids) @abc.abstractmethod def get_root_objectives(self): """Gets the root objective in this objective hierarchy. :return: the root objective :rtype: ``osid.learning.ObjectiveList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ObjectiveList root_objectives = property(fget=get_root_objectives) @abc.abstractmethod def has_parent_objectives(self, objective_id): """Tests if the ``Objective`` has any parents. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if the objective has parents, ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def is_parent_of_objective(self, id_, objective_id): """Tests if an ``Id`` is a direct parent of an objective. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if this ``id`` is a parent of ``objective_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def get_parent_objective_ids(self, objective_id): """Gets the parent ``Ids`` of the given objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: the parent ``Ids`` of the objective :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_parent_objectives(self, objective_id): """Gets the parents of the given objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: the parents of the objective :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def is_ancestor_of_objective(self, id_, objective_id): """Tests if an ``Id`` is an ancestor of an objective. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if this ``id`` is an ancestor of ``objective_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def has_child_objectives(self, objective_id): """Tests if an objective has any children. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if the ``objective_id`` has children, ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def is_child_of_objective(self, id_, objective_id): """Tests if an objective is a direct child of another. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if the ``id`` is a child of ``objective_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def get_child_objective_ids(self, objective_id): """Gets the child ``Ids`` of the given objective. :param objective_id: the ``Id`` to query :type objective_id: ``osid.id.Id`` :return: the children of the objective :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_child_objectives(self, objective_id): """Gets the children of the given objective. :param objective_id: the ``Id`` to query :type objective_id: ``osid.id.Id`` :return: the children of the objective :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def is_descendant_of_objective(self, id_, objective_id): """Tests if an ``Id`` is a descendant of an objective. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :return: ``true`` if the ``id`` is a descendant of the ``objective_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` is not found return ``false``. """ return # boolean @abc.abstractmethod def get_objective_node_ids(self, objective_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given objective. :param objective_id: the ``Id`` to query :type objective_id: ``osid.id.Id`` :param ancestor_levels: the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. :type ancestor_levels: ``cardinal`` :param descendant_levels: the maximum number of descendant levels to include. A value of 0 returns no children in the node. :type descendant_levels: ``cardinal`` :param include_siblings: ``true`` to include the siblings of the given node, ``false`` to omit the siblings :type include_siblings: ``boolean`` :return: a catalog node :rtype: ``osid.hierarchy.Node`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Node @abc.abstractmethod def get_objective_nodes(self, objective_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given objective. :param objective_id: the ``Id`` to query :type objective_id: ``osid.id.Id`` :param ancestor_levels: the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. :type ancestor_levels: ``cardinal`` :param descendant_levels: the maximum number of descendant levels to include. A value of 0 returns no children in the node. :type descendant_levels: ``cardinal`` :param include_siblings: ``true`` to include the siblings of the given node, ``false`` to omit the siblings :type include_siblings: ``boolean`` :return: an objective node :rtype: ``osid.learning.ObjectiveNode`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveNode class ObjectiveHierarchyDesignSession: """This session defines methods for managing a hierarchy of ``Objective`` objects. Each node in the hierarchy is a unique ``Objective``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. :return: the hierarchy ``Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_hierarchy_id = property(fget=get_objective_hierarchy_id) @abc.abstractmethod def get_objective_hierarchy(self): """Gets the hierarchy associated with this session. :return: the hierarchy associated with this session :rtype: ``osid.hierarchy.Hierarchy`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Hierarchy objective_hierarchy = property(fget=get_objective_hierarchy) @abc.abstractmethod def can_modify_objective_hierarchy(self): """Tests if this user can change the hierarchy. A return of true does not guarantee successful authorization. A return of false indicates that it is known performing any update will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer these operations to an unauthorized user. :return: ``false`` if changing this hierarchy is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def add_root_objective(self, objective_id): """Adds a root objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_id`` is already in hierarchy :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_root_objective(self, objective_id): """Removes a root objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def add_child_objective(self, objective_id, child_id): """Adds a child to an objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :param child_id: the ``Id`` of the new child :type child_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_id`` is already a parent of ``child_id`` :raise: ``NotFound`` -- ``objective_id`` or ``child_id`` not found :raise: ``NullArgument`` -- ``objective_id`` or ``child_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_child_objective(self, objective_id, child_id): """Removes a child from an objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :param child_id: the ``Id`` of the new child :type child_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` not a parent of ``child_id`` :raise: ``NullArgument`` -- ``objective_id`` or ``child_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_child_objectives(self, objective_id): """Removes all children from an objective. :param objective_id: the ``Id`` of an objective :type objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveSequencingSession: """This session provides methods to sequence the objectives in the objective hierarchy.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. :return: the hierarchy ``Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_hierarchy_id = property(fget=get_objective_hierarchy_id) @abc.abstractmethod def get_objective_hierarchy(self): """Gets the hierarchy associated with this session. :return: the hierarchy associated with this session :rtype: ``osid.hierarchy.Hierarchy`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Hierarchy objective_hierarchy = property(fget=get_objective_hierarchy) @abc.abstractmethod def can_sequence_objectives(self): """Tests if this user can sequence objectives. A return of true does not guarantee successful authorization. A return of false indicates that it is known performing any update will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer these operations to an unauthorized user. :return: ``false`` if sequencing objectives is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def move_objective_ahead(self, parent_objective_id, reference_objective_id, objective_id): """Moves an objective ahead of a refrence objective under the given parent. :param parent_objective_id: the ``Id`` of the parent objective :type parent_objective_id: ``osid.id.Id`` :param reference_objective_id: the ``Id`` of the objective :type reference_objective_id: ``osid.id.Id`` :param objective_id: the ``Id`` of the objective to move ahead of ``reference_objective_id`` :type objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``parent_objective_id, reference_objective_id,`` or ``objective_id`` not found, or ``reference_objective_id`` or ``objective_id`` is not a child of ``parent_objective_id`` :raise: ``NullArgument`` -- ``parent_objective_id, reference_objective_id,`` or ``id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def move_objective_behind(self, parent_objective_id, reference_objective_id, objective_id): """Moves an objective behind a refrence objective under the given parent. :param parent_objective_id: the ``Id`` of the parent objective :type parent_objective_id: ``osid.id.Id`` :param reference_objective_id: the ``Id`` of the objective :type reference_objective_id: ``osid.id.Id`` :param objective_id: the ``Id`` of the objective to move behind ``reference_objective_id`` :type objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``parent_objective_id, reference_objective_id,`` or ``objective_id`` not found, or ``reference_objective_id`` or ``objective_id`` is not a child of ``parent_objective_id`` :raise: ``NullArgument`` -- ``parent_objective_id, reference_objective_id,`` or ``id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def sequence_objectives(self, parent_objective_id, objective_ids): """Sequences a set of objectives under a parent. :param parent_objective_id: the ``Id`` of the parent objective :type parent_objective_id: ``osid.id.Id`` :param objective_ids: the ``Id`` of the objectives :type objective_ids: ``osid.id.Id[]`` :raise: ``NotFound`` -- ``parent_id`` or an ``objective_id`` not found, or an ``objective_id`` is not a child of ``parent_objective_id`` :raise: ``NullArgument`` -- ``paren_objectivet_id`` or ``objective_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveObjectiveBankSession: """This session provides methods to retrieve ``Objective`` to ``ObjectiveBank`` mappings. An ``Objective`` may appear in multiple ``ObjectiveBanks``. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to look at it. This lookup session defines two views: * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete result set or is an error condition """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_lookup_objective_objective_bank_mappings(self): """Tests if this user can perform lookups of objective/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known lookup methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if looking up mappings is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_bank_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_bank_view(self): """A complete view of the ``Objective`` and ``ObjectiveBank`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_objective_ids_by_objective_bank(self, objective_bank_id): """Gets the list of ``Objective`` ``Ids`` associated with an ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related objectives :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_objectives_by_objective_bank(self, objective_bank_id): """Gets the list of ``Objectives`` associated with an ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related objective ``Ids`` :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objective_ids_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Objective Ids`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objective bank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of objective ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_objectives_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Objectives`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objective bank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objective_bank_ids_by_objective(self, objective_id): """Gets the list of ``ObjectiveBank`` ``Ids`` mapped to an ``Objective``. :param objective_id: ``Id`` of an ``Objective`` :type objective_id: ``osid.id.Id`` :return: list of objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_objective_banks_by_objective(self, objective_id): """Gets the list of ``ObjectiveBanks`` mapped to an ``Objective``. :param objective_id: ``Id`` of an ``Objective`` :type objective_id: ``osid.id.Id`` :return: list of objective banks :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList class ObjectiveObjectiveBankAssignmentSession: """This session provides methods to re-assign ``Objectives`` to ``ObjectiveBanks``. An ``Objective`` may map to multiple ``ObjectiveBanks`` and removing the last reference to an ``Objective`` is the equivalent of deleting it. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to operate on it. Moving or adding a reference of an ``Objective`` to another ``ObjectiveBank`` is not a copy operation (eg: does not change its ``Id`` ). """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_assign_objectives(self): """Tests if this user can alter objective/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_assign_objectives_to_objective_bank(self, objective_bank_id): """Tests if this user can alter objective/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_assignable_objective_bank_ids(self, objective_bank_id): """Gets a list of objective banks including and under the given objective bank node in which any objective can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of assignable objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_assignable_objective_bank_ids_for_objective(self, objective_bank_id, objective_id): """Gets a list of objective banks including and under the given objective bank node in which a specific objective can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: list of assignable objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def assign_objective_to_objective_bank(self, objective_id, objective_bank_id): """Adds an existing ``Objective`` to an ``ObjectiveBank``. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_id`` already mapped to ``objective_bank_id`` :raise: ``NotFound`` -- ``objective_id`` or ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def unassign_objective_from_objective_bank(self, objective_id, objective_bank_id): """Removes an ``Objective`` from an ``ObjectiveBank``. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` or ``objective_bank_id`` not found or ``objective_id`` not mapped to ``objective_bank_id`` :raise: ``NullArgument`` -- ``objective_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reassign_proficiency_to_objective_bank(self, objective_id, from_objective_bank_id, to_objective_bank_id): """Moves an ``Objective`` from one ``ObjectiveBank`` to another. Mappings to other ``ObjectiveBanks`` are unaffected. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param from_objective_bank_id: the ``Id`` of the current ``ObjectiveBank`` :type from_objective_bank_id: ``osid.id.Id`` :param to_objective_bank_id: the ``Id`` of the destination ``ObjectiveBank`` :type to_objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id, from_objective_bank_id,`` or ``to_objective_bank_id`` not found or ``objective_id`` not mapped to ``from_objective_bank_id`` :raise: ``NullArgument`` -- ``objective_id, from_objective_bank_id,`` or ``to_objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveSmartObjectiveBankSession: """This session manages queries and sequencing to create "smart" dynamic catalogs. An ``ObjectiveQuery`` can be retrieved from this session and mapped to this ``ObjectiveBank`` to create a virtual collection of ``Objectives``. The objectives may be sequenced using the ``ObjectiveSearchOrder`` from this session. This ``ObjectiveBank`` has a default query that matches any objective and a default search order that specifies no sequencing. The queries may be examined using an ``ObjectiveQueryInspector``. The query may be modified by converting the inspector back to an ``ObjectiveQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_manage_smart_objective_banks(self): """Tests if this user can manage smart objective banks. A return of true does not guarantee successful assessment. A return of false indicates that it is known methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer operations to unauthorized users. :return: ``false`` if smart objective bank management is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_query(self): """Gets an objective query. :return: the objective query :rtype: ``osid.learning.ObjectiveQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveQuery objective_query = property(fget=get_objective_query) @abc.abstractmethod def get_objective_search_order(self): """Gets an objective search order. :return: the objective search order :rtype: ``osid.learning.ObjectiveSearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveSearchOrder objective_search_order = property(fget=get_objective_search_order) @abc.abstractmethod def apply_objective_query(self, objective_query): """Applies an objective query to this bank. :param objective_query: the objective query :type objective_query: ``osid.learning.ObjectiveQuery`` :raise: ``NullArgument`` -- ``objective_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``objective_query`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def inspect_objective_query(self): """Gets an objective query inspector for this objective bank. :return: the objective query inspector :rtype: ``osid.learning.ObjectiveQueryInspector`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveQueryInspector @abc.abstractmethod def apply_objective_sequencing(self, objective_search_order): """Applies an objective search order to this objective bank. :param objective_search_order: the objective search order :type objective_search_order: ``osid.learning.ObjectiveSearchOrder`` :raise: ``NullArgument`` -- ``objective_search_order`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``objective_search_order`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def get_objective_query_from_inspector(self, objective_query_inspector): """Gets an objective query from an inspector. :param objective_query_inspector: a query inspector :type objective_query_inspector: ``osid.learning.ObjectiveQueryInspector`` :return: the objective query :rtype: ``osid.learning.ObjectiveQuery`` :raise: ``NullArgument`` -- ``objective_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``objective_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveQuery class ObjectiveRequisiteSession: """This session provides methods for retrieving objective requisites. A requisite is a set of ``Objectives`` that should be achieved before another ``Objective`` is attempted. This session defines views that offer differing behaviors when retrieving multiple objects. * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete set or is an error condition * isolated objective bank view: All objective methods in this session operate, retrieve and pertain to objectives defined explicitly in the current objective bank. Using an isolated view is useful for managing objectives with the ``ObjectiveAdminSession.`` * federated objective bank view: All objective methods in this session operate, retrieve and pertain to all objectives defined in this objective bank and any other objective banks implicitly available in this objective bank through objective bank inheritence. Objectives may have an additional records indicated by their respective record types. The record may not be accessed through a cast of the ``Objective``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_objective_prerequisites(self): """Tests if this user can perform ``Objective`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_view(self): """A complete view of the ``Objective`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include objectives in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts lookups to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_requisite_objectives(self, objective_id): """Gets a list of ``Objectives`` that are the immediate requisites for the given ``Objective``. In plenary mode, the returned list contains all of the immediate requisites, or an error results if an ``Objective`` is not found or inaccessible. Otherwise, inaccessible ``Objectives`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the returned requisite ``Objectives`` :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_all_requisite_objectives(self, objective_id): """Gets a list of ``Objectives`` that are the requisites for the given ``Objective`` including the requistes of the requisites, and so on. In plenary mode, the returned list contains all of the immediate requisites, or an error results if an ``Objective`` is not found or inaccessible. Otherwise, inaccessible ``Objectives`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_dependent_objectives(self, objective_id): """Gets a list of ``Objectives`` that require the given ``Objective``. In plenary mode, the returned list contains all of the immediate requisites, or an error results if an Objective is not found or inaccessible. Otherwise, inaccessible ``Objectives`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def is_objective_required(self, objective_id, required_objective_id): """Tests if an objective is required before proceeding with an objective. One objective may indirectly depend on another objective by way of one or more other objectives. :param objective_id: ``Id`` of the dependent ``Objective`` :type objective_id: ``osid.id.Id`` :param required_objective_id: ``Id`` of the required ``Objective`` :type required_objective_id: ``osid.id.Id`` :return: ``true`` if ``objective_id`` depends on ``required_objective_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_equivalent_objectives(self, objective_id): """Gets a list of ``Objectives`` that are equivalent to the given ``Objective`` for the purpose of requisites. An equivalent objective can satisfy the given objective. In plenary mode, the returned list contains all of the equivalent requisites, or an error results if an Objective is not found or inaccessible. Otherwise, inaccessible ``Objectives`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: the returned ``Objective`` list :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList class ObjectiveRequisiteAssignmentSession: """This session provides methods to manage requisites. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to operate on it. Moving or adding a reference of an ``Objective`` to another ``ObjectiveBank`` is not a copy operation (eg: does not change its ``Id`` ). """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_assign_requisites(self): """Tests if this user can manage objective requisites. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def assign_objective_requisite(self, objective_id, requisite_objective_id): """Creates a requirement dependency between two ``Objectives``. :param objective_id: the ``Id`` of the dependent ``Objective`` :type objective_id: ``osid.id.Id`` :param requisite_objective_id: the ``Id`` of the required ``Objective`` :type requisite_objective_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_id`` already mapped to ``requisite_objective_id`` :raise: ``NotFound`` -- ``objective_id`` or ``requisite_objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` or ``requisite_objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def unassign_objective_requisite(self, objective_id, requisite_objective_id): """Removes an ``Objective`` requisite from an ``Objective``. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param requisite_objective_id: the ``Id`` of the required ``Objective`` :type requisite_objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` or ``requisite_objective_id`` not found or ``objective_id`` not mapped to ``requisite_objective_id`` :raise: ``NullArgument`` -- ``objective_id`` or ``requisite_objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def assign_equivalent_objective(self, objective_id, equivalent_objective_id): """Makes an objective equivalent to another objective for the purposes of satisfying a requisite. :param objective_id: the ``Id`` of the principal ``Objective`` :type objective_id: ``osid.id.Id`` :param equivalent_objective_id: the ``Id`` of the equivalent ``Objective`` :type equivalent_objective_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_id`` already mapped to ``equiavelnt_objective_id`` :raise: ``NotFound`` -- ``objective_id`` or ``equivalent_objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` or ``equivalent_objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def unassign_equivalent_objective(self, objective_id, equivalent_objective_id): """Removes an ``Objective`` requisite from an ``Objective``. :param objective_id: the ``Id`` of the principal ``Objective`` :type objective_id: ``osid.id.Id`` :param equivalent_objective_id: the ``Id`` of the equivalent ``Objective`` :type equivalent_objective_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_id`` or ``equivalent_objective_id`` not found or ``objective_id`` is already equivalent to ``equivalent_objective_id`` :raise: ``NullArgument`` -- ``objective_id`` or ``equivalent_objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ActivityLookupSession: """This session provides methods for retrieving ``Activity`` objects. The ``Activity`` represents something to perform in order to achieve a learning objective. This session defines views that offer differing behaviors when retrieving multiple objects. * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete set or is an error condition * isolated objective bank view: All activity methods in this session operate, retrieve and pertain to activities defined explicitly in the current objective bank. Using an isolated view is useful for managing activities with the ``ActivityAdminSession.`` * federated objective bank view: All activity methods in this session operate, retrieve and pertain to all activities defined in this objective bank and any other objective banks implicitly available in this objective bank through objective bank inheritence. Activities may have an additional records indicated by their respective record types. The record may not be accessed through a cast of the ``Activity``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_activities(self): """Tests if this user can perform ``Activity`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_activity_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_activity_view(self): """A complete view of the ``Activity`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include activities in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts lookups to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_activity(self, activity_id): """Gets the ``Activity`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Activity`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``Activity`` and retained for compatibility. :param activity_id: ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :return: the activity :rtype: ``osid.learning.Activity`` :raise: ``NotFound`` -- ``activity_id`` not found :raise: ``NullArgument`` -- ``activity_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.Activity @abc.abstractmethod def get_activities_by_ids(self, activity_ids): """Gets an ``ActivityList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the activities specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Activities`` may be omitted from the list and may present the elements in any order including returning a unique set. :param activity_ids: the list of ``Ids`` to retrieve :type activity_ids: ``osid.id.IdList`` :return: the returned ``Activity`` list :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- an ``Id was`` not found :raise: ``NullArgument`` -- ``activity_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_by_genus_type(self, activity_genus_type): """Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` which does not include activities of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known activities or an error results. Otherwise, the returned list may contain only those activities that are accessible through this session. :param activity_genus_type: an activity genus type :type activity_genus_type: ``osid.type.Type`` :return: the returned ``Activity`` list :rtype: ``osid.learning.ActivityList`` :raise: ``NullArgument`` -- ``activity_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_by_parent_genus_type(self, activity_genus_type): """Gets an ``ActivityList`` corresponding to the given activity genus ``Type`` and include any additional activity with genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known activities or an error results. Otherwise, the returned list may contain only those activities that are accessible through this session. :param activity_genus_type: an activity genus type :type activity_genus_type: ``osid.type.Type`` :return: the returned ``Activity`` list :rtype: ``osid.learning.ActivityList`` :raise: ``NullArgument`` -- ``activity_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_by_record_type(self, activity_record_type): """Gets a ``ActivityList`` containing the given activity record ``Type``. In plenary mode, the returned list contains all known activities or an error results. Otherwise, the returned list may contain only those activities that are accessible through this session. :param activity_record_type: an activity record type :type activity_record_type: ``osid.type.Type`` :return: the returned ``Activity`` list :rtype: ``osid.learning.ActivityList`` :raise: ``NullArgument`` -- ``activity_record_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_for_objective(self, objective_id): """Gets the activities for the given objective. In plenary mode, the returned list contains all of the activities mapped to the objective ``Id`` or an error results if an Id in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Activities`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_id: ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :return: list of enrollments :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_for_objectives(self, objective_ids): """Gets the activities for the given objectives. In plenary mode, the returned list contains all of the activities specified in the objective ``Id`` list, in the order of the list, including duplicates, or an error results if a course offering ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Activities`` may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_ids: list of objective ``Ids`` :type objective_ids: ``osid.id.IdList`` :return: list of activities :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- an ``objective_id`` not found :raise: ``NullArgument`` -- ``objective_id_list`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_by_asset(self, asset_id): """Gets the activities for the given asset. In plenary mode, the returned list contains all of the activities mapped to the asset ``Id`` or an error results if an ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Activities`` may be omitted from the list and may present the elements in any order including returning a unique set. :param asset_id: ``Id`` of an ``Asset`` :type asset_id: ``osid.id.Id`` :return: list of activities :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- ``asset_id`` not found :raise: ``NullArgument`` -- ``asset_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities_by_assets(self, asset_ids): """Gets the activities for the given asset. In plenary mode, the returned list contains all of the activities mapped to the asset ``Id`` or an error results if an ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``Activities`` may be omitted from the list and may present the elements in any order including returning a unique set. :param asset_ids: ``Ids`` of ``Assets`` :type asset_ids: ``osid.id.IdList`` :return: list of activities :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- an ``asset_id`` not found :raise: ``NullArgument`` -- ``asset_id_list`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activities(self): """Gets all ``Activities``. In plenary mode, the returned list contains all known activites or an error results. Otherwise, the returned list may contain only those activities that are accessible through this session. :return: a ``ActivityList`` :rtype: ``osid.learning.ActivityList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList activities = property(fget=get_activities) class ActivityQuerySession: """This session provides methods for searching ``Activity`` objects. The search query is constructed using the ``ActivityQuery``. The activity record ``Type`` also specifies the record for the activity query. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include activities in objective banks of which this objective bank is a ancestor in the objective bank hierarchy * isolated objective bank view: searches are restricted to activities in this objective bank Activities may have a query record indicated by their respective record types. The query record is accessed via the ``ActivityQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_search_activities(self): """Tests if this user can perform ``Activity`` searches. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer search operations to unauthorized users. :return: ``false`` if search methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include activities in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts searches to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_activity_query(self): """Gets an activity query. :return: the activity query :rtype: ``osid.learning.ActivityQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityQuery activity_query = property(fget=get_activity_query) @abc.abstractmethod def get_activities_by_query(self, activity_query): """Gets a list of ``Activities`` matching the given activity query. :param activity_query: the activity query :type activity_query: ``osid.learning.ActivityQuery`` :return: the returned ``ActivityList`` :rtype: ``osid.learning.ActivityList`` :raise: ``NullArgument`` -- ``activity_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``activity_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList class ActivitySearchSession: """This session provides methods for searching ``Activity`` objects. The search query is constructed using the ``ActivityQuery``. The activity record ``Type`` also specifies the record for the activity query. ``get_activities_by_query()`` is the basic search method and returns a list of ``Activities``. A more advanced search may be performed with ``getActivitiesBySearch()``. It accepts a ``ActivitySearch`` in addition to the query for the purpose of specifying additional options affecting the entire search, such as ordering. ``get_activities_by_search()`` returns an ``ActivitySearchResults`` that can be used to access the resulting ``ActivityList`` or be used to perform a search within the result set through ``ActivitySearch``. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include activities in objective banks of which this objective bank is a ancestor in the objective bank hierarchy * isolated objective bank view: searches are restricted to activities in this objective bank Activities may have a query record indicated by their respective record types. The query record is accessed via the ``ActivityQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_activity_search(self): """Gets an activity search. :return: the activity search :rtype: ``osid.learning.ActivitySearch`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivitySearch activity_search = property(fget=get_activity_search) @abc.abstractmethod def get_activity_search_order(self): """Gets an activity search order. The ``ActivitySearchOrder`` is supplied to a ``ActivitySearch`` to specify the ordering of results. :return: the activity search order :rtype: ``osid.learning.ActivitySearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivitySearchOrder activity_search_order = property(fget=get_activity_search_order) @abc.abstractmethod def get_activities_by_search(self, activity_query, activitiesearch): """Gets the search results matching the given search query using the given search. :param activity_query: the activity query :type activity_query: ``osid.learning.ActivityQuery`` :param activitiesearch: the activity search :type activitiesearch: ``osid.learning.ActivitySearch`` :return: the returned search results :rtype: ``osid.learning.ActivitySearchResults`` :raise: ``NullArgument`` -- ``activity_query`` or ``activitiesearch`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``activitiesearch`` or ``activity_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivitySearchResults @abc.abstractmethod def get_activity_query_from_inspector(self, activity_query_inspector): """Gets an activity query from an inspector. The inspector is available from an ``ActivitySearchResults``. :param activity_query_inspector: an activity bank query inspector :type activity_query_inspector: ``osid.learning.ActivityQueryInspector`` :return: the activity query :rtype: ``osid.learning.ActivityQuery`` :raise: ``NullArgument`` -- ``activity_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``activity_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityQuery class ActivityAdminSession: """This session creates, updates, and deletes ``Activities``. The data for create and update is provided by the consumer via the form object. ``OsidForms`` are requested for each create or update and may not be reused. Create and update operations differ in their usage. To create an ``Activity,`` an ``ActivityForm`` is requested using ``get_activity_form_for_create()`` specifying the desired objective and record ``Types`` or none if no record ``Types`` are needed. The returned ``ActivityForm`` will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the ``ActivityForm`` is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ``ActivityForm`` corresponds to an attempted transaction. For updates, ``ActivityForms`` are requested to the ``Activity`` ``Id`` that is to be updated using ``getActivityFormForUpdate()``. Similarly, the ``ActivityForm`` has metadata about the data that can be updated and it can perform validation before submitting the update. The ``ActivityForm`` can only be used once for a successful update and cannot be reused. The delete operations delete ``Activities``. To unmap an ``Activity`` from the current ``ObjectiveBank,`` the ``ActivityObjectiveBankAssignmentSession`` should be used. These delete operations attempt to remove the ``Activity`` itself thus removing it from all known ``ObjectiveBank`` catalogs. This session includes an ``Id`` aliasing mechanism to assign an external ``Id`` to an internally assigned Id. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_create_activities(self): """Tests if this user can create ``Activities``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``Activity`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user. :return: ``false`` if ``Activity`` creation is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_create_activity_with_record_types(self, activity_record_types): """Tests if this user can create a single ``Activity`` using the desired record types. While ``LearningManager.getActivityRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Activity``. Providing an empty array tests if an ``Activity`` can be created with no records. :param activity_record_types: array of activity record types :type activity_record_types: ``osid.type.Type[]`` :return: ``true`` if ``Activity`` creation using the specified record ``Types`` is supported, ``false`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``activity_record_types`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_activity_form_for_create(self, objective_id, activity_record_types): """Gets the activity form for creating new activities. A new form should be requested for each create transaction. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param activity_record_types: array of activity record types :type activity_record_types: ``osid.type.Type[]`` :return: the activity form :rtype: ``osid.learning.ActivityForm`` :raise: ``NotFound`` -- ``objective_id`` is not found :raise: ``NullArgument`` -- ``objective_id`` or ``activity_record_types`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- unable to get form for requested record types *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityForm @abc.abstractmethod def create_activity(self, activity_form): """Creates a new ``Activity``. :param activity_form: the form for this ``Activity`` :type activity_form: ``osid.learning.ActivityForm`` :return: the new ``Activity`` :rtype: ``osid.learning.Activity`` :raise: ``IllegalState`` -- ``activity_form`` already used in a create transaction :raise: ``InvalidArgument`` -- one or more of the form elements is invalid :raise: ``NullArgument`` -- ``activity_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``activity_form`` did not originate from ``get_activity_form_for_create()`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.Activity @abc.abstractmethod def can_update_activities(self): """Tests if this user can update ``Activities``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``Activity`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user. :return: ``false`` if activity modification is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_activity_form_for_update(self, activity_id): """Gets the activity form for updating an existing activity. A new activity form should be requested for each update transaction. :param activity_id: the ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :return: the activity form :rtype: ``osid.learning.ActivityForm`` :raise: ``NotFound`` -- ``activity_id`` is not found :raise: ``NullArgument`` -- ``activity_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityForm @abc.abstractmethod def update_activity(self, activity_form): """Updates an existing activity,. :param activity_form: the form containing the elements to be updated :type activity_form: ``osid.learning.ActivityForm`` :raise: ``IllegalState`` -- ``activity_form`` already used in an update transaction :raise: ``InvalidArgument`` -- the form contains an invalid value :raise: ``NullArgument`` -- ``activity_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``activity_form`` did not originate from ``get_activity_form_for_update()`` *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_delete_activities(self): """Tests if this user can delete ``Activities``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``Activity`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user. :return: ``false`` if ``Activity`` deletion is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def delete_activity(self, activity_id): """Deletes the ``Activity`` identified by the given ``Id``. :param activity_id: the ``Id`` of the ``Activity`` to delete :type activity_id: ``osid.id.Id`` :raise: ``NotFound`` -- an ``Activity`` was not found identified by the given ``Id`` :raise: ``NullArgument`` -- ``activity_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_manage_activity_aliases(self): """Tests if this user can manage ``Id`` aliases for activities. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user. :return: ``false`` if ``Activity`` aliasing is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def alias_activity(self, activity_id, alias_id): """Adds an ``Id`` to an ``Activity`` for the purpose of creating compatibility. The primary ``Id`` of the ``Activity`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another activity, it is reassigned to the given activity ``Id``. :param activity_id: the ``Id`` of an ``Activity`` :type activity_id: ``osid.id.Id`` :param alias_id: the alias ``Id`` :type alias_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``alias_id`` is already assigned :raise: ``NotFound`` -- ``activity_id`` not found :raise: ``NullArgument`` -- ``activity_id`` or ``alias_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ActivityNotificationSession: """This session defines methods to receive asynchronous notifications on adds/changes to ``Activity`` objects. This session is intended for consumers needing to synchronize their state with this service without the use of polling. Notifications are cancelled when this session is closed. The two views defined in this session correspond to the views in the ``ActivityLookupSession``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_register_for_activity_notifications(self): """Tests if this user can register for ``Activity`` notifications. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer notification operations. :return: ``false`` if notification methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include notifications for activities in objective banks which are children of this objective bank in the objective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts notifications to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def reliable_activity_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_activity_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_activity_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_activity_notification(self, notification_id): """Acknowledge an activity notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_activities(self): """Register for notifications of new activities. ``ActivityReceiver.newActivities()`` is invoked when a new activity is created. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_activities_for_objective(self, objective_id): """Register for notifications of new activities for the given objective. ``ActivityReceiver.newActivities()`` is invoked when a new activity is created. :param objective_id: the ``Id`` of the ``Activity`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_activities(self): """Registers for notification of updated activities. ``ActivityReceiver.changedActivities()`` is invoked when an activity is changed. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_activities_for_objective(self, objective_id): """Registers for notification of updated activities. ``ActivityReceiver.changedActivities()`` is invoked when an activity is changed. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_activity(self, activity_id): """Registers for notification of an updated activity. ``ActivityReceiver.changedActivities()`` is invoked when the specified activity is changed. :param activity_id: the ``Id`` of the ``Activity`` to monitor :type activity_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``activity_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_activities(self): """Registers for notification of deleted activities. ``ActivityReceiver.deletedActivities()`` is invoked when an activity is removed from this objective bank. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_activities_for_objective(self, objective_id): """Registers for notification of deleted activities. ``ActivityReceiver.deletedActivities()`` is invoked when an activity is removed from this objective bank. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_activity(self, activity_id): """Registers for notification of a deleted activity. ``ActivityReceiver.changedActivities()`` is invoked when the specified activity is removed from this objective bank. :param activity_id: the ``Id`` of the ``Activity`` to monitor :type activity_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``activity_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reliable_activity_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_item_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_activity_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_activity_notification(self, notification_id): """Acknowledge an activity notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ActivityObjectiveBankSession: """This session provides methods to retrieve ``Activity`` to ``ObjectiveBank`` mappings. An ``Activity`` may appear in multiple ``ObjectiveBanks``. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to look at it. This lookup session defines two views: * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete result set or is an error condition """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_lookup_activity_objective_bank_mappings(self): """Tests if this user can perform lookups of activity/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known lookup methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if looking up mappings is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_bank_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_bank_view(self): """A complete view of the ``Activity`` and ``ObjectiveBank`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_activity_ids_by_objective_bank(self, objective_bank_id): """Gets the list of ``Activity`` ``Ids`` associated with an ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related activity ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_activities_by_objective_bank(self, objective_bank_id): """Gets the list of ``Activities`` associated with an ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related activities :rtype: ``osid.learning.ActivityList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_activity_ids_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Activity Ids`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objective bank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of activity ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_activities_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Activities`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objective bank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of activities :rtype: ``osid.learning.ActivityList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityList @abc.abstractmethod def get_objective_bank_ids_by_activity(self, activity_id): """Gets the list of ``ObjectiveBank Ids`` mapped to a ``Activity``. :param activity_id: ``Id`` of a ``Activity`` :type activity_id: ``osid.id.Id`` :return: list of objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``activity_id`` is not found :raise: ``NullArgument`` -- ``activity_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_objective_banks_by_activity(self, activity_id): """Gets the list of ``ObjectiveBanks`` mapped to a ``Activity``. :param activity_id: ``Id`` of a ``Activity`` :type activity_id: ``osid.id.Id`` :return: list of objective bank ``Ids`` :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- ``activity_id`` is not found :raise: ``NullArgument`` -- ``activity_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList class ActivityObjectiveBankAssignmentSession: """This session provides methods to re-assign ``Activities`` to ``ObjectiveBanks``. An ``Activity`` may map to multiple ``ObjectiveBanks`` and removing the last reference to a ``Activity`` is the equivalent of deleting it. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to operate on it. Moving or adding a reference of an ``Activity`` to another ``ObjectiveBank`` is not a copy operation (eg: does not change its ``Id`` ). """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_assign_activities(self): """Tests if this user can alter activity/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_assign_activities_to_objective_bank(self, objective_bank_id): """Tests if this user can alter activity/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_assignable_objective_bank_ids(self, objective_bank_id): """Gets a list of objective banks including and under the given objective bank node in which any activity can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of assignable objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_assignable_objective_bank_ids_for_activity(self, objective_bank_id, activity_id): """Gets a list of objective banks including and under the given objective bank node in which a specific activity can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :param activity_id: the ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :return: list of assignable objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``activity_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def assign_activity_to_objective_bank(self, activity_id, objective_bank_id): """Adds an existing ``Activity`` to a ``ObjectiveBank``. :param activity_id: the ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``activity_id`` already mapped to ``objective_bank_id`` :raise: ``NotFound`` -- ``activity_id`` or ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``activity_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def unassign_activity_from_objective_bank(self, activity_id, objective_bank_id): """Removes a ``Activity`` from a ``ObjectiveBank``. :param activity_id: the ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``activity_id`` or ``objective_bank_id`` not found or ``activity_id`` not mapped to ``objective_bank_id`` :raise: ``NullArgument`` -- ``activity_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reassign_activity_to_objective_bank(self, activity_id, from_objective_bank_id, to_objective_bank_id): """Moves an ``Activity`` from one ``ObjectiveBank`` to another. Mappings to other ``ObjectiveBanks`` are unaffected. :param activity_id: the ``Id`` of the ``Activity`` :type activity_id: ``osid.id.Id`` :param from_objective_bank_id: the ``Id`` of the current ``ObjectiveBank`` :type from_objective_bank_id: ``osid.id.Id`` :param to_objective_bank_id: the ``Id`` of the destination ``ObjectiveBank`` :type to_objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``activity_id, from_objective_bank_id,`` or ``to_objective_bank_id`` not found or ``activity_id`` not mapped to ``from_objective_bank_id`` :raise: ``NullArgument`` -- ``activity_id, from_objective_bank_id,`` or ``to_objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ActivitySmartObjectiveBankSession: """This session manages queries and sequencing to create "smart" dynamic catalogs. An ``ActivityQuery`` can be retrieved from this session and mapped to this ``ObjectiveBank`` to create a virtual collection of activities. The activities may be sequenced using the ``ActivitySearchOrder`` from this session. This ``ObjectiveBank`` has a default query that matches any activity and a default search order that specifies no sequencing. The queries may be examined using an ``ActivityQueryInspector``. The query may be modified by converting the inspector back to an ``ActivityQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the ``ObjectiveBank`` associated with this session :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_manage_smart_objective_banks(self): """Tests if this user can manage smart objective banks. A return of true does not guarantee successful assessment. A return of false indicates that it is known methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer operations to unauthorized users. :return: ``false`` if smart objective bank management is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_activity_query(self): """Gets an activity query. :return: the activity query :rtype: ``osid.learning.ActivityQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityQuery activity_query = property(fget=get_activity_query) @abc.abstractmethod def get_activity_search_order(self): """Gets an activity search order. :return: the activity search order :rtype: ``osid.learning.ActivitySearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivitySearchOrder activity_search_order = property(fget=get_activity_search_order) @abc.abstractmethod def apply_activity_query(self, activity_query): """Applies an activity query to this bank. :param activity_query: the activity query :type activity_query: ``osid.learning.ActivityQuery`` :raise: ``NullArgument`` -- ``activity_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``activity_query`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def inspect_activity_query(self): """Gets an activity query inspector for this objective bank. :return: the activity query inspector :rtype: ``osid.learning.ActivityQueryInspector`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityQueryInspector @abc.abstractmethod def apply_activity_sequencing(self, activity_search_order): """Applies an activity search order to this objective bank. :param activity_search_order: the activity search order :type activity_search_order: ``osid.learning.ActivitySearchOrder`` :raise: ``NullArgument`` -- ``activity_search_order`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``activity_search_order`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def get_activity_query_from_inspector(self, activity_query_inspector): """Gets an activity query from an inspector. :param activity_query_inspector: an activity query inspector :type activity_query_inspector: ``osid.learning.ActivityQueryInspector`` :return: the activity query :rtype: ``osid.learning.ActivityQuery`` :raise: ``NullArgument`` -- ``activity_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``activity_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ActivityQuery class ProficiencyLookupSession: """This session defines methods for retrieving proficiencies.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_proficiencies(self): """Tests if this user can perform ``Proficiency`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may not offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_proficiency_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_proficiency_view(self): """A complete view of the ``Proficiency`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include proficiencies in objective banks which are children of this objective bank in the obective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts retrievals to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_effective_proficiency_view(self): """Only proficiencies whose effective dates are current are returned by methods in this session. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_any_effective_proficiency_view(self): """All proficienies of any effective dates are returned by methods in this session. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_proficiency(self, proficiency_id): """Gets the ``Proficiency`` specified by its ``Id``. :param proficiency_id: the ``Id`` of the ``Proficiency`` to retrieve :type proficiency_id: ``osid.id.Id`` :return: the returned ``Proficiency`` :rtype: ``osid.learning.Proficiency`` :raise: ``NotFound`` -- no ``Proficiency`` found with the given ``Id`` :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.Proficiency @abc.abstractmethod def get_proficiencies_by_ids(self, proficiency_ids): """Gets a ``ProficiencyList`` corresponding to the given ``IdList``. :param proficiency_ids: the list of ``Ids`` to retrieve :type proficiency_ids: ``osid.id.IdList`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NotFound`` -- an ``Id`` was not found :raise: ``NullArgument`` -- ``proficiency_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type(self, proficiency_genus_type): """Gets a ``ProficiencyList`` corresponding to the given proficiency genus ``Type`` which does not include proficiencies of types derived from the specified ``Type``. :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_parent_genus_type(self, proficiency_genus_type): """Gets a ``ProficiencyList`` corresponding to the given proficiency genus ``Type`` and include any additional proficiencies with genus types derived from the specified ``Type``. :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_record_type(self, proficiency_record_type): """Gets a ``ProficiencyList`` containing the given proficiency record ``Type``. :param proficiency_record_type: a proficiency record type :type proficiency_record_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``proficiency_record_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_on_date(self, from_, to): """Gets a ``ProficiencyList`` effecyive during the entire given date range inclusive but not confined to the date range. :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_on_date(self, proficiency_genus_type, from_, to): """Gets a ``ProficiencyList`` of the given proficiency genus type effective during the entire given date range inclusive but not confined to the date range. :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``proficiency_genus_type, from,`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_objective(self, objective_id): """Gets a ``ProficiencyList`` relating to the given objective. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_objective_on_date(self, objective_id, from_, to): """Gets a ``ProficiencyList`` relating to the given objective effective during the entire given date range inclusive but not confined to the date range. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``objective_id, from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_objective(self, objective_id, proficiency_genus_type): """Gets a ``ProficiencyList`` relating to the given objective and proficiency genus ``Type``. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_id`` or ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_objective_on_date(self, objective_id, proficiency_genus_type, from_, to): """Gets a ``ProficiencyList`` of the given proficiency genus type relating to the given objective effective during the entire given date range inclusive but not confined to the date range. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``objective_id, proficiency_genus_type, from,`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_objectives(self, objective_ids): """Gets a ``ProficiencyList`` relating to the given objectives. :param objective_ids: the objective ``Ids`` :type objective_ids: ``osid.id.IdList`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_resource(self, resource_id): """Gets a ``ProficiencyList`` relating to the given resource. :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_resource_on_date(self, resource_id, from_, to): """Gets a ``ProficiencyList`` relating to the given resource effective during the entire given date range inclusive but not confined to the date range. :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``resource_id, from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_resource(self, resource_id, proficiency_genus_type): """Gets a ``ProficiencyList`` relating to the given resource and proficiency genus ``Type``. :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``resource_id`` or ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_resource_on_date(self, resource_id, proficiency_genus_type, from_, to): """Gets a ``ProficiencyList`` of the given proficiency genus type relating to the given resource effective during the entire given date range inclusive but not confined to the date range. :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``resource_id, proficiency_genus_type, from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_resources(self, resource_ids): """Gets a ``ProficiencyList`` relating to the given resources. :param resource_ids: the resource ``Ids`` :type resource_ids: ``osid.id.IdList`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``resource_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_objective_and_resource(self, objective_id, resource_id): """Gets a ``ProficiencyList`` relating to the given objective and resource ````. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_id`` or ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_for_objective_and_resource_on_date(self, objective_id, resource_id, from_, to): """Gets a ``ProficiencyList`` relating to the given resource and objective effective during the entire given date range inclusive but not confined to the date range. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``objective_id, resource_id, from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_objective_and_resource(self, objective_id, resource_id, proficiency_genus_type): """Gets a ``ProficiencyList`` of the given genus type relating to the given objective and resource ````. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_id, resource_id`` or ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies_by_genus_type_for_objective_and_resource_on_date(self, objective_id, resource_id, proficiency_genus_type, from_, to): """Gets a ``ProficiencyList`` of the given genus type relating to the given resource and objective effective during the entire given date range inclusive but not confined to the date range. :param objective_id: an objective ``Id`` :type objective_id: ``osid.id.Id`` :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :param proficiency_genus_type: a proficiency genus type :type proficiency_genus_type: ``osid.type.Type`` :param from: starting date :type from: ``osid.calendaring.DateTime`` :param to: ending date :type to: ``osid.calendaring.DateTime`` :return: the returned ``Proficiency`` list :rtype: ``osid.learning.ProficiencyList`` :raise: ``InvalidArgument`` -- ``from`` is greater than ``to`` :raise: ``NullArgument`` -- ``objective_id, resource_id, proficiency_genus_type, from`` or ``to`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiencies(self): """Gets all ``Proficiencies``. :return: a list of ``Proficiencies`` :rtype: ``osid.learning.ProficiencyList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList proficiencies = property(fget=get_proficiencies) class ProficiencyQuerySession: """This session provides methods for searching among ``Proficiency`` objects. The search query is constructed using the ``ProficiencyQuery``. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include proficiencies in objective banks of which this objective bank is an ancestor in the obective bank hierarchy * isolated objective bank view: searches are restricted to proficiencies in this objective bank Proficiencies may have a query record indicated by their respective record types. The query record is accessed via the ``ProficiencyQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_search_proficiencies(self): """Tests if this user can perform ``Proficiency`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may not offer lookup operations to unauthorized users. :return: ``false`` if search methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include proficiencies in objective banks which are children of this objective bank in the obective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts lookups to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_proficiency_query(self): """Gets a proficiency query. :return: the proficiency query :rtype: ``osid.learning.ProficiencyQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyQuery proficiency_query = property(fget=get_proficiency_query) @abc.abstractmethod def get_proficiencies_by_query(self, proficiency_query): """Gets a list of ``Proficiencies`` matching the given proficiency query. :param proficiency_query: the proficiency query :type proficiency_query: ``osid.learning.ProficiencyQuery`` :return: the returned ``ProficiencyList`` :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``proficiency_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``proficiency_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList class ProficiencySearchSession: """This session provides methods for searching among ``Proficiency`` objects. The search query is constructed using the ``ProficiencyQuery``. ``get_proficiencies_by_query()`` is the basic search method and returns a list of ``Proficiencies``. A more advanced search may be performed with ``getProficienciesBySearch()``. It accepts a ``ProficiencySearch`` in addition to the query for the purpose of specifying additional options affecting the entire search, such as ordering. ``get_proficiencies_by_search()`` returns a ``ProficiencySearchResults`` that can be used to access the resulting ``ProficiencyList`` or be used to perform a search within the result set through ``ProficiencySearch``. This session defines views that offer differing behaviors for searching. * federated objective bank view: searches include proficiencies in objective banks of which this objective bank is an ancestor in the obective bank hierarchy * isolated objective bank view: searches are restricted to proficiencies in this objective bank Proficiencies may have a query record indicated by their respective record types. The query record is accessed via the ``ProficiencyQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_proficiency_search(self): """Gets a proficiency search. :return: the proficiency search :rtype: ``osid.learning.ProficiencySearch`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencySearch proficiency_search = property(fget=get_proficiency_search) @abc.abstractmethod def get_proficiency_search_order(self): """Gets a proficiency search order. The ``ProficiencySearchOrder`` is supplied to a ``ProficiencySearch`` to specify the ordering of results. :return: the proficiency search order :rtype: ``osid.learning.ProficiencySearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencySearchOrder proficiency_search_order = property(fget=get_proficiency_search_order) @abc.abstractmethod def get_proficiencies_by_search(self, proficiency_query, proficiency_search): """Gets the search results matching the given search query using the given search. :param proficiency_query: the proficiency query :type proficiency_query: ``osid.learning.ProficiencyQuery`` :param proficiency_search: the proficiency search :type proficiency_search: ``osid.learning.ProficiencySearch`` :return: the returned search results :rtype: ``osid.learning.ProficiencySearchResults`` :raise: ``NullArgument`` -- ``proficiency_query`` or ``proficiency_search`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``proficiency_query`` or ``proficiency_search`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencySearchResults @abc.abstractmethod def get_proficiency_query_from_inspector(self, proficiency_query_inspector): """Gets a proficiency query from an inspector. The inspector is available from a ``ProficiencySearchResults``. :param proficiency_query_inspector: a proficiency query inspector :type proficiency_query_inspector: ``osid.learning.ProficiencyQueryInspector`` :return: the proficiency query :rtype: ``osid.learning.ProficiencyQuery`` :raise: ``NullArgument`` -- ``proficiency_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``proficiency_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyQuery class ProficiencyAdminSession: """This session creates, updates, and deletes ``Proficiencies``. The data for create and update is provided by the consumer via the form object. ``OsidForms`` are requested for each create or update and may not be reused. Create and update operations differ in their usage. To create a ``Proficiency,`` a ``ProficiencyForm`` is requested using ``get_proficiency_form_for_create()`` specifying the desired relationship peers and record ``Types`` or none if no record ``Types`` are needed. The returned ``ProficiencyForm`` will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the ``ProficiencyForm`` is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ``ProficiencyForm`` corresponds to an attempted transaction. For updates, ``ProficiencyForms`` are requested to the ``Proficiency`` ``Id`` that is to be updated using ``getProficiencyFormForUpdate()``. Similarly, the ``ProficiencyForm`` has metadata about the data that can be updated and it can perform validation before submitting the update. The ``ProficiencyForm`` can only be used once for a successful update and cannot be reused. The delete operations delete ``Proficiencies``. To unmap a ``Proficiency`` from the current ``ObjectiveBank,`` the ``ProficiencyObjectiveBankAssignmentSession`` should be used. These delete operations attempt to remove the ``Proficiency`` itself thus removing it from all known ``ObjectiveBank`` catalogs. This session includes an ``Id`` aliasing mechanism to assign an external ``Id`` to an internally assigned Id. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_create_proficiencies(self): """Tests if this user can create ``Proficiencies``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a ``Proficiency`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user. :return: ``false`` if ``Proficiency`` creation is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_create_proficiency_with_record_types(self, proficiency_record_types): """Tests if this user can create a single ``Proficiency`` using the desired record types. While ``LearningManager.getProficiencyRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Proficiency``. Providing an empty array tests if a ``Proficiency`` can be created with no records. :param proficiency_record_types: array of proficiency record types :type proficiency_record_types: ``osid.type.Type[]`` :return: ``true`` if ``Proficiency`` creation using the specified record ``Types`` is supported, ``false`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``proficiency_record_types`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_proficiency_form_for_create(self, objective_id, resource_id, proficiency_record_types): """Gets the proficiency form for creating new proficiencies. A new form should be requested for each create transaction. :param objective_id: the ``Id`` of the ``Objective`` :type objective_id: ``osid.id.Id`` :param resource_id: the ``Id`` of the ``Resource`` :type resource_id: ``osid.id.Id`` :param proficiency_record_types: array of proficiency record types :type proficiency_record_types: ``osid.type.Type[]`` :return: the proficiency form :rtype: ``osid.learning.ProficiencyForm`` :raise: ``NotFound`` -- ``objective_id`` or ``resource_id`` is not found :raise: ``NullArgument`` -- ``objective_id, resource_id,`` or ``proficieny_record_types`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- unable to get form for requested record types *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyForm @abc.abstractmethod def create_proficiency(self, proficiency_form): """Creates a new ``Proficiency``. A new form should be requested for each create transaction. :param proficiency_form: the form for this ``Proficiency`` :type proficiency_form: ``osid.learning.ProficiencyForm`` :return: the new ``Proficiency`` :rtype: ``osid.learning.Proficiency`` :raise: ``IllegalState`` -- ``proficiency_form`` already used in a create transaction :raise: ``InvalidArgument`` -- one or more of the form elements is invalid :raise: ``NullArgument`` -- ``proficiency_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``proficiency_form`` did not originate from ``get_proficiency_form_for_create()`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.Proficiency @abc.abstractmethod def can_update_proficiencies(self): """Tests if this user can update ``Proficiencies``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a ``Proficiency`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user. :return: ``false`` if ``Proficiency`` modification is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_proficiency_form_for_update(self, proficiency_id): """Gets the proficiency form for updating an existing proficiency. :param proficiency_id: the ``Id`` of the ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :return: the proficiency form :rtype: ``osid.learning.ProficiencyForm`` :raise: ``NotFound`` -- ``proficiency_id`` is not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyForm @abc.abstractmethod def update_proficiency(self, proficiency_form): """Updates an existing proficiency. :param proficiency_form: the form containing the elements to be updated :type proficiency_form: ``osid.learning.ProficiencyForm`` :raise: ``IllegalState`` -- ``proficiency_form`` already used in an update transaction :raise: ``InvalidArgument`` -- the form contains an invalid value :raise: ``NullArgument`` -- ``proficiency_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``proficiency_form`` did not originate from ``get_proficiency_form_for_update()`` *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_delete_proficiencies(self): """Tests if this user can delete ``Proficiencies``. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a ``Proficiency`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user. :return: ``false`` if ``Proficiency`` deletion is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def delete_proficiency(self, proficiency_id): """Deletes a ``Proficiency``. :param proficiency_id: the ``Id`` of the ``Proficiency`` to remove :type proficiency_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``proficiency_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def delete_proficiencies(self): """Deletes all proficiencies in this ``ObjectiveBank``. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_manage_proficiency_aliases(self): """Tests if this user can manage ``Id`` aliases for proficiency entries. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user. :return: ``false`` if ``Proficiency`` aliasing is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def alias_proficiency(self, proficiency_id, alias_id): """Adds an ``Id`` to a ``Proficiency`` for the purpose of creating compatibility. The primary ``Id`` of the ``Proficiency`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another proficiency, it is reassigned to the given proficiency ``Id``. :param proficiency_id: the ``Id`` of a ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :param alias_id: the alias ``Id`` :type alias_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``alias_id`` is already assigned :raise: ``NotFound`` -- ``proficiency_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` or ``alias_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ProficiencyNotificationSession: """This session defines methods to receive notifications on adds/changes to ``Proficiency`` objects in this ``ObjectiveBank``. This also includes existing proficiencies that may appear or disappear due to changes in the ``ObjectiveBank`` hierarchy, This session is intended for consumers needing to synchronize their state with this service without the use of polling. Notifications are cancelled when this session is closed. The two views defined in this session correspond to the views in the ``ProficiencyLookupSession``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_register_for_proficiency_notifications(self): """Tests if this user can register for ``Proficiency`` notifications. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer notification operations. :return: ``false`` if notification methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include proficiencies in objective banks which are children of this objective bank in the obective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts notifications to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def reliable_proficiency_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_proficiency_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_proficiency_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_proficiency_notification(self, notification_id): """Acknowledge a proficiency notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_proficiencies(self): """Register for notifications of new proficiencies. ``ProficiencyReceiver.newProficiencies()`` is invoked when a new ``Proficiency`` appears in this objective bank. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_proficiencies_by_genus_type(self, proficiency_genus_type): """Register for notifications of new proficiencies with the given genus type. ``ProficiencyReceiver.newProficiencies()`` is invoked when a new ``Proficiency`` appears for the given resource in this objective bank. :param proficiency_genus_type: the genus type of a proficiency to monitor :type proficiency_genus_type: ``osid.type.Type`` :raise: ``NullArgument`` -- ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_proficiencies_for_objective(self, objective_id): """Register for notifications of new proficiencies. ``ProficiencyReceiver.newProficiencies()`` is invoked when a new ``Proficiency`` appears for the given objective in this objective bank. :param objective_id: the ``Id`` of a resource to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_proficiencies_for_resource(self, resource_id): """Register for notifications of new proficiencies. ``ProficiencyReceiver.newProficiencies()`` is invoked when a new ``Proficiency`` appears for the given resource in this objective bank. :param resource_id: the ``Id`` of a resource to monitor :type resource_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_proficiencies(self): """Registers for notification of updated proficiencies. ``ProficiencyReceiver.changedProficiencies()`` is invoked when a proficiency in this objective bank is changed. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_proficiencies_by_genus_type(self, proficiency_genus_type): """Registers for notification of updated proficiencies of the given genus type. ``ProficiencyReceiver.changedProficiencies()`` is invoked when a proficiency in this objective bank is changed. :param proficiency_genus_type: the genus type of the ``Proficiency`` to monitor :type proficiency_genus_type: ``osid.type.Type`` :raise: ``NullArgument`` -- ``proficiency_genus_t_ype`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_proficiencies_for_objective(self, objective_id): """Registers for notification of an updated proficiency. ``ProficiencyReceiver.changedProficiencies()`` is invoked when the specified proficiency related to the given objective is changed in this objective bank. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_proficiencies_for_resource(self, resource_id): """Registers for notification of an updated proficiency. ``ProficiencyReceiver.changedProficiencies()`` is invoked when the specified proficiency related to the given resource is changed in this objective bank. :param resource_id: the ``Id`` of the ``Resource`` to monitor :type resource_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_proficiency(self, proficiency_id): """Registers for notification of an updated proficiency. ``ProficiencyReceiver.changedProficiencies()`` is invoked when the specified proficiency in this objective bank is changed. :param proficiency_id: the ``Id`` of the ``Proficiency`` to monitor :type proficiency_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_proficiencies(self): """Registers for notification of deleted proficiencies. ``ProficiencyReceiver.deletedProficiencies()`` is invoked when a proficiency is deleted or removed from this objective bank. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_proficiencies_by_genus_type(self, proficiency_genus_type): """Registers for notification of deleted proficiencies of the given genus type. ``ProficiencyReceiver.deletedProficiencies()`` is invoked when a proficiency is deleted or removed from this objective bank. :param proficiency_genus_type: the genus type of the ``Proficiency`` to monitor :type proficiency_genus_type: ``osid.type.Type`` :raise: ``NullArgument`` -- ``proficiency_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_proficiencies_for_objective(self, objective_id): """Registers for notification of a deleted proficiency. ``ProficiencyReceiver.deletedProficiencies()`` is invoked when the specified proficiency related to the objective is deleted or removed from this objective bank. :param objective_id: the ``Id`` of the ``Objective`` to monitor :type objective_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_proficiencies_for_resource(self, resource_id): """Registers for notification of a deleted proficiency. ``ProficiencyReceiver.deletedProficiencies()`` is invoked when the specified proficiency related to the resource is deleted or removed from this objective bank. :param resource_id: the ``Id`` of the ``Resource`` to monitor :type resource_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_proficiency(self, proficiency_id): """Registers for notification of a deleted proficiency. ``ProficiencyReceiver.deletedProficiencies()`` is invoked when the specified proficiency is deleted or removed from this objective bank. :param proficiency_id: the ``Id`` of the ``Proficiency`` to monitor :type proficiency_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reliable_proficiency_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_item_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_proficiency_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_proficiency_notification(self, notification_id): """Acknowledge an proficiency notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ProficiencyObjectiveBankSession: """This session provides methods to retrieve ``Proficiency`` to ``ObjectiveBank`` mappings. A ``Proficiency`` may appear in multiple ``ObjectiveBank`` objects. Each objective bank may have its own authorizations governing who is allowed to look at it. This lookup session defines several views: * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete result set or is an error condition """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_lookup_proficiency_objective_bank_mappings(self): """Tests if this user can perform lookups of proficiency/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known lookup methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if looking up mappings is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_proficiency_objective_bank_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_proficiency_objective_bank_view(self): """A complete view of the ``Proficiency`` and ``ObjectiveBank`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_proficiency_ids_by_objective_bank(self, objective_bank_id): """Gets the list of ``Proficiency Ids`` associated with a ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related proficiency ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_proficiencies_by_objective_bank(self, objective_bank_id): """Gets the list of ``Proficiencies`` associated with a ``ObjectiveBank``. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of related proficiencies :rtype: ``osid.learning.ProficiencyList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_proficiency_ids_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Proficiency Ids`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objectiveBank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of proficiency ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_proficiencies_by_objective_banks(self, objective_bank_ids): """Gets the list of ``Proficiencies`` corresponding to a list of ``ObjectiveBanks``. :param objective_bank_ids: list of objectiveBank ``Ids`` :type objective_bank_ids: ``osid.id.IdList`` :return: list of proficiencies :rtype: ``osid.learning.ProficiencyList`` :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyList @abc.abstractmethod def get_objective_bank_ids_by_proficiency(self, proficiency_id): """Gets the ``ObjectiveBank`` ``Ids`` mapped to a ``Proficiency``. :param proficiency_id: ``Id`` of a ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :return: list of objective banks :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``proficiency_id`` is not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_objective_banks_by_proficiency(self, proficiency_id): """Gets the ``ObjectiveBanks`` mapped to a ``Proficiency``. :param proficiency_id: ``Id`` of a ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :return: list of objective banks :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- ``proficiency_id`` is not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList class ProficiencyObjectiveBankAssignmentSession: """This session provides methods to re-assign ``Proficiencies`` to ``ObjectiveBank`` objects. A ``Proficiency`` may appear in multiple ``ObjectiveBank`` objects and removing the last reference to a ``Proficiency`` is the equivalent of deleting it. Each ``ObjectiveBank`` may have its own authorizations governing who is allowed to operate on it. Adding a reference of a ``Proficiency`` to another ``ObjectiveBank`` is not a copy operation (eg: does not change its ``Id`` ). """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_assign_proficiencies(self): """Tests if this user can alter proficiency/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_assign_proficiencies_to_objective_bank(self, objective_bank_id): """Tests if this user can alter proficiency/objective bank mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer assignment operations to unauthorized users. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: ``false`` if mapping is not authorized, ``true`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_assignable_objective_bank_ids(self, objective_bank_id): """Gets a list of objective banks including and under the given objective bank proficiency in which any proficiency can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: list of assignable objectiveBank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_assignable_objective_bank_ids_for_proficiency(self, objective_bank_id, proficiency_id): """Gets a list of objective banks including and under the given objective bank proficiency in which a specific proficiency can be assigned. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :param proficiency_id: the ``Id`` of the ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :return: list of assignable objectiveBank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``NullArgument`` -- ``objective_bank_id`` or ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def assign_proficiency_to_objective_bank(self, proficiency_id, objective_bank_id): """Adds an existing ``Proficiency`` to a ``ObjectiveBank``. :param proficiency_id: the ``Id`` of the ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``proficiency_id`` is already mapped to ``objective_bank_id`` :raise: ``NotFound`` -- ``proficiency_id`` or ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def unassign_proficiency_from_objective_bank(self, proficiency_id, objective_bank_id): """Removes a ``Proficiency`` from a ``ObjectiveBank``. :param proficiency_id: the ``Id`` of the ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``proficiency_id`` or ``objective_bank_id`` not found or ``proficiency_id`` not mapped to ``objective_bank_id`` :raise: ``NullArgument`` -- ``proficiency_id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reassign_proficiency_to_objective_bank(self, proficiency_id, from_objective_bank_id, to_objective_bank_id): """Moves a ``Proficiency`` from one ``ObjectiveBank`` to another. Mappings to other ``ObjectiveBanks`` are unaffected. :param proficiency_id: the ``Id`` of the ``Proficiency`` :type proficiency_id: ``osid.id.Id`` :param from_objective_bank_id: the ``Id`` of the current ``ObjectiveBank`` :type from_objective_bank_id: ``osid.id.Id`` :param to_objective_bank_id: the ``Id`` of the destination ``ObjectiveBank`` :type to_objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``proficiency_id, from_objective_bank_id,`` or ``to_objective_bank_id`` not found or ``proficiency_id`` not mapped to ``from_objective_bank_id`` :raise: ``NullArgument`` -- ``proficiency_id, from_objective_bank_id,`` or ``to_objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ProficiencySmartObjectiveBankSession: """This session manages queries and sequencing to create "smart" dynamic catalogs. A ``ProficiencyQuery`` can be retrieved from this session and mapped to this ``ObjectiveBank`` to create a virtual collection of ``Proficiencies``. The proficiencies may be sequenced using the ``ProficiencySearchOrder`` from this session. This ``ObjectiveBank`` has a default query that matches any proficiency and a default search order that specifies no sequencing. The queries may be examined using a ``ProficiencyQueryInspector``. The query may be modified by converting the inspector back to a ``ProficiencyQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``Familt`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_manage_smart_objective_banks(self): """Tests if this user can manage smart objective banks. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer smart operations. :return: ``false`` if smart objective bank methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_proficiency_query(self): """Gets a proficiency query. :return: the proficiency query :rtype: ``osid.learning.ProficiencyQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyQuery proficiency_query = property(fget=get_proficiency_query) @abc.abstractmethod def get_proficiency_search_order(self): """Gets a proficiency search order. :return: the proficiency search order :rtype: ``osid.learning.ProficiencySearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencySearchOrder proficiency_search_order = property(fget=get_proficiency_search_order) @abc.abstractmethod def apply_proficiency_query(self, proficiency_query): """Applies a proficiency query to this objective bank. :param proficiency_query: the proficiency query :type proficiency_query: ``osid.learning.ProficiencyQuery`` :raise: ``NullArgument`` -- ``proficiency_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``proficiency_query`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def inspect_proficiency_query(self): """Gets a proficiency query inspector for this objective bank. :return: the proficiency query inspector :rtype: ``osid.learning.ProficiencyQueryInspector`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyQueryInspector @abc.abstractmethod def apply_proficiency_sequencing(self, proficiency_search_order): """Applies a proficiency search order to this objective bank. :param proficiency_search_order: the proficiency search order :type proficiency_search_order: ``osid.learning.ProficiencySearchOrder`` :raise: ``NullArgument`` -- ``proficiency_search_order`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure occurred :raise: ``Unsupported`` -- ``proficiency_search_order`` not of this service *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def get_proficiency_query_from_inspector(self, proficiency_query_inspector): """Gets a proficiency query from an inspector. :param proficiency_query_inspector: a proficiency query inspector :type proficiency_query_inspector: ``osid.learning.ProficiencyQueryInspector`` :return: the proficiency query :rtype: ``osid.learning.ProficiencyQuery`` :raise: ``NullArgument`` -- ``relatinship_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``proficiency_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ProficiencyQuery class MyLearningPathSession: """This session defines methods for finding learning paths through an objective hierarchy based on proficiencies.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_learning_paths(self): """Tests if this user can perform learning path lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may not offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_proficiency_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_proficiency_view(self): """A complete view of the ``Proficiency`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include proficiencies in objective banks which are children of this objective bank in the obective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts retrievals to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def find_path(self, objective_id): """Gets the shortest path to an objective. The path is a list of objectives for which there is a deficient proficiency. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def find_path_at_proficiency(self, objective_id, grade_id): """Gets the shortest path to an objective. The path is a list of objectives for which there is a proficiency less than the given proficiency. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :param grade_id: the ``Id`` of a proficiency level :type grade_id: ``osid.id.Id`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` or ``grade_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives_by_completion(self, objective_id, completion): """Gets the list of objectives for there is a minimum completion. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :param completion: the minimum completion as a percentage number :type completion: ``cardinal`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList class LearningPathSession: """This session defines methods for finding learning paths through an objective hierarchy based on proficiencies.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_id(self): """Gets the ``ObjectiveBank`` ``Id`` associated with this session. :return: the ``ObjectiveBank Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_id = property(fget=get_objective_bank_id) @abc.abstractmethod def get_objective_bank(self): """Gets the ``ObjectiveBank`` associated with this session. :return: the obective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank objective_bank = property(fget=get_objective_bank) @abc.abstractmethod def can_lookup_learning_paths(self): """Tests if this user can perform learning path lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may not offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_proficiency_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_proficiency_view(self): """A complete view of the ``Proficiency`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_federated_objective_bank_view(self): """Federates the view for methods in this session. A federated view will include proficiencies in objective banks which are children of this objective bank in the obective bank hierarchy. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_isolated_objective_bank_view(self): """Isolates the view for methods in this session. An isolated view restricts retrievals to this objective bank only. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def find_path_for_resource(self, objective_id, resource_id): """Gets the shortest path to an objective. The path is a list of objectives for which the resource has a deficient proficiency. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :param resource_id: the ``Id`` of the ``Resource`` :type resource_id: ``osid.id.Id`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` or ``resource_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` or ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def find_path_for_resource_at_proficiency(self, objective_id, resource_id, grade_id): """Gets the shortest path to an objective. The path is a list of objectives for which the resource has a proficiency less than the given proficiency. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :param resource_id: the ``Id`` of the ``Resource`` :type resource_id: ``osid.id.Id`` :param grade_id: the ``Id`` of a proficiency level :type grade_id: ``osid.id.Id`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` or ``resource_id`` not found :raise: ``NullArgument`` -- ``proficiency_id, resource_id`` or ``grade_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList @abc.abstractmethod def get_objectives_for_resource_by_completion(self, objective_id, resource_id, completion): """Gets the list of objectives for a resource that have a minimum completion. :param objective_id: the ``Id`` of the ``Objective`` to reach :type objective_id: ``osid.id.Id`` :param resource_id: the ``Id`` of the ``Resource`` :type resource_id: ``osid.id.Id`` :param completion: the minimum completion as a percentage number :type completion: ``cardinal`` :return: the returned list of objectives :rtype: ``osid.learning.ObjectiveList`` :raise: ``NotFound`` -- ``objective_id`` or ``resource_id`` not found :raise: ``NullArgument`` -- ``proficiency_id`` or ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveList class ObjectiveBankLookupSession: """This session provides methods for retrieving ``ObjectiveBank`` objects. The ``ObjectiveBank`` represents a collection of ``Objectives Activities`` , and ``Proficiencies``. This session defines views that offer differing behaviors when retrieving multiple objects. * comparative view: elements may be silently omitted or re-ordered * plenary view: provides a complete set or is an error condition Generally, the comparative view should be used for most applications as it permits operation even if there is data that cannot be accessed. For example, a browsing application may only need to examine the ``ObjectiveBanks`` it can access, without breaking execution. However, an administrative application may require all ``ObjectiveBank`` elements to be available. ``ObjectiveBanks`` may have an additional records indicated by their respective record types. The record may not be accessed through a cast of the ``ObjectiveBank``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_lookup_objective_banks(self): """Tests if this user can perform ``ObjectiveBank`` lookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users. :return: ``false`` if lookup methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_bank_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_bank_view(self): """A complete view of the ``ObjectiveBank`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_objective_bank(self, objective_bank_id): """Gets the ``ObjectiveBank`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``ObjectiveBank`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``ObjectiveBank`` and retained for compatility. :param objective_bank_id: ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: the objective bank :rtype: ``osid.learning.ObjectiveBank`` :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ObjectiveBank @abc.abstractmethod def get_objective_banks_by_ids(self, objective_bank_ids): """Gets a ``ObjectiveBankList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the objective banks specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inaccessible. Otherwise, inaccessible ``ObjectiveBank`` objects may be omitted from the list and may present the elements in any order including returning a unique set. :param objective_bank_ids: the list of ``Ids`` to retrieve :type objective_bank_ids: ``osid.id.IdList`` :return: the returned ``ObjectiveBank`` list :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- an ``Id was`` not found :raise: ``NullArgument`` -- ``objective_bank_ids`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def get_objective_banks_by_genus_type(self, objective_bank_genus_type): """Gets a ``ObjectiveBankList`` corresponding to the given objective bank genus ``Type`` which does not include objective banks of types derived from the specified ``Type``. In plenary mode, the returned list contains all known objective banks or an error results. Otherwise, the returned list may contain only those objective banks that are accessible through this session. :param objective_bank_genus_type: an objective bank genus type :type objective_bank_genus_type: ``osid.type.Type`` :return: the returned ``ObjectiveBank`` list :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NullArgument`` -- ``objective_bank_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def get_objective_banks_by_parent_genus_type(self, objective_bank_genus_type): """Gets a ``ObjectiveBankList`` corresponding to the given objective bank genus ``Type`` and include any additional objective banks with genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known objective banks or an error results. Otherwise, the returned list may contain only those objective banks that are accessible through this session. :param objective_bank_genus_type: an objective bank genus type :type objective_bank_genus_type: ``osid.type.Type`` :return: the returned ``ObjectiveBank`` list :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NullArgument`` -- ``objective_bank_genus_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def get_objective_banks_by_record_type(self, objective_bank_record_type): """Gets a ``ObjectiveBankList`` containing the given objective bank record ``Type``. In plenary mode, the returned list contains all known objective banks or an error results. Otherwise, the returned list may contain only those objective banks that are accessible through this session. :param objective_bank_record_type: an objective bank record type :type objective_bank_record_type: ``osid.type.Type`` :return: the returned ``ObjectiveBank`` list :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NullArgument`` -- ``objective_bank_record_type`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def get_objective_banks_by_provider(self, resource_id): """Gets a ``ObjectiveBankList`` for the given provider. In plenary mode, the returned list contains all known objective banks or an error results. Otherwise, the returned list may contain only those objective banks that are accessible through this session. :param resource_id: a resource ``Id`` :type resource_id: ``osid.id.Id`` :return: the returned ``ObjectiveBank`` list :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NullArgument`` -- ``resource_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def get_objective_banks(self): """Gets all ``ObjectiveBanks``. In plenary mode, the returned list contains all known objective banks or an error results. Otherwise, the returned list may contain only those objective banks that are accessible through this session. :return: a ``ObjectiveBankList`` :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList objective_banks = property(fget=get_objective_banks) class ObjectiveBankQuerySession: """This session provides methods for searching among ``ObjectiveBank`` objects. The search query is constructed using the ``ObjectiveBankQuery``. ``ObjectiveBanks`` may have a query record indicated by their respective record types. The query record is accessed via the ``ObjectiveBankQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_search_objective_banks(self): """Tests if this user can perform ``ObjectiveBank`` searches. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer search operations to unauthorized users. :return: ``false`` if search methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_bank_query(self): """Gets an objective bank query. :return: an objective bank query :rtype: ``osid.learning.ObjectiveBankQuery`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankQuery objective_bank_query = property(fget=get_objective_bank_query) @abc.abstractmethod def get_objective_banks_by_query(self, objective_bank_query): """Gets a list of ``ObjectiveBank`` objects matching the given objectiove bank query. :param objective_bank_query: the objective bank query :type objective_bank_query: ``osid.learning.ObjectiveBankQuery`` :return: the returned ``ObjectiveBankList`` :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NullArgument`` -- ``objective_bank_query`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_bank_query`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList class ObjectiveBankSearchSession: """This session provides methods for searching among ``ObjectiveBank`` objects. The search query is constructed using the ``ObjectiveBankQuery``. ``get_objective_banks_by_query()`` is the basic search method and returns a list of ``ObjectiveBank`` objects.A more advanced search may be performed with ``getObjectiveBanksBySearch()``. It accepts a ``ObjectiveBankSearch`` in addition to the query for the purpose of specifying additional options affecting the entire search, such as ordering. ``get_objective_banks_by_search()`` returns a ``ObjectiveBankSearchResults`` that can be used to access the resulting ``ObjectiveBankList`` or be used to perform a search within the result set through ``ObjectiveBankSearch``. ``ObjectiveBanks`` may have a query record indicated by their respective record types. The query record is accessed via the ``ObjectiveBankQuery``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_search(self): """Gets an objective bank search. :return: an objective bank search :rtype: ``osid.learning.ObjectiveBankSearch`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankSearch objective_bank_search = property(fget=get_objective_bank_search) @abc.abstractmethod def get_objective_bank_search_order(self): """Gets an objective bank search order. The ``ObjectiveBankSearchOrder`` is supplied to a ``ObjectiveBankSearch`` to specify the ordering of results. :return: the objective bank search order :rtype: ``osid.learning.ObjectiveBankSearchOrder`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankSearchOrder objective_bank_search_order = property(fget=get_objective_bank_search_order) @abc.abstractmethod def get_objective_banks_by_search(self, objective_bank_query, objective_bank_search): """Gets the search results matching the given search query using the given search. :param objective_bank_query: the objective bank query :type objective_bank_query: ``osid.learning.ObjectiveBankQuery`` :param objective_bank_search: the objective bank search :type objective_bank_search: ``osid.learning.ObjectiveBankSearch`` :return: the search results :rtype: ``osid.learning.ObjectiveBankSearchResults`` :raise: ``NullArgument`` -- ``objective_bank_query`` or ``objective_bank_search`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_bank_query`` or ``objective_bank_search`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankSearchResults @abc.abstractmethod def get_objective_bank_query_from_inspector(self, objective_bank_query_inspector): """Gets an objective bank query from an inspector. The inspector is available from an ``ObjectiveBankSearchResults``. :param objective_bank_query_inspector: an objective bank query inspector :type objective_bank_query_inspector: ``osid.learning.ObjectiveBankQueryInspector`` :return: the objective bank query :rtype: ``osid.learning.ObjectiveBankQuery`` :raise: ``NullArgument`` -- ``objective_bank_query_inspector`` is ``null`` :raise: ``Unsupported`` -- ``objective_bank_query_inspector`` is not of this service *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankQuery class ObjectiveBankAdminSession: """This session creates, updates, and deletes ``ObjectiveBanks``. The data for create and update is provided by the consumer via the form object. ``OsidForms`` are requested for each create or update and may not be reused. Create and update operations differ in their usage. To create an ``ObjectiveBank,`` an ``ObjectiveBankForm`` is requested using ``get_objective_bank_form_for_create()`` specifying the desired record ``Types`` or none if no record ``Types`` are needed. The returned ``ObjectiveBankForm`` will indicate that it is to be used with a create operation and can be used to examine metdata or validate data prior to creation. Once the ``ObjectiveBankForm`` is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each ``ObjectiveBankForm`` corresponds to an attempted transaction. For updates, ``ObjectiveBankForms`` are requested to the ``ObjectiveBank`` ``Id`` that is to be updated using ``getObjectiveBankFormForUpdate()``. Similarly, the ``ObjectiveBankForm`` has metadata about the data that can be updated and it can perform validation before submitting the update. The ``ObjectiveBankForm`` can only be used once for a successful update and cannot be reused. The delete operations delete ``ObjectiveBanks``. It is safer to remove all mappings to the ``ObjectiveBank`` catalogs before deletion. This session includes an ``Id`` aliasing mechanism to assign an external ``Id`` to an internally assigned Id. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_create_objective_banks(self): """Tests if this user can create ``ObjectiveBanks``. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an ``ObjectiveBank`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users. :return: ``false`` if ``ObjectiveBank`` creation is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def can_create_objective_bank_with_record_types(self, objective_bank_record_types): """Tests if this user can create a single ``ObjectiveBank`` using the desired record types. While ``LearningManager.getObjectiveBankRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``ObjectiveBank``. Providing an empty array tests if an ``ObjectiveBank`` can be created with no records. :param objective_bank_record_types: array of objective bank record types :type objective_bank_record_types: ``osid.type.Type[]`` :return: ``true`` if ``ObjectiveBank`` creation using the specified ``Types`` is supported, ``false`` otherwise :rtype: ``boolean`` :raise: ``NullArgument`` -- ``objective_bank_record_types`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_bank_form_for_create(self, objective_bank_record_types): """Gets the objective bank form for creating new objective banks. A new form should be requested for each create transaction. :param objective_bank_record_types: array of objective bank record types :type objective_bank_record_types: ``osid.type.Type[]`` :return: the objective bank form :rtype: ``osid.learning.ObjectiveBankForm`` :raise: ``NullArgument`` -- ``objective_bank_record_types`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- unable to get form for requested record types. *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankForm @abc.abstractmethod def create_objective_bank(self, objective_bank_form): """Creates a new ``ObjectiveBank``. :param objective_bank_form: the form for this ``ObjectiveBank`` :type objective_bank_form: ``osid.learning.ObjectiveBankForm`` :return: the new ``ObjectiveBank`` :rtype: ``osid.learning.ObjectiveBank`` :raise: ``IllegalState`` -- ``objective_bank_form`` already used in a create transaction :raise: ``InvalidArgument`` -- one or more of the form elements is invalid :raise: ``NullArgument`` -- ``objective_bank_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_bank_form`` did not originate from ``get_objective_bank_form_for_create()`` *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBank @abc.abstractmethod def can_update_objective_banks(self): """Tests if this user can update ``ObjectiveBanks``. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an ``ObjectiveBank`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users. :return: ``false`` if ``ObjectiveBank`` modification is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def get_objective_bank_form_for_update(self, objective_bank_id): """Gets the objective bank form for updating an existing objective bank. A new objective bank form should be requested for each update transaction. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :return: the objective bank form :rtype: ``osid.learning.ObjectiveBankForm`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankForm @abc.abstractmethod def update_objective_bank(self, objective_bank_form): """Updates an existing objective bank. :param objective_bank_form: the form containing the elements to be updated :type objective_bank_form: ``osid.learning.ObjectiveBankForm`` :raise: ``IllegalState`` -- ``objective_bank_form`` already used in an update transaction :raise: ``InvalidArgument`` -- the form contains an invalid value :raise: ``NullArgument`` -- ``objective_bank_form`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure :raise: ``Unsupported`` -- ``objective_bank_form did not originate from get_objective_bank_form_for_update()`` *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_delete_objective_banks(self): """Tests if this user can delete objective banks. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an ``ObjectiveBank`` will result in a ``PermissionDenied``. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users. :return: ``false`` if ``ObjectiveBank`` deletion is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def delete_objective_bank(self, objective_bank_id): """Deletes an ``ObjectiveBank``. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` to remove :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def can_manage_objective_bank_aliases(self): """Tests if this user can manage ``Id`` aliases for ``ObjectiveBanks``. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user. :return: ``false`` if ``ObjectiveBank`` aliasing is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def alias_objective_bank(self, objective_bank_id, alias_id): """Adds an ``Id`` to an ``ObjectiveBank`` for the purpose of creating compatibility. The primary ``Id`` of the ``ObjectiveBank`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another objective bank, it is reassigned to the given objective bank ``Id``. :param objective_bank_id: the ``Id`` of an ``ObjectiveBank`` :type objective_bank_id: ``osid.id.Id`` :param alias_id: the alias ``Id`` :type alias_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``alias_id`` is already assigned :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` or ``alias_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveBankNotificationSession: """This session defines methods to receive notifications on adds/changes to ``ObjectiveBank`` objects. This session is intended for consumers needing to synchronize their state with this service without the use of polling. Notifications are cancelled when this session i """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def can_register_for_objective_bank_notifications(self): """Tests if this user can register for ``ObjectiveBank`` notifications. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer notification operations. :return: ``false`` if notification methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def reliable_objective_bank_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_objective_bank_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_objective_bank_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_objective_bank_notification(self, notification_id): """Acknowledge an objective bank notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_new_objective_banks(self): """Register for notifications of new objective banks. ``ObjectiveBankReceiver.newObjectiveBanks()`` is invoked when a new ``ObjectiveBank`` is created. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_banks(self): """Registers for notification of updated objective banks. ``ObjectiveBankReceiver.changedObjectiveBanks()`` is invoked when an objective bank is changed. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_bank(self, objective_bank_id): """Registers for notification of an updated objective bank. ``ObjectiveBankReceiver.changedObjectiveBanks()`` is invoked when the specified objective bank is changed. :param objective_bank_id: the ``Id`` of the objective bank to monitor :type objective_bank_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_bank_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_objective_banks(self): """Registers for notification of deleted objective banks. ``ObjectiveBankReceiver.deletedObjectiveBanks()`` is invoked when a calenedar is deleted. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_deleted_objective_bank(self, objective_bank_id): """Registers for notification of a deleted objective bank. ``ObjectiveBankReceiver.deletedObjectiveBanks()`` is invoked when the specified objective bank is deleted. :param objective_bank_id: the ``Id`` of the objective bank to monitor :type objective_bank_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_bank_id is null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_bank_hierarchy(self): """Registers for notification of an updated objective bank hierarchy structure. ``ObjectiveBankReceiver.changedChildOfObjectiveBanks()`` is invoked when a node experiences a change in its children. :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_bank_hierarchy_for_ancestors(self, objective_bank_id): """Registers for notification of an updated objective bank hierarchy structure. ``ObjectiveBankReceiver.changedChildOfObjectiveBanks()`` is invoked when the specified node or any of its ancestors experiences a change in its children. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` node to monitor :type objective_bank_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def register_for_changed_objective_bank_hierarchy_for_descendants(self, objective_bank_id): """Registers for notification of an updated objective bank hierarchy structure. ``ObjectiveBankReceiver.changedChildOfObjectiveBanks()`` is invoked when the specified node or any of its descendants experiences a change in its children. :param objective_bank_id: the ``Id`` of the ``ObjectiveBank`` node to monitor :type objective_bank_id: ``osid.id.Id`` :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def reliable_objective_bank_notifications(self): """Reliable notifications are desired. In reliable mode, notifications are to be acknowledged using ``acknowledge_item_notification()`` . *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def unreliable_objective_bank_notifications(self): """Unreliable notifications are desired. In unreliable mode, notifications do not need to be acknowledged. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def acknowledge_objective_bank_notification(self, notification_id): """Acknowledge an objective_bank notification. :param notification_id: the ``Id`` of the notification :type notification_id: ``osid.id.Id`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass class ObjectiveBankHierarchySession: """This session defines methods for traversing a hierarchy of ``ObjectiveBank`` objects. Each node in the hierarchy is a unique ``ObjectiveBank``. The hierarchy may be traversed recursively to establish the tree structure through ``get_parent_objective_banks()`` and ``getChildObjectiveBanks()``. To relate these ``Ids`` to another OSID, ``get_objective_bank_nodes()`` can be used for retrievals that can be used for bulk lookups in other OSIDs. Any ``ObjectiveBank`` available in the ObjectiveBanking OSID is known to this hierarchy but does not appear in the hierarchy traversal until added as a root node or a child of another node. A user may not be authorized to traverse the entire hierarchy. Parts of the hierarchy may be made invisible through omission from the returns of ``get_parent_objective_banks()`` or ``get_child_objective_banks()`` in lieu of a ``PermissionDenied`` error that may disrupt the traversal through authorized pathways. This session defines views that offer differing behaviors when retrieving multiple objects. * comparative view: objective bank elements may be silently omitted or re-ordered * plenary view: provides a complete set or is an error condition """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. :return: the hierarchy ``Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_hierarchy_id = property(fget=get_objective_bank_hierarchy_id) @abc.abstractmethod def get_objective_bank_hierarchy(self): """Gets the hierarchy associated with this session. :return: the hierarchy associated with this session :rtype: ``osid.hierarchy.Hierarchy`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Hierarchy objective_bank_hierarchy = property(fget=get_objective_bank_hierarchy) @abc.abstractmethod def can_access_objective_bank_hierarchy(self): """Tests if this user can perform hierarchy queries. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a ``PermissionDenied``. This is intended as a hint to an an application that may not offer traversal functions to unauthorized users. :return: ``false`` if hierarchy traversal methods are not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def use_comparative_objective_bank_view(self): """The returns from the objective bank methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def use_plenary_objective_bank_view(self): """A complete view of the ``Hierarchy`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemented.* """ pass @abc.abstractmethod def get_root_objective_bank_ids(self): """Gets the root objective bank ``Ids`` in this hierarchy. :return: the root objective bank ``Ids`` :rtype: ``osid.id.IdList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList root_objective_bank_ids = property(fget=get_root_objective_bank_ids) @abc.abstractmethod def get_root_objective_banks(self): """Gets the root objective banks in this objective bank hierarchy. :return: the root objective banks :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method is must be implemented.* """ return # osid.learning.ObjectiveBankList root_objective_banks = property(fget=get_root_objective_banks) @abc.abstractmethod def has_parent_objective_banks(self, objective_bank_id): """Tests if the ``ObjectiveBank`` has any parents. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if the objective bank has parents, ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def is_parent_of_objective_bank(self, id_, objective_bank_id): """Tests if an ``Id`` is a direct parent of an objective bank. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if this ``id`` is a parent of ``objective_bank_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def get_parent_objective_bank_ids(self, objective_bank_id): """Gets the parent ``Ids`` of the given objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: the parent ``Ids`` of the objective bank :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_parent_objective_banks(self, objective_bank_id): """Gets the parents of the given objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: the parents of the objective bank :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def is_ancestor_of_objective_bank(self, id_, objective_bank_id): """Tests if an ``Id`` is an ancestor of an objective bank. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if this ``id`` is an ancestor of ``objective_bank_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def has_child_objective_banks(self, objective_bank_id): """Tests if an objective bank has any children. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if the ``objective_bank_id`` has children, ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def is_child_of_objective_bank(self, id_, objective_bank_id): """Tests if an objective bank is a direct child of another. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if the ``id`` is a child of ``objective_bank_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` not found return ``false``. """ return # boolean @abc.abstractmethod def get_child_objective_bank_ids(self, objective_bank_id): """Gets the child ``Ids`` of the given objective bank. :param objective_bank_id: the ``Id`` to query :type objective_bank_id: ``osid.id.Id`` :return: the children of the objective bank :rtype: ``osid.id.IdList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.id.IdList @abc.abstractmethod def get_child_objective_banks(self, objective_bank_id): """Gets the children of the given objective bank. :param objective_bank_id: the ``Id`` to query :type objective_bank_id: ``osid.id.Id`` :return: the children of the objective bank :rtype: ``osid.learning.ObjectiveBankList`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankList @abc.abstractmethod def is_descendant_of_objective_bank(self, id_, objective_bank_id): """Tests if an ``Id`` is a descendant of an objective bank. :param id: an ``Id`` :type id: ``osid.id.Id`` :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :return: ``true`` if the ``id`` is a descendant of the ``objective_bank_id,`` ``false`` otherwise :rtype: ``boolean`` :raise: ``NotFound`` -- ``objective_bank_id`` is not found :raise: ``NullArgument`` -- ``id`` or ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* *implementation notes*: If ``id`` is not found return ``false``. """ return # boolean @abc.abstractmethod def get_objective_bank_node_ids(self, objective_bank_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given objective bank. :param objective_bank_id: the ``Id`` to query :type objective_bank_id: ``osid.id.Id`` :param ancestor_levels: the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. :type ancestor_levels: ``cardinal`` :param descendant_levels: the maximum number of descendant levels to include. A value of 0 returns no children in the node. :type descendant_levels: ``cardinal`` :param include_siblings: ``true`` to include the siblings of the given node, ``false`` to omit the siblings :type include_siblings: ``boolean`` :return: a catalog node :rtype: ``osid.hierarchy.Node`` :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Node @abc.abstractmethod def get_objective_bank_nodes(self, objective_bank_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given objective bank. :param objective_bank_id: the ``Id`` to query :type objective_bank_id: ``osid.id.Id`` :param ancestor_levels: the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. :type ancestor_levels: ``cardinal`` :param descendant_levels: the maximum number of descendant levels to include. A value of 0 returns no children in the node. :type descendant_levels: ``cardinal`` :param include_siblings: ``true`` to include the siblings of the given node, ``false`` to omit the siblings :type include_siblings: ``boolean`` :return: an objective bank node :rtype: ``osid.learning.ObjectiveBankNode`` :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.learning.ObjectiveBankNode class ObjectiveBankHierarchyDesignSession: """This session defines methods for managing a hierarchy of ``ObjectiveBank`` objects. Each node in the hierarchy is a unique ``ObjectiveBank``. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def get_objective_bank_hierarchy_id(self): """Gets the hierarchy ``Id`` associated with this session. :return: the hierarchy ``Id`` associated with this session :rtype: ``osid.id.Id`` *compliance: mandatory -- This method must be implemented.* """ return # osid.id.Id objective_bank_hierarchy_id = property(fget=get_objective_bank_hierarchy_id) @abc.abstractmethod def get_objective_bank_hierarchy(self): """Gets the hierarchy associated with this session. :return: the hierarchy associated with this session :rtype: ``osid.hierarchy.Hierarchy`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ return # osid.hierarchy.Hierarchy objective_bank_hierarchy = property(fget=get_objective_bank_hierarchy) @abc.abstractmethod def can_modify_objective_bank_hierarchy(self): """Tests if this user can change the hierarchy. A return of true does not guarantee successful authorization. A return of false indicates that it is known performing any update will result in a ``PermissionDenied``. This is intended as a hint to an application that may opt not to offer these operations to an unauthorized user. :return: ``false`` if changing this hierarchy is not authorized, ``true`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.* """ return # boolean @abc.abstractmethod def add_root_objective_bank(self, objective_bank_id): """Adds a root objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_bank_id`` is already in hierarchy :raise: ``NotFound`` -- ``objective_bank_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_root_objective_bank(self, objective_bank_id): """Removes a root objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_bank_id`` is not a root :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def add_child_objective_bank(self, objective_bank_id, child_id): """Adds a child to an objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :param child_id: the ``Id`` of the new child :type child_id: ``osid.id.Id`` :raise: ``AlreadyExists`` -- ``objective_bank_id`` is already a parent of ``child_id`` :raise: ``NotFound`` -- ``objective_bank_id`` or ``child_id`` not found :raise: ``NullArgument`` -- ``objective_bank_id`` or ``child_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_child_objective_bank(self, objective_bank_id, child_id): """Removes a child from an objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :param child_id: the ``Id`` of the child :type child_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_bank_id`` not a parent of ``child_id`` :raise: ``NullArgument`` -- ``objective_bank_id`` or ``child_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass @abc.abstractmethod def remove_child_objective_banks(self, objective_bank_id): """Removes all children from an objective bank. :param objective_bank_id: the ``Id`` of an objective bank :type objective_bank_id: ``osid.id.Id`` :raise: ``NotFound`` -- ``objective_bank_id`` not in hierarchy :raise: ``NullArgument`` -- ``objective_bank_id`` is ``null`` :raise: ``OperationFailed`` -- unable to complete request :raise: ``PermissionDenied`` -- authorization failure *compliance: mandatory -- This method must be implemented.* """ pass
38.207054
203
0.661692
34,779
309,821
5.783893
0.020185
0.051442
0.041162
0.059684
0.936925
0.921117
0.903041
0.88337
0.866125
0.85324
0
0.000034
0.238451
309,821
8,108
204
38.211766
0.852533
0.726297
0
0.766691
0
0
0
0
0
0
0
0
0
1
0.2972
false
0.112706
0.000718
0
0.590093
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
1
0
1
0
0
1
0
0
10
b86abb5ba75a48884cb1eb70a6dd79ca61e08f77
5,735
py
Python
afnumpy/core/dtypes.py
FilipeMaia/afnumpy
11958f501f7ddeb88915a44d0fd4914e1779e7dd
[ "BSD-2-Clause" ]
31
2015-06-16T17:17:06.000Z
2021-01-03T16:20:23.000Z
afnumpy/core/dtypes.py
daurer/afnumpy
83f529eab7cb0ba49101aa5869059ac38f457e36
[ "BSD-2-Clause" ]
33
2015-05-14T18:03:43.000Z
2019-09-23T20:02:45.000Z
afnumpy/core/dtypes.py
daurer/afnumpy
83f529eab7cb0ba49101aa5869059ac38f457e36
[ "BSD-2-Clause" ]
13
2015-06-16T17:17:09.000Z
2021-11-06T22:46:15.000Z
import numpy import afnumpy import numbers class int64(numpy.int64): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.int64(x) else: return afnumpy.array(x).astype(cls) class int32(numpy.int32): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.int32(x) else: return afnumpy.array(x).astype(cls) class int16(numpy.intc): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.int16(x) else: return afnumpy.array(x).astype(cls) class int8(numpy.int8): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.int8(x) else: return afnumpy.array(x).astype(cls) class uint64(numpy.uint64): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.uint64(x) else: return afnumpy.array(x).astype(cls) class uint32(numpy.uint32): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.uint32(x) else: return afnumpy.array(x).astype(cls) class uint16(numpy.uint16): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.uint16(x) else: return afnumpy.array(x).astype(cls) class uint8(numpy.uint8): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.uint8(x) else: return afnumpy.array(x).astype(cls) class intc(numpy.intc): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.intc(x) else: return afnumpy.array(x).astype(cls) class intp(numpy.intp): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.intp(x) else: return afnumpy.array(x).astype(cls) class int_(numpy.int_): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.int_(x) else: return afnumpy.array(x).astype(cls) class bool_(numpy.bool_): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.bool_(x) else: return afnumpy.array(x).astype(cls) class float_(numpy.float_): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.float_(x) else: return afnumpy.array(x).astype(cls) class float16(numpy.float16): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.float16(x) else: return afnumpy.array(x).astype(cls) class float32(numpy.float32): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.float32(x) else: return afnumpy.array(x).astype(cls) class float64(numpy.float64): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.float64(x) else: return afnumpy.array(x).astype(cls) # removed for now #class float128(numpy.float64): # def __new__(cls, x=0): # if isinstance(x, afnumpy.ndarray): # raise NotImplementedError('Arrayfire does not support 128 bit floats') # elif isinstance(x, numbers.Number): # return numpy.float64(x) # else: # raise NotImplementedError('Arrayfire does not support 128 bit floats') class complex_(numpy.complex_): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.complex_(x) else: return afnumpy.array(x).astype(cls) class complex64(numpy.complex64): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.complex64(x) else: return afnumpy.array(x).astype(cls) class complex128(numpy.complex128): def __new__(cls, x=0): if isinstance(x, afnumpy.ndarray): return x.astype(cls) elif isinstance(x, numbers.Number): return numpy.complex128(x) else: return afnumpy.array(x).astype(cls) float = float complex = complex bool = bool int = int long = int bool8 = bool_ promote_types = numpy.promote_types
28.964646
83
0.58762
714
5,735
4.586835
0.077031
0.134351
0.116031
0.061069
0.835115
0.835115
0.835115
0.835115
0.816489
0.583206
0
0.026577
0.297995
5,735
197
84
29.111675
0.786885
0.064167
0
0.703704
0
0
0
0
0
0
0
0
0
1
0.117284
false
0
0.018519
0
0.604938
0
0
0
0
null
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
7
b21e92dc799f421c176856993fd77c4f394e9fe1
127,940
py
Python
pyboto3/comprehendmedical.py
gehad-shaat/pyboto3
4a0c2851a8bc04fb1c71c36086f7bb257e48181d
[ "MIT" ]
91
2016-12-31T11:38:37.000Z
2021-09-16T19:33:23.000Z
pyboto3/comprehendmedical.py
gehad-shaat/pyboto3
4a0c2851a8bc04fb1c71c36086f7bb257e48181d
[ "MIT" ]
7
2017-01-02T18:54:23.000Z
2020-08-11T13:54:02.000Z
pyboto3/comprehendmedical.py
gehad-shaat/pyboto3
4a0c2851a8bc04fb1c71c36086f7bb257e48181d
[ "MIT" ]
26
2016-12-31T13:11:00.000Z
2022-03-03T21:01:12.000Z
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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. ''' def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). """ pass def describe_entities_detection_v2_job(JobId=None): """ Gets the properties associated with a medical entities detection job. Use this operation to get the status of a detection job. See also: AWS API Documentation Exceptions :example: response = client.describe_entities_detection_v2_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier that Amazon Comprehend Medical generated for the job. The StartEntitiesDetectionV2Job operation returns this identifier in its response.\n :rtype: dict ReturnsResponse Syntax{ 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } Response Structure (dict) -- ComprehendMedicalAsyncJobProperties (dict) --An object that contains the properties associated with a detection job. JobId (string) --The identifier assigned to the detection job. JobName (string) --The name that you assigned to the detection job. JobStatus (string) --The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) --A description of the status of a job. SubmitTime (datetime) --The time that the detection job was submitted for processing. EndTime (datetime) --The time that the detection job completed. ExpirationTime (datetime) --The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) --The input data configuration that you supplied when you created the detection job. S3Bucket (string) --The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) --The path to the input data files in the S3 bucket. OutputDataConfig (dict) --The output data configuration that you supplied when you created the detection job. S3Bucket (string) --When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) --The language code of the input documents. DataAccessRoleArn (string) --The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) --The path to the file that describes the results of a batch job. KMSKey (string) --The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } """ pass def describe_icd10_cm_inference_job(JobId=None): """ Gets the properties associated with an InferICD10CM job. Use this operation to get the status of an inference job. See also: AWS API Documentation Exceptions :example: response = client.describe_icd10_cm_inference_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier that Amazon Comprehend Medical generated for the job. The StartICD10CMInferenceJob operation returns this identifier in its response.\n :rtype: dict ReturnsResponse Syntax{ 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } Response Structure (dict) -- ComprehendMedicalAsyncJobProperties (dict) --An object that contains the properties associated with a detection job. JobId (string) --The identifier assigned to the detection job. JobName (string) --The name that you assigned to the detection job. JobStatus (string) --The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) --A description of the status of a job. SubmitTime (datetime) --The time that the detection job was submitted for processing. EndTime (datetime) --The time that the detection job completed. ExpirationTime (datetime) --The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) --The input data configuration that you supplied when you created the detection job. S3Bucket (string) --The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) --The path to the input data files in the S3 bucket. OutputDataConfig (dict) --The output data configuration that you supplied when you created the detection job. S3Bucket (string) --When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) --The language code of the input documents. DataAccessRoleArn (string) --The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) --The path to the file that describes the results of a batch job. KMSKey (string) --The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } """ pass def describe_phi_detection_job(JobId=None): """ Gets the properties associated with a protected health information (PHI) detection job. Use this operation to get the status of a detection job. See also: AWS API Documentation Exceptions :example: response = client.describe_phi_detection_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier that Amazon Comprehend Medical generated for the job. The StartPHIDetectionJob operation returns this identifier in its response.\n :rtype: dict ReturnsResponse Syntax{ 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } Response Structure (dict) -- ComprehendMedicalAsyncJobProperties (dict) --An object that contains the properties associated with a detection job. JobId (string) --The identifier assigned to the detection job. JobName (string) --The name that you assigned to the detection job. JobStatus (string) --The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) --A description of the status of a job. SubmitTime (datetime) --The time that the detection job was submitted for processing. EndTime (datetime) --The time that the detection job completed. ExpirationTime (datetime) --The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) --The input data configuration that you supplied when you created the detection job. S3Bucket (string) --The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) --The path to the input data files in the S3 bucket. OutputDataConfig (dict) --The output data configuration that you supplied when you created the detection job. S3Bucket (string) --When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) --The language code of the input documents. DataAccessRoleArn (string) --The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) --The path to the file that describes the results of a batch job. KMSKey (string) --The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } """ pass def describe_rx_norm_inference_job(JobId=None): """ Gets the properties associated with an InferRxNorm job. Use this operation to get the status of an inference job. See also: AWS API Documentation Exceptions :example: response = client.describe_rx_norm_inference_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier that Amazon Comprehend Medical generated for the job. The StartRxNormInferenceJob operation returns this identifier in its response.\n :rtype: dict ReturnsResponse Syntax{ 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } Response Structure (dict) -- ComprehendMedicalAsyncJobProperties (dict) --An object that contains the properties associated with a detection job. JobId (string) --The identifier assigned to the detection job. JobName (string) --The name that you assigned to the detection job. JobStatus (string) --The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) --A description of the status of a job. SubmitTime (datetime) --The time that the detection job was submitted for processing. EndTime (datetime) --The time that the detection job completed. ExpirationTime (datetime) --The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) --The input data configuration that you supplied when you created the detection job. S3Bucket (string) --The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) --The path to the input data files in the S3 bucket. OutputDataConfig (dict) --The output data configuration that you supplied when you created the detection job. S3Bucket (string) --When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) --The language code of the input documents. DataAccessRoleArn (string) --The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) --The path to the file that describes the results of a batch job. KMSKey (string) --The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobProperties': { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' } } """ pass def detect_entities(Text=None): """ The DetectEntities operation is deprecated. You should use the DetectEntitiesV2 operation instead. Inspects the clinical text for a variety of medical entities and returns specific information about them such as entity category, location, and confidence score on that information . See also: AWS API Documentation Exceptions :example: response = client.detect_entities( Text='string' ) :type Text: string :param Text: [REQUIRED]\nA UTF-8 text string containing the clinical content being examined for entities. Each string must contain fewer than 20,000 bytes of characters.\n :rtype: dict ReturnsResponse Syntax{ 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'UnmappedAttributes': [ { 'Type': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Attribute': { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] } }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } Response Structure (dict) -- Entities (list) --The collection of medical entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence that Amazon Comprehend Medical has in the detection and analysis. Attributes and traits of the entity are also returned. (dict) --Provides information about an extracted medical entity. Id (integer) --The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection. Text (string) --The segment of input text extracted as this entity. Category (string) --The category of the entity. Type (string) --Describes the specific type of entity with category of entities. Traits (list) --Contextual information for the entity. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. Attributes (list) --The extracted attributes that relate to this entity. (dict) --An extracted segment of the text that is an attribute of an entity, or otherwise related to an entity, such as the dosage of a medication taken. It contains information about the attribute such as id, begin and end offset within the input text, and the segment of the input text. Type (string) --The type of attribute. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. RelationshipType (string) --The type of relationship between the entity and attribute. Type for the relationship is OVERLAP , indicating that the entity occurred at the same time as the Date_Expression . Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text extracted as this attribute. Category (string) --The category of attribute. Traits (list) --Contextual information for this attribute. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. UnmappedAttributes (list) --Attributes extracted from the input text that we were unable to relate to an entity. (dict) --An attribute that we extracted, but were unable to relate to an entity. Type (string) --The type of the attribute, could be one of the following values: "MEDICATION", "MEDICAL_CONDITION", "ANATOMY", "TEST_AND_TREATMENT_PROCEDURE" or "PROTECTED_HEALTH_INFORMATION". Attribute (dict) --The specific attribute that has been extracted but not mapped to an entity. Type (string) --The type of attribute. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. RelationshipType (string) --The type of relationship between the entity and attribute. Type for the relationship is OVERLAP , indicating that the entity occurred at the same time as the Date_Expression . Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text extracted as this attribute. Category (string) --The category of attribute. Traits (list) --Contextual information for this attribute. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. PaginationToken (string) --If the result of the previous request to DetectEntities was truncated, include the PaginationToken to fetch the next page of entities. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InternalServerException ComprehendMedical.Client.exceptions.ServiceUnavailableException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.InvalidEncodingException ComprehendMedical.Client.exceptions.TextSizeLimitExceededException :return: { 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'UnmappedAttributes': [ { 'Type': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Attribute': { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] } }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } """ pass def detect_entities_v2(Text=None): """ Inspects the clinical text for a variety of medical entities and returns specific information about them such as entity category, location, and confidence score on that information. Amazon Comprehend Medical only detects medical entities in English language texts. The DetectEntitiesV2 operation replaces the DetectEntities operation. This new action uses a different model for determining the entities in your medical text and changes the way that some entities are returned in the output. You should use the DetectEntitiesV2 operation in all new applications. The DetectEntitiesV2 operation returns the Acuity and Direction entities as attributes instead of types. See also: AWS API Documentation Exceptions :example: response = client.detect_entities_v2( Text='string' ) :type Text: string :param Text: [REQUIRED]\nA UTF-8 string containing the clinical content being examined for entities. Each string must contain fewer than 20,000 bytes of characters.\n :rtype: dict ReturnsResponse Syntax{ 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'UnmappedAttributes': [ { 'Type': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Attribute': { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] } }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } Response Structure (dict) -- Entities (list) --The collection of medical entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence in the detection and analysis. Attributes and traits of the entity are also returned. (dict) --Provides information about an extracted medical entity. Id (integer) --The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection. Text (string) --The segment of input text extracted as this entity. Category (string) --The category of the entity. Type (string) --Describes the specific type of entity with category of entities. Traits (list) --Contextual information for the entity. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. Attributes (list) --The extracted attributes that relate to this entity. (dict) --An extracted segment of the text that is an attribute of an entity, or otherwise related to an entity, such as the dosage of a medication taken. It contains information about the attribute such as id, begin and end offset within the input text, and the segment of the input text. Type (string) --The type of attribute. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. RelationshipType (string) --The type of relationship between the entity and attribute. Type for the relationship is OVERLAP , indicating that the entity occurred at the same time as the Date_Expression . Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text extracted as this attribute. Category (string) --The category of attribute. Traits (list) --Contextual information for this attribute. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. UnmappedAttributes (list) --Attributes extracted from the input text that couldn\'t be related to an entity. (dict) --An attribute that we extracted, but were unable to relate to an entity. Type (string) --The type of the attribute, could be one of the following values: "MEDICATION", "MEDICAL_CONDITION", "ANATOMY", "TEST_AND_TREATMENT_PROCEDURE" or "PROTECTED_HEALTH_INFORMATION". Attribute (dict) --The specific attribute that has been extracted but not mapped to an entity. Type (string) --The type of attribute. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. RelationshipType (string) --The type of relationship between the entity and attribute. Type for the relationship is OVERLAP , indicating that the entity occurred at the same time as the Date_Expression . Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text extracted as this attribute. Category (string) --The category of attribute. Traits (list) --Contextual information for this attribute. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. PaginationToken (string) --If the result to the DetectEntitiesV2 operation was truncated, include the PaginationToken to fetch the next page of entities. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InternalServerException ComprehendMedical.Client.exceptions.ServiceUnavailableException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.InvalidEncodingException ComprehendMedical.Client.exceptions.TextSizeLimitExceededException :return: { 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'UnmappedAttributes': [ { 'Type': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Attribute': { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] } }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } """ pass def detect_phi(Text=None): """ Inspects the clinical text for protected health information (PHI) entities and returns the entity category, location, and confidence score for each entity. Amazon Comprehend Medical only detects entities in English language texts. See also: AWS API Documentation Exceptions :example: response = client.detect_phi( Text='string' ) :type Text: string :param Text: [REQUIRED]\nA UTF-8 text string containing the clinical content being examined for PHI entities. Each string must contain fewer than 20,000 bytes of characters.\n :rtype: dict ReturnsResponse Syntax{ 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } Response Structure (dict) -- Entities (list) --The collection of PHI entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence that Amazon Comprehend Medical has in its detection. (dict) --Provides information about an extracted medical entity. Id (integer) --The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection. Text (string) --The segment of input text extracted as this entity. Category (string) --The category of the entity. Type (string) --Describes the specific type of entity with category of entities. Traits (list) --Contextual information for the entity. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. Attributes (list) --The extracted attributes that relate to this entity. (dict) --An extracted segment of the text that is an attribute of an entity, or otherwise related to an entity, such as the dosage of a medication taken. It contains information about the attribute such as id, begin and end offset within the input text, and the segment of the input text. Type (string) --The type of attribute. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. RelationshipType (string) --The type of relationship between the entity and attribute. Type for the relationship is OVERLAP , indicating that the entity occurred at the same time as the Date_Expression . Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text extracted as this attribute. Category (string) --The category of attribute. Traits (list) --Contextual information for this attribute. (dict) --Provides contextual information about the extracted entity. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of this trait. PaginationToken (string) --If the result of the previous request to DetectPHI was truncated, include the PaginationToken to fetch the next page of PHI entities. ModelVersion (string) --The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InternalServerException ComprehendMedical.Client.exceptions.ServiceUnavailableException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.InvalidEncodingException ComprehendMedical.Client.exceptions.TextSizeLimitExceededException :return: { 'Entities': [ { 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Score': ..., 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ], 'Attributes': [ { 'Type': 'NAME'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'GENERIC_NAME'|'BRAND_NAME'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_NAME'|'TEST_VALUE'|'TEST_UNITS'|'PROCEDURE_NAME'|'TREATMENT_NAME'|'DATE'|'AGE'|'CONTACT_POINT'|'EMAIL'|'IDENTIFIER'|'URL'|'ADDRESS'|'PROFESSION'|'SYSTEM_ORGAN_SITE'|'DIRECTION'|'QUALITY'|'QUANTITY'|'TIME_EXPRESSION'|'TIME_TO_MEDICATION_NAME'|'TIME_TO_DX_NAME'|'TIME_TO_TEST_NAME'|'TIME_TO_PROCEDURE_NAME'|'TIME_TO_TREATMENT_NAME', 'Score': ..., 'RelationshipScore': ..., 'RelationshipType': 'EVERY'|'WITH_DOSAGE'|'ADMINISTERED_VIA'|'FOR'|'NEGATIVE'|'OVERLAP'|'DOSAGE'|'ROUTE_OR_MODE'|'FORM'|'FREQUENCY'|'DURATION'|'STRENGTH'|'RATE'|'ACUITY'|'TEST_VALUE'|'TEST_UNITS'|'DIRECTION', 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Category': 'MEDICATION'|'MEDICAL_CONDITION'|'PROTECTED_HEALTH_INFORMATION'|'TEST_TREATMENT_PROCEDURE'|'ANATOMY'|'TIME_EXPRESSION', 'Traits': [ { 'Name': 'SIGN'|'SYMPTOM'|'DIAGNOSIS'|'NEGATION', 'Score': ... }, ] }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to\nClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model. """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} ReturnsA paginator object. """ pass def get_waiter(waiter_name=None): """ Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters. :rtype: botocore.waiter.Waiter """ pass def infer_icd10_cm(Text=None): """ InferICD10CM detects medical conditions as entities listed in a patient record and links those entities to normalized concept identifiers in the ICD-10-CM knowledge base from the Centers for Disease Control. Amazon Comprehend Medical only detects medical entities in English language texts. See also: AWS API Documentation Exceptions :example: response = client.infer_icd10_cm( Text='string' ) :type Text: string :param Text: [REQUIRED]\nThe input text used for analysis. The input for InferICD10CM is a string from 1 to 10000 characters.\n :rtype: dict ReturnsResponse Syntax{ 'Entities': [ { 'Id': 123, 'Text': 'string', 'Category': 'MEDICAL_CONDITION', 'Type': 'DX_NAME', 'Score': ..., 'BeginOffset': 123, 'EndOffset': 123, 'Attributes': [ { 'Type': 'ACUITY'|'DIRECTION'|'SYSTEM_ORGAN_SITE'|'QUALITY'|'QUANTITY', 'Score': ..., 'RelationshipScore': ..., 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Traits': [ { 'Name': 'NEGATION'|'DIAGNOSIS'|'SIGN'|'SYMPTOM', 'Score': ... }, ] }, ], 'Traits': [ { 'Name': 'NEGATION'|'DIAGNOSIS'|'SIGN'|'SYMPTOM', 'Score': ... }, ], 'ICD10CMConcepts': [ { 'Description': 'string', 'Code': 'string', 'Score': ... }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } Response Structure (dict) -- Entities (list) --The medical conditions detected in the text linked to ICD-10-CM concepts. If the action is successful, the service sends back an HTTP 200 response, as well as the entities detected. (dict) --The collection of medical entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence that Amazon Comprehend Medical has in the detection and analysis. Attributes and traits of the entity are also returned. Id (integer) --The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier. Text (string) --The segment of input text that is matched to the detected entity. Category (string) --The category of the entity. InferICD10CM detects entities in the MEDICAL_CONDITION category. Type (string) --Describes the specific type of entity with category of entities. InferICD10CM detects entities of the type DX_NAME . Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detection. BeginOffset (integer) --The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string. Attributes (list) --The detected attributes that relate to the entity. An extracted segment of the text that is an attribute of an entity, or otherwise related to an entity, such as the nature of a medical condition. (dict) --The detected attributes that relate to an entity. This includes an extracted segment of the text that is an attribute of an entity, or otherwise related to an entity. InferICD10CM detects the following attributes: Direction , System, Organ or Site , and Acuity . Type (string) --The type of attribute. InferICD10CM detects entities of the type DX_NAME . Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that this attribute is correctly related to this entity. Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text which contains the detected attribute. Traits (list) --The contextual information for the attribute. The traits recognized by InferICD10CM are DIAGNOSIS , SIGN , SYMPTOM , and NEGATION . (dict) --Contextual information for the entity. The traits recognized by InferICD10CM are DIAGNOSIS , SIGN , SYMPTOM , and NEGATION . Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as a trait. Traits (list) --Provides Contextual information for the entity. The traits recognized by InferICD10CM are DIAGNOSIS , SIGN , SYMPTOM , and NEGATION. (dict) --Contextual information for the entity. The traits recognized by InferICD10CM are DIAGNOSIS , SIGN , SYMPTOM , and NEGATION . Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has that the segment of text is correctly recognized as a trait. ICD10CMConcepts (list) --The ICD-10-CM concepts that the entity could refer to, along with a score indicating the likelihood of the match. (dict) --The ICD-10-CM concepts that the entity could refer to, along with a score indicating the likelihood of the match. Description (string) --The long description of the ICD-10-CM code in the ontology. Code (string) --The ICD-10-CM code that identifies the concept found in the knowledge base from the Centers for Disease Control. Score (float) --The level of confidence that Amazon Comprehend Medical has that the entity is accurately linked to an ICD-10-CM concept. PaginationToken (string) --If the result of the previous request to InferICD10CM was truncated, include the PaginationToken to fetch the next page of medical condition entities. ModelVersion (string) --The version of the model used to analyze the documents, in the format n .*n* .*n* You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InternalServerException ComprehendMedical.Client.exceptions.ServiceUnavailableException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.InvalidEncodingException ComprehendMedical.Client.exceptions.TextSizeLimitExceededException :return: { 'Entities': [ { 'Id': 123, 'Text': 'string', 'Category': 'MEDICAL_CONDITION', 'Type': 'DX_NAME', 'Score': ..., 'BeginOffset': 123, 'EndOffset': 123, 'Attributes': [ { 'Type': 'ACUITY'|'DIRECTION'|'SYSTEM_ORGAN_SITE'|'QUALITY'|'QUANTITY', 'Score': ..., 'RelationshipScore': ..., 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Traits': [ { 'Name': 'NEGATION'|'DIAGNOSIS'|'SIGN'|'SYMPTOM', 'Score': ... }, ] }, ], 'Traits': [ { 'Name': 'NEGATION'|'DIAGNOSIS'|'SIGN'|'SYMPTOM', 'Score': ... }, ], 'ICD10CMConcepts': [ { 'Description': 'string', 'Code': 'string', 'Score': ... }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } """ pass def infer_rx_norm(Text=None): """ InferRxNorm detects medications as entities listed in a patient record and links to the normalized concept identifiers in the RxNorm database from the National Library of Medicine. Amazon Comprehend Medical only detects medical entities in English language texts. See also: AWS API Documentation Exceptions :example: response = client.infer_rx_norm( Text='string' ) :type Text: string :param Text: [REQUIRED]\nThe input text used for analysis. The input for InferRxNorm is a string from 1 to 10000 characters.\n :rtype: dict ReturnsResponse Syntax{ 'Entities': [ { 'Id': 123, 'Text': 'string', 'Category': 'MEDICATION', 'Type': 'BRAND_NAME'|'GENERIC_NAME', 'Score': ..., 'BeginOffset': 123, 'EndOffset': 123, 'Attributes': [ { 'Type': 'DOSAGE'|'DURATION'|'FORM'|'FREQUENCY'|'RATE'|'ROUTE_OR_MODE'|'STRENGTH', 'Score': ..., 'RelationshipScore': ..., 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Traits': [ { 'Name': 'NEGATION', 'Score': ... }, ] }, ], 'Traits': [ { 'Name': 'NEGATION', 'Score': ... }, ], 'RxNormConcepts': [ { 'Description': 'string', 'Code': 'string', 'Score': ... }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } Response Structure (dict) -- Entities (list) --The medication entities detected in the text linked to RxNorm concepts. If the action is successful, the service sends back an HTTP 200 response, as well as the entities detected. (dict) --The collection of medical entities extracted from the input text and their associated information. For each entity, the response provides the entity text, the entity category, where the entity text begins and ends, and the level of confidence that Amazon Comprehend Medical has in the detection and analysis. Attributes and traits of the entity are also returned. Id (integer) --The numeric identifier for the entity. This is a monotonically increasing id unique within this response rather than a global unique identifier. Text (string) --The segment of input text extracted from which the entity was detected. Category (string) --The category of the entity. The recognized categories are GENERIC or BRAND_NAME . Type (string) --Describes the specific type of entity. For InferRxNorm, the recognized entity type is MEDICATION . Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected entity. BeginOffset (integer) --The 0-based character offset in the input text that shows where the entity begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the entity ends. The offset returns the UTF-8 code point in the string. Attributes (list) --The extracted attributes that relate to the entity. The attributes recognized by InferRxNorm are DOSAGE , DURATION , FORM , FREQUENCY , RATE , ROUTE_OR_MODE , and STRENGTH . (dict) --The extracted attributes that relate to this entity. The attributes recognized by InferRxNorm are DOSAGE , DURATION , FORM , FREQUENCY , RATE , ROUTE_OR_MODE . Type (string) --The type of attribute. The types of attributes recognized by InferRxNorm are BRAND_NAME and GENERIC_NAME . Score (float) --The level of confidence that Comprehend Medical has that the segment of text is correctly recognized as an attribute. RelationshipScore (float) --The level of confidence that Amazon Comprehend Medical has that the attribute is accurately linked to an entity. Id (integer) --The numeric identifier for this attribute. This is a monotonically increasing id unique within this response rather than a global unique identifier. BeginOffset (integer) --The 0-based character offset in the input text that shows where the attribute begins. The offset returns the UTF-8 code point in the string. EndOffset (integer) --The 0-based character offset in the input text that shows where the attribute ends. The offset returns the UTF-8 code point in the string. Text (string) --The segment of input text which corresponds to the detected attribute. Traits (list) --Contextual information for the attribute. InferRxNorm recognizes the trait NEGATION for attributes, i.e. that the patient is not taking a specific dose or form of a medication. (dict) --The contextual information for the entity. InferRxNorm recognizes the trait NEGATION , which is any indication that the patient is not taking a medication. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected trait. Traits (list) --Contextual information for the entity. (dict) --The contextual information for the entity. InferRxNorm recognizes the trait NEGATION , which is any indication that the patient is not taking a medication. Name (string) --Provides a name or contextual description about the trait. Score (float) --The level of confidence that Amazon Comprehend Medical has in the accuracy of the detected trait. RxNormConcepts (list) --The RxNorm concepts that the entity could refer to, along with a score indicating the likelihood of the match. (dict) --The RxNorm concept that the entity could refer to, along with a score indicating the likelihood of the match. Description (string) --The description of the RxNorm concept. Code (string) --RxNorm concept ID, also known as the RxCUI. Score (float) --The level of confidence that Amazon Comprehend Medical has that the entity is accurately linked to the reported RxNorm concept. PaginationToken (string) --If the result of the previous request to InferRxNorm was truncated, include the PaginationToken to fetch the next page of medication entities. ModelVersion (string) --The version of the model used to analyze the documents, in the format n .*n* .*n* You can use this information to track the model used for a particular batch of documents. Exceptions ComprehendMedical.Client.exceptions.InternalServerException ComprehendMedical.Client.exceptions.ServiceUnavailableException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.InvalidEncodingException ComprehendMedical.Client.exceptions.TextSizeLimitExceededException :return: { 'Entities': [ { 'Id': 123, 'Text': 'string', 'Category': 'MEDICATION', 'Type': 'BRAND_NAME'|'GENERIC_NAME', 'Score': ..., 'BeginOffset': 123, 'EndOffset': 123, 'Attributes': [ { 'Type': 'DOSAGE'|'DURATION'|'FORM'|'FREQUENCY'|'RATE'|'ROUTE_OR_MODE'|'STRENGTH', 'Score': ..., 'RelationshipScore': ..., 'Id': 123, 'BeginOffset': 123, 'EndOffset': 123, 'Text': 'string', 'Traits': [ { 'Name': 'NEGATION', 'Score': ... }, ] }, ], 'Traits': [ { 'Name': 'NEGATION', 'Score': ... }, ], 'RxNormConcepts': [ { 'Description': 'string', 'Code': 'string', 'Score': ... }, ] }, ], 'PaginationToken': 'string', 'ModelVersion': 'string' } """ pass def list_entities_detection_v2_jobs(Filter=None, NextToken=None, MaxResults=None): """ Gets a list of medical entity detection jobs that you have submitted. See also: AWS API Documentation Exceptions :example: response = client.list_entities_detection_v2_jobs( Filter={ 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 ) :type Filter: dict :param Filter: Filters the jobs that are returned. You can filter jobs based on their names, status, or the date and time that they were submitted. You can only set one filter at a time.\n\nJobName (string) --Filters on the name of the job.\n\nJobStatus (string) --Filters the list of jobs based on job status. Returns only jobs with the specified status.\n\nSubmitTimeBefore (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.\n\nSubmitTimeAfter (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.\n\n\n :type NextToken: string :param NextToken: Identifies the next page of results to return. :type MaxResults: integer :param MaxResults: The maximum number of results to return in each page. The default is 100. :rtype: dict ReturnsResponse Syntax { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- ComprehendMedicalAsyncJobPropertiesList (list) -- A list containing the properties of each job returned. (dict) -- Provides information about a detection job. JobId (string) -- The identifier assigned to the detection job. JobName (string) -- The name that you assigned to the detection job. JobStatus (string) -- The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) -- A description of the status of a job. SubmitTime (datetime) -- The time that the detection job was submitted for processing. EndTime (datetime) -- The time that the detection job completed. ExpirationTime (datetime) -- The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) -- The input data configuration that you supplied when you created the detection job. S3Bucket (string) -- The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) -- The path to the input data files in the S3 bucket. OutputDataConfig (dict) -- The output data configuration that you supplied when you created the detection job. S3Bucket (string) -- When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) -- The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) -- The language code of the input documents. DataAccessRoleArn (string) -- The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) -- The path to the file that describes the results of a batch job. KMSKey (string) -- The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) -- The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. NextToken (string) -- Identifies the next page of results to return. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException """ pass def list_icd10_cm_inference_jobs(Filter=None, NextToken=None, MaxResults=None): """ Gets a list of InferICD10CM jobs that you have submitted. See also: AWS API Documentation Exceptions :example: response = client.list_icd10_cm_inference_jobs( Filter={ 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 ) :type Filter: dict :param Filter: Filters the jobs that are returned. You can filter jobs based on their names, status, or the date and time that they were submitted. You can only set one filter at a time.\n\nJobName (string) --Filters on the name of the job.\n\nJobStatus (string) --Filters the list of jobs based on job status. Returns only jobs with the specified status.\n\nSubmitTimeBefore (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.\n\nSubmitTimeAfter (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.\n\n\n :type NextToken: string :param NextToken: Identifies the next page of results to return. :type MaxResults: integer :param MaxResults: The maximum number of results to return in each page. The default is 100. :rtype: dict ReturnsResponse Syntax { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- ComprehendMedicalAsyncJobPropertiesList (list) -- A list containing the properties of each job that is returned. (dict) -- Provides information about a detection job. JobId (string) -- The identifier assigned to the detection job. JobName (string) -- The name that you assigned to the detection job. JobStatus (string) -- The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) -- A description of the status of a job. SubmitTime (datetime) -- The time that the detection job was submitted for processing. EndTime (datetime) -- The time that the detection job completed. ExpirationTime (datetime) -- The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) -- The input data configuration that you supplied when you created the detection job. S3Bucket (string) -- The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) -- The path to the input data files in the S3 bucket. OutputDataConfig (dict) -- The output data configuration that you supplied when you created the detection job. S3Bucket (string) -- When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) -- The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) -- The language code of the input documents. DataAccessRoleArn (string) -- The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) -- The path to the file that describes the results of a batch job. KMSKey (string) -- The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) -- The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. NextToken (string) -- Identifies the next page of results to return. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException """ pass def list_phi_detection_jobs(Filter=None, NextToken=None, MaxResults=None): """ Gets a list of protected health information (PHI) detection jobs that you have submitted. See also: AWS API Documentation Exceptions :example: response = client.list_phi_detection_jobs( Filter={ 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 ) :type Filter: dict :param Filter: Filters the jobs that are returned. You can filter jobs based on their names, status, or the date and time that they were submitted. You can only set one filter at a time.\n\nJobName (string) --Filters on the name of the job.\n\nJobStatus (string) --Filters the list of jobs based on job status. Returns only jobs with the specified status.\n\nSubmitTimeBefore (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.\n\nSubmitTimeAfter (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.\n\n\n :type NextToken: string :param NextToken: Identifies the next page of results to return. :type MaxResults: integer :param MaxResults: The maximum number of results to return in each page. The default is 100. :rtype: dict ReturnsResponse Syntax { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- ComprehendMedicalAsyncJobPropertiesList (list) -- A list containing the properties of each job returned. (dict) -- Provides information about a detection job. JobId (string) -- The identifier assigned to the detection job. JobName (string) -- The name that you assigned to the detection job. JobStatus (string) -- The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) -- A description of the status of a job. SubmitTime (datetime) -- The time that the detection job was submitted for processing. EndTime (datetime) -- The time that the detection job completed. ExpirationTime (datetime) -- The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) -- The input data configuration that you supplied when you created the detection job. S3Bucket (string) -- The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) -- The path to the input data files in the S3 bucket. OutputDataConfig (dict) -- The output data configuration that you supplied when you created the detection job. S3Bucket (string) -- When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) -- The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) -- The language code of the input documents. DataAccessRoleArn (string) -- The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) -- The path to the file that describes the results of a batch job. KMSKey (string) -- The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) -- The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. NextToken (string) -- Identifies the next page of results to return. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException """ pass def list_rx_norm_inference_jobs(Filter=None, NextToken=None, MaxResults=None): """ Gets a list of InferRxNorm jobs that you have submitted. See also: AWS API Documentation Exceptions :example: response = client.list_rx_norm_inference_jobs( Filter={ 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'SubmitTimeBefore': datetime(2015, 1, 1), 'SubmitTimeAfter': datetime(2015, 1, 1) }, NextToken='string', MaxResults=123 ) :type Filter: dict :param Filter: Filters the jobs that are returned. You can filter jobs based on their names, status, or the date and time that they were submitted. You can only set one filter at a time.\n\nJobName (string) --Filters on the name of the job.\n\nJobStatus (string) --Filters the list of jobs based on job status. Returns only jobs with the specified status.\n\nSubmitTimeBefore (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.\n\nSubmitTimeAfter (datetime) --Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.\n\n\n :type NextToken: string :param NextToken: Identifies the next page of results to return. :type MaxResults: integer :param MaxResults: Identifies the next page of results to return. :rtype: dict ReturnsResponse Syntax { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } Response Structure (dict) -- ComprehendMedicalAsyncJobPropertiesList (list) -- The maximum number of results to return in each page. The default is 100. (dict) -- Provides information about a detection job. JobId (string) -- The identifier assigned to the detection job. JobName (string) -- The name that you assigned to the detection job. JobStatus (string) -- The current status of the detection job. If the status is FAILED , the Message field shows the reason for the failure. Message (string) -- A description of the status of a job. SubmitTime (datetime) -- The time that the detection job was submitted for processing. EndTime (datetime) -- The time that the detection job completed. ExpirationTime (datetime) -- The date and time that job metadata is deleted from the server. Output files in your S3 bucket will not be deleted. After the metadata is deleted, the job will no longer appear in the results of the ListEntitiesDetectionV2Job or the ListPHIDetectionJobs operation. InputDataConfig (dict) -- The input data configuration that you supplied when you created the detection job. S3Bucket (string) -- The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling. Each file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket. S3Key (string) -- The path to the input data files in the S3 bucket. OutputDataConfig (dict) -- The output data configuration that you supplied when you created the detection job. S3Bucket (string) -- When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output. S3Key (string) -- The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another. LanguageCode (string) -- The language code of the input documents. DataAccessRoleArn (string) -- The Amazon Resource Name (ARN) that gives Amazon Comprehend Medical read access to your input data. ManifestFilePath (string) -- The path to the file that describes the results of a batch job. KMSKey (string) -- The AWS Key Management Service key, if any, used to encrypt the output files. ModelVersion (string) -- The version of the model used to analyze the documents. The version number looks like X.X.X. You can use this information to track the model used for a particular batch of documents. NextToken (string) -- Identifies the next page of results to return. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'ComprehendMedicalAsyncJobPropertiesList': [ { 'JobId': 'string', 'JobName': 'string', 'JobStatus': 'SUBMITTED'|'IN_PROGRESS'|'COMPLETED'|'PARTIAL_SUCCESS'|'FAILED'|'STOP_REQUESTED'|'STOPPED', 'Message': 'string', 'SubmitTime': datetime(2015, 1, 1), 'EndTime': datetime(2015, 1, 1), 'ExpirationTime': datetime(2015, 1, 1), 'InputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'OutputDataConfig': { 'S3Bucket': 'string', 'S3Key': 'string' }, 'LanguageCode': 'en', 'DataAccessRoleArn': 'string', 'ManifestFilePath': 'string', 'KMSKey': 'string', 'ModelVersion': 'string' }, ], 'NextToken': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ValidationException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.InternalServerException """ pass def start_entities_detection_v2_job(InputDataConfig=None, OutputDataConfig=None, DataAccessRoleArn=None, JobName=None, ClientRequestToken=None, KMSKey=None, LanguageCode=None): """ Starts an asynchronous medical entity detection job for a collection of documents. Use the DescribeEntitiesDetectionV2Job operation to track the status of a job. See also: AWS API Documentation Exceptions :example: response = client.start_entities_detection_v2_job( InputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, OutputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, DataAccessRoleArn='string', JobName='string', ClientRequestToken='string', KMSKey='string', LanguageCode='en' ) :type InputDataConfig: dict :param InputDataConfig: [REQUIRED]\nSpecifies the format and location of the input data for the job.\n\nS3Bucket (string) -- [REQUIRED]The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling.\nEach file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket.\n\nS3Key (string) --The path to the input data files in the S3 bucket.\n\n\n :type OutputDataConfig: dict :param OutputDataConfig: [REQUIRED]\nSpecifies where to send the output files.\n\nS3Bucket (string) -- [REQUIRED]When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output.\n\nS3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another.\n\n\n :type DataAccessRoleArn: string :param DataAccessRoleArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations .\n :type JobName: string :param JobName: The identifier of the job. :type ClientRequestToken: string :param ClientRequestToken: A unique identifier for the request. If you don\'t set the client request token, Amazon Comprehend Medical generates one.\nThis field is autopopulated if not provided.\n :type KMSKey: string :param KMSKey: An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text. :type LanguageCode: string :param LanguageCode: [REQUIRED]\nThe language of the input documents. All documents must be in the same language.\n :rtype: dict ReturnsResponse Syntax { 'JobId': 'string' } Response Structure (dict) -- JobId (string) -- The identifier generated for the job. To get the status of a job, use this identifier with the DescribeEntitiesDetectionV2Job operation. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException """ pass def start_icd10_cm_inference_job(InputDataConfig=None, OutputDataConfig=None, DataAccessRoleArn=None, JobName=None, ClientRequestToken=None, KMSKey=None, LanguageCode=None): """ Starts an asynchronous job to detect medical conditions and link them to the ICD-10-CM ontology. Use the DescribeICD10CMInferenceJob operation to track the status of a job. See also: AWS API Documentation Exceptions :example: response = client.start_icd10_cm_inference_job( InputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, OutputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, DataAccessRoleArn='string', JobName='string', ClientRequestToken='string', KMSKey='string', LanguageCode='en' ) :type InputDataConfig: dict :param InputDataConfig: [REQUIRED]\nSpecifies the format and location of the input data for the job.\n\nS3Bucket (string) -- [REQUIRED]The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling.\nEach file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket.\n\nS3Key (string) --The path to the input data files in the S3 bucket.\n\n\n :type OutputDataConfig: dict :param OutputDataConfig: [REQUIRED]\nSpecifies where to send the output files.\n\nS3Bucket (string) -- [REQUIRED]When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output.\n\nS3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another.\n\n\n :type DataAccessRoleArn: string :param DataAccessRoleArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations .\n :type JobName: string :param JobName: The identifier of the job. :type ClientRequestToken: string :param ClientRequestToken: A unique identifier for the request. If you don\'t set the client request token, Amazon Comprehend Medical generates one.\nThis field is autopopulated if not provided.\n :type KMSKey: string :param KMSKey: An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text. :type LanguageCode: string :param LanguageCode: [REQUIRED]\nThe language of the input documents. All documents must be in the same language.\n :rtype: dict ReturnsResponse Syntax { 'JobId': 'string' } Response Structure (dict) -- JobId (string) -- The identifier generated for the job. To get the status of a job, use this identifier with the StartICD10CMInferenceJob operation. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException """ pass def start_phi_detection_job(InputDataConfig=None, OutputDataConfig=None, DataAccessRoleArn=None, JobName=None, ClientRequestToken=None, KMSKey=None, LanguageCode=None): """ Starts an asynchronous job to detect protected health information (PHI). Use the DescribePHIDetectionJob operation to track the status of a job. See also: AWS API Documentation Exceptions :example: response = client.start_phi_detection_job( InputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, OutputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, DataAccessRoleArn='string', JobName='string', ClientRequestToken='string', KMSKey='string', LanguageCode='en' ) :type InputDataConfig: dict :param InputDataConfig: [REQUIRED]\nSpecifies the format and location of the input data for the job.\n\nS3Bucket (string) -- [REQUIRED]The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling.\nEach file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket.\n\nS3Key (string) --The path to the input data files in the S3 bucket.\n\n\n :type OutputDataConfig: dict :param OutputDataConfig: [REQUIRED]\nSpecifies where to send the output files.\n\nS3Bucket (string) -- [REQUIRED]When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output.\n\nS3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another.\n\n\n :type DataAccessRoleArn: string :param DataAccessRoleArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations .\n :type JobName: string :param JobName: The identifier of the job. :type ClientRequestToken: string :param ClientRequestToken: A unique identifier for the request. If you don\'t set the client request token, Amazon Comprehend Medical generates one.\nThis field is autopopulated if not provided.\n :type KMSKey: string :param KMSKey: An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text. :type LanguageCode: string :param LanguageCode: [REQUIRED]\nThe language of the input documents. All documents must be in the same language.\n :rtype: dict ReturnsResponse Syntax { 'JobId': 'string' } Response Structure (dict) -- JobId (string) -- The identifier generated for the job. To get the status of a job, use this identifier with the DescribePHIDetectionJob operation. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException """ pass def start_rx_norm_inference_job(InputDataConfig=None, OutputDataConfig=None, DataAccessRoleArn=None, JobName=None, ClientRequestToken=None, KMSKey=None, LanguageCode=None): """ Starts an asynchronous job to detect medication entities and link them to the RxNorm ontology. Use the DescribeRxNormInferenceJob operation to track the status of a job. See also: AWS API Documentation Exceptions :example: response = client.start_rx_norm_inference_job( InputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, OutputDataConfig={ 'S3Bucket': 'string', 'S3Key': 'string' }, DataAccessRoleArn='string', JobName='string', ClientRequestToken='string', KMSKey='string', LanguageCode='en' ) :type InputDataConfig: dict :param InputDataConfig: [REQUIRED]\nSpecifies the format and location of the input data for the job.\n\nS3Bucket (string) -- [REQUIRED]The URI of the S3 bucket that contains the input data. The bucket must be in the same region as the API endpoint that you are calling.\nEach file in the document collection must be less than 40 KB. You can store a maximum of 30 GB in the bucket.\n\nS3Key (string) --The path to the input data files in the S3 bucket.\n\n\n :type OutputDataConfig: dict :param OutputDataConfig: [REQUIRED]\nSpecifies where to send the output files.\n\nS3Bucket (string) -- [REQUIRED]When you use the OutputDataConfig object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output.\n\nS3Key (string) --The path to the output data files in the S3 bucket. Amazon Comprehend Medical creates an output directory using the job ID so that the output from one job does not overwrite the output of another.\n\n\n :type DataAccessRoleArn: string :param DataAccessRoleArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations .\n :type JobName: string :param JobName: The identifier of the job. :type ClientRequestToken: string :param ClientRequestToken: A unique identifier for the request. If you don\'t set the client request token, Amazon Comprehend Medical generates one.\nThis field is autopopulated if not provided.\n :type KMSKey: string :param KMSKey: An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text. :type LanguageCode: string :param LanguageCode: [REQUIRED]\nThe language of the input documents. All documents must be in the same language.\n :rtype: dict ReturnsResponse Syntax { 'JobId': 'string' } Response Structure (dict) -- JobId (string) -- The identifier of the job. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } :returns: ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.TooManyRequestsException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException """ pass def stop_entities_detection_v2_job(JobId=None): """ Stops a medical entities detection job in progress. See also: AWS API Documentation Exceptions :example: response = client.stop_entities_detection_v2_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier of the medical entities job to stop.\n :rtype: dict ReturnsResponse Syntax{ 'JobId': 'string' } Response Structure (dict) -- JobId (string) --The identifier of the medical entities detection job that was stopped. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } """ pass def stop_icd10_cm_inference_job(JobId=None): """ Stops an InferICD10CM inference job in progress. See also: AWS API Documentation Exceptions :example: response = client.stop_icd10_cm_inference_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier of the job.\n :rtype: dict ReturnsResponse Syntax{ 'JobId': 'string' } Response Structure (dict) -- JobId (string) --The identifier generated for the job. To get the status of job, use this identifier with the DescribeICD10CMInferenceJob operation. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } """ pass def stop_phi_detection_job(JobId=None): """ Stops a protected health information (PHI) detection job in progress. See also: AWS API Documentation Exceptions :example: response = client.stop_phi_detection_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier of the PHI detection job to stop.\n :rtype: dict ReturnsResponse Syntax{ 'JobId': 'string' } Response Structure (dict) -- JobId (string) --The identifier of the PHI detection job that was stopped. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } """ pass def stop_rx_norm_inference_job(JobId=None): """ Stops an InferRxNorm inference job in progress. See also: AWS API Documentation Exceptions :example: response = client.stop_rx_norm_inference_job( JobId='string' ) :type JobId: string :param JobId: [REQUIRED]\nThe identifier of the job.\n :rtype: dict ReturnsResponse Syntax{ 'JobId': 'string' } Response Structure (dict) -- JobId (string) --The identifier generated for the job. To get the status of job, use this identifier with the DescribeRxNormInferenceJob operation. Exceptions ComprehendMedical.Client.exceptions.InvalidRequestException ComprehendMedical.Client.exceptions.ResourceNotFoundException ComprehendMedical.Client.exceptions.InternalServerException :return: { 'JobId': 'string' } """ pass
41.231067
824
0.672604
14,979
127,940
5.685426
0.04039
0.009629
0.047275
0.009206
0.954322
0.948064
0.940572
0.93813
0.933797
0.931824
0
0.010271
0.235954
127,940
3,102
825
41.244358
0.860934
0.980725
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
false
0.5
0
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
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
9
b22525068eb325fd22cc279b7eb73f54ebb34404
13,262
py
Python
roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py
shgriffi/openshift-ansible
6313f519307cf50055589c3876d8bec398bbc4d4
[ "Apache-2.0" ]
164
2015-07-29T17:35:04.000Z
2021-12-16T16:38:04.000Z
roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py
shgriffi/openshift-ansible
6313f519307cf50055589c3876d8bec398bbc4d4
[ "Apache-2.0" ]
3,634
2015-06-09T13:49:15.000Z
2022-03-23T20:55:44.000Z
roles/lib_openshift/src/test/unit/test_oc_serviceaccount_secret.py
shgriffi/openshift-ansible
6313f519307cf50055589c3876d8bec398bbc4d4
[ "Apache-2.0" ]
250
2015-06-08T19:53:11.000Z
2022-03-01T04:51:23.000Z
''' Unit tests for oc secret add ''' import os import six import sys import unittest import mock # Removing invalid variable names for tests so that I can # keep them brief # pylint: disable=invalid-name,no-name-in-module # Disable import-error b/c our libraries aren't loaded in jenkins # pylint: disable=import-error,wrong-import-position # place class in our python path module_path = os.path.join('/'.join(os.path.realpath(__file__).split('/')[:-4]), 'library') # noqa: E501 sys.path.insert(0, module_path) from oc_serviceaccount_secret import OCServiceAccountSecret, locate_oc_binary # noqa: E402 try: import ruamel.yaml as yaml # noqa: EF401 YAML_TYPE = 'ruamel' except ImportError: YAML_TYPE = 'pyyaml' class OCServiceAccountSecretTest(unittest.TestCase): ''' Test class for OCServiceAccountSecret ''' @mock.patch('oc_serviceaccount_secret.locate_oc_binary') @mock.patch('oc_serviceaccount_secret.Utils.create_tmpfile_copy') @mock.patch('oc_serviceaccount_secret.Yedit._write') @mock.patch('oc_serviceaccount_secret.OCServiceAccountSecret._run') def test_adding_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_oc_binary): ''' Testing adding a secret to a service account ''' # Arrange # run_ansible input parameters params = { 'state': 'present', 'namespace': 'default', 'secret': 'newsecret', 'service_account': 'builder', 'kubeconfig': '/etc/origin/master/admin.kubeconfig', 'debug': False, } oc_get_sa_before = '''{ "apiVersion": "v1", "imagePullSecrets": [ { "name": "builder-dockercfg-rsrua" } ], "kind": "ServiceAccount", "metadata": { "name": "builder", "namespace": "default", "selfLink": "/api/v1/namespaces/default/serviceaccounts/builder", "uid": "cf47bca7-ebc4-11e6-b041-0ed9df7abc38", "resourceVersion": "302879", "creationTimestamp": "2017-02-05T17:02:00Z" }, "secrets": [ { "name": "builder-dockercfg-rsrua" }, { "name": "builder-token-akqxi" } ] } ''' oc_get_sa_after = '''{ "apiVersion": "v1", "imagePullSecrets": [ { "name": "builder-dockercfg-rsrua" } ], "kind": "ServiceAccount", "metadata": { "name": "builder", "namespace": "default", "selfLink": "/api/v1/namespaces/default/serviceaccounts/builder", "uid": "cf47bca7-ebc4-11e6-b041-0ed9df7abc38", "resourceVersion": "302879", "creationTimestamp": "2017-02-05T17:02:00Z" }, "secrets": [ { "name": "builder-dockercfg-rsrua" }, { "name": "builder-token-akqxi" }, { "name": "newsecret" } ] } ''' builder_ryaml_file = '''\ secrets: - name: builder-dockercfg-rsrua - name: builder-token-akqxi - name: newsecret kind: ServiceAccount imagePullSecrets: - name: builder-dockercfg-rsrua apiVersion: v1 metadata: name: builder namespace: default resourceVersion: '302879' creationTimestamp: '2017-02-05T17:02:00Z' selfLink: /api/v1/namespaces/default/serviceaccounts/builder uid: cf47bca7-ebc4-11e6-b041-0ed9df7abc38 ''' builder_pyyaml_file = '''\ apiVersion: v1 imagePullSecrets: - name: builder-dockercfg-rsrua kind: ServiceAccount metadata: creationTimestamp: '2017-02-05T17:02:00Z' name: builder namespace: default resourceVersion: '302879' selfLink: /api/v1/namespaces/default/serviceaccounts/builder uid: cf47bca7-ebc4-11e6-b041-0ed9df7abc38 secrets: - name: builder-dockercfg-rsrua - name: builder-token-akqxi - name: newsecret ''' # Return values of our mocked function call. These get returned once per call. mock_cmd.side_effect = [ (0, oc_get_sa_before, ''), # First call to the mock (0, oc_get_sa_before, ''), # Second call to the mock (0, 'serviceaccount "builder" replaced', ''), # Third call to the mock (0, oc_get_sa_after, ''), # Fourth call to the mock ] mock_oc_binary.side_effect = [ 'oc' ] mock_tmpfile_copy.side_effect = [ '/tmp/mocked_kubeconfig', ] # Act results = OCServiceAccountSecret.run_ansible(params, False) # Assert self.assertTrue(results['changed']) self.assertEqual(results['results']['returncode'], 0) self.assertEqual(results['state'], 'present') # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), mock.call(['oc', 'replace', '-f', mock.ANY, '-n', 'default'], None), mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None) ]) yaml_file = builder_pyyaml_file if YAML_TYPE == 'ruamel': yaml_file = builder_ryaml_file mock_write.assert_has_calls([ mock.call(mock.ANY, yaml_file) ]) @mock.patch('oc_serviceaccount_secret.locate_oc_binary') @mock.patch('oc_serviceaccount_secret.Utils.create_tmpfile_copy') @mock.patch('oc_serviceaccount_secret.Yedit._write') @mock.patch('oc_serviceaccount_secret.OCServiceAccountSecret._run') def test_removing_a_secret_to_a_serviceaccount(self, mock_cmd, mock_write, mock_tmpfile_copy, mock_oc_binary): ''' Testing removing a secret to a service account ''' # Arrange # run_ansible input parameters params = { 'state': 'absent', 'namespace': 'default', 'secret': 'newsecret', 'service_account': 'builder', 'kubeconfig': '/etc/origin/master/admin.kubeconfig', 'debug': False, } oc_get_sa_before = '''{ "apiVersion": "v1", "imagePullSecrets": [ { "name": "builder-dockercfg-rsrua" } ], "kind": "ServiceAccount", "metadata": { "name": "builder", "namespace": "default", "selfLink": "/api/v1/namespaces/default/serviceaccounts/builder", "uid": "cf47bca7-ebc4-11e6-b041-0ed9df7abc38", "resourceVersion": "302879", "creationTimestamp": "2017-02-05T17:02:00Z" }, "secrets": [ { "name": "builder-dockercfg-rsrua" }, { "name": "builder-token-akqxi" }, { "name": "newsecret" } ] } ''' builder_ryaml_file = '''\ secrets: - name: builder-dockercfg-rsrua - name: builder-token-akqxi kind: ServiceAccount imagePullSecrets: - name: builder-dockercfg-rsrua apiVersion: v1 metadata: name: builder namespace: default resourceVersion: '302879' creationTimestamp: '2017-02-05T17:02:00Z' selfLink: /api/v1/namespaces/default/serviceaccounts/builder uid: cf47bca7-ebc4-11e6-b041-0ed9df7abc38 ''' builder_pyyaml_file = '''\ apiVersion: v1 imagePullSecrets: - name: builder-dockercfg-rsrua kind: ServiceAccount metadata: creationTimestamp: '2017-02-05T17:02:00Z' name: builder namespace: default resourceVersion: '302879' selfLink: /api/v1/namespaces/default/serviceaccounts/builder uid: cf47bca7-ebc4-11e6-b041-0ed9df7abc38 secrets: - name: builder-dockercfg-rsrua - name: builder-token-akqxi ''' # Return values of our mocked function call. These get returned once per call. mock_cmd.side_effect = [ (0, oc_get_sa_before, ''), # First call to the mock (0, oc_get_sa_before, ''), # Second call to the mock (0, 'serviceaccount "builder" replaced', ''), # Third call to the mock ] mock_oc_binary.side_effect = [ 'oc' ] mock_tmpfile_copy.side_effect = [ '/tmp/mocked_kubeconfig', ] # Act results = OCServiceAccountSecret.run_ansible(params, False) # Assert self.assertTrue(results['changed']) self.assertEqual(results['results']['returncode'], 0) self.assertEqual(results['state'], 'absent') # Making sure our mocks were called as we expected mock_cmd.assert_has_calls([ mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), mock.call(['oc', 'get', 'sa', 'builder', '-o', 'json', '-n', 'default'], None), mock.call(['oc', 'replace', '-f', mock.ANY, '-n', 'default'], None), ]) yaml_file = builder_pyyaml_file if YAML_TYPE == 'ruamel': yaml_file = builder_ryaml_file mock_write.assert_has_calls([ mock.call(mock.ANY, yaml_file) ]) @unittest.skipIf(six.PY3, 'py2 test only') @mock.patch('os.path.exists') @mock.patch('os.environ.get') def test_binary_lookup_fallback(self, mock_env_get, mock_path_exists): ''' Testing binary lookup fallback ''' mock_env_get.side_effect = lambda _v, _d: '' mock_path_exists.side_effect = lambda _: False self.assertEqual(locate_oc_binary(), 'oc') @unittest.skipIf(six.PY3, 'py2 test only') @mock.patch('os.path.exists') @mock.patch('os.environ.get') def test_binary_lookup_in_path(self, mock_env_get, mock_path_exists): ''' Testing binary lookup in path ''' oc_bin = '/usr/bin/oc' mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_path_exists.side_effect = lambda f: f == oc_bin self.assertEqual(locate_oc_binary(), oc_bin) @unittest.skipIf(six.PY3, 'py2 test only') @mock.patch('os.path.exists') @mock.patch('os.environ.get') def test_binary_lookup_in_usr_local(self, mock_env_get, mock_path_exists): ''' Testing binary lookup in /usr/local/bin ''' oc_bin = '/usr/local/bin/oc' mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_path_exists.side_effect = lambda f: f == oc_bin self.assertEqual(locate_oc_binary(), oc_bin) @unittest.skipIf(six.PY3, 'py2 test only') @mock.patch('os.path.exists') @mock.patch('os.environ.get') def test_binary_lookup_in_home(self, mock_env_get, mock_path_exists): ''' Testing binary lookup in ~/bin ''' oc_bin = os.path.expanduser('~/bin/oc') mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_path_exists.side_effect = lambda f: f == oc_bin self.assertEqual(locate_oc_binary(), oc_bin) @unittest.skipIf(six.PY2, 'py3 test only') @mock.patch('shutil.which') @mock.patch('os.environ.get') def test_binary_lookup_fallback_py3(self, mock_env_get, mock_shutil_which): ''' Testing binary lookup fallback ''' mock_env_get.side_effect = lambda _v, _d: '' mock_shutil_which.side_effect = lambda _f, path=None: None self.assertEqual(locate_oc_binary(), 'oc') @unittest.skipIf(six.PY2, 'py3 test only') @mock.patch('shutil.which') @mock.patch('os.environ.get') def test_binary_lookup_in_path_py3(self, mock_env_get, mock_shutil_which): ''' Testing binary lookup in path ''' oc_bin = '/usr/bin/oc' mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_shutil_which.side_effect = lambda _f, path=None: oc_bin self.assertEqual(locate_oc_binary(), oc_bin) @unittest.skipIf(six.PY2, 'py3 test only') @mock.patch('shutil.which') @mock.patch('os.environ.get') def test_binary_lookup_in_usr_local_py3(self, mock_env_get, mock_shutil_which): ''' Testing binary lookup in /usr/local/bin ''' oc_bin = '/usr/local/bin/oc' mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_shutil_which.side_effect = lambda _f, path=None: oc_bin self.assertEqual(locate_oc_binary(), oc_bin) @unittest.skipIf(six.PY2, 'py3 test only') @mock.patch('shutil.which') @mock.patch('os.environ.get') def test_binary_lookup_in_home_py3(self, mock_env_get, mock_shutil_which): ''' Testing binary lookup in ~/bin ''' oc_bin = os.path.expanduser('~/bin/oc') mock_env_get.side_effect = lambda _v, _d: '/bin:/usr/bin' mock_shutil_which.side_effect = lambda _f, path=None: oc_bin self.assertEqual(locate_oc_binary(), oc_bin)
31.956627
114
0.591464
1,483
13,262
5.074174
0.13621
0.04093
0.021262
0.046512
0.910831
0.90711
0.903654
0.903654
0.902591
0.889568
0
0.031156
0.276353
13,262
414
115
32.033816
0.752944
0.093802
0
0.764706
0
0
0.472367
0.138166
0
0
0
0
0.058824
1
0.03268
false
0
0.026144
0
0.062092
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
b2628988545357216b3bb870795b3224c0bedbe2
44,760
py
Python
keras/layers/rnn/lstm_test.py
tsheaff/keras
ee227dda766d769b7499a5549e8ed77b5e88105b
[ "Apache-2.0" ]
1
2022-03-21T02:42:58.000Z
2022-03-21T02:42:58.000Z
keras/layers/rnn/lstm_test.py
tsheaff/keras
ee227dda766d769b7499a5549e8ed77b5e88105b
[ "Apache-2.0" ]
1
2022-03-31T16:40:51.000Z
2022-03-31T16:40:51.000Z
keras/layers/rnn/lstm_test.py
tsheaff/keras
ee227dda766d769b7499a5549e8ed77b5e88105b
[ "Apache-2.0" ]
null
null
null
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for LSTM layer.""" # pylint: disable=g-direct-tensorflow-import import copy import os import shutil from absl.testing import parameterized import keras from keras.layers.rnn import gru_lstm_utils from keras.testing_infra import test_combinations from keras.testing_infra import test_utils from keras.utils import np_utils import numpy as np import tensorflow.compat.v2 as tf from tensorflow.core.protobuf import rewriter_config_pb2 from tensorflow.python.framework import test_util as tf_test_util # Global config for grappler setting that is used for graph mode test. _rewrites = rewriter_config_pb2.RewriterConfig() _rewrites.implementation_selector = rewriter_config_pb2.RewriterConfig.ON _rewrites.min_graph_nodes = -1 _graph_options = tf.compat.v1.GraphOptions(rewrite_options=_rewrites) _config = tf.compat.v1.ConfigProto(graph_options=_graph_options) @test_combinations.run_all_keras_modes(config=_config) class LSTMGraphRewriteTest(test_combinations.TestCase): input_shape = 10 output_shape = 8 rnn_state_size = 8 timestep = 4 batch = 100 epoch = 1 @parameterized.named_parameters( ('non_tan_activation', 'relu', 'sigmoid', 0, False, True), ('non_sigmoid_recur_activation', 'tanh', 'relu', 0, False, True), ('use_recurrent_dropout', 'tanh', 'sigmoid', 0.1, False, True), ('unroll', 'tanh', 'sigmoid', 0, True, True), ('not_use_bias', 'tanh', 'sigmoid', 0, False, False), ) @test_utils.run_v2_only def test_could_use_defun_backend(self, activation, recurrent_activation, recurrent_dropout, unroll, use_bias): layer = keras.layers.LSTM( 1, activation=activation, recurrent_activation=recurrent_activation, recurrent_dropout=recurrent_dropout, unroll=unroll, use_bias=use_bias) self.assertFalse(layer._could_use_gpu_kernel) @test_utils.run_v2_only def test_use_on_default_activation_with_gpu_kernel(self): layer = keras.layers.LSTM(1, activation=tf.tanh) self.assertTrue(layer._could_use_gpu_kernel) layer = keras.layers.LSTM(1, recurrent_activation=tf.sigmoid) self.assertTrue(layer._could_use_gpu_kernel) def test_static_shape_inference_LSTM(self): # Github issue: 15165 timesteps = 3 embedding_dim = 4 units = 2 model = keras.models.Sequential() inputs = keras.layers.Dense( embedding_dim, input_shape=(timesteps, embedding_dim)) model.add(inputs) layer = keras.layers.LSTM(units, return_sequences=True) model.add(layer) outputs = model.layers[-1].output self.assertEqual(outputs.shape.as_list(), [None, timesteps, units]) def test_dynamic_behavior_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 layer = keras.layers.LSTM(units, input_shape=(None, embedding_dim)) model = keras.models.Sequential() model.add(layer) model.compile(tf.compat.v1.train.GradientDescentOptimizer(0.001), 'mse') x = np.random.random((num_samples, timesteps, embedding_dim)) y = np.random.random((num_samples, units)) model.train_on_batch(x, y) def test_stacking_LSTM(self): inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) targets /= targets.sum(axis=-1, keepdims=True) model = keras.models.Sequential() model.add(keras.layers.LSTM(10, return_sequences=True, unroll=False)) model.add(keras.layers.LSTM(5, return_sequences=True, unroll=False)) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) def test_from_config_LSTM(self): layer_class = keras.layers.LSTM for stateful in (False, True): l1 = layer_class(units=1, stateful=stateful) l2 = layer_class.from_config(l1.get_config()) assert l1.get_config() == l2.get_config() def test_specify_initial_state_keras_tensor(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 # Test with Keras tensor inputs = keras.Input((timesteps, embedding_dim)) initial_state = [keras.Input((units,)) for _ in range(num_states)] layer = keras.layers.LSTM(units) if len(initial_state) == 1: output = layer(inputs, initial_state=initial_state[0]) else: output = layer(inputs, initial_state=initial_state) self.assertTrue( any(initial_state[0] is t for t in layer._inbound_nodes[0].input_tensors)) model = keras.models.Model([inputs] + initial_state, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [ np.random.random((num_samples, units)) for _ in range(num_states) ] targets = np.random.random((num_samples, units)) model.train_on_batch([inputs] + initial_state, targets) def test_specify_initial_state_non_keras_tensor(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 # Test with non-Keras tensor inputs = keras.Input((timesteps, embedding_dim)) initial_state = [ keras.backend.random_normal_variable((num_samples, units), 0, 1) for _ in range(num_states) ] layer = keras.layers.LSTM(units) output = layer(inputs, initial_state=initial_state) model = keras.models.Model(inputs, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) inputs = np.random.random((num_samples, timesteps, embedding_dim)) targets = np.random.random((num_samples, units)) model.train_on_batch(inputs, targets) def test_reset_states_with_values(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 layer = keras.layers.LSTM(units, stateful=True) layer.build((num_samples, timesteps, embedding_dim)) initial_weight_count = len(layer.weights) layer.reset_states() assert len(layer.states) == num_states assert layer.states[0] is not None self.assertAllClose( keras.backend.eval(layer.states[0]), np.zeros(keras.backend.int_shape(layer.states[0])), atol=1e-4) state_shapes = [keras.backend.int_shape(state) for state in layer.states] values = [np.ones(shape) for shape in state_shapes] if len(values) == 1: values = values[0] layer.reset_states(values) self.assertAllClose( keras.backend.eval(layer.states[0]), np.ones(keras.backend.int_shape(layer.states[0])), atol=1e-4) # Test with invalid data with self.assertRaises(ValueError): layer.reset_states([1] * (len(layer.states) + 1)) self.assertEqual(initial_weight_count, len(layer.weights)) # Variables in "states" shouldn't show up in .weights layer.states = tf.nest.map_structure(tf.Variable, values) layer.reset_states() self.assertEqual(initial_weight_count, len(layer.weights)) def test_specify_state_with_masking(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input((timesteps, embedding_dim)) _ = keras.layers.Masking()(inputs) initial_state = [keras.Input((units,)) for _ in range(num_states)] output = keras.layers.LSTM(units)( inputs, initial_state=initial_state) model = keras.models.Model([inputs] + initial_state, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [ np.random.random((num_samples, units)) for _ in range(num_states) ] targets = np.random.random((num_samples, units)) model.train_on_batch([inputs] + initial_state, targets) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') def test_return_state(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input(batch_shape=(num_samples, timesteps, embedding_dim)) masked = keras.layers.Masking()(inputs) layer = keras.layers.LSTM(units, return_state=True, stateful=True) outputs = layer(masked) state = outputs[1:] assert len(state) == num_states model = keras.models.Model(inputs, state[0]) inputs = np.random.random((num_samples, timesteps, embedding_dim)) state = model.predict(inputs) self.assertAllClose(keras.backend.eval(layer.states[0]), state, atol=1e-4) def test_state_reuse(self): timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input(batch_shape=(num_samples, timesteps, embedding_dim)) layer = keras.layers.LSTM( units, return_state=True, return_sequences=True) outputs = layer(inputs) output, state = outputs[0], outputs[1:] output = keras.layers.LSTM(units)(output, initial_state=state) model = keras.models.Model(inputs, output) inputs = np.random.random((num_samples, timesteps, embedding_dim)) model.predict(inputs) def test_initial_states_as_other_inputs(self): timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 num_states = 2 layer_class = keras.layers.LSTM # Test with Keras tensor main_inputs = keras.Input((timesteps, embedding_dim)) initial_state = [keras.Input((units,)) for _ in range(num_states)] inputs = [main_inputs] + initial_state layer = layer_class(units) output = layer(inputs) self.assertTrue( any(initial_state[0] is t for t in layer._inbound_nodes[0].input_tensors)) model = keras.models.Model(inputs, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) main_inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [ np.random.random((num_samples, units)) for _ in range(num_states) ] targets = np.random.random((num_samples, units)) model.train_on_batch([main_inputs] + initial_state, targets) @parameterized.named_parameters(('v0', 0), ('v1', 1), ('v2', 2)) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') def test_implementation_mode_LSTM(self, implementation_mode): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={ 'units': units, 'implementation': implementation_mode }, input_shape=(num_samples, timesteps, embedding_dim)) layer_class = keras.layers.LSTM k_constraint = keras.constraints.max_norm(0.01) r_constraint = keras.constraints.max_norm(0.01) b_constraint = keras.constraints.max_norm(0.01) layer = layer_class( 5, return_sequences=False, weights=None, input_shape=(None, embedding_dim), kernel_constraint=k_constraint, recurrent_constraint=r_constraint, bias_constraint=b_constraint) layer.build((None, None, embedding_dim)) self.assertEqual(layer.cell.kernel.constraint, k_constraint) self.assertEqual(layer.cell.recurrent_kernel.constraint, r_constraint) self.assertEqual(layer.cell.bias.constraint, b_constraint) layer_class = keras.layers.LSTM inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) targets /= targets.sum(axis=-1, keepdims=True) model = keras.models.Sequential() model.add(keras.layers.Masking(input_shape=(3, 4))) model.add(layer_class(units=5, return_sequences=True, unroll=False)) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') def test_masking_with_stacking_LSTM(self): inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) targets /= targets.sum(axis=-1, keepdims=True) model = keras.models.Sequential() model.add(keras.layers.Masking(input_shape=(3, 4))) model.add(keras.layers.LSTM(10, return_sequences=True, unroll=False)) model.add(keras.layers.LSTM(5, return_sequences=True, unroll=False)) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01)) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) @parameterized.named_parameters( # test_name, use_bias, bias_initializer, activation ('normal', True, 'zeros'), ('no_bias', False, 'zeros'), ('random_bias', True, 'random_uniform'), ) def test_lstm_model_save_load(self, use_bias, bias_initializer): temp_dir = self.get_temp_dir() self.addCleanup(shutil.rmtree, temp_dir) h5_path = os.path.join(temp_dir, 'test.h5') batch = 10 timestep = 3 input_dim = 5 units = 2 x = np.random.random((batch, timestep, input_dim)) def build_model(): inputs = keras.layers.Input( shape=[timestep, input_dim], dtype=tf.float32) layer = keras.layers.LSTM( units, use_bias=use_bias, bias_initializer=bias_initializer) output = layer(inputs) return keras.models.Model(inputs, output), layer model, layer = build_model() y_ref = model.predict(x) model.save_weights(h5_path) cloned_model, new_layer = build_model() cloned_model.load_weights(h5_path) y = cloned_model.predict(x) self.assertAllClose(y, y_ref) self.assertAllClose(layer.get_weights(), new_layer.get_weights()) def test_lstm_output_on_multiple_kernel(self): x_train = np.random.random((self.batch, self.timestep, self.input_shape)) inputs = keras.layers.Input( shape=[self.timestep, self.input_shape], dtype=tf.float32) with test_utils.device(should_use_gpu=False): layer = keras.layers.LSTM(self.rnn_state_size) output = layer(inputs) cpu_model = keras.models.Model(inputs, output) weights = cpu_model.get_weights() y_1 = cpu_model.predict(x_train) with test_utils.device(should_use_gpu=True): layer = keras.layers.LSTM(self.rnn_state_size) output = layer(inputs) gpu_model = keras.models.Model(inputs, output) gpu_model.set_weights(weights) y_2 = gpu_model.predict(x_train) self.assertAllClose(y_1, y_2) def test_return_sequences_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={ 'units': units, 'return_sequences': True }, input_shape=(num_samples, timesteps, embedding_dim)) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support float64 yet.') @test_utils.run_v2_only def test_float64_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={ 'units': units, 'return_sequences': True, 'dtype': 'float64' }, input_shape=(num_samples, timesteps, embedding_dim), input_dtype='float64') def test_regularizers_LSTM(self): embedding_dim = 4 layer_class = keras.layers.LSTM layer = layer_class( 5, return_sequences=False, weights=None, input_shape=(None, embedding_dim), kernel_regularizer=keras.regularizers.l1(0.01), recurrent_regularizer=keras.regularizers.l1(0.01), bias_regularizer='l2', activity_regularizer='l1') layer.build((None, None, 2)) self.assertEqual(len(layer.losses), 3) x = keras.backend.variable(np.ones((2, 3, 2))) layer(x) if tf.executing_eagerly(): self.assertEqual(len(layer.losses), 4) else: self.assertEqual(len(layer.get_losses_for(x)), 1) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') def test_statefulness_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 layer_class = keras.layers.LSTM model = keras.models.Sequential() model.add( keras.layers.Embedding( 4, embedding_dim, mask_zero=True, input_length=timesteps, batch_input_shape=(num_samples, timesteps))) layer = layer_class( units, return_sequences=False, stateful=True, weights=None) model.add(layer) model.compile( optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01), loss='mse', run_eagerly=test_utils.should_run_eagerly()) out1 = model.predict(np.ones((num_samples, timesteps))) self.assertEqual(out1.shape, (num_samples, units)) # train once so that the states change model.train_on_batch( np.ones((num_samples, timesteps)), np.ones((num_samples, units))) out2 = model.predict(np.ones((num_samples, timesteps))) # if the state is not reset, output should be different self.assertNotEqual(out1.max(), out2.max()) # check that output changes after states are reset # (even though the model itself didn't change) layer.reset_states() out3 = model.predict(np.ones((num_samples, timesteps))) self.assertNotEqual(out2.max(), out3.max()) # check that container-level reset_states() works model.reset_states() out4 = model.predict(np.ones((num_samples, timesteps))) self.assertAllClose(out3, out4, atol=1e-5) # check that the call to `predict` updated the states out5 = model.predict(np.ones((num_samples, timesteps))) self.assertNotEqual(out4.max(), out5.max()) # Check masking layer.reset_states() left_padded_input = np.ones((num_samples, timesteps)) left_padded_input[0, :1] = 0 left_padded_input[1, :2] = 0 out6 = model.predict(left_padded_input) layer.reset_states() right_padded_input = np.ones((num_samples, timesteps)) right_padded_input[0, -1:] = 0 right_padded_input[1, -2:] = 0 out7 = model.predict(right_padded_input) layer.reset_states() mix_padded_input = np.ones((num_samples, timesteps)) mix_padded_input[0, 1] = 0 mix_padded_input[1, 0] = 0 mix_padded_input[1, 2] = 0 out8 = model.predict(mix_padded_input) self.assertAllClose(out7, out6, atol=1e-5) self.assertAllClose(out8, out7, atol=1e-5) def test_stateful_LSTM_training(self): # See b/123587692 for more context. vocab_size = 20 embedding_dim = 10 batch_size = 8 timestep = 12 units = 5 x = np.random.randint(0, vocab_size, size=(batch_size, timestep)) y = np.random.randint(0, vocab_size, size=(batch_size, timestep)) model = keras.Sequential([ keras.layers.Embedding(vocab_size, embedding_dim, batch_input_shape=[batch_size, timestep]), keras.layers.LSTM(units, return_sequences=True, stateful=True), keras.layers.Dense(vocab_size) ]) model.compile( optimizer='adam', loss='sparse_categorical_crossentropy', run_eagerly=test_utils.should_run_eagerly()) model.fit(x, y, epochs=1, shuffle=False) def test_dropout_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={ 'units': units, 'dropout': 0.1, 'recurrent_dropout': 0.1 }, input_shape=(num_samples, timesteps, embedding_dim)) def test_bidirectional(self): batch = 128 timestep = 20 vocab_size = 1000 model = keras.Sequential([ keras.layers.Embedding(vocab_size, 64), keras.layers.Bidirectional(keras.layers.LSTM( 64, return_sequences=True)), keras.layers.Bidirectional(keras.layers.LSTM(32)), keras.layers.Dense(64, activation='relu'), keras.layers.Dense(1, activation='sigmoid') ]) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) x = np.random.randint(0, vocab_size, size=(batch, timestep)) y = np.random.randint(0, 1, size=(batch)) model.fit(x, y, epochs=1, shuffle=False) model.evaluate(x, y) model.predict(x) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') @test_utils.run_v2_only def test_explicit_device_with_go_backward_and_mask(self): batch_size = 8 timestep = 7 masksteps = 5 units = 4 inputs = np.random.randn(batch_size, timestep, units).astype(np.float32) mask = np.ones((batch_size, timestep)).astype(np.bool) mask[:, masksteps:] = 0 lstm_layer = keras.layers.LSTM( units, return_sequences=True, go_backwards=True) with test_utils.device(should_use_gpu=True): outputs_masked = lstm_layer(inputs, mask=tf.constant(mask)) outputs_trimmed = lstm_layer(inputs[:, :masksteps]) self.assertAllClose(outputs_masked[:, -masksteps:], outputs_trimmed) @tf_test_util.enable_output_all_intermediates def test_v1_session_behavior(self): with tf.compat.v1.get_default_graph().as_default(): # See b/139132348 for more details. x = np.random.uniform(size=(100, 4, 8)) y = np.random.uniform(size=(100, 1)) dataset = tf.data.Dataset.from_tensor_slices( (x, y)).shuffle(100).batch(32) inp = keras.layers.Input(shape=(4, 8)) layer = keras.layers.LSTM(1)(inp) layer = keras.layers.Dense(1)(layer) model = keras.models.Model(inp, layer) model.compile(loss='mse', optimizer='sgd') model.fit(dataset) def test_with_fully_masked_inputs(self): num_samples = 8 timestep = 5 embedding_dim = 4 vocab_size = 20 units = 2 inputs = np.random.randint(0, vocab_size, size=(num_samples, timestep)) # Set the first inputs to be fully zero. inputs[0, :] = 0.0 model = keras.models.Sequential() model.add( keras.layers.Embedding( vocab_size, embedding_dim, mask_zero=True, input_length=timestep, batch_input_shape=(num_samples, timestep))) layer = keras.layers.LSTM(units) model.add(layer) model.compile( optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01), loss='mse', run_eagerly=test_utils.should_run_eagerly()) # Make sure it doesn't crash with cudnn kernel. model.predict(inputs) # TODO (b/169895267): test with xla_gpu is disabled. def test_deepcopy(self): if not tf.executing_eagerly(): self.skipTest('v2-only test') original_layer = keras.layers.LSTM(5) copied_layer = copy.deepcopy(original_layer) self.assertEqual(copied_layer.units, 5) self.assertEqual(original_layer.get_config(), original_layer.get_config()) # Copy layer before layer call on inputs without weight initialization. inputs = np.random.normal(size=[32, 10, 8]).astype(np.float32) original_layer = keras.layers.LSTM(4) copied_layer = copy.deepcopy(original_layer) outputs = original_layer(inputs) copied_outputs = copied_layer(inputs) self.assertNotAllClose( self.evaluate(outputs), self.evaluate(copied_outputs)) # Copy layer after layer call on inputs with weight initialization. original_layer = keras.layers.LSTM(4) outputs = original_layer(inputs) copied_layer = copy.deepcopy(original_layer) copied_outputs = copied_layer(inputs) self.assertAllClose(self.evaluate(outputs), self.evaluate(copied_outputs)) def _test_runtime_with_model(self, model): (x_train, y_train), _ = test_utils.get_test_data( train_samples=self.batch, test_samples=0, input_shape=(self.timestep, self.input_shape), num_classes=self.output_shape) y_train = np_utils.to_categorical(y_train, self.output_shape) model.compile( optimizer='sgd', loss=['categorical_crossentropy', None], run_eagerly=test_utils.should_run_eagerly()) existing_loss = 0 for _ in range(self.epoch): history = model.fit(x_train, y_train) loss_value = history.history['loss'][0] self.assertNotEqual(existing_loss, loss_value) existing_loss = loss_value _, runtime_value = model.predict(x_train) if tf.test.is_gpu_available(): self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_GPU) else: self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_CPU) @test_utils.run_v2_only def test_LSTM_runtime(self): layer = keras.layers.LSTM(self.rnn_state_size, return_runtime=True) inputs = keras.layers.Input( shape=[self.timestep, self.input_shape], dtype=tf.float32) outputs, runtime = layer(inputs) # Expand the runtime so that it is a 1D tensor instead of scalar. # TF model does not work with scalar model output, specially during # aggregation. runtime = keras.layers.Lambda( lambda x: tf.expand_dims(x, axis=-1))(runtime) model = keras.models.Model(inputs=inputs, outputs=[outputs, runtime]) self._test_runtime_with_model(model) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input yet.') @test_utils.run_v2_only def test_LSTM_runtime_with_mask(self): # Masking will affect which backend is selected based on whether the mask # is strictly right padded. layer = keras.layers.LSTM(self.rnn_state_size, return_runtime=True) inputs = keras.layers.Input( shape=[self.timestep, self.input_shape], dtype=tf.float32) masked_inputs = keras.layers.Masking()(inputs) outputs, runtime = layer(masked_inputs) # Expand the runtime so that it is a 1D tensor instead of scalar. # TF model does not work with scalar model output, specially during # aggregation. runtime = keras.layers.Lambda( lambda x: tf.expand_dims(x, axis=-1))(runtime) model = keras.models.Model(inputs=inputs, outputs=[outputs, runtime]) (x_train, y_train), _ = test_utils.get_test_data( train_samples=self.batch, test_samples=0, input_shape=(self.timestep, self.input_shape), num_classes=self.output_shape) y_train = np_utils.to_categorical(y_train, self.output_shape) model.compile( optimizer='sgd', loss=['categorical_crossentropy', None], run_eagerly=test_utils.should_run_eagerly()) model.fit(x_train, y_train) # Verify unpadded data. _, runtime_value = model.predict(x_train) if tf.test.is_gpu_available(): self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_GPU) else: self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_CPU) # Update x/y to be right padded by setting the last timestep to 0 x_train[:, -1, :] = 0 y_train[:, -1] = 0 _, runtime_value = model.predict(x_train) if tf.test.is_gpu_available(): self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_GPU) else: self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_CPU) # Further update x/y to be mix padded (masks in the middle), and verify # only cpu kernel can be selected. x_train[:, -3, :] = 0 y_train[:, -3] = 0 _, runtime_value = model.predict(x_train) self.assertEqual(runtime_value[0], gru_lstm_utils.RUNTIME_CPU) @test_utils.run_v2_only def test_LSTM_runtime_with_cond(self): # This test is to demonstrate the graph rewrite of grappler plugin under # the condition that the function returns different number of internal # states. layer = keras.layers.LSTM(self.rnn_state_size, return_runtime=True) inputs = keras.layers.Input( shape=[self.timestep, self.input_shape], dtype=tf.float32) zeros = tf.zeros([self.batch, self.output_shape]) dummy_runtime = gru_lstm_utils.runtime(gru_lstm_utils.RUNTIME_UNKNOWN) a = tf.constant(0) b = tf.constant(1) # Will always run the lstm layer. outputs, runtime = tf.cond( tf.less(a, b), lambda: layer(inputs), lambda: (zeros, dummy_runtime)) # Expand the runtime so that it is a 1D tensor instead of scalar. # TF model does not work with scalar model output, specially during # aggregation. runtime = keras.layers.Lambda( lambda x: tf.expand_dims(x, axis=-1))(runtime) model = keras.models.Model(inputs=inputs, outputs=[outputs, runtime]) self._test_runtime_with_model(model) @test_combinations.run_all_keras_modes class LSTMLayerTest(test_combinations.TestCase): def test_return_sequences_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={'units': units, 'return_sequences': True}, input_shape=(num_samples, timesteps, embedding_dim)) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Double type is yet not supported in ROCm') @test_utils.run_v2_only def test_float64_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={'units': units, 'return_sequences': True, 'dtype': 'float64'}, input_shape=(num_samples, timesteps, embedding_dim), input_dtype='float64') def test_static_shape_inference_LSTM(self): # Github issue: 15165 timesteps = 3 embedding_dim = 4 units = 2 model = keras.models.Sequential() inputs = keras.layers.Dense(embedding_dim, input_shape=(timesteps, embedding_dim)) model.add(inputs) layer = keras.layers.LSTM(units, return_sequences=True) model.add(layer) outputs = model.layers[-1].output self.assertEqual(outputs.shape.as_list(), [None, timesteps, units]) def test_dynamic_behavior_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 layer = keras.layers.LSTM(units, input_shape=(None, embedding_dim)) model = keras.models.Sequential() model.add(layer) model.compile( 'rmsprop', 'mse', run_eagerly=test_utils.should_run_eagerly()) x = np.random.random((num_samples, timesteps, embedding_dim)) y = np.random.random((num_samples, units)) model.train_on_batch(x, y) def test_dropout_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={'units': units, 'dropout': 0.1, 'recurrent_dropout': 0.1}, input_shape=(num_samples, timesteps, embedding_dim)) def test_recurrent_dropout_with_implementation_restriction(self): layer = keras.layers.LSTM(2, recurrent_dropout=0.1, implementation=2) # The implementation is force to 1 due to the limit of recurrent_dropout. self.assertEqual(layer.implementation, 1) @parameterized.parameters([0, 1, 2]) def test_implementation_mode_LSTM(self, implementation_mode): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 test_utils.layer_test( keras.layers.LSTM, kwargs={'units': units, 'implementation': implementation_mode}, input_shape=(num_samples, timesteps, embedding_dim)) def test_constraints_LSTM(self): embedding_dim = 4 layer_class = keras.layers.LSTM k_constraint = keras.constraints.max_norm(0.01) r_constraint = keras.constraints.max_norm(0.01) b_constraint = keras.constraints.max_norm(0.01) layer = layer_class( 5, return_sequences=False, weights=None, input_shape=(None, embedding_dim), kernel_constraint=k_constraint, recurrent_constraint=r_constraint, bias_constraint=b_constraint) layer.build((None, None, embedding_dim)) self.assertEqual(layer.cell.kernel.constraint, k_constraint) self.assertEqual(layer.cell.recurrent_kernel.constraint, r_constraint) self.assertEqual(layer.cell.bias.constraint, b_constraint) @parameterized.parameters([True, False]) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input.') def test_with_masking_layer_LSTM(self, unroll): layer_class = keras.layers.LSTM inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) targets /= targets.sum(axis=-1, keepdims=True) model = keras.models.Sequential() model.add(keras.layers.Masking(input_shape=(3, 4))) model.add(layer_class(units=5, return_sequences=True, unroll=unroll)) model.compile( loss='categorical_crossentropy', optimizer='rmsprop', run_eagerly=test_utils.should_run_eagerly()) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) @parameterized.parameters([True, False]) def test_masking_with_stacking_LSTM(self, unroll): inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) targets /= targets.sum(axis=-1, keepdims=True) model = keras.models.Sequential() model.add(keras.layers.Masking(input_shape=(3, 4))) lstm_cells = [keras.layers.LSTMCell(10), keras.layers.LSTMCell(5)] model.add(keras.layers.RNN( lstm_cells, return_sequences=True, unroll=unroll)) model.compile( loss='categorical_crossentropy', optimizer='rmsprop', run_eagerly=test_utils.should_run_eagerly()) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) def test_from_config_LSTM(self): layer_class = keras.layers.LSTM for stateful in (False, True): l1 = layer_class(units=1, stateful=stateful) l2 = layer_class.from_config(l1.get_config()) assert l1.get_config() == l2.get_config() def test_deep_copy_LSTM(self): cell = keras.layers.LSTMCell(5) copied_cell = copy.deepcopy(cell) self.assertEqual(copied_cell.units, 5) self.assertEqual(cell.get_config(), copied_cell.get_config()) def test_specify_initial_state_keras_tensor(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 # Test with Keras tensor inputs = keras.Input((timesteps, embedding_dim)) initial_state = [keras.Input((units,)) for _ in range(num_states)] layer = keras.layers.LSTM(units) if len(initial_state) == 1: output = layer(inputs, initial_state=initial_state[0]) else: output = layer(inputs, initial_state=initial_state) self.assertTrue( any(initial_state[0] is t for t in layer._inbound_nodes[0].input_tensors)) model = keras.models.Model([inputs] + initial_state, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.AdamOptimizer(), run_eagerly=test_utils.should_run_eagerly()) inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [np.random.random((num_samples, units)) for _ in range(num_states)] targets = np.random.random((num_samples, units)) model.train_on_batch([inputs] + initial_state, targets) def test_specify_initial_state_non_keras_tensor(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 # Test with non-Keras tensor inputs = keras.Input((timesteps, embedding_dim)) initial_state = [keras.backend.random_normal_variable( (num_samples, units), 0, 1) for _ in range(num_states)] layer = keras.layers.LSTM(units) output = layer(inputs, initial_state=initial_state) model = keras.models.Model(inputs, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.AdamOptimizer(), run_eagerly=test_utils.should_run_eagerly()) inputs = np.random.random((num_samples, timesteps, embedding_dim)) targets = np.random.random((num_samples, units)) model.train_on_batch(inputs, targets) def test_reset_states_with_values(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 layer = keras.layers.LSTM(units, stateful=True) layer.build((num_samples, timesteps, embedding_dim)) layer.reset_states() assert len(layer.states) == num_states assert layer.states[0] is not None self.assertAllClose( keras.backend.eval(layer.states[0]), np.zeros(keras.backend.int_shape(layer.states[0])), atol=1e-4) state_shapes = [keras.backend.int_shape(state) for state in layer.states] values = [np.ones(shape) for shape in state_shapes] if len(values) == 1: values = values[0] layer.reset_states(values) self.assertAllClose( keras.backend.eval(layer.states[0]), np.ones(keras.backend.int_shape(layer.states[0])), atol=1e-4) # Test with invalid data with self.assertRaises(ValueError): layer.reset_states([1] * (len(layer.states) + 1)) def test_specify_state_with_masking(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input((timesteps, embedding_dim)) _ = keras.layers.Masking()(inputs) initial_state = [keras.Input((units,)) for _ in range(num_states)] output = keras.layers.LSTM(units)(inputs, initial_state=initial_state) model = keras.models.Model([inputs] + initial_state, output) model.compile( loss='categorical_crossentropy', optimizer='rmsprop', run_eagerly=test_utils.should_run_eagerly()) inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [np.random.random((num_samples, units)) for _ in range(num_states)] targets = np.random.random((num_samples, units)) model.train_on_batch([inputs] + initial_state, targets) def test_return_state(self): num_states = 2 timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input(batch_shape=(num_samples, timesteps, embedding_dim)) layer = keras.layers.LSTM(units, return_state=True, stateful=True) outputs = layer(inputs) state = outputs[1:] assert len(state) == num_states model = keras.models.Model(inputs, state[0]) inputs = np.random.random((num_samples, timesteps, embedding_dim)) state = model.predict(inputs) self.assertAllClose(keras.backend.eval(layer.states[0]), state, atol=1e-4) def test_state_reuse(self): timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 inputs = keras.Input(batch_shape=(num_samples, timesteps, embedding_dim)) layer = keras.layers.LSTM(units, return_state=True, return_sequences=True) outputs = layer(inputs) output, state = outputs[0], outputs[1:] output = keras.layers.LSTM(units)(output, initial_state=state) model = keras.models.Model(inputs, output) inputs = np.random.random((num_samples, timesteps, embedding_dim)) outputs = model.predict(inputs) def test_initial_states_as_other_inputs(self): timesteps = 3 embedding_dim = 4 units = 3 num_samples = 2 num_states = 2 layer_class = keras.layers.LSTM # Test with Keras tensor main_inputs = keras.Input((timesteps, embedding_dim)) initial_state = [keras.Input((units,)) for _ in range(num_states)] inputs = [main_inputs] + initial_state layer = layer_class(units) output = layer(inputs) self.assertTrue( any(initial_state[0] is t for t in layer._inbound_nodes[0].input_tensors)) model = keras.models.Model(inputs, output) model.compile( loss='categorical_crossentropy', optimizer=tf.compat.v1.train.AdamOptimizer(), run_eagerly=test_utils.should_run_eagerly()) main_inputs = np.random.random((num_samples, timesteps, embedding_dim)) initial_state = [np.random.random((num_samples, units)) for _ in range(num_states)] targets = np.random.random((num_samples, units)) model.train_on_batch([main_inputs] + initial_state, targets) def test_regularizers_LSTM(self): embedding_dim = 4 layer_class = keras.layers.LSTM layer = layer_class( 5, return_sequences=False, weights=None, input_shape=(None, embedding_dim), kernel_regularizer=keras.regularizers.l1(0.01), recurrent_regularizer=keras.regularizers.l1(0.01), bias_regularizer='l2', activity_regularizer='l1') layer.build((None, None, 2)) self.assertEqual(len(layer.losses), 3) x = keras.backend.variable(np.ones((2, 3, 2))) layer(x) if tf.executing_eagerly(): self.assertEqual(len(layer.losses), 4) else: self.assertEqual(len(layer.get_losses_for(x)), 1) @tf.test.disable_with_predicate( pred=tf.test.is_built_with_rocm, skip_message='Skipping as ROCm MIOpen does not support padded input.') def test_statefulness_LSTM(self): num_samples = 2 timesteps = 3 embedding_dim = 4 units = 2 layer_class = keras.layers.LSTM model = keras.models.Sequential() model.add( keras.layers.Embedding( 4, embedding_dim, mask_zero=True, input_length=timesteps, batch_input_shape=(num_samples, timesteps))) layer = layer_class( units, return_sequences=False, stateful=True, weights=None) model.add(layer) model.compile( optimizer=tf.compat.v1.train.GradientDescentOptimizer(0.01), loss='mse', run_eagerly=test_utils.should_run_eagerly()) out1 = model.predict(np.ones((num_samples, timesteps))) self.assertEqual(out1.shape, (num_samples, units)) # train once so that the states change model.train_on_batch( np.ones((num_samples, timesteps)), np.ones((num_samples, units))) out2 = model.predict(np.ones((num_samples, timesteps))) # if the state is not reset, output should be different self.assertNotEqual(out1.max(), out2.max()) # check that output changes after states are reset # (even though the model itself didn't change) layer.reset_states() out3 = model.predict(np.ones((num_samples, timesteps))) self.assertNotEqual(out2.max(), out3.max()) # check that container-level reset_states() works model.reset_states() out4 = model.predict(np.ones((num_samples, timesteps))) self.assertAllClose(out3, out4, atol=1e-5) # check that the call to `predict` updated the states out5 = model.predict(np.ones((num_samples, timesteps))) self.assertNotEqual(out4.max(), out5.max()) # Check masking layer.reset_states() left_padded_input = np.ones((num_samples, timesteps)) left_padded_input[0, :1] = 0 left_padded_input[1, :2] = 0 out6 = model.predict(left_padded_input) layer.reset_states() right_padded_input = np.ones((num_samples, timesteps)) right_padded_input[0, -1:] = 0 right_padded_input[1, -2:] = 0 out7 = model.predict(right_padded_input) self.assertAllClose(out7, out6, atol=1e-5) if __name__ == '__main__': tf.test.main()
35.188679
80
0.684651
5,951
44,760
4.936649
0.077634
0.033358
0.031146
0.020423
0.802471
0.781163
0.757472
0.740997
0.727449
0.721526
0
0.019641
0.201497
44,760
1,271
81
35.216365
0.802328
0.067806
0
0.762136
0
0
0.035749
0.010564
0
0
0
0.000787
0.068932
1
0.052427
false
0
0.012621
0
0.073786
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
b29b9896e52017d7c21c76703696e0f13393fa9a
11,229
py
Python
src/tests/api/test_device_event_selection.py
fakegit/pretix
b6e9e64ff967f7b4f91fe88694f4157d8a0787b4
[ "Apache-2.0" ]
null
null
null
src/tests/api/test_device_event_selection.py
fakegit/pretix
b6e9e64ff967f7b4f91fe88694f4157d8a0787b4
[ "Apache-2.0" ]
56
2020-05-07T07:54:17.000Z
2021-04-19T12:14:14.000Z
src/tests/api/test_device_event_selection.py
fakegit/pretix
b6e9e64ff967f7b4f91fe88694f4157d8a0787b4
[ "Apache-2.0" ]
null
null
null
# # This file is part of pretix (Community Edition). # # Copyright (C) 2014-2020 Raphael Michel and contributors # Copyright (C) 2020-2021 rami.io GmbH and contributors # # This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General # Public License as published by the Free Software Foundation in version 3 of the License. # # ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are # applicable granting you additional permissions and placing additional restrictions on your usage of this software. # Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive # this file, see <https://pretix.eu/about/en/license>. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along with this program. If not, see # <https://www.gnu.org/licenses/>. # from datetime import datetime import pytest import pytz from django_scopes import scopes_disabled from freezegun import freeze_time tz = pytz.timezone("Asia/Tokyo") @pytest.mark.django_db def test_no_events(device_client, device): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1') assert resp.status_code == 404 @pytest.mark.django_db def test_choose_between_events(device_client, device): with scopes_disabled(): e1 = device.organizer.events.create( name="Event", slug="e1", live=True, date_from=tz.localize(datetime(2020, 1, 10, 14, 0)), date_to=tz.localize(datetime(2020, 1, 10, 15, 0)), ) cl1 = e1.checkin_lists.create(name="Same name") e2 = device.organizer.events.create( name="Event", slug="e2", live=True, date_from=tz.localize(datetime(2020, 1, 10, 16, 0)), date_to=tz.localize(datetime(2020, 1, 10, 17, 0)), ) e2.checkin_lists.create(name="Other name") cl2 = e2.checkin_lists.create(name="Same name") e2.checkin_lists.create(name="Yet another name") tomorrow = device.organizer.events.create( name="Event", slug="tomorrow", live=True, date_from=tz.localize(datetime(2020, 1, 11, 15, 0)), date_to=tz.localize(datetime(2020, 1, 11, 16, 0)), ) cl3 = tomorrow.checkin_lists.create(name="Just any name") for e in device.organizer.events.all(): e.settings.timezone = "Asia/Tokyo" # Keep current when still running with freeze_time("2020-01-10T14:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}') assert resp.status_code == 304 with freeze_time("2020-01-10T16:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1') assert resp.status_code == 200 resp = device_client.get(f'/api/v1/device/eventselection?current_event=e2') assert resp.status_code == 304 # Next one only with freeze_time("2020-01-10T12:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' # Last one only with freeze_time("2020-01-10T17:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e2' # Running one with freeze_time("2020-01-10T14:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' with freeze_time("2020-01-10T16:01:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e2' assert resp.data['checkinlist'] == cl2.pk # Prefer the one on the same day with freeze_time("2020-01-10T23:59:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e2' assert resp.data['checkinlist'] == cl2.pk with freeze_time("2020-01-11T01:00:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'tomorrow' assert resp.data['checkinlist'] == cl3.pk # Switch at half-time with freeze_time("2020-01-10T15:29:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' with freeze_time("2020-01-10T15:31:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e2' @pytest.mark.django_db def test_choose_between_subevents(device_client, device): with scopes_disabled(): e = device.organizer.events.create( name="Event", slug="e1", live=True, date_from=tz.localize(datetime(2020, 1, 10, 14, 0)), has_subevents=True, ) e.settings.timezone = "Asia/Tokyo" se1 = e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 10, 14, 0)), date_to=tz.localize(datetime(2020, 1, 10, 15, 0)), ) cl1 = e.checkin_lists.create(name="Same name", subevent=se1) se2 = e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 10, 16, 0)), date_to=tz.localize(datetime(2020, 1, 10, 17, 0)), ) cl2 = e.checkin_lists.create(name="Same name", subevent=se2) cl3 = e.checkin_lists.create(name="Other name") e.checkin_lists.create(name="Yet another name", subevent=se2) se_tomorrow = e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 11, 15, 0)), date_to=tz.localize(datetime(2020, 1, 11, 16, 0)), ) with freeze_time("2020-01-10T14:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_subevent={se1.pk}') assert resp.status_code == 304 with freeze_time("2020-01-10T16:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_subevent={se1.pk}') assert resp.status_code == 200 resp = device_client.get(f'/api/v1/device/eventselection?current_event=e1&current_subevent={se2.pk}') assert resp.status_code == 304 # Next one only with freeze_time("2020-01-10T12:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se1.pk # Last one only with freeze_time("2020-01-10T17:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se2.pk # Running one with freeze_time("2020-01-10T14:30:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se1.pk with freeze_time("2020-01-10T16:01:00+09:00"): resp = device_client.get( f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}&current_subevent={se1.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se2.pk assert resp.data['checkinlist'] == cl2.pk # Prefer the one on the same day with freeze_time("2020-01-10T23:59:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se2.pk with freeze_time("2020-01-11T01:00:00+09:00"): resp = device_client.get( f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}&current_subevent={se1.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se_tomorrow.pk assert resp.data['checkinlist'] == cl3.pk # Switch at half-time with freeze_time("2020-01-10T15:29:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se1.pk with freeze_time("2020-01-10T15:31:00+09:00"): resp = device_client.get(f'/api/v1/device/eventselection') assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se2.pk @pytest.mark.django_db def test_require_gate(device_client, device): with scopes_disabled(): g = device.organizer.gates.create(name="Gate 1") device.gate = g device.save() e = device.organizer.events.create( name="Event", slug="e1", live=True, date_from=tz.localize(datetime(2020, 1, 10, 14, 0)), has_subevents=True, ) e.settings.timezone = "Asia/Tokyo" se0 = e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 10, 9, 0)), date_to=tz.localize(datetime(2020, 1, 10, 10, 0)), ) e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 10, 14, 0)), date_to=tz.localize(datetime(2020, 1, 10, 15, 0)), ) cl1 = e.checkin_lists.create(name="Same name", subevent=se0) se2 = e.subevents.create( name="Event", active=True, date_from=tz.localize(datetime(2020, 1, 10, 16, 0)), date_to=tz.localize(datetime(2020, 1, 10, 17, 0)), ) e.checkin_lists.create(name="Same name", subevent=se2) cl3 = e.checkin_lists.create(name="Other name", subevent=se2) cl3.gates.add(g) with freeze_time("2020-01-10T11:00:00+09:00"): resp = device_client.get( f'/api/v1/device/eventselection?current_event=e1&current_checkinlist={cl1.pk}&current_subevent={se0.pk}') assert resp.status_code == 200 assert resp.data['event']['slug'] == 'e1' assert resp.data['subevent'] == se2.pk assert resp.data['checkinlist'] == cl3.pk
44.916
118
0.640574
1,589
11,229
4.42983
0.137823
0.078136
0.063645
0.064782
0.822702
0.815031
0.78335
0.737179
0.726382
0.721267
0
0.087935
0.216137
11,229
249
119
45.096386
0.71177
0.120224
0
0.712821
0
0.015385
0.241519
0.182917
0
0
0
0
0.282051
1
0.020513
false
0
0.025641
0
0.046154
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
a238f4b9286c859b23bee93bdb616bb9971dc30e
148
py
Python
export/__init__.py
tombulled/export
6c24bc6f325ba9612ab26db2f11fc62a6ba225a8
[ "MIT" ]
null
null
null
export/__init__.py
tombulled/export
6c24bc6f325ba9612ab26db2f11fc62a6ba225a8
[ "MIT" ]
1
2022-01-07T22:18:42.000Z
2022-03-15T22:48:55.000Z
export/__init__.py
tombulled/export
6c24bc6f325ba9612ab26db2f11fc62a6ba225a8
[ "MIT" ]
null
null
null
from .api import init, public, private from . import enums PUBLIC: enums.Access = enums.Access.PUBLIC PRIVATE: enums.Access = enums.Access.PRIVATE
24.666667
44
0.777027
21
148
5.47619
0.380952
0.382609
0.278261
0.382609
0
0
0
0
0
0
0
0
0.128378
148
5
45
29.6
0.891473
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
7
a2b26fce0960609a2ed9e0ba3f24de1337671f11
5,924
py
Python
pyaz/keyvault/private_endpoint_connection/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/keyvault/private_endpoint_connection/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/keyvault/private_endpoint_connection/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
1
2022-02-03T09:12:01.000Z
2022-02-03T09:12:01.000Z
from ... pyaz_utils import _call_az def approve(description=None, hsm_name=None, id=None, name=None, no_wait=None, resource_group=None, vault_name=None): ''' Approve a private endpoint connection request for a Key Vault/HSM. Optional Parameters: - description -- Comments for the approve operation. - hsm_name -- Name of the HSM. Required if --id is not specified.(--hsm-name and --vault-name are mutually exclusive, please specify just one of them) - id -- The ID of the private endpoint connection associated with the Key Vault/HSM. If specified --vault-name/--hsm-name and --name/-n, this should be omitted. - name -- The name of the private endpoint connection associated with the Key Vault/HSM. Required if --id is not specified - no_wait -- Do not wait for the long-running operation to finish. - resource_group -- Proceed only if Key Vault belongs to the specified resource group. - vault_name -- Name of the Key Vault. Required if --id is not specified ''' return _call_az("az keyvault private-endpoint-connection approve", locals()) def reject(description=None, hsm_name=None, id=None, name=None, no_wait=None, resource_group=None, vault_name=None): ''' Reject a private endpoint connection request for a Key Vault/HSM. Optional Parameters: - description -- Comments for the reject operation. - hsm_name -- Name of the HSM. Required if --id is not specified.(--hsm-name and --vault-name are mutually exclusive, please specify just one of them) - id -- The ID of the private endpoint connection associated with the Key Vault/HSM. If specified --vault-name/--hsm-name and --name/-n, this should be omitted. - name -- The name of the private endpoint connection associated with the Key Vault/HSM. Required if --id is not specified - no_wait -- Do not wait for the long-running operation to finish. - resource_group -- Proceed only if Key Vault belongs to the specified resource group. - vault_name -- Name of the Key Vault. Required if --id is not specified ''' return _call_az("az keyvault private-endpoint-connection reject", locals()) def delete(hsm_name=None, id=None, name=None, no_wait=None, resource_group=None, vault_name=None): ''' Delete the specified private endpoint connection associated with a Key Vault/HSM. Optional Parameters: - hsm_name -- Name of the HSM. Required if --id is not specified.(--hsm-name and --vault-name are mutually exclusive, please specify just one of them) - id -- The ID of the private endpoint connection associated with the Key Vault/HSM. If specified --vault-name/--hsm-name and --name/-n, this should be omitted. - name -- The name of the private endpoint connection associated with the Key Vault/HSM. Required if --id is not specified - no_wait -- Do not wait for the long-running operation to finish. - resource_group -- Proceed only if Key Vault belongs to the specified resource group. - vault_name -- Name of the Key Vault. Required if --id is not specified ''' return _call_az("az keyvault private-endpoint-connection delete", locals()) def list(hsm_name, resource_group=None): ''' List all private endpoint connections associated with a HSM. Required Parameters: - hsm_name -- Name of the HSM. Optional Parameters: - resource_group -- Proceed only if Key Vault belongs to the specified resource group. ''' return _call_az("az keyvault private-endpoint-connection list", locals()) def show(hsm_name=None, id=None, name=None, resource_group=None, vault_name=None): ''' Show details of a private endpoint connection associated with a Key Vault/HSM. Optional Parameters: - hsm_name -- Name of the HSM. Required if --id is not specified.(--hsm-name and --vault-name are mutually exclusive, please specify just one of them) - id -- The ID of the private endpoint connection associated with the Key Vault/HSM. If specified --vault-name/--hsm-name and --name/-n, this should be omitted. - name -- The name of the private endpoint connection associated with the Key Vault/HSM. Required if --id is not specified - resource_group -- Proceed only if Key Vault belongs to the specified resource group. - vault_name -- Name of the Key Vault. Required if --id is not specified ''' return _call_az("az keyvault private-endpoint-connection show", locals()) def wait(created=None, custom=None, deleted=None, exists=None, hsm_name=None, id=None, interval=None, name=None, resource_group=None, timeout=None, updated=None, vault_name=None): ''' Place the CLI in a waiting state until a condition of the private endpoint connection is met. Optional Parameters: - created -- wait until created with 'provisioningState' at 'Succeeded' - custom -- Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'] - deleted -- wait until deleted - exists -- wait until the resource exists - hsm_name -- Name of the HSM. Required if --id is not specified.(--hsm-name and --vault-name are mutually exclusive, please specify just one of them) - id -- The ID of the private endpoint connection associated with the Key Vault/HSM. If specified --vault-name/--hsm-name and --name/-n, this should be omitted. - interval -- polling interval in seconds - name -- The name of the private endpoint connection associated with the Key Vault/HSM. Required if --id is not specified - resource_group -- Proceed only if Key Vault belongs to the specified resource group. - timeout -- maximum wait in seconds - updated -- wait until updated with provisioningState at 'Succeeded' - vault_name -- Name of the Key Vault. Required if --id is not specified ''' return _call_az("az keyvault private-endpoint-connection wait", locals())
61.072165
179
0.724848
879
5,924
4.822526
0.114903
0.047181
0.12385
0.04954
0.812456
0.805379
0.793583
0.773767
0.76268
0.76268
0
0
0.185854
5,924
96
180
61.708333
0.878914
0.752532
0
0
0
0
0.227731
0.136134
0
0
0
0
0
1
0.461538
false
0
0.076923
0
1
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
7
a2c197a69004fa3a8de7cd3a7c42a05d1d0b32fc
17,453
py
Python
tests/pytests/test_data_updater.py
GambitResearch/replisome
775fe3766b8e433470c1048ac79334ed04b8caa2
[ "BSD-3-Clause" ]
7
2017-07-23T14:12:04.000Z
2020-09-13T18:17:57.000Z
tests/pytests/test_data_updater.py
dvarrazzo/replisome
775fe3766b8e433470c1048ac79334ed04b8caa2
[ "BSD-3-Clause" ]
4
2017-11-30T10:38:11.000Z
2018-02-11T06:36:43.000Z
tests/pytests/test_data_updater.py
GambitResearch/replisome
775fe3766b8e433470c1048ac79334ed04b8caa2
[ "BSD-3-Clause" ]
6
2017-12-15T14:05:07.000Z
2020-02-07T10:40:50.000Z
import pytest from decimal import Decimal from replisome.errors import ReplisomeError from replisome.consumers.DataUpdater import DataUpdater from replisome.receivers.JsonReceiver import JsonReceiver def test_insert(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True, skip_missing_tables=True) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute( "create table testins (id serial primary key, data text, more text)") tcur.execute("drop table if exists testins") tcur.execute(""" create table testins ( id integer primary key, data text, ts timestamptz not null default now(), clock timestamptz not null default clock_timestamp()) """) scur.execute("insert into testins (data) values ('hello')") c.get() tcur.execute("select * from testins") rs = tcur.fetchall() assert len(rs) == 1 r = rs[0] assert r[0] == 1 assert r[1] == 'hello' # Test records are inserted in the same transaction scur.execute("begin") scur.execute("insert into testins default values") scur.execute("insert into testins default values") scur.execute("commit") c.get() tcur.execute("select * from testins where id > 1 order by id") rs = tcur.fetchall() assert len(rs) == 2 assert rs[0][0] == 2 assert rs[1][0] == 3 assert rs[0][2] == rs[1][2] assert rs[0][3] < rs[1][3] # Missing tables are ignored scur.execute("drop table if exists notable") scur.execute( "create table notable (id serial primary key)") scur.execute("insert into notable default values") c.get() scur.execute("insert into testins default values") c.get() tcur.execute("select max(id) from testins") assert tcur.fetchone()[0] == 4 def test_insert_missing_table(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute( "create table testins (id serial primary key, data text)") tcur.execute("drop table if exists testins") scur.execute("insert into testins (data) values ('hello')") with pytest.raises(ReplisomeError): c.get() jr.stop() rconn.close() tcur.execute("create table testins (id serial primary key, data text)") jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) c.get() tcur.execute("select * from testins") assert tcur.fetchall() == [(1, 'hello')] def test_insert_missing_col(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute( "create table testins (id serial primary key, data text, more text)") tcur.execute("drop table if exists testins") tcur.execute(""" create table testins ( id integer primary key, data text) """) scur.execute("insert into testins (data) values ('hello')") with pytest.raises(ReplisomeError): c.get() tcur.execute("select * from testins") assert tcur.fetchall() == [] jr.stop() rconn.close() tcur.execute("alter table testins add more text") du = DataUpdater(tgt_db.conn.dsn) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) c.get() tcur.execute("select * from testins") assert tcur.fetchall() == [(1, 'hello', None)] def test_insert_conflict(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute(""" create table testins ( id serial primary key, data text, foo text, more text) """) tcur.execute("drop table if exists testins") tcur.execute(""" create table testins ( id integer primary key, data text, foo text, n int) """) tcur.execute( "insert into testins (id, data, foo, n) values (1, 'foo', 'ouch', 42)") scur.execute( "insert into testins (data, foo, more) values ('baz', 'qux', 'quux')") if tgt_db.conn.server_version >= 90500: c.get() else: with pytest.raises(ReplisomeError): c.get() pytest.skip() tcur.execute("select * from testins") rs = tcur.fetchall() assert len(rs) == 1 assert rs[0] == (1, 'baz', 'qux', 42) def test_insert_conflict_do_nothing(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testinsmini") scur.execute("create table testinsmini (id serial primary key, data text)") tcur.execute("drop table if exists testinsmini") tcur.execute("create table testinsmini (id serial primary key, other text)") tcur.execute( "insert into testinsmini (id, other) values (1, 'foo')") scur.execute( "insert into testinsmini (data) values ('bar')") if tgt_db.conn.server_version >= 90500: c.get() else: with pytest.raises(ReplisomeError): c.get() pytest.skip() tcur.execute("select * from testinsmini") rs = tcur.fetchall() assert len(rs) == 1 assert rs[0] == (1, 'foo') def test_update(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True, skip_missing_tables=True) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testup") scur.execute( "create table testup (id serial primary key, data text, more text)") tcur.execute("drop table if exists testup") tcur.execute(""" create table testup ( id integer primary key, data text, ts timestamptz not null default now(), clock timestamptz not null default clock_timestamp()) """) scur.execute("insert into testup (data) values ('hello')") scur.execute("insert into testup (data) values ('world')") scur.execute("update testup set data = 'mama' where id = 2") for i in range(3): c.get() tcur.execute("select id, data from testup order by id") rs = tcur.fetchall() assert rs == [(1, 'hello'), (2, 'mama')] # The key can change too scur.execute("update testup set id = 22 where id = 2") c.get() tcur.execute("select id, data from testup order by id") rs = tcur.fetchall() assert rs == [(1, 'hello'), (22, 'mama')] # Missing tables are ignored scur.execute("drop table if exists notable") scur.execute( "create table notable (id serial primary key)") scur.execute("insert into notable default values") c.get() scur.execute("update notable set id = 2 where id = 1") c.get() scur.execute("insert into testup default values") c.get() tcur.execute("select id from testup where id = 3") assert tcur.fetchone()[0] == 3 def test_update_missing_table(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute("drop table if exists testins2") scur.execute( "create table testins (id serial primary key, data text)") tcur.execute("drop table if exists testins") tcur.execute("drop table if exists testins2") tcur.execute("create table testins (id serial primary key, data text)") scur.execute("insert into testins (data) values ('hello')") c.get() scur.execute("alter table testins rename to testins2") scur.execute("update testins2 set data = 'world' where id = 1") with pytest.raises(ReplisomeError): c.get() jr.stop() rconn.close() tcur.execute("alter table testins rename to testins2") jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) c.get() tcur.execute("select * from testins2") assert tcur.fetchall() == [(1, 'world')] def test_update_missing_col(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testup") scur.execute( "create table testup (id serial primary key, data text)") tcur.execute("drop table if exists testup") tcur.execute(""" create table testup ( id integer primary key, data text) """) scur.execute("insert into testup (data) values ('hello')") scur.execute("insert into testup (data) values ('world')") scur.execute("alter table testup add more text") scur.execute("update testup set more = 'mama' where id = 2") for i in range(2): c.get() with pytest.raises(ReplisomeError): c.get() tcur.execute("select id, data from testup order by id") rs = tcur.fetchall() assert rs == [(1, 'hello'), (2, 'world')] jr.stop() rconn.close() tcur.execute("alter table testup add more text") jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) c.get() tcur.execute("select id, data, more from testup order by id") rs = tcur.fetchall() assert rs == [(1, 'hello', None), (2, 'world', 'mama')] def test_delete(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True, skip_missing_tables=True) c = called(du, 'process_message') jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testdel") scur.execute( "create table testdel (id serial primary key, data text)") tcur.execute("drop table if exists testdel") tcur.execute( "create table testdel (id serial primary key, data text)") scur.execute("insert into testdel (data) values ('hello')") scur.execute("insert into testdel (data) values ('world')") scur.execute("delete from testdel where id = 2") scur.execute("insert into testdel (data) values ('mama')") for i in range(4): c.get() tcur.execute("select id, data from testdel order by id") rs = tcur.fetchall() assert rs == [(1, 'hello'), (3, 'mama')] # Missing tables are ignored scur.execute("drop table if exists notable") scur.execute( "create table notable (id serial primary key)") scur.execute("insert into notable default values") c.get() scur.execute("delete from notable where id = 1") c.get() scur.execute("insert into testdel default values") c.get() tcur.execute("select id from testdel where id = 4") assert tcur.fetchone()[0] == 4 def test_delete_missing_table(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists testins") scur.execute("drop table if exists testins2") scur.execute( "create table testins (id serial primary key, data text)") tcur.execute("drop table if exists testins") tcur.execute("drop table if exists testins2") tcur.execute("create table testins (id serial primary key, data text)") scur.execute("insert into testins (data) values ('hello'), ('world')") c.get() scur.execute("alter table testins rename to testins2") scur.execute("delete from testins2 where id = 1") with pytest.raises(ReplisomeError): c.get() jr.stop() rconn.close() tcur.execute("alter table testins rename to testins2") jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, src_db.make_repl_conn()) c.get() tcur.execute("select * from testins2") assert tcur.fetchall() == [(2, 'world')] def test_toast(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() scur.execute("drop table if exists xpto") scur.execute(""" create table xpto ( id serial primary key, toast1 text, other float8, toast2 text) """) tcur.execute("drop table if exists xpto") tcur.execute(""" create table xpto ( id integer primary key, toast1 text, other float8, toast2 text) """) # uncompressed external toast data scur.execute(""" insert into xpto (toast1, toast2) select string_agg(g.i::text, ''), string_agg((g.i*2)::text, '') from generate_series(1, 2000) g(i) """) c.get() tcur.execute("select * from xpto where id = 1") r1 = tcur.fetchone() assert r1 assert len(r1[1]) > 1000 assert len(r1[3]) > 1000 # compressed external toast data scur.execute(""" insert into xpto (toast2) select repeat(string_agg(to_char(g.i, 'fm0000'), ''), 50) from generate_series(1, 500) g(i) """) c.get() tcur.execute("select * from xpto where id = 2") r2 = tcur.fetchone() assert r2 assert r2[1] is None assert len(r2[3]) > 1000 # update of existing column scur.execute(""" update xpto set toast1 = (select string_agg(g.i::text, '') from generate_series(1, 2000) g(i)) where id = 1 """) c.get() tcur.execute("select * from xpto where id = 1") r11 = tcur.fetchone() assert len(r11[1]) > 1000 assert r11[1] == r1[1] assert r11[3] == r1[3] scur.execute("update xpto set other = 123.456 where id = 1") c.get() tcur.execute("select * from xpto where id = 1") r12 = tcur.fetchone() assert len(r12[1]) > 1000 assert len(r12[3]) > 1000 assert r11[1] == r12[1] assert r12[3] == r12[3] scur.execute("delete from xpto where id = 1") c.get() tcur.execute("select * from xpto where id = 1") assert not tcur.fetchone() def test_numeric(src_db, tgt_db, called): du = DataUpdater(tgt_db.conn.dsn) c = called(du, 'process_message') rconn = src_db.make_repl_conn() jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message) src_db.thread_receive(jr, rconn) scur = src_db.conn.cursor() tcur = tgt_db.conn.cursor() for _c in [scur, tcur]: _c.execute("drop table if exists num") _c.execute(""" create table num ( id integer primary key, num numeric) """) scur.execute(""" insert into num values (1, 1.000000000000000000000000000000000000000000000000000000000000001) """) scur.execute("select num from num where id = 1") sn = scur.fetchone()[0] assert isinstance(sn, Decimal) assert len(str(sn)) > 20 c.get() tcur.execute("select num from num where id = 1") tn = tcur.fetchone()[0] assert tn == sn
30.091379
80
0.640119
2,427
17,453
4.489081
0.072518
0.034419
0.044057
0.049564
0.842588
0.821294
0.809454
0.77843
0.734924
0.706196
0
0.020829
0.23251
17,453
579
81
30.143351
0.792535
0.013923
0
0.705336
0
0.00464
0.365211
0.009476
0
0
0
0
0.097448
1
0.027842
false
0
0.011601
0
0.039443
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
a2d602cfb13c3941db38cbf715f35104383553ba
4,503
py
Python
cell.py
smh0505/minesweeper
bbcf13df44743cdf3e8153e08da0b9ff27a502ca
[ "MIT" ]
null
null
null
cell.py
smh0505/minesweeper
bbcf13df44743cdf3e8153e08da0b9ff27a502ca
[ "MIT" ]
null
null
null
cell.py
smh0505/minesweeper
bbcf13df44743cdf3e8153e08da0b9ff27a502ca
[ "MIT" ]
null
null
null
from random import randint class Cell(object): def __init__(self): self.num = 0 self.isOpen = False def newBoard(row, col): board = [[Cell() for x in range(row)] for y in range(col)] return board def setMine(board, num): i = 0 while i < num: y = randint(0, len(board) - 1) x = randint(0, len(board[0]) - 1) if board[y][x].num == 0: board[y][x].num = -1 i += 1 return countMine(board) def countMine(board): for y in range(len(board)): if y == 0: for x in range(len(board[0])): if board[y][x].num != -1: if x == 0: if board[y][x + 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 if board[y + 1][x + 1].num == -1: board[y][x].num += 1 elif x == len(board[0]) - 1: if board[y][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 else: if board[y][x - 1].num == -1: board[y][x].num += 1 if board[y][x + 1].num == -1: board[y][x].num += 1 if board[y + 1][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 if board[y + 1][x + 1].num == -1: board[y][x].num += 1 elif y == len(board) - 1: for x in range(len(board[0])): if board[y][x].num != -1: if x == 0: if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y - 1][x + 1].num == -1: board[y][x].num += 1 if board[y][x + 1].num == -1: board[y][x].num += 1 elif x == len(board[0]) - 1: if board[y - 1][x - 1].num == -1: board[y][x].num += 1 if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y][x - 1].num == -1: board[y][x].num += 1 else: if board[y - 1][x - 1].num == -1: board[y][x].num += 1 if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y - 1][x + 1].num == -1: board[y][x].num += 1 if board[y][x - 1].num == -1: board[y][x].num += 1 if board[y][x + 1].num == -1: board[y][x].num += 1 else: for x in range(len(board[0])): if board[y][x].num != -1: if x == 0: if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y - 1][x + 1].num == -1: board[y][x].num += 1 if board[y][x + 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 if board[y + 1][x + 1].num == -1: board[y][x].num += 1 elif x == len(board[0]) - 1: if board[y - 1][x - 1].num == -1: board[y][x].num += 1 if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 else: if board[y - 1][x - 1].num == -1: board[y][x].num += 1 if board[y - 1][x].num == -1: board[y][x].num += 1 if board[y - 1][x + 1].num == -1: board[y][x].num += 1 if board[y][x - 1].num == -1: board[y][x].num += 1 if board[y][x + 1].num == -1: board[y][x].num += 1 if board[y + 1][x - 1].num == -1: board[y][x].num += 1 if board[y + 1][x].num == -1: board[y][x].num += 1 if board[y + 1][x + 1].num == -1: board[y][x].num += 1 return board def printBoard(board): for row in board: string = "" for col in row: if col.num == -1: string = string + "x " else: string = string + str(col.num) + " " print(string)
48.945652
78
0.357984
684
4,503
2.350877
0.054094
0.317164
0.248134
0.279851
0.761816
0.753109
0.753109
0.753109
0.741294
0.741294
0
0.065469
0.443704
4,503
92
79
48.945652
0.576447
0
0
0.678161
0
0
0.000666
0
0
0
0
0
0
1
0.057471
false
0
0.011494
0
0.114943
0.022989
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
0c570f074cad84ce13cef5bf17cf9c571316e14b
36,760
py
Python
oase-root/tests/web_app/views/top/test_dashboard.py
Masa-Yasuno/oase
90f3cee73c0d9b3153808a4a72bd19984a4873f9
[ "Apache-2.0" ]
9
2020-03-25T07:51:47.000Z
2022-02-07T00:07:28.000Z
oase-root/tests/web_app/views/top/test_dashboard.py
Masa-Yasuno/oase
90f3cee73c0d9b3153808a4a72bd19984a4873f9
[ "Apache-2.0" ]
1,164
2021-01-28T23:16:11.000Z
2022-03-28T07:23:10.000Z
oase-root/tests/web_app/views/top/test_dashboard.py
Masa-Yasuno/oase
90f3cee73c0d9b3153808a4a72bd19984a4873f9
[ "Apache-2.0" ]
25
2020-03-17T06:48:30.000Z
2022-02-15T15:13:44.000Z
# Copyright 2019 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to 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. # """ [概要] DashBoard画面 """ import pytest import datetime import pytz import json from web_app.models.models import EventsRequest, DataObject, RuleType from web_app.views.top import dashboard ################################################################ # テストデータ(共通) ################################################################ @pytest.fixture() def widget_data_common(): now = datetime.datetime.now(pytz.timezone('UTC')) DataObject( data_object_id = 999, rule_type_id = 999, conditional_name = 'pytest', label = 'pytest', conditional_expression_id = 1, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) RuleType( rule_type_id = 999, rule_type_name = 'pytest', summary = 'pytest', rule_table_name = 'pytest', generation_limit = 1, group_id = 999, artifact_id = 'pytest', container_id_prefix_staging = 'pytest', container_id_prefix_product = 'pytest', current_container_id_staging = 'pytest', current_container_id_product = 'pytest', label_count = 1, unknown_event_notification = '0', mail_address = None, servicenow_driver_id = None, disuse_flag = '0', last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield RuleType.objects.filter(last_update_user='pytest_user').delete() DataObject.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テストデータ(既知ランキング、daily、円グラフ) ################################################################ @pytest.fixture() def widget_data1(): now = datetime.datetime.now(pytz.timezone('UTC')) ############################################ # ランキング1位 EventsRequest( request_id = 9999, trace_id = 'TOS_pytest9999', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9998, trace_id = 'TOS_pytest9998', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9997, trace_id = 'TOS_pytest9997', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9996, trace_id = 'TOS_pytest9996', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # ランキング2位 EventsRequest( request_id = 9995, trace_id = 'TOS_pytest9995', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9994, trace_id = 'TOS_pytest9994', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9993, trace_id = 'TOS_pytest9993', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # ランキング3位 EventsRequest( request_id = 9992, trace_id = 'TOS_pytest9992', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["ccc"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9991, trace_id = 'TOS_pytest9991', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["ccc"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # その他 EventsRequest( request_id = 9990, trace_id = 'TOS_pytest9990', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["xyz"]}', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield EventsRequest.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テスト(既知ランキング、daily、円グラフ) ################################################################ @pytest.mark.django_db class TestPieGraphDateMatchgData(object): @pytest.mark.usefixtures('widget_data_common', 'widget_data1') def test_ok(self): """ 正常系 """ cls_widget = dashboard.WidgetData() data = cls_widget.pie_graph_date_match_data(3, **{'language':'JA', 'req_rule_ids':[999,], 'count':3}) assert len(data['data']) == 4 assert '[pytest]<br>pytest:aaa' in data['data'] and data['data']['[pytest]<br>pytest:aaa'][0] == 'known1' assert '[pytest]<br>pytest:bbb' in data['data'] and data['data']['[pytest]<br>pytest:bbb'][0] == 'known2' assert '[pytest]<br>pytest:ccc' in data['data'] and data['data']['[pytest]<br>pytest:ccc'][0] == 'known3' assert 'その他' in data['data'] and data['data']['その他'][0] == 'known6' ################################################################ # テストデータ(未知ランキング、daily、円グラフ) ################################################################ @pytest.fixture() def widget_data2(): now = datetime.datetime.now(pytz.timezone('UTC')) ############################################ # ランキング1位 EventsRequest( request_id = 9999, trace_id = 'TOS_pytest9999', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9998, trace_id = 'TOS_pytest9998', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9997, trace_id = 'TOS_pytest9997', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9996, trace_id = 'TOS_pytest9996', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["aaa"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # ランキング2位 EventsRequest( request_id = 9995, trace_id = 'TOS_pytest9995', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9994, trace_id = 'TOS_pytest9994', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9993, trace_id = 'TOS_pytest9993', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["bbb"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # ランキング3位 EventsRequest( request_id = 9992, trace_id = 'TOS_pytest9992', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["ccc"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9991, trace_id = 'TOS_pytest9991', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["ccc"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # その他 EventsRequest( request_id = 9990, trace_id = 'TOS_pytest9990', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '{"EVENT_INFO":["xyz"]}', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield EventsRequest.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テスト(未知ランキング、daily、円グラフ) ################################################################ @pytest.mark.django_db class TestPieGraphDateUnmatchingData(object): @pytest.mark.usefixtures('widget_data_common', 'widget_data2') def test_ok(self): """ 正常系 """ cls_widget = dashboard.WidgetData() data = cls_widget.pie_graph_date_unmatch_data(3, **{'language':'JA', 'req_rule_ids':[999,], 'count':3}) assert len(data['data']) == 4 assert '[pytest]<br>pytest:aaa' in data['data'] and data['data']['[pytest]<br>pytest:aaa'][0] == 'unknown1' assert '[pytest]<br>pytest:bbb' in data['data'] and data['data']['[pytest]<br>pytest:bbb'][0] == 'unknown2' assert '[pytest]<br>pytest:ccc' in data['data'] and data['data']['[pytest]<br>pytest:ccc'][0] == 'unknown3' assert 'その他' in data['data'] and data['data']['その他'][0] == 'unknown6' ################################################################ # テストデータ(既知/未知、daily、円グラフ) ################################################################ @pytest.fixture() def widget_data3(): now = datetime.datetime.now(pytz.timezone('UTC')) ############################################ # 取得対象データ ############################################ # 既知 EventsRequest( request_id = 9999, trace_id = 'TOS_pytest9999', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9998, trace_id = 'TOS_pytest9998', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 4, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 未知 EventsRequest( request_id = 9997, trace_id = 'TOS_pytest9997', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 対象外データ ############################################ # 対象外ステータス EventsRequest( request_id = 9996, trace_id = 'TOS_pytest9996', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 5, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外リクエスト種別 EventsRequest( request_id = 9995, trace_id = 'TOS_pytest9995', request_type_id = 2, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外ルール EventsRequest( request_id = 9994, trace_id = 'TOS_pytest9994', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外日時 EventsRequest( request_id = 9993, trace_id = 'TOS_pytest9993', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = now - datetime.timedelta(days=1), event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield EventsRequest.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テスト(既知/未知、daily、円グラフ) ################################################################ @pytest.mark.django_db class TestPieGraphDateMatchingData(object): @pytest.mark.usefixtures('widget_data3') def test_ok(self): """ 正常系 """ cls_widget = dashboard.WidgetData() data = cls_widget.pie_graph_date_matching_data(3, **{'language':'JA', 'req_rule_ids':[999,]}) assert len(data['data']) == 2 assert data['data']['Match'][1] == 2 assert data['data']['Unmatch'][1] == 1 ################################################################ # テストデータ(既知/未知、hourly、棒グラフ) ################################################################ @pytest.fixture() def widget_data21(): now = datetime.datetime.now(pytz.timezone('UTC')) today = datetime.datetime(now.year, now.month, now.day, 12, 0, 0) yesterday = pytz.timezone('UTC').localize(today - datetime.timedelta(days=1)) ############################################ # 取得対象データ ############################################ # 既知 EventsRequest( request_id = 9999, trace_id = 'TOS_pytest9999', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9998, trace_id = 'TOS_pytest9998', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 4, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 未知 EventsRequest( request_id = 9997, trace_id = 'TOS_pytest9997', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 対象外データ ############################################ # 対象外ステータス EventsRequest( request_id = 9996, trace_id = 'TOS_pytest9996', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 5, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外リクエスト種別 EventsRequest( request_id = 9995, trace_id = 'TOS_pytest9995', request_type_id = 2, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外ルール EventsRequest( request_id = 9994, trace_id = 'TOS_pytest9994', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外日時 EventsRequest( request_id = 9993, trace_id = 'TOS_pytest9993', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = yesterday - datetime.timedelta(days=31), event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield EventsRequest.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テスト(既知/未知、daily、円グラフ) ################################################################ @pytest.mark.django_db class TestStackedGraphHourlyMatchingData(object): @pytest.mark.usefixtures('widget_data21') def test_ok(self): """ 正常系 """ param_info = { 'language' : 'JA', 'date_range' : 30, 'req_rule_ids' : [999,], } cls_widget = dashboard.WidgetData() data = cls_widget.stacked_graph_hourly_matching_data(21, **param_info) assert len(data['data']) == 24 for d in data['data']: if d[1] == '12': assert d[2] == 2 assert d[3] == 1 else: assert d[2] == 0 assert d[3] == 0 ################################################################ # テストデータ(既知/未知、monthly、棒グラフ) ################################################################ @pytest.fixture() def widget_data22(): now = datetime.datetime.now(pytz.timezone('UTC')) today = datetime.datetime(now.year, now.month, 15, 12, 0, 0) last_month = pytz.timezone('UTC').localize(today - datetime.timedelta(days=30)) ############################################ # 取得対象データ ############################################ # 既知 EventsRequest( request_id = 9999, trace_id = 'TOS_pytest9999', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) EventsRequest( request_id = 9998, trace_id = 'TOS_pytest9998', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 4, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 未知 EventsRequest( request_id = 9997, trace_id = 'TOS_pytest9997', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 1000, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) ############################################ # 対象外データ ############################################ # 対象外ステータス EventsRequest( request_id = 9996, trace_id = 'TOS_pytest9996', request_type_id = 1, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 5, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外リクエスト種別 EventsRequest( request_id = 9995, trace_id = 'TOS_pytest9995', request_type_id = 2, rule_type_id = 999, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外ルール EventsRequest( request_id = 9994, trace_id = 'TOS_pytest9994', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month, event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) # 対象外日時 EventsRequest( request_id = 9993, trace_id = 'TOS_pytest9993', request_type_id = 1, rule_type_id = 998, request_reception_time = now, request_user = 'pytest_user', request_server = 'pytest_server', event_to_time = last_month - datetime.timedelta(days=400), event_info = '', status = 3, status_update_id = 'pytest_user', retry_cnt = 999, last_update_timestamp = now, last_update_user = 'pytest_user' ).save(force_insert=True) yield EventsRequest.objects.filter(last_update_user='pytest_user').delete() ################################################################ # テスト(既知/未知、daily、円グラフ) ################################################################ @pytest.mark.django_db class TestStackedGraphMonthlyMatchingData(object): @pytest.mark.usefixtures('widget_data22') def test_ok(self): """ 正常系 """ param_info = { 'language' : 'JA', 'date_range' : 30, 'req_rule_ids' : [999,], } cls_widget = dashboard.WidgetData() data = cls_widget.stacked_graph_monthly_matching_data(22, **param_info) cnt_known = 0 cnt_unknown = 0 assert len(data['data']) == 12 for d in data['data']: cnt_known += d[2] cnt_unknown += d[3] assert cnt_known == 2 assert cnt_unknown == 1
35.724004
115
0.468906
3,321
36,760
4.81632
0.077386
0.082526
0.07965
0.06252
0.886715
0.875274
0.869459
0.860832
0.84145
0.84145
0
0.036537
0.381284
36,760
1,028
116
35.758755
0.666725
0.029026
0
0.89434
0
0
0.113895
0.021274
0
0
0
0
0.026415
1
0.013836
false
0
0.007547
0
0.027673
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
38efba5f26789ab440eaaa4b25ce05457b872c34
220
py
Python
env/Lib/site-packages/libarchive-0.4.7/libarchive/adapters/archive_read_support_filter_all.py
dondemonz/RestApi
0459d2b8079b9f2abc50bf5e206625427c4a2dcf
[ "Apache-2.0" ]
94
2015-03-13T07:38:51.000Z
2022-03-18T02:28:04.000Z
env/Lib/site-packages/libarchive-0.4.7/libarchive/adapters/archive_read_support_filter_all.py
dondemonz/RestApi
0459d2b8079b9f2abc50bf5e206625427c4a2dcf
[ "Apache-2.0" ]
45
2015-04-25T09:19:08.000Z
2022-03-18T18:07:05.000Z
env/Lib/site-packages/libarchive-0.4.7/libarchive/adapters/archive_read_support_filter_all.py
dondemonz/RestApi
0459d2b8079b9f2abc50bf5e206625427c4a2dcf
[ "Apache-2.0" ]
29
2015-03-13T07:38:43.000Z
2021-10-10T18:23:50.000Z
import libarchive.calls.archive_read_support_filter_all def archive_read_support_filter_all(archive): return libarchive.calls.archive_read_support_filter_all.\ c_archive_read_support_filter_all(archive)
36.666667
61
0.840909
30
220
5.6
0.366667
0.261905
0.428571
0.571429
0.904762
0.904762
0.5
0
0
0
0
0
0.109091
220
5
62
44
0.857143
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
0.75
0
0
0
0
null
1
1
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
9
ac168b7194c6b98b68f8cdd11d426b1d2cce692c
30,562
py
Python
Interaction/Style/Testing/Python/TestStyleUser.py
txwhhny/vtk
854d9aa87b944bc9079510515996406b98b86f7c
[ "BSD-3-Clause" ]
1,755
2015-01-03T06:55:00.000Z
2022-03-29T05:23:26.000Z
Interaction/Style/Testing/Python/TestStyleUser.py
txwhhny/vtk
854d9aa87b944bc9079510515996406b98b86f7c
[ "BSD-3-Clause" ]
29
2015-04-23T20:58:30.000Z
2022-03-02T16:16:42.000Z
Interaction/Style/Testing/Python/TestStyleUser.py
txwhhny/vtk
854d9aa87b944bc9079510515996406b98b86f7c
[ "BSD-3-Clause" ]
1,044
2015-01-05T22:48:27.000Z
2022-03-31T02:38:26.000Z
#!/usr/bin/env python import vtk import vtk.test.Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # This script exercises vtkInteractorStyleUser. It creates some # simple bindings for the mouse bottons and scroll wheel. # Helper math stuff import math def magnitude(v): return math.sqrt(sum(v[i]*v[i] for i in range(0,3))) def dot(u, v): return sum(u[i]*v[i] for i in range(0,3)) def normalize(v): vmag = magnitude(v) return [ v[i]/vmag for i in range(0,3) ] # Variables local to this module left = 0 middle = 0 right = 0 oldPickD = [] newPickD = [] oldPickW = [0,0,0,0] newPickW = [0,0,0,0] fpD = [0,0,0] motionD = [0,0] motionW = [0,0,0] cam = "" # The binding actions are defined below # This general method computes some common information from mouse # motion and button presses. def getMotion(iRen,ren): global oldPickD, newPickD, oldPickW, newPickW, fpD, fpW, posW global motionD, motionW, cam style = iRen.GetInteractorStyle() oldPickD = iRen.GetLastEventPosition() newPickD = iRen.GetEventPosition() motionD[0] = newPickD[0] - oldPickD[0]; motionD[1] = newPickD[1] - oldPickD[1]; cam = ren.GetActiveCamera() fpW = cam.GetFocalPoint() posW = cam.GetPosition() style.ComputeWorldToDisplay(ren, fpW[0], fpW[1], fpW[2], fpD) focalDepth = fpD[2] style.ComputeDisplayToWorld(ren,oldPickD[0],oldPickD[1],focalDepth,oldPickW) style.ComputeDisplayToWorld(ren,newPickD[0],newPickD[1],focalDepth,newPickW) motionW[0] = oldPickW[0] - newPickW[0] motionW[1] = oldPickW[1] - newPickW[1] motionW[2] = oldPickW[2] - newPickW[2] # Left mouse button is pan def mouseLeftMove(iRen,ren): getMotion(iRen,ren) cam.SetFocalPoint(fpW[0]+motionW[0],fpW[1]+motionW[1],fpW[2]+motionW[2]) cam.SetPosition(posW[0]+motionW[0],posW[1]+motionW[1],posW[2]+motionW[2]) iRen.Render() # Mouse middle button up/down is elevation, and left and right is azimuth def mouseMiddleMove(iRen,ren): getMotion(iRen,ren) if abs(motionD[0]) > abs(motionD[1]): cam.Azimuth(-2.0*motionD[0]) else: vup = cam.GetViewUp() normalize(vup) dop = cam.GetDirectionOfProjection(); normalize(dop) theta = math.degrees( math.acos(-dot(vup,dop)) ) cam.Elevation(-motionD[1]) iRen.Render() # Right mouse button is rotate (left/right movement) and zoom in/out (up/down # movement) def mouseRightMove(iRen,ren): getMotion(iRen,ren) if abs(motionD[0]) > abs(motionD[1]): cam.Azimuth(-2.0*motionD[0]) else: cam.Zoom(1 + motionD[1]/100.0) iRen.Render() # Mouse scroll wheel is zoom in/out def mouseWheelForward(iRen,ren): cam = ren.GetActiveCamera() cam.Zoom(1.1) iRen.Render() def mouseWheelBackward(iRen,ren): cam = ren.GetActiveCamera() cam.Zoom(0.9) iRen.Render() # The events to be played back Recording = \ "# StreamVersion 1\n\ EnterEvent 299 92 0 0 0 0 0\n\ MouseMoveEvent 299 92 0 0 0 0 0\n\ MouseMoveEvent 296 98 0 0 0 0 0\n\ MouseMoveEvent 293 104 0 0 0 0 0\n\ MouseMoveEvent 290 108 0 0 0 0 0\n\ MouseMoveEvent 287 112 0 0 0 0 0\n\ MouseMoveEvent 285 116 0 0 0 0 0\n\ MouseMoveEvent 282 120 0 0 0 0 0\n\ MouseMoveEvent 281 122 0 0 0 0 0\n\ MouseMoveEvent 279 124 0 0 0 0 0\n\ MouseMoveEvent 277 126 0 0 0 0 0\n\ MouseMoveEvent 276 127 0 0 0 0 0\n\ MouseMoveEvent 275 128 0 0 0 0 0\n\ MouseMoveEvent 273 129 0 0 0 0 0\n\ MouseMoveEvent 272 130 0 0 0 0 0\n\ MouseMoveEvent 271 131 0 0 0 0 0\n\ MouseMoveEvent 269 132 0 0 0 0 0\n\ LeftButtonPressEvent 269 132 0 0 0 0 0\n\ MouseMoveEvent 268 132 0 0 0 0 0\n\ MouseMoveEvent 267 132 0 0 0 0 0\n\ MouseMoveEvent 267 132 0 0 0 0 0\n\ MouseMoveEvent 265 132 0 0 0 0 0\n\ MouseMoveEvent 263 132 0 0 0 0 0\n\ MouseMoveEvent 260 132 0 0 0 0 0\n\ MouseMoveEvent 258 132 0 0 0 0 0\n\ MouseMoveEvent 255 133 0 0 0 0 0\n\ MouseMoveEvent 250 134 0 0 0 0 0\n\ MouseMoveEvent 246 135 0 0 0 0 0\n\ MouseMoveEvent 245 136 0 0 0 0 0\n\ MouseMoveEvent 243 136 0 0 0 0 0\n\ MouseMoveEvent 242 136 0 0 0 0 0\n\ MouseMoveEvent 241 136 0 0 0 0 0\n\ MouseMoveEvent 240 136 0 0 0 0 0\n\ MouseMoveEvent 239 136 0 0 0 0 0\n\ MouseMoveEvent 238 136 0 0 0 0 0\n\ MouseMoveEvent 237 136 0 0 0 0 0\n\ MouseMoveEvent 235 136 0 0 0 0 0\n\ MouseMoveEvent 231 136 0 0 0 0 0\n\ MouseMoveEvent 230 136 0 0 0 0 0\n\ MouseMoveEvent 227 136 0 0 0 0 0\n\ MouseMoveEvent 224 136 0 0 0 0 0\n\ MouseMoveEvent 219 136 0 0 0 0 0\n\ MouseMoveEvent 215 136 0 0 0 0 0\n\ MouseMoveEvent 211 136 0 0 0 0 0\n\ MouseMoveEvent 208 136 0 0 0 0 0\n\ MouseMoveEvent 205 136 0 0 0 0 0\n\ MouseMoveEvent 203 136 0 0 0 0 0\n\ MouseMoveEvent 201 136 0 0 0 0 0\n\ MouseMoveEvent 199 136 0 0 0 0 0\n\ MouseMoveEvent 197 136 0 0 0 0 0\n\ MouseMoveEvent 194 136 0 0 0 0 0\n\ MouseMoveEvent 191 136 0 0 0 0 0\n\ MouseMoveEvent 189 136 0 0 0 0 0\n\ MouseMoveEvent 187 136 0 0 0 0 0\n\ MouseMoveEvent 185 136 0 0 0 0 0\n\ MouseMoveEvent 181 136 0 0 0 0 0\n\ MouseMoveEvent 178 136 0 0 0 0 0\n\ MouseMoveEvent 175 136 0 0 0 0 0\n\ MouseMoveEvent 172 136 0 0 0 0 0\n\ MouseMoveEvent 168 136 0 0 0 0 0\n\ MouseMoveEvent 163 136 0 0 0 0 0\n\ MouseMoveEvent 159 136 0 0 0 0 0\n\ MouseMoveEvent 157 136 0 0 0 0 0\n\ MouseMoveEvent 155 136 0 0 0 0 0\n\ MouseMoveEvent 154 136 0 0 0 0 0\n\ MouseMoveEvent 153 136 0 0 0 0 0\n\ MouseMoveEvent 152 136 0 0 0 0 0\n\ MouseMoveEvent 151 136 0 0 0 0 0\n\ MouseMoveEvent 151 136 0 0 0 0 0\n\ MouseMoveEvent 153 135 0 0 0 0 0\n\ MouseMoveEvent 157 135 0 0 0 0 0\n\ MouseMoveEvent 163 133 0 0 0 0 0\n\ MouseMoveEvent 173 133 0 0 0 0 0\n\ MouseMoveEvent 180 133 0 0 0 0 0\n\ MouseMoveEvent 187 132 0 0 0 0 0\n\ MouseMoveEvent 197 132 0 0 0 0 0\n\ MouseMoveEvent 206 132 0 0 0 0 0\n\ MouseMoveEvent 212 131 0 0 0 0 0\n\ MouseMoveEvent 216 131 0 0 0 0 0\n\ MouseMoveEvent 218 131 0 0 0 0 0\n\ MouseMoveEvent 221 131 0 0 0 0 0\n\ MouseMoveEvent 221 131 0 0 0 0 0\n\ MouseMoveEvent 222 131 0 0 0 0 0\n\ MouseMoveEvent 223 131 0 0 0 0 0\n\ MouseMoveEvent 225 130 0 0 0 0 0\n\ MouseMoveEvent 225 130 0 0 0 0 0\n\ MouseMoveEvent 227 130 0 0 0 0 0\n\ MouseMoveEvent 227 130 0 0 0 0 0\n\ MouseMoveEvent 229 130 0 0 0 0 0\n\ MouseMoveEvent 231 130 0 0 0 0 0\n\ MouseMoveEvent 233 130 0 0 0 0 0\n\ MouseMoveEvent 234 130 0 0 0 0 0\n\ MouseMoveEvent 235 130 0 0 0 0 0\n\ MouseMoveEvent 237 130 0 0 0 0 0\n\ MouseMoveEvent 238 130 0 0 0 0 0\n\ MouseMoveEvent 239 130 0 0 0 0 0\n\ MouseMoveEvent 239 130 0 0 0 0 0\n\ MouseMoveEvent 239 130 0 0 0 0 0\n\ MouseMoveEvent 238 130 0 0 0 0 0\n\ MouseMoveEvent 237 130 0 0 0 0 0\n\ MouseMoveEvent 235 130 0 0 0 0 0\n\ MouseMoveEvent 234 130 0 0 0 0 0\n\ MouseMoveEvent 233 130 0 0 0 0 0\n\ LeftButtonReleaseEvent 233 130 0 0 0 0 0\n\ MouseMoveEvent 233 130 0 0 0 0 0\n\ MouseMoveEvent 231 129 0 0 0 0 0\n\ MouseMoveEvent 228 128 0 0 0 0 0\n\ MouseMoveEvent 227 126 0 0 0 0 0\n\ MouseMoveEvent 226 126 0 0 0 0 0\n\ MouseMoveEvent 224 125 0 0 0 0 0\n\ MouseMoveEvent 219 124 0 0 0 0 0\n\ MouseMoveEvent 217 124 0 0 0 0 0\n\ MouseMoveEvent 216 123 0 0 0 0 0\n\ MouseMoveEvent 215 122 0 0 0 0 0\n\ MouseMoveEvent 213 122 0 0 0 0 0\n\ MouseMoveEvent 212 122 0 0 0 0 0\n\ MouseMoveEvent 209 121 0 0 0 0 0\n\ MouseMoveEvent 208 120 0 0 0 0 0\n\ MouseMoveEvent 207 120 0 0 0 0 0\n\ MouseMoveEvent 205 118 0 0 0 0 0\n\ MouseMoveEvent 204 117 0 0 0 0 0\n\ MouseMoveEvent 204 118 0 0 0 0 0\n\ MouseMoveEvent 204 122 0 0 0 0 0\n\ MouseMoveEvent 204 125 0 0 0 0 0\n\ MouseMoveEvent 204 129 0 0 0 0 0\n\ MouseMoveEvent 204 133 0 0 0 0 0\n\ MouseMoveEvent 204 136 0 0 0 0 0\n\ MouseMoveEvent 204 140 0 0 0 0 0\n\ MouseMoveEvent 204 142 0 0 0 0 0\n\ MouseMoveEvent 204 145 0 0 0 0 0\n\ MouseMoveEvent 204 147 0 0 0 0 0\n\ MouseMoveEvent 204 149 0 0 0 0 0\n\ MouseMoveEvent 204 152 0 0 0 0 0\n\ MouseMoveEvent 205 154 0 0 0 0 0\n\ MouseMoveEvent 205 156 0 0 0 0 0\n\ MouseMoveEvent 205 158 0 0 0 0 0\n\ MouseMoveEvent 206 160 0 0 0 0 0\n\ MouseMoveEvent 206 162 0 0 0 0 0\n\ MouseMoveEvent 207 163 0 0 0 0 0\n\ MouseMoveEvent 207 166 0 0 0 0 0\n\ MouseMoveEvent 207 168 0 0 0 0 0\n\ MouseMoveEvent 207 169 0 0 0 0 0\n\ MouseMoveEvent 208 169 0 0 0 0 0\n\ MouseMoveEvent 208 170 0 0 0 0 0\n\ MouseMoveEvent 208 172 0 0 0 0 0\n\ MiddleButtonPressEvent 208 172 0 0 0 0 0\n\ MouseMoveEvent 209 172 0 0 0 0 0\n\ MouseMoveEvent 209 173 0 0 0 0 0\n\ MouseMoveEvent 209 174 0 0 0 0 0\n\ MouseMoveEvent 209 174 0 0 0 0 0\n\ MouseMoveEvent 209 176 0 0 0 0 0\n\ MouseMoveEvent 209 177 0 0 0 0 0\n\ MouseMoveEvent 209 178 0 0 0 0 0\n\ MouseMoveEvent 209 179 0 0 0 0 0\n\ MouseMoveEvent 209 180 0 0 0 0 0\n\ MouseMoveEvent 210 182 0 0 0 0 0\n\ MouseMoveEvent 211 184 0 0 0 0 0\n\ MouseMoveEvent 211 186 0 0 0 0 0\n\ MouseMoveEvent 212 188 0 0 0 0 0\n\ MouseMoveEvent 212 190 0 0 0 0 0\n\ MouseMoveEvent 213 192 0 0 0 0 0\n\ MouseMoveEvent 214 196 0 0 0 0 0\n\ MouseMoveEvent 214 198 0 0 0 0 0\n\ MouseMoveEvent 215 201 0 0 0 0 0\n\ MouseMoveEvent 215 204 0 0 0 0 0\n\ MouseMoveEvent 216 206 0 0 0 0 0\n\ MouseMoveEvent 217 209 0 0 0 0 0\n\ MouseMoveEvent 217 212 0 0 0 0 0\n\ MouseMoveEvent 218 213 0 0 0 0 0\n\ MouseMoveEvent 218 214 0 0 0 0 0\n\ MouseMoveEvent 218 216 0 0 0 0 0\n\ MouseMoveEvent 218 217 0 0 0 0 0\n\ MouseMoveEvent 218 218 0 0 0 0 0\n\ MouseMoveEvent 218 218 0 0 0 0 0\n\ MouseMoveEvent 218 219 0 0 0 0 0\n\ MouseMoveEvent 218 218 0 0 0 0 0\n\ MouseMoveEvent 218 215 0 0 0 0 0\n\ MouseMoveEvent 218 212 0 0 0 0 0\n\ MouseMoveEvent 218 210 0 0 0 0 0\n\ MouseMoveEvent 218 206 0 0 0 0 0\n\ MouseMoveEvent 218 203 0 0 0 0 0\n\ MouseMoveEvent 218 200 0 0 0 0 0\n\ MouseMoveEvent 218 197 0 0 0 0 0\n\ MouseMoveEvent 218 194 0 0 0 0 0\n\ MouseMoveEvent 218 192 0 0 0 0 0\n\ MouseMoveEvent 218 189 0 0 0 0 0\n\ MouseMoveEvent 218 186 0 0 0 0 0\n\ MouseMoveEvent 218 183 0 0 0 0 0\n\ MouseMoveEvent 218 182 0 0 0 0 0\n\ MouseMoveEvent 218 179 0 0 0 0 0\n\ MouseMoveEvent 218 178 0 0 0 0 0\n\ MouseMoveEvent 218 176 0 0 0 0 0\n\ MouseMoveEvent 218 175 0 0 0 0 0\n\ MouseMoveEvent 218 174 0 0 0 0 0\n\ MouseMoveEvent 218 172 0 0 0 0 0\n\ MouseMoveEvent 218 171 0 0 0 0 0\n\ MouseMoveEvent 218 169 0 0 0 0 0\n\ MouseMoveEvent 218 168 0 0 0 0 0\n\ MouseMoveEvent 218 167 0 0 0 0 0\n\ MouseMoveEvent 218 166 0 0 0 0 0\n\ MouseMoveEvent 218 166 0 0 0 0 0\n\ MouseMoveEvent 218 164 0 0 0 0 0\n\ MouseMoveEvent 218 163 0 0 0 0 0\n\ MouseMoveEvent 218 162 0 0 0 0 0\n\ MouseMoveEvent 218 161 0 0 0 0 0\n\ MouseMoveEvent 218 160 0 0 0 0 0\n\ MouseMoveEvent 218 159 0 0 0 0 0\n\ MouseMoveEvent 218 158 0 0 0 0 0\n\ MouseMoveEvent 218 157 0 0 0 0 0\n\ MouseMoveEvent 218 156 0 0 0 0 0\n\ MouseMoveEvent 218 156 0 0 0 0 0\n\ MiddleButtonReleaseEvent 218 156 0 0 0 0 0\n\ MouseMoveEvent 218 156 0 0 0 0 0\n\ MouseMoveEvent 217 156 0 0 0 0 0\n\ MouseMoveEvent 214 156 0 0 0 0 0\n\ MouseMoveEvent 210 156 0 0 0 0 0\n\ MouseMoveEvent 204 156 0 0 0 0 0\n\ MouseMoveEvent 197 158 0 0 0 0 0\n\ MouseMoveEvent 193 158 0 0 0 0 0\n\ MouseMoveEvent 183 161 0 0 0 0 0\n\ MouseMoveEvent 173 163 0 0 0 0 0\n\ MiddleButtonPressEvent 173 163 0 0 0 0 0\n\ MouseMoveEvent 165 164 0 0 0 0 0\n\ MouseMoveEvent 155 166 0 0 0 0 0\n\ MouseMoveEvent 147 167 0 0 0 0 0\n\ MouseMoveEvent 137 169 0 0 0 0 0\n\ MouseMoveEvent 131 171 0 0 0 0 0\n\ MouseMoveEvent 124 172 0 0 0 0 0\n\ MouseMoveEvent 121 173 0 0 0 0 0\n\ MouseMoveEvent 119 173 0 0 0 0 0\n\ MouseMoveEvent 118 173 0 0 0 0 0\n\ MouseMoveEvent 117 174 0 0 0 0 0\n\ MouseMoveEvent 116 174 0 0 0 0 0\n\ MouseMoveEvent 115 174 0 0 0 0 0\n\ MouseMoveEvent 113 174 0 0 0 0 0\n\ MouseMoveEvent 110 174 0 0 0 0 0\n\ MouseMoveEvent 108 174 0 0 0 0 0\n\ MouseMoveEvent 106 174 0 0 0 0 0\n\ MouseMoveEvent 105 174 0 0 0 0 0\n\ MouseMoveEvent 103 174 0 0 0 0 0\n\ MouseMoveEvent 103 174 0 0 0 0 0\n\ MouseMoveEvent 101 175 0 0 0 0 0\n\ MouseMoveEvent 101 175 0 0 0 0 0\n\ MouseMoveEvent 100 175 0 0 0 0 0\n\ MouseMoveEvent 101 175 0 0 0 0 0\n\ MouseMoveEvent 104 175 0 0 0 0 0\n\ MouseMoveEvent 107 175 0 0 0 0 0\n\ MouseMoveEvent 112 175 0 0 0 0 0\n\ MouseMoveEvent 118 175 0 0 0 0 0\n\ MouseMoveEvent 122 175 0 0 0 0 0\n\ MouseMoveEvent 128 175 0 0 0 0 0\n\ MouseMoveEvent 132 175 0 0 0 0 0\n\ MouseMoveEvent 136 175 0 0 0 0 0\n\ MouseMoveEvent 142 175 0 0 0 0 0\n\ MouseMoveEvent 145 175 0 0 0 0 0\n\ MouseMoveEvent 148 175 0 0 0 0 0\n\ MouseMoveEvent 151 175 0 0 0 0 0\n\ MouseMoveEvent 153 175 0 0 0 0 0\n\ MouseMoveEvent 154 175 0 0 0 0 0\n\ MouseMoveEvent 155 175 0 0 0 0 0\n\ MouseMoveEvent 155 174 0 0 0 0 0\n\ MouseMoveEvent 156 174 0 0 0 0 0\n\ MouseMoveEvent 157 174 0 0 0 0 0\n\ MouseMoveEvent 157 174 0 0 0 0 0\n\ MouseMoveEvent 158 174 0 0 0 0 0\n\ MouseMoveEvent 159 174 0 0 0 0 0\n\ MouseMoveEvent 159 174 0 0 0 0 0\n\ MouseMoveEvent 161 174 0 0 0 0 0\n\ MouseMoveEvent 164 174 0 0 0 0 0\n\ MouseMoveEvent 166 174 0 0 0 0 0\n\ MouseMoveEvent 169 174 0 0 0 0 0\n\ MouseMoveEvent 172 174 0 0 0 0 0\n\ MouseMoveEvent 174 174 0 0 0 0 0\n\ MouseMoveEvent 177 174 0 0 0 0 0\n\ MouseMoveEvent 178 174 0 0 0 0 0\n\ MouseMoveEvent 179 174 0 0 0 0 0\n\ MouseMoveEvent 181 174 0 0 0 0 0\n\ MouseMoveEvent 181 174 0 0 0 0 0\n\ MouseMoveEvent 182 174 0 0 0 0 0\n\ MouseMoveEvent 183 175 0 0 0 0 0\n\ MouseMoveEvent 183 175 0 0 0 0 0\n\ MouseMoveEvent 184 175 0 0 0 0 0\n\ MouseMoveEvent 185 175 0 0 0 0 0\n\ MiddleButtonReleaseEvent 185 175 0 0 0 0 0\n\ MouseMoveEvent 185 175 0 0 0 0 0\n\ RightButtonPressEvent 185 175 0 0 0 0 0\n\ MouseMoveEvent 185 176 0 0 0 0 0\n\ MouseMoveEvent 185 178 0 0 0 0 0\n\ MouseMoveEvent 183 181 0 0 0 0 0\n\ MouseMoveEvent 183 183 0 0 0 0 0\n\ MouseMoveEvent 183 185 0 0 0 0 0\n\ MouseMoveEvent 182 188 0 0 0 0 0\n\ MouseMoveEvent 182 189 0 0 0 0 0\n\ MouseMoveEvent 182 191 0 0 0 0 0\n\ MouseMoveEvent 182 193 0 0 0 0 0\n\ MouseMoveEvent 182 194 0 0 0 0 0\n\ MouseMoveEvent 182 195 0 0 0 0 0\n\ MouseMoveEvent 182 196 0 0 0 0 0\n\ MouseMoveEvent 182 198 0 0 0 0 0\n\ MouseMoveEvent 182 199 0 0 0 0 0\n\ MouseMoveEvent 182 200 0 0 0 0 0\n\ MouseMoveEvent 182 201 0 0 0 0 0\n\ MouseMoveEvent 182 202 0 0 0 0 0\n\ MouseMoveEvent 182 203 0 0 0 0 0\n\ MouseMoveEvent 182 204 0 0 0 0 0\n\ MouseMoveEvent 182 204 0 0 0 0 0\n\ MouseMoveEvent 182 206 0 0 0 0 0\n\ MouseMoveEvent 182 206 0 0 0 0 0\n\ MouseMoveEvent 182 207 0 0 0 0 0\n\ MouseMoveEvent 182 208 0 0 0 0 0\n\ MouseMoveEvent 182 210 0 0 0 0 0\n\ MouseMoveEvent 182 212 0 0 0 0 0\n\ MouseMoveEvent 182 213 0 0 0 0 0\n\ MouseMoveEvent 182 215 0 0 0 0 0\n\ MouseMoveEvent 182 216 0 0 0 0 0\n\ MouseMoveEvent 182 218 0 0 0 0 0\n\ MouseMoveEvent 182 221 0 0 0 0 0\n\ MouseMoveEvent 183 224 0 0 0 0 0\n\ MouseMoveEvent 184 226 0 0 0 0 0\n\ MouseMoveEvent 184 228 0 0 0 0 0\n\ MouseMoveEvent 185 230 0 0 0 0 0\n\ MouseMoveEvent 185 232 0 0 0 0 0\n\ MouseMoveEvent 185 233 0 0 0 0 0\n\ MouseMoveEvent 185 234 0 0 0 0 0\n\ MouseMoveEvent 185 237 0 0 0 0 0\n\ MouseMoveEvent 186 238 0 0 0 0 0\n\ MouseMoveEvent 187 240 0 0 0 0 0\n\ MouseMoveEvent 187 241 0 0 0 0 0\n\ MouseMoveEvent 187 242 0 0 0 0 0\n\ MouseMoveEvent 187 244 0 0 0 0 0\n\ MouseMoveEvent 188 245 0 0 0 0 0\n\ MouseMoveEvent 188 246 0 0 0 0 0\n\ MouseMoveEvent 188 247 0 0 0 0 0\n\ MouseMoveEvent 189 248 0 0 0 0 0\n\ MouseMoveEvent 189 249 0 0 0 0 0\n\ MouseMoveEvent 189 250 0 0 0 0 0\n\ MouseMoveEvent 189 250 0 0 0 0 0\n\ MouseMoveEvent 189 251 0 0 0 0 0\n\ MouseMoveEvent 190 252 0 0 0 0 0\n\ MouseMoveEvent 190 252 0 0 0 0 0\n\ MouseMoveEvent 190 254 0 0 0 0 0\n\ MouseMoveEvent 191 255 0 0 0 0 0\n\ MouseMoveEvent 191 256 0 0 0 0 0\n\ MouseMoveEvent 192 258 0 0 0 0 0\n\ MouseMoveEvent 192 259 0 0 0 0 0\n\ MouseMoveEvent 193 261 0 0 0 0 0\n\ MouseMoveEvent 193 264 0 0 0 0 0\n\ MouseMoveEvent 193 265 0 0 0 0 0\n\ MouseMoveEvent 194 267 0 0 0 0 0\n\ MouseMoveEvent 194 269 0 0 0 0 0\n\ MouseMoveEvent 194 270 0 0 0 0 0\n\ MouseMoveEvent 195 273 0 0 0 0 0\n\ MouseMoveEvent 196 275 0 0 0 0 0\n\ MouseMoveEvent 196 276 0 0 0 0 0\n\ MouseMoveEvent 197 278 0 0 0 0 0\n\ MouseMoveEvent 197 279 0 0 0 0 0\n\ MouseMoveEvent 197 280 0 0 0 0 0\n\ MouseMoveEvent 197 280 0 0 0 0 0\n\ MouseMoveEvent 197 282 0 0 0 0 0\n\ MouseMoveEvent 197 282 0 0 0 0 0\n\ MouseMoveEvent 197 284 0 0 0 0 0\n\ MouseMoveEvent 197 284 0 0 0 0 0\n\ MouseMoveEvent 197 286 0 0 0 0 0\n\ MouseMoveEvent 197 287 0 0 0 0 0\n\ MouseMoveEvent 198 288 0 0 0 0 0\n\ MouseMoveEvent 198 288 0 0 0 0 0\n\ MouseMoveEvent 198 289 0 0 0 0 0\n\ MouseMoveEvent 198 288 0 0 0 0 0\n\ MouseMoveEvent 198 287 0 0 0 0 0\n\ MouseMoveEvent 198 286 0 0 0 0 0\n\ MouseMoveEvent 197 283 0 0 0 0 0\n\ MouseMoveEvent 197 280 0 0 0 0 0\n\ MouseMoveEvent 196 278 0 0 0 0 0\n\ MouseMoveEvent 195 276 0 0 0 0 0\n\ MouseMoveEvent 193 272 0 0 0 0 0\n\ MouseMoveEvent 193 269 0 0 0 0 0\n\ MouseMoveEvent 193 266 0 0 0 0 0\n\ MouseMoveEvent 192 262 0 0 0 0 0\n\ MouseMoveEvent 191 258 0 0 0 0 0\n\ MouseMoveEvent 191 256 0 0 0 0 0\n\ MouseMoveEvent 190 253 0 0 0 0 0\n\ MouseMoveEvent 189 251 0 0 0 0 0\n\ MouseMoveEvent 189 249 0 0 0 0 0\n\ MouseMoveEvent 189 248 0 0 0 0 0\n\ MouseMoveEvent 189 246 0 0 0 0 0\n\ MouseMoveEvent 189 246 0 0 0 0 0\n\ MouseMoveEvent 189 244 0 0 0 0 0\n\ MouseMoveEvent 189 244 0 0 0 0 0\n\ MouseMoveEvent 189 243 0 0 0 0 0\n\ MouseMoveEvent 189 242 0 0 0 0 0\n\ MouseMoveEvent 189 242 0 0 0 0 0\n\ MouseMoveEvent 188 241 0 0 0 0 0\n\ MouseMoveEvent 188 240 0 0 0 0 0\n\ MouseMoveEvent 188 238 0 0 0 0 0\n\ MouseMoveEvent 188 237 0 0 0 0 0\n\ MouseMoveEvent 188 236 0 0 0 0 0\n\ MouseMoveEvent 188 235 0 0 0 0 0\n\ MouseMoveEvent 187 234 0 0 0 0 0\n\ MouseMoveEvent 187 233 0 0 0 0 0\n\ MouseMoveEvent 187 231 0 0 0 0 0\n\ MouseMoveEvent 187 230 0 0 0 0 0\n\ MouseMoveEvent 187 228 0 0 0 0 0\n\ MouseMoveEvent 187 227 0 0 0 0 0\n\ MouseMoveEvent 187 226 0 0 0 0 0\n\ MouseMoveEvent 186 225 0 0 0 0 0\n\ MouseMoveEvent 185 224 0 0 0 0 0\n\ MouseMoveEvent 185 222 0 0 0 0 0\n\ MouseMoveEvent 185 221 0 0 0 0 0\n\ MouseMoveEvent 185 220 0 0 0 0 0\n\ MouseMoveEvent 185 218 0 0 0 0 0\n\ MouseMoveEvent 185 217 0 0 0 0 0\n\ MouseMoveEvent 185 216 0 0 0 0 0\n\ MouseMoveEvent 184 215 0 0 0 0 0\n\ MouseMoveEvent 184 214 0 0 0 0 0\n\ MouseMoveEvent 184 212 0 0 0 0 0\n\ MouseMoveEvent 184 212 0 0 0 0 0\n\ MouseMoveEvent 184 210 0 0 0 0 0\n\ MouseMoveEvent 184 209 0 0 0 0 0\n\ MouseMoveEvent 183 208 0 0 0 0 0\n\ MouseMoveEvent 183 208 0 0 0 0 0\n\ MouseMoveEvent 183 207 0 0 0 0 0\n\ MouseMoveEvent 183 206 0 0 0 0 0\n\ MouseMoveEvent 183 204 0 0 0 0 0\n\ MouseMoveEvent 183 204 0 0 0 0 0\n\ MouseMoveEvent 183 202 0 0 0 0 0\n\ MouseMoveEvent 183 202 0 0 0 0 0\n\ MouseMoveEvent 183 200 0 0 0 0 0\n\ MouseMoveEvent 183 198 0 0 0 0 0\n\ MouseMoveEvent 183 198 0 0 0 0 0\n\ MouseMoveEvent 183 196 0 0 0 0 0\n\ MouseMoveEvent 183 195 0 0 0 0 0\n\ MouseMoveEvent 183 193 0 0 0 0 0\n\ MouseMoveEvent 183 192 0 0 0 0 0\n\ MouseMoveEvent 183 192 0 0 0 0 0\n\ MouseMoveEvent 183 190 0 0 0 0 0\n\ MouseMoveEvent 183 189 0 0 0 0 0\n\ MouseMoveEvent 183 188 0 0 0 0 0\n\ MouseMoveEvent 183 188 0 0 0 0 0\n\ MouseMoveEvent 182 186 0 0 0 0 0\n\ MouseMoveEvent 182 185 0 0 0 0 0\n\ MouseMoveEvent 182 184 0 0 0 0 0\n\ MouseMoveEvent 182 183 0 0 0 0 0\n\ MouseMoveEvent 182 182 0 0 0 0 0\n\ MouseMoveEvent 181 182 0 0 0 0 0\n\ MouseMoveEvent 181 181 0 0 0 0 0\n\ MouseMoveEvent 181 180 0 0 0 0 0\n\ MouseMoveEvent 181 180 0 0 0 0 0\n\ MouseMoveEvent 181 179 0 0 0 0 0\n\ MouseMoveEvent 181 178 0 0 0 0 0\n\ MouseMoveEvent 181 178 0 0 0 0 0\n\ MouseMoveEvent 181 176 0 0 0 0 0\n\ MouseMoveEvent 181 175 0 0 0 0 0\n\ MouseMoveEvent 181 174 0 0 0 0 0\n\ MouseMoveEvent 181 172 0 0 0 0 0\n\ MouseMoveEvent 181 172 0 0 0 0 0\n\ MouseMoveEvent 181 170 0 0 0 0 0\n\ MouseMoveEvent 181 170 0 0 0 0 0\n\ MouseMoveEvent 181 168 0 0 0 0 0\n\ MouseMoveEvent 181 168 0 0 0 0 0\n\ MouseMoveEvent 181 167 0 0 0 0 0\n\ MouseMoveEvent 181 166 0 0 0 0 0\n\ MouseMoveEvent 181 165 0 0 0 0 0\n\ MouseMoveEvent 181 164 0 0 0 0 0\n\ MouseMoveEvent 181 163 0 0 0 0 0\n\ MouseMoveEvent 181 162 0 0 0 0 0\n\ MouseMoveEvent 181 160 0 0 0 0 0\n\ MouseMoveEvent 181 159 0 0 0 0 0\n\ MouseMoveEvent 181 158 0 0 0 0 0\n\ MouseMoveEvent 181 158 0 0 0 0 0\n\ MouseMoveEvent 180 157 0 0 0 0 0\n\ MouseMoveEvent 180 156 0 0 0 0 0\n\ MouseMoveEvent 180 156 0 0 0 0 0\n\ MouseMoveEvent 180 155 0 0 0 0 0\n\ MouseMoveEvent 180 154 0 0 0 0 0\n\ MouseMoveEvent 179 154 0 0 0 0 0\n\ MouseMoveEvent 177 154 0 0 0 0 0\n\ MouseMoveEvent 173 154 0 0 0 0 0\n\ MouseMoveEvent 169 154 0 0 0 0 0\n\ MouseMoveEvent 166 154 0 0 0 0 0\n\ MouseMoveEvent 163 154 0 0 0 0 0\n\ MouseMoveEvent 159 154 0 0 0 0 0\n\ MouseMoveEvent 155 154 0 0 0 0 0\n\ MouseMoveEvent 152 154 0 0 0 0 0\n\ MouseMoveEvent 148 154 0 0 0 0 0\n\ MouseMoveEvent 145 155 0 0 0 0 0\n\ MouseMoveEvent 141 155 0 0 0 0 0\n\ MouseMoveEvent 137 156 0 0 0 0 0\n\ MouseMoveEvent 135 156 0 0 0 0 0\n\ MouseMoveEvent 132 156 0 0 0 0 0\n\ MouseMoveEvent 130 156 0 0 0 0 0\n\ MouseMoveEvent 129 156 0 0 0 0 0\n\ MouseMoveEvent 128 156 0 0 0 0 0\n\ MouseMoveEvent 127 156 0 0 0 0 0\n\ MouseMoveEvent 126 156 0 0 0 0 0\n\ MouseMoveEvent 125 156 0 0 0 0 0\n\ MouseMoveEvent 123 157 0 0 0 0 0\n\ MouseMoveEvent 123 157 0 0 0 0 0\n\ MouseMoveEvent 121 157 0 0 0 0 0\n\ MouseMoveEvent 121 157 0 0 0 0 0\n\ MouseMoveEvent 119 158 0 0 0 0 0\n\ MouseMoveEvent 119 158 0 0 0 0 0\n\ MouseMoveEvent 118 158 0 0 0 0 0\n\ MouseMoveEvent 117 158 0 0 0 0 0\n\ MouseMoveEvent 117 158 0 0 0 0 0\n\ MouseMoveEvent 116 158 0 0 0 0 0\n\ MouseMoveEvent 115 158 0 0 0 0 0\n\ MouseMoveEvent 114 158 0 0 0 0 0\n\ MouseMoveEvent 113 158 0 0 0 0 0\n\ MouseMoveEvent 111 158 0 0 0 0 0\n\ MouseMoveEvent 110 158 0 0 0 0 0\n\ MouseMoveEvent 109 158 0 0 0 0 0\n\ MouseMoveEvent 107 158 0 0 0 0 0\n\ MouseMoveEvent 106 158 0 0 0 0 0\n\ MouseMoveEvent 105 158 0 0 0 0 0\n\ MouseMoveEvent 103 158 0 0 0 0 0\n\ MouseMoveEvent 103 158 0 0 0 0 0\n\ MouseMoveEvent 102 158 0 0 0 0 0\n\ MouseMoveEvent 101 158 0 0 0 0 0\n\ MouseMoveEvent 101 158 0 0 0 0 0\n\ MouseMoveEvent 100 158 0 0 0 0 0\n\ MouseMoveEvent 99 158 0 0 0 0 0\n\ MouseMoveEvent 99 158 0 0 0 0 0\n\ MouseMoveEvent 98 158 0 0 0 0 0\n\ MouseMoveEvent 97 158 0 0 0 0 0\n\ MouseMoveEvent 97 158 0 0 0 0 0\n\ MouseMoveEvent 97 159 0 0 0 0 0\n\ MouseMoveEvent 97 160 0 0 0 0 0\n\ MouseMoveEvent 96 161 0 0 0 0 0\n\ MouseMoveEvent 96 162 0 0 0 0 0\n\ MouseMoveEvent 96 163 0 0 0 0 0\n\ MouseMoveEvent 96 164 0 0 0 0 0\n\ MouseMoveEvent 96 165 0 0 0 0 0\n\ MouseMoveEvent 96 166 0 0 0 0 0\n\ MouseMoveEvent 96 167 0 0 0 0 0\n\ MouseMoveEvent 96 168 0 0 0 0 0\n\ MouseMoveEvent 96 168 0 0 0 0 0\n\ MouseMoveEvent 96 170 0 0 0 0 0\n\ MouseMoveEvent 96 170 0 0 0 0 0\n\ MouseMoveEvent 96 171 0 0 0 0 0\n\ MouseMoveEvent 97 171 0 0 0 0 0\n\ MouseMoveEvent 97 172 0 0 0 0 0\n\ MouseMoveEvent 97 172 0 0 0 0 0\n\ MouseMoveEvent 98 173 0 0 0 0 0\n\ MouseMoveEvent 99 174 0 0 0 0 0\n\ MouseMoveEvent 99 174 0 0 0 0 0\n\ MouseMoveEvent 99 175 0 0 0 0 0\n\ MouseMoveEvent 100 176 0 0 0 0 0\n\ MouseMoveEvent 100 176 0 0 0 0 0\n\ MouseMoveEvent 101 177 0 0 0 0 0\n\ MouseMoveEvent 101 178 0 0 0 0 0\n\ MouseMoveEvent 103 179 0 0 0 0 0\n\ MouseMoveEvent 103 180 0 0 0 0 0\n\ MouseMoveEvent 103 180 0 0 0 0 0\n\ MouseMoveEvent 104 181 0 0 0 0 0\n\ MouseMoveEvent 105 182 0 0 0 0 0\n\ MouseMoveEvent 105 183 0 0 0 0 0\n\ MouseMoveEvent 105 184 0 0 0 0 0\n\ MouseMoveEvent 106 185 0 0 0 0 0\n\ MouseMoveEvent 107 186 0 0 0 0 0\n\ MouseMoveEvent 107 187 0 0 0 0 0\n\ MouseMoveEvent 108 188 0 0 0 0 0\n\ MouseMoveEvent 108 188 0 0 0 0 0\n\ MouseMoveEvent 108 189 0 0 0 0 0\n\ MouseMoveEvent 108 190 0 0 0 0 0\n\ MouseMoveEvent 109 190 0 0 0 0 0\n\ MouseMoveEvent 109 190 0 0 0 0 0\n\ MouseMoveEvent 110 192 0 0 0 0 0\n\ MouseMoveEvent 110 192 0 0 0 0 0\n\ MouseMoveEvent 111 194 0 0 0 0 0\n\ MouseMoveEvent 111 195 0 0 0 0 0\n\ MouseMoveEvent 111 196 0 0 0 0 0\n\ MouseMoveEvent 112 198 0 0 0 0 0\n\ MouseMoveEvent 112 198 0 0 0 0 0\n\ MouseMoveEvent 113 199 0 0 0 0 0\n\ MouseMoveEvent 113 200 0 0 0 0 0\n\ MouseMoveEvent 113 201 0 0 0 0 0\n\ MouseMoveEvent 113 202 0 0 0 0 0\n\ MouseMoveEvent 113 202 0 0 0 0 0\n\ MouseMoveEvent 114 203 0 0 0 0 0\n\ MouseMoveEvent 114 204 0 0 0 0 0\n\ MouseMoveEvent 114 204 0 0 0 0 0\n\ MouseMoveEvent 114 205 0 0 0 0 0\n\ MouseMoveEvent 114 206 0 0 0 0 0\n\ MouseMoveEvent 114 206 0 0 0 0 0\n\ MouseMoveEvent 114 207 0 0 0 0 0\n\ MouseMoveEvent 114 208 0 0 0 0 0\n\ MouseMoveEvent 114 210 0 0 0 0 0\n\ RightButtonReleaseEvent 114 210 0 0 0 0 0\n\ " # Now define a script to build a pipeline # Start by loading some data. # dem = vtk.vtkDEMReader() dem.SetFileName(VTK_DATA_ROOT + "/Data/SainteHelens.dem") dem.Update() Scale = 2 lut = vtk.vtkLookupTable() lut.SetHueRange(0.6, 0) lut.SetSaturationRange(1.0, 0) lut.SetValueRange(0.5, 1.0) lo = Scale * dem.GetElevationBounds()[0] hi = Scale * dem.GetElevationBounds()[1] shrink = vtk.vtkImageShrink3D() shrink.SetShrinkFactors(4, 4, 1) shrink.SetInputConnection(dem.GetOutputPort()) shrink.AveragingOn() geom = vtk.vtkImageDataGeometryFilter() geom.SetInputConnection(shrink.GetOutputPort()) geom.ReleaseDataFlagOn() warp = vtk.vtkWarpScalar() warp.SetInputConnection(geom.GetOutputPort()) warp.SetNormal(0, 0, 1) warp.UseNormalOn() warp.SetScaleFactor(Scale) warp.ReleaseDataFlagOn() elevation = vtk.vtkElevationFilter() elevation.SetInputConnection(warp.GetOutputPort()) elevation.SetLowPoint(0, 0, lo) elevation.SetHighPoint(0, 0, hi) elevation.SetScalarRange(lo, hi) elevation.ReleaseDataFlagOn() normals = vtk.vtkPolyDataNormals() normals.SetInputConnection(elevation.GetOutputPort()) normals.SetFeatureAngle(60) normals.ConsistencyOff() normals.SplittingOff() normals.ReleaseDataFlagOn() normals.Update() demMapper = vtk.vtkPolyDataMapper() demMapper.SetInputConnection(normals.GetOutputPort()) demMapper.SetScalarRange(lo, hi) demMapper.SetLookupTable(lut) demActor = vtk.vtkActor() demActor.SetMapper(demMapper) # Create the RenderWindow, Renderer and both Actors # ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.SetMultiSamples(0) renWin.AddRenderer(ren) iRen = vtk.vtkRenderWindowInteractor() iRen.SetRenderWindow(renWin) iRen.LightFollowCameraOff() recorder = vtk.vtkInteractorEventRecorder() recorder.SetInteractor(iRen) #recorder.SetFileName("c:/d/VTK/record.log") #recorder.Record() recorder.ReadFromInputStringOn() recorder.SetInputString(Recording) # Add the actors to the renderer, set the background and size # ren.AddActor(demActor) ren.SetBackground(1, 1, 1) renWin.SetSize(300, 300) ren.SetBackground(0.1, 0.2, 0.4) cam1 = ren.GetActiveCamera() cam1.SetViewUp(0, 0, 1) cam1.SetFocalPoint(dem.GetOutput().GetCenter()) cam1.SetPosition(1, 0, 0) ren.ResetCamera() cam1.Elevation(25) cam1.Azimuth(125) cam1.Zoom(1.25) # This is where the bindings are set up # The callback stubs are defined here. The callback takes two arguments. # The first being the object that generates the event and the second argument # the event name (which is a string). def leftDown(widget, event_string): global left left = 1 def leftUp(widget, event_string): global left left = 0 def middleDown(widget, event_string): global middle middle = 1 def middleUp(widget, event_string): global middle middle = 0 def rightDown(widget, event_string): global right right = 1 def rightUp(widget, event_string): global right right = 0 def wheelForward(widget, event_string): mouseWheelForward(iRen,ren) def wheelBackward(widget, event_string): mouseWheelBackward(iRen,ren) def mouseMove(widget, event_string): global left, middle, right if left == 1: mouseLeftMove(iRen,ren) if middle == 1: mouseMiddleMove(iRen,ren) if right == 1: mouseRightMove(iRen,ren) if ( (left == 0) and (middle == 0) and (right == 0) ) : pass # This is where the interaction style is defined style = vtk.vtkInteractorStyleUser() iRen.SetInteractorStyle(style) style.AddObserver("LeftButtonPressEvent", leftDown) style.AddObserver("LeftButtonReleaseEvent", leftUp) style.AddObserver("MiddleButtonPressEvent", middleDown) style.AddObserver("MiddleButtonReleaseEvent", middleUp) style.AddObserver("RightButtonPressEvent", rightDown) style.AddObserver("RightButtonReleaseEvent", rightUp) style.AddObserver("MouseWheelForwardEvent", wheelForward) style.AddObserver("MouseWheelBackwardEvent", wheelBackward) style.AddObserver("MouseMoveEvent", mouseMove) iRen.Initialize() renWin.Render() # render the image renWin.Render() recorder.Play() #iRen.Start()
36.296912
80
0.667921
6,196
30,562
3.292447
0.073757
0.232255
0.260294
0.23098
0.755686
0.753235
0.742892
0.728088
0.294461
0.264118
0
0.293429
0.264479
30,562
841
81
36.340071
0.614084
0.035927
0
0.235825
0
0
0.007237
0.006081
0
0
0
0
0
1
0.023196
false
0.001289
0.005155
0.002577
0.032216
0
0
0
0
null
1
1
1
0
1
1
1
0
0
0
1
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
ac41007adcb10e06ed98bf00d0cbd370f393b0ac
119
py
Python
models/__init__.py
Lee-Gihun/Micronet_GSJ
72289bb66507b6c3b4d14f2e5916dec718a1b198
[ "MIT" ]
12
2019-11-12T15:19:45.000Z
2022-01-22T09:28:36.000Z
models/__init__.py
Lee-Gihun/MicroNet_OSI-AI
72289bb66507b6c3b4d14f2e5916dec718a1b198
[ "MIT" ]
null
null
null
models/__init__.py
Lee-Gihun/MicroNet_OSI-AI
72289bb66507b6c3b4d14f2e5916dec718a1b198
[ "MIT" ]
6
2019-11-13T08:36:45.000Z
2021-07-29T01:01:05.000Z
from .utils import efficientnet from .EfficientNet import EfficientNet from .pruning import * from .early_exit import *
29.75
38
0.823529
15
119
6.466667
0.466667
0.371134
0.453608
0
0
0
0
0
0
0
0
0
0.12605
119
4
39
29.75
0.932692
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
ac6387a53a075f351ba376f1455fa1584ffd19e7
3,379
py
Python
deepfence_backend/tasks/user_activity.py
tuapuikia/ThreatMapper
22c473e133e2a57a402f27a12d44e1787a2895cc
[ "Apache-2.0" ]
1,281
2020-04-08T17:07:21.000Z
2022-03-31T11:22:16.000Z
deepfence_backend/tasks/user_activity.py
tuapuikia/ThreatMapper
22c473e133e2a57a402f27a12d44e1787a2895cc
[ "Apache-2.0" ]
180
2020-04-06T15:40:16.000Z
2022-03-31T02:19:34.000Z
deepfence_backend/tasks/user_activity.py
tuapuikia/ThreatMapper
22c473e133e2a57a402f27a12d44e1787a2895cc
[ "Apache-2.0" ]
148
2020-04-08T21:38:39.000Z
2022-03-30T18:04:50.000Z
from models.notification import UserActivityNotification from config.app import celery_app, app as flask_app from tasks.notification import user_activity_digest from models.user_activity_log import UserActivityLog from models.user import User, Role from utils.custom_exception import InvalidUsage import json import arrow # create_user_activity logs the user activity @celery_app.task def create_user_activity(current_user_id, action, event, resources=None, patch=None, success=False): with flask_app.app_context(): user = User.query.filter_by(id=current_user_id).one_or_none() if not user: raise InvalidUsage("User Invalid.") role = Role.query.filter_by(id=user.role_id).one_or_none() if not role: raise InvalidUsage("Role Invalid.") # converting None to empty string if resources is None: resources = '' else: resources = json.dumps(resources) if patch is None: patch = '' else: patch = json.dumps(patch) ual = UserActivityLog( action=action, event=event, user=user, success=success, role=role, resources=str(resources), patch=str(patch) ) try: ual.save() # send user activity for immediate notification integrations active_user_ids = [user.id for user in User.query.filter_by(isActive=True).all()] time = arrow.now().datetime for notification in UserActivityNotification.query.filter( UserActivityNotification.user_id.in_(active_user_ids)).all(): if notification.duration_in_mins == -1: user_activity_digest(time, notification.id) except: pass # create_user_activity logs the user activity while login @celery_app.task def create_user_activity_login(current_user_id, action, event, resources=None, patch=None, success=False): with flask_app.app_context(): user = User.query.filter_by(id=current_user_id).one_or_none() if not user: raise InvalidUsage("User Invalid.") role = Role.query.filter_by(id=user.role_id).one_or_none() if not role: raise InvalidUsage("Role Invalid.") # converting None to empty string if resources is None: resources = '' else: resources = json.dumps(resources) if patch is None: patch = '' else: patch = json.dumps(patch) ual = UserActivityLog( action=action, event=event, user=user, success=success, role=role, resources=str(resources), patch=str(patch) ) try: ual.save() # send user activity for immediate notification integrations active_user_ids = [user.id for user in User.query.filter_by(isActive=True).all()] time = arrow.now().datetime for notification in UserActivityNotification.query.filter( UserActivityNotification.user_id.in_(active_user_ids)).all(): if notification.duration_in_mins == -1: user_activity_digest(time, notification.id) except: pass
36.728261
106
0.613199
384
3,379
5.223958
0.205729
0.071785
0.038883
0.033898
0.855434
0.855434
0.855434
0.784646
0.784646
0.784646
0
0.000853
0.306304
3,379
91
107
37.131868
0.854949
0.083161
0
0.85
0
0
0.016823
0
0
0
0
0
0
1
0.025
false
0.025
0.1
0
0.125
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
3baac43763e834e63e683d8777fbe91cb31b50dd
164
py
Python
curris/test/test_inline_code.py
a1trl9/curris
f9b55a7a2a8864882f297a4a324ccff182176417
[ "MIT" ]
null
null
null
curris/test/test_inline_code.py
a1trl9/curris
f9b55a7a2a8864882f297a4a324ccff182176417
[ "MIT" ]
null
null
null
curris/test/test_inline_code.py
a1trl9/curris
f9b55a7a2a8864882f297a4a324ccff182176417
[ "MIT" ]
null
null
null
from curris.test.base import compare_json def test_inline_code(): compare_json('curris/test/resource/inline_code.md', 'curris/test/resource/inline_code.json')
32.8
96
0.79878
25
164
5
0.48
0.24
0.288
0.384
0.448
0
0
0
0
0
0
0
0.079268
164
4
97
41
0.827815
0
0
0
0
0
0.439024
0.439024
0
0
0
0
0
1
0.333333
true
0
0.333333
0
0.666667
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
1
1
0
1
0
1
0
0
10
3bde48a162ca817e19eb72a9c9320719f44eab19
883,714
py
Python
env/Lib/site-packages/azure/mgmt/network/networkresourceprovider.py
Ammar12/simplebanking
6080d638b2e98bfcf96d782703e1dce25aebfcbc
[ "MIT" ]
null
null
null
env/Lib/site-packages/azure/mgmt/network/networkresourceprovider.py
Ammar12/simplebanking
6080d638b2e98bfcf96d782703e1dce25aebfcbc
[ "MIT" ]
null
null
null
env/Lib/site-packages/azure/mgmt/network/networkresourceprovider.py
Ammar12/simplebanking
6080d638b2e98bfcf96d782703e1dce25aebfcbc
[ "MIT" ]
null
null
null
# # Copyright (c) Microsoft and contributors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. # # Warning: This code was generated by a tool. # # Changes to this file may cause incorrect behavior and will be lost if the # code is regenerated. import json import re from requests import Session, Request import time try: from urllib import quote, unquote except: from urllib.parse import quote, unquote from azure.common import AzureHttpError from azure.mgmt.common import AzureOperationResponse, OperationStatusResponse, OperationStatus, Service from azure.mgmt.common.arm import ResourceBase, ResourceBaseExtended class DnsNameAvailabilityResponse(AzureOperationResponse): """ Response for CheckDnsNameAvailability Api servive call """ def __init__(self, **kwargs): super(DnsNameAvailabilityResponse, self).__init__(**kwargs) self._dns_name_availability = kwargs.get('dns_name_availability') @property def dns_name_availability(self): """ Domain availability (True/False) """ return self._dns_name_availability @dns_name_availability.setter def dns_name_availability(self, value): self._dns_name_availability = value class ResourceProviderErrorResponse(AzureOperationResponse): """ If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ def __init__(self, **kwargs): super(ResourceProviderErrorResponse, self).__init__(**kwargs) self._error = kwargs.get('error') @property def error(self): return self._error @error.setter def error(self, value): self._error = value class RetriableOperationResponse(ResourceProviderErrorResponse): """ If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ def __init__(self, **kwargs): super(RetriableOperationResponse, self).__init__(**kwargs) self._retry_after = kwargs.get('retry_after', 0) @property def retry_after(self): """ The recommended retry interval for the Get Azure-AsyncOperation call """ return self._retry_after @retry_after.setter def retry_after(self, value): self._retry_after = value class AzureAsyncOperationResponse(RetriableOperationResponse): """ The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ def __init__(self, **kwargs): super(AzureAsyncOperationResponse, self).__init__(**kwargs) self._status = kwargs.get('status') @property def status(self): """ Status of the AzureAsuncOperation """ return self._status @status.setter def status(self, value): self._status = value class UpdateOperationResponse(RetriableOperationResponse): """ If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ def __init__(self, **kwargs): super(UpdateOperationResponse, self).__init__(**kwargs) self._azure_async_operation = kwargs.get('azure_async_operation') @property def azure_async_operation(self): """ Users can perform a Get on Azure-AsyncOperation to get the status of their update(PUT/PATCH/DELETE) operations """ return self._azure_async_operation @azure_async_operation.setter def azure_async_operation(self, value): self._azure_async_operation = value class LoadBalancerGetResponse(AzureOperationResponse): """ Response of a GET Load Balancer operation """ def __init__(self, **kwargs): super(LoadBalancerGetResponse, self).__init__(**kwargs) self._load_balancer = kwargs.get('load_balancer') @property def load_balancer(self): """ Gets a Load Balancer in a resource group """ return self._load_balancer @load_balancer.setter def load_balancer(self, value): self._load_balancer = value class LoadBalancerListResponse(AzureOperationResponse): """ Response for ListLoadBalancers Api service call """ def __init__(self, **kwargs): super(LoadBalancerListResponse, self).__init__(**kwargs) self._load_balancers = kwargs.get('load_balancers') self._next_link = kwargs.get('next_link') @property def load_balancers(self): """ Gets a list of LoadBalancers in a resource group """ return self._load_balancers @load_balancers.setter def load_balancers(self, value): self._load_balancers = value @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value class LoadBalancerPutResponse(UpdateOperationResponse): """ Response of a PUT Load Balancer operation """ def __init__(self, **kwargs): super(LoadBalancerPutResponse, self).__init__(**kwargs) self._load_balancer = kwargs.get('load_balancer') @property def load_balancer(self): """ Gets Load Balancer in a resource group """ return self._load_balancer @load_balancer.setter def load_balancer(self, value): self._load_balancer = value class TopLevelResource(ResourceBaseExtended): """ A common class for general resource information """ def __init__(self, **kwargs): super(TopLevelResource, self).__init__(**kwargs) self._etag = kwargs.get('etag') @property def etag(self): """ Gets a unique read-only string that changes whenever the resource is updated """ return self._etag @etag.setter def etag(self, value): self._etag = value class LoadBalancer(TopLevelResource): """ LoadBalancer resource """ def __init__(self, **kwargs): super(LoadBalancer, self).__init__(**kwargs) self._frontend_ip_configurations = kwargs.get('frontend_ip_configurations') self._backend_address_pools = kwargs.get('backend_address_pools') self._load_balancing_rules = kwargs.get('load_balancing_rules') self._probes = kwargs.get('probes') self._inbound_nat_rules = kwargs.get('inbound_nat_rules') self._provisioning_state = kwargs.get('provisioning_state') @property def backend_address_pools(self): """ Gets or sets Pools of backend IP addresseses """ return self._backend_address_pools @backend_address_pools.setter def backend_address_pools(self, value): self._backend_address_pools = value @property def frontend_ip_configurations(self): """ Gets or sets frontend IP addresses of the load balancer """ return self._frontend_ip_configurations @frontend_ip_configurations.setter def frontend_ip_configurations(self, value): self._frontend_ip_configurations = value @property def inbound_nat_rules(self): """ Gets or sets list of inbound rules """ return self._inbound_nat_rules @inbound_nat_rules.setter def inbound_nat_rules(self, value): self._inbound_nat_rules = value @property def load_balancing_rules(self): """ Gets or sets loadbalancing rules """ return self._load_balancing_rules @load_balancing_rules.setter def load_balancing_rules(self, value): self._load_balancing_rules = value @property def probes(self): """ Gets or sets list of Load balancer probes """ return self._probes @probes.setter def probes(self, value): self._probes = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class LocalNetworkGatewayPutResponse(UpdateOperationResponse): """ Response for PutLocalNetworkGateway Api servive call """ def __init__(self, **kwargs): super(LocalNetworkGatewayPutResponse, self).__init__(**kwargs) self._local_network_gateway = kwargs.get('local_network_gateway') @property def local_network_gateway(self): """ Puts the local network gateway that exists in a resource group """ return self._local_network_gateway @local_network_gateway.setter def local_network_gateway(self, value): self._local_network_gateway = value class LocalNetworkGateway(TopLevelResource): """ A common class for general resource information """ def __init__(self, **kwargs): super(LocalNetworkGateway, self).__init__(**kwargs) self._gateway_ip_address = kwargs.get('gateway_ip_address') self._local_network_site_address_space = kwargs.get('local_network_site_address_space') self._provisioning_state = kwargs.get('provisioning_state') @property def gateway_ip_address(self): """ IP address of local network gateway. """ return self._gateway_ip_address @gateway_ip_address.setter def gateway_ip_address(self, value): self._gateway_ip_address = value @property def local_network_site_address_space(self): """ Local network site Address space """ return self._local_network_site_address_space @local_network_site_address_space.setter def local_network_site_address_space(self, value): self._local_network_site_address_space = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the LocalNetworkGateway resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class LocalNetworkGatewayGetResponse(AzureOperationResponse): """ Response for GetLocalNetworkgateway Api servive call. """ def __init__(self, **kwargs): super(LocalNetworkGatewayGetResponse, self).__init__(**kwargs) self._local_network_gateway = kwargs.get('local_network_gateway') @property def local_network_gateway(self): """ Gets local network gateway details that exists in a resource group """ return self._local_network_gateway @local_network_gateway.setter def local_network_gateway(self, value): self._local_network_gateway = value class LocalNetworkGatewayListResponse(AzureOperationResponse): """ Response for ListLocalNetworkGateways Api service call """ def __init__(self, **kwargs): super(LocalNetworkGatewayListResponse, self).__init__(**kwargs) self._local_network_gateways = kwargs.get('local_network_gateways') self._next_link = kwargs.get('next_link') @property def local_network_gateways(self): """ Gets List of LocalNetworkGateways that exists in a resource group """ return self._local_network_gateways @local_network_gateways.setter def local_network_gateways(self, value): self._local_network_gateways = value @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value class NetworkInterfaceListResponse(AzureOperationResponse): """ Response for ListNetworkInterface Api service call """ def __init__(self, **kwargs): super(NetworkInterfaceListResponse, self).__init__(**kwargs) self._network_interfaces = kwargs.get('network_interfaces') self._next_link = kwargs.get('next_link') @property def network_interfaces(self): """ Gets or sets list of NetworkInterfaces in a resource group """ return self._network_interfaces @network_interfaces.setter def network_interfaces(self, value): self._network_interfaces = value @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value class NetworkInterfaceGetResponse(AzureOperationResponse): """ Response for GetNetworkInterface Api service call """ def __init__(self, **kwargs): super(NetworkInterfaceGetResponse, self).__init__(**kwargs) self._network_interface = kwargs.get('network_interface') @property def network_interface(self): """ Gets or sets a NetworkInterface that exists in a resource group """ return self._network_interface @network_interface.setter def network_interface(self, value): self._network_interface = value class NetworkInterfacePutResponse(UpdateOperationResponse): """ Response for PutNetworkInterface Api servive call """ def __init__(self, **kwargs): super(NetworkInterfacePutResponse, self).__init__(**kwargs) self._network_interface = kwargs.get('network_interface') @property def network_interface(self): """ Gets a NetworkInterface that exists in a resource group """ return self._network_interface @network_interface.setter def network_interface(self, value): self._network_interface = value class NetworkInterface(TopLevelResource): """ A NetworkInterface in a resource group """ def __init__(self, **kwargs): super(NetworkInterface, self).__init__(**kwargs) self._virtual_machine = kwargs.get('virtual_machine') self._network_security_group = kwargs.get('network_security_group') self._ip_configurations = kwargs.get('ip_configurations') self._dns_settings = kwargs.get('dns_settings') self._mac_address = kwargs.get('mac_address') self._primary = kwargs.get('primary') self._provisioning_state = kwargs.get('provisioning_state') @property def dns_settings(self): """ Gets or sets DNsSettings in NetworkInterface """ return self._dns_settings @dns_settings.setter def dns_settings(self, value): self._dns_settings = value @property def ip_configurations(self): """ Gets or sets list of IPConfigurations of the NetworkInterface """ return self._ip_configurations @ip_configurations.setter def ip_configurations(self, value): self._ip_configurations = value @property def mac_address(self): """ Gets the MAC Address of the network interface """ return self._mac_address @mac_address.setter def mac_address(self, value): self._mac_address = value @property def network_security_group(self): """ Gets or sets the reference of the NetworkSecurityGroup resource """ return self._network_security_group @network_security_group.setter def network_security_group(self, value): self._network_security_group = value @property def primary(self): """ Gets whether this is a primary NIC on a virtual machine """ return self._primary @primary.setter def primary(self, value): self._primary = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def virtual_machine(self): """ Gets or sets the reference of a VirtualMachine """ return self._virtual_machine @virtual_machine.setter def virtual_machine(self, value): self._virtual_machine = value class NetworkSecurityGroupGetResponse(AzureOperationResponse): """ Response for GetNetworkSecurityGroup Api service call """ def __init__(self, **kwargs): super(NetworkSecurityGroupGetResponse, self).__init__(**kwargs) self._network_security_group = kwargs.get('network_security_group') @property def network_security_group(self): """ Gets a Network Security Group in a resource group """ return self._network_security_group @network_security_group.setter def network_security_group(self, value): self._network_security_group = value class NetworkSecurityGroupListResponse(AzureOperationResponse): """ Response for ListNetworkSecurityGroups Api servive call """ def __init__(self, **kwargs): super(NetworkSecurityGroupListResponse, self).__init__(**kwargs) self._network_security_groups = kwargs.get('network_security_groups') self._next_link = kwargs.get('next_link') @property def network_security_groups(self): """ Gets List of NetworkSecurityGroups in a resource group """ return self._network_security_groups @network_security_groups.setter def network_security_groups(self, value): self._network_security_groups = value @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value class NetworkSecurityGroupPutResponse(UpdateOperationResponse): """ Response for PUT NetworkSecurityGroups Api servive call """ def __init__(self, **kwargs): super(NetworkSecurityGroupPutResponse, self).__init__(**kwargs) self._network_security_group = kwargs.get('network_security_group') @property def network_security_group(self): """ Gets NetworkSecurityGroups in a resource group """ return self._network_security_group @network_security_group.setter def network_security_group(self, value): self._network_security_group = value class NetworkSecurityGroup(TopLevelResource): """ NetworkSecurityGroup resource """ def __init__(self, **kwargs): super(NetworkSecurityGroup, self).__init__(**kwargs) self._security_rules = kwargs.get('security_rules') self._default_security_rules = kwargs.get('default_security_rules') self._network_interfaces = kwargs.get('network_interfaces') self._subnets = kwargs.get('subnets') self._provisioning_state = kwargs.get('provisioning_state') @property def default_security_rules(self): """ Gets or sets Default security rules of network security group """ return self._default_security_rules @default_security_rules.setter def default_security_rules(self, value): self._default_security_rules = value @property def network_interfaces(self): """ Gets collection of references to Network Interfaces """ return self._network_interfaces @network_interfaces.setter def network_interfaces(self, value): self._network_interfaces = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def security_rules(self): """ Gets or sets Security rules of network security group """ return self._security_rules @security_rules.setter def security_rules(self, value): self._security_rules = value @property def subnets(self): """ Gets collection of references to subnets """ return self._subnets @subnets.setter def subnets(self, value): self._subnets = value class PublicIpAddressListResponse(AzureOperationResponse): """ Response for ListPublicIpAddresses Api service call """ def __init__(self, **kwargs): super(PublicIpAddressListResponse, self).__init__(**kwargs) self._public_ip_addresses = kwargs.get('public_ip_addresses') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def public_ip_addresses(self): """ Gets List of publicIP addresses that exists in a resource group """ return self._public_ip_addresses @public_ip_addresses.setter def public_ip_addresses(self, value): self._public_ip_addresses = value class PublicIpAddressGetResponse(AzureOperationResponse): """ Response for GetPublicIpAddress Api servive call """ def __init__(self, **kwargs): super(PublicIpAddressGetResponse, self).__init__(**kwargs) self._public_ip_address = kwargs.get('public_ip_address') @property def public_ip_address(self): """ Gets publicIP address that exists in a resource group """ return self._public_ip_address @public_ip_address.setter def public_ip_address(self, value): self._public_ip_address = value class PublicIpAddressPutResponse(UpdateOperationResponse): """ Response for PutPublicIpAddress Api servive call """ def __init__(self, **kwargs): super(PublicIpAddressPutResponse, self).__init__(**kwargs) self._public_ip_address = kwargs.get('public_ip_address') @property def public_ip_address(self): """ Gets a publicIP address that exists in a resource group """ return self._public_ip_address @public_ip_address.setter def public_ip_address(self, value): self._public_ip_address = value class PublicIpAddress(TopLevelResource): """ PublicIPAddress resource """ def __init__(self, **kwargs): super(PublicIpAddress, self).__init__(**kwargs) self._public_ip_allocation_method = kwargs.get('public_ip_allocation_method') self._ip_configuration = kwargs.get('ip_configuration') self._dns_settings = kwargs.get('dns_settings') self._ip_address = kwargs.get('ip_address') self._idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes') self._provisioning_state = kwargs.get('provisioning_state') @property def dns_settings(self): """ Gets or sets FQDN of the DNS record associated with the public IP address """ return self._dns_settings @dns_settings.setter def dns_settings(self, value): self._dns_settings = value @property def idle_timeout_in_minutes(self): """ Gets or sets the Idletimeout of the public IP address """ return self._idle_timeout_in_minutes @idle_timeout_in_minutes.setter def idle_timeout_in_minutes(self, value): self._idle_timeout_in_minutes = value @property def ip_address(self): """ Gets the assigned public IP address """ return self._ip_address @ip_address.setter def ip_address(self, value): self._ip_address = value @property def ip_configuration(self): """ Gets a reference to the network interface IP configurations using this public IP address """ return self._ip_configuration @ip_configuration.setter def ip_configuration(self, value): self._ip_configuration = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def public_ip_allocation_method(self): """ Gets or sets PublicIP allocation method (Static/Dynamic) """ return self._public_ip_allocation_method @public_ip_allocation_method.setter def public_ip_allocation_method(self, value): self._public_ip_allocation_method = value class SecurityRuleGetResponse(AzureOperationResponse): """ Response for GetSecurityRule Api service call """ def __init__(self, **kwargs): super(SecurityRuleGetResponse, self).__init__(**kwargs) self._security_rule = kwargs.get('security_rule') @property def security_rule(self): """ Gets the security rule in a network security group """ return self._security_rule @security_rule.setter def security_rule(self, value): self._security_rule = value class SecurityRuleListResponse(AzureOperationResponse): """ Response for ListSecurityRule Api service callRetrieves all security rules that belongs to a network security group """ def __init__(self, **kwargs): super(SecurityRuleListResponse, self).__init__(**kwargs) self._security_rules = kwargs.get('security_rules') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def security_rules(self): """ Gets security rules in a network security group """ return self._security_rules @security_rules.setter def security_rules(self, value): self._security_rules = value class SecurityRulePutResponse(UpdateOperationResponse): """ Response for PUT SecurityRule Api service call """ def __init__(self, **kwargs): super(SecurityRulePutResponse, self).__init__(**kwargs) self._security_rule = kwargs.get('security_rule') @property def security_rule(self): """ Gets the security rule in a network security group """ return self._security_rule @security_rule.setter def security_rule(self, value): self._security_rule = value class ResourceId(object): """ Id of the resource """ def __init__(self, **kwargs): self._id = kwargs.get('id') @property def id(self): """ Id of the resource """ return self._id @id.setter def id(self, value): self._id = value class ChildResource(ResourceId): """ A common class for general resource information """ def __init__(self, **kwargs): super(ChildResource, self).__init__(**kwargs) self._name = kwargs.get('name') self._etag = kwargs.get('etag') @property def etag(self): """ A unique read-only string that changes whenever the resource is updated """ return self._etag @etag.setter def etag(self, value): self._etag = value @property def name(self): """ Gets name of the resource that is unique within a resource group. This name can be used to access the resource """ return self._name @name.setter def name(self, value): self._name = value class SecurityRule(ChildResource): """ Network security rule """ def __init__(self, **kwargs): super(SecurityRule, self).__init__(**kwargs) self._description = kwargs.get('description') self._protocol = kwargs.get('protocol') self._source_port_range = kwargs.get('source_port_range') self._destination_port_range = kwargs.get('destination_port_range') self._source_address_prefix = kwargs.get('source_address_prefix') self._destination_address_prefix = kwargs.get('destination_address_prefix') self._access = kwargs.get('access') self._priority = kwargs.get('priority') self._direction = kwargs.get('direction') self._provisioning_state = kwargs.get('provisioning_state') @property def access(self): """ Gets or sets network traffic is allowed or denied. Possible values are “Allow” and “Deny” """ return self._access @access.setter def access(self, value): self._access = value @property def description(self): """ Gets or sets a description for this rule. Restricted to 140 chars. """ return self._description @description.setter def description(self, value): self._description = value @property def destination_address_prefix(self): """ Gets or sets destination address prefix. CIDR or source IP range. Asterix “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. """ return self._destination_address_prefix @destination_address_prefix.setter def destination_address_prefix(self, value): self._destination_address_prefix = value @property def destination_port_range(self): """ Gets or sets Destination Port or Range. Integer or range between 0 and 65535. Asterix “*” can also be used to match all ports. """ return self._destination_port_range @destination_port_range.setter def destination_port_range(self, value): self._destination_port_range = value @property def direction(self): """ Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outcoming traffic. """ return self._direction @direction.setter def direction(self, value): self._direction = value @property def priority(self): """ Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. """ return self._priority @priority.setter def priority(self, value): self._priority = value @property def protocol(self): """ Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*). """ return self._protocol @protocol.setter def protocol(self, value): self._protocol = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def source_address_prefix(self): """ Gets or sets source address prefix. CIDR or source IP range. Asterix “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. If this is an ingress rule, specifies where network traffic originates from. """ return self._source_address_prefix @source_address_prefix.setter def source_address_prefix(self, value): self._source_address_prefix = value @property def source_port_range(self): """ Gets or sets Source Port or Range. Integer or range between 0 and 65535. Asterix “*” can also be used to match all ports. """ return self._source_port_range @source_port_range.setter def source_port_range(self, value): self._source_port_range = value class SubnetListResponse(AzureOperationResponse): """ Response for ListSubnets Api service callRetrieves all subnet that belongs to a virtual network """ def __init__(self, **kwargs): super(SubnetListResponse, self).__init__(**kwargs) self._subnets = kwargs.get('subnets') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def subnets(self): """ Gets the subnets in a virtual network """ return self._subnets @subnets.setter def subnets(self, value): self._subnets = value class SubnetGetResponse(AzureOperationResponse): """ Response for GetSubnet Api service call """ def __init__(self, **kwargs): super(SubnetGetResponse, self).__init__(**kwargs) self._subnet = kwargs.get('subnet') @property def subnet(self): """ Gets the subnet in a virtual network """ return self._subnet @subnet.setter def subnet(self, value): self._subnet = value class SubnetPutResponse(UpdateOperationResponse): """ Response for PutSubnet Api service call """ def __init__(self, **kwargs): super(SubnetPutResponse, self).__init__(**kwargs) self._subnet = kwargs.get('subnet') @property def subnet(self): """ Gets the subnet in a virtual network """ return self._subnet @subnet.setter def subnet(self, value): self._subnet = value class Subnet(ChildResource): """ Subnet in a VirtualNework resource """ def __init__(self, **kwargs): super(Subnet, self).__init__(**kwargs) self._address_prefix = kwargs.get('address_prefix') self._network_security_group = kwargs.get('network_security_group') self._ip_configurations = kwargs.get('ip_configurations') self._provisioning_state = kwargs.get('provisioning_state') @property def address_prefix(self): """ Gets or sets Address prefix for the subnet. """ return self._address_prefix @address_prefix.setter def address_prefix(self, value): self._address_prefix = value @property def ip_configurations(self): """ Gets array of references to the network interface IP configurations using subnet """ return self._ip_configurations @ip_configurations.setter def ip_configurations(self, value): self._ip_configurations = value @property def network_security_group(self): """ Gets or sets the reference of the NetworkSecurityGroup resource """ return self._network_security_group @network_security_group.setter def network_security_group(self, value): self._network_security_group = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class UsagesListResponse(AzureOperationResponse): """ The List Usages operation response. """ def __init__(self, **kwargs): super(UsagesListResponse, self).__init__(**kwargs) self._usages = kwargs.get('usages') @property def usages(self): """ Gets or sets the list Network Resource Usages. """ return self._usages @usages.setter def usages(self, value): self._usages = value class VirtualNetworkGatewayConnectionPutResponse(UpdateOperationResponse): """ Response for CreateOrUpdateVirtualNetworkGatewayConnection Api servive call """ def __init__(self, **kwargs): super(VirtualNetworkGatewayConnectionPutResponse, self).__init__(**kwargs) self._virtual_network_gateway_connection = kwargs.get('virtual_network_gateway_connection') @property def virtual_network_gateway_connection(self): """ Gets the virtual network gateway connection that exists in a resource group """ return self._virtual_network_gateway_connection @virtual_network_gateway_connection.setter def virtual_network_gateway_connection(self, value): self._virtual_network_gateway_connection = value class VirtualNetworkGatewayConnection(TopLevelResource): """ A common class for general resource information """ def __init__(self, **kwargs): super(VirtualNetworkGatewayConnection, self).__init__(**kwargs) self._virtual_network_gateway1 = kwargs.get('virtual_network_gateway1') self._virtual_network_gateway2 = kwargs.get('virtual_network_gateway2') self._local_network_gateway2 = kwargs.get('local_network_gateway2') self._connection_type = kwargs.get('connection_type') self._routing_weight = kwargs.get('routing_weight') self._shared_key = kwargs.get('shared_key') self._provisioning_state = kwargs.get('provisioning_state') @property def connection_type(self): """ Gateway connection type -Ipsec/Dedicated/VpnClient/Vnet2Vnet """ return self._connection_type @connection_type.setter def connection_type(self, value): self._connection_type = value @property def local_network_gateway2(self): return self._local_network_gateway2 @local_network_gateway2.setter def local_network_gateway2(self, value): self._local_network_gateway2 = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the VirtualNetworkGatewayConnection resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def routing_weight(self): """ The Routing weight. """ return self._routing_weight @routing_weight.setter def routing_weight(self, value): self._routing_weight = value @property def shared_key(self): """ The Ipsec share key. """ return self._shared_key @shared_key.setter def shared_key(self, value): self._shared_key = value @property def virtual_network_gateway1(self): return self._virtual_network_gateway1 @virtual_network_gateway1.setter def virtual_network_gateway1(self, value): self._virtual_network_gateway1 = value @property def virtual_network_gateway2(self): return self._virtual_network_gateway2 @virtual_network_gateway2.setter def virtual_network_gateway2(self, value): self._virtual_network_gateway2 = value class VirtualNetworkGatewayConnectionGetResponse(AzureOperationResponse): """ Response for GetVitualNetworkGatewayConnection Api servive call. """ def __init__(self, **kwargs): super(VirtualNetworkGatewayConnectionGetResponse, self).__init__(**kwargs) self._virtual_network_gateway_connection = kwargs.get('virtual_network_gateway_connection') @property def virtual_network_gateway_connection(self): """ Gets virtual network gateway connection details that exists in a resource group """ return self._virtual_network_gateway_connection @virtual_network_gateway_connection.setter def virtual_network_gateway_connection(self, value): self._virtual_network_gateway_connection = value class ConnectionSharedKeyResponse(AzureOperationResponse): """ Response for CheckConnectionSharedKey Api servive call """ def __init__(self, **kwargs): super(ConnectionSharedKeyResponse, self).__init__(**kwargs) self._value = kwargs.get('value') @property def value(self): """ The virtual network connection shared key value """ return self._value @value.setter def value(self, value): self._value = value class VirtualNetworkGatewayConnectionListResponse(AzureOperationResponse): """ Response for ListVirtualNetworkGatewayConnections Api service call """ def __init__(self, **kwargs): super(VirtualNetworkGatewayConnectionListResponse, self).__init__(**kwargs) self._virtual_network_gateway_connections = kwargs.get('virtual_network_gateway_connections') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def virtual_network_gateway_connections(self): """ Gets List of VirtualNetworkGatewayConnections that exists in a resource group """ return self._virtual_network_gateway_connections @virtual_network_gateway_connections.setter def virtual_network_gateway_connections(self, value): self._virtual_network_gateway_connections = value class ConnectionResetSharedKeyPutResponse(UpdateOperationResponse): """ Response for PutVirtualNetworkGatewayConnectionResetSharedKey Api servive call """ def __init__(self, **kwargs): super(ConnectionResetSharedKeyPutResponse, self).__init__(**kwargs) self._connection_reset_shared_key = kwargs.get('connection_reset_shared_key') @property def connection_reset_shared_key(self): """ Puts the virtual network gateway connection reset shared key that exists in a resource group """ return self._connection_reset_shared_key @connection_reset_shared_key.setter def connection_reset_shared_key(self, value): self._connection_reset_shared_key = value class ConnectionResetSharedKey(object): def __init__(self, **kwargs): self._key_length = kwargs.get('key_length') @property def key_length(self): """ The virtual network connection reset shared key length """ return self._key_length @key_length.setter def key_length(self, value): self._key_length = value class ConnectionSharedKeyPutResponse(UpdateOperationResponse): """ Response for PutVirtualNetworkGatewayConnectionSharedKey Api servive call """ def __init__(self, **kwargs): super(ConnectionSharedKeyPutResponse, self).__init__(**kwargs) self._connection_shared_key = kwargs.get('connection_shared_key') @property def connection_shared_key(self): """ Puts the virtual network gateway connection shared key that exists in a resource group """ return self._connection_shared_key @connection_shared_key.setter def connection_shared_key(self, value): self._connection_shared_key = value class ConnectionSharedKey(object): """ Response for GetConnectionSharedKey Api servive call """ def __init__(self, **kwargs): self._value = kwargs.get('value') @property def value(self): """ The virtual network connection shared key value """ return self._value @value.setter def value(self, value): self._value = value class VirtualNetworkGatewayPutResponse(UpdateOperationResponse): """ Response for PutVirtualNetworkGateway Api servive call """ def __init__(self, **kwargs): super(VirtualNetworkGatewayPutResponse, self).__init__(**kwargs) self._virtual_network_gateway = kwargs.get('virtual_network_gateway') @property def virtual_network_gateway(self): """ Puts the virtual network gateway that exists in a resource group """ return self._virtual_network_gateway @virtual_network_gateway.setter def virtual_network_gateway(self, value): self._virtual_network_gateway = value class VirtualNetworkGateway(TopLevelResource): """ A common class for general resource information """ def __init__(self, **kwargs): super(VirtualNetworkGateway, self).__init__(**kwargs) self._ip_configurations = kwargs.get('ip_configurations') self._gateway_size = kwargs.get('gateway_size') self._gateway_type = kwargs.get('gateway_type') self._enable_bgp = kwargs.get('enable_bgp') self._provisioning_state = kwargs.get('provisioning_state') @property def enable_bgp(self): """ EnableBgp Flag """ return self._enable_bgp @enable_bgp.setter def enable_bgp(self, value): self._enable_bgp = value @property def gateway_size(self): """ The size of this virtual network gateway. """ return self._gateway_size @gateway_size.setter def gateway_size(self, value): self._gateway_size = value @property def gateway_type(self): """ The type of this virtual network gateway. """ return self._gateway_type @gateway_type.setter def gateway_type(self, value): self._gateway_type = value @property def ip_configurations(self): """ IpConfigurations for Virtual network gateway. """ return self._ip_configurations @ip_configurations.setter def ip_configurations(self, value): self._ip_configurations = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the VirtualNetworkGateway resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class VirtualNetworkGatewayGetResponse(AzureOperationResponse): """ Response for GetVitualNetworkgateway Api servive call. """ def __init__(self, **kwargs): super(VirtualNetworkGatewayGetResponse, self).__init__(**kwargs) self._virtual_network_gateway = kwargs.get('virtual_network_gateway') @property def virtual_network_gateway(self): """ Gets virtual network gateway details that exists in a resource group """ return self._virtual_network_gateway @virtual_network_gateway.setter def virtual_network_gateway(self, value): self._virtual_network_gateway = value class VirtualNetworkGatewayListResponse(AzureOperationResponse): """ Response for ListVirtualNetworkGateways Api service call """ def __init__(self, **kwargs): super(VirtualNetworkGatewayListResponse, self).__init__(**kwargs) self._virtual_network_gateways = kwargs.get('virtual_network_gateways') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def virtual_network_gateways(self): """ Gets List of VirtualNetworkGateways that exists in a resource group """ return self._virtual_network_gateways @virtual_network_gateways.setter def virtual_network_gateways(self, value): self._virtual_network_gateways = value class VirtualNetworkListResponse(AzureOperationResponse): """ Response for ListVirtualNetworks Api servive call """ def __init__(self, **kwargs): super(VirtualNetworkListResponse, self).__init__(**kwargs) self._virtual_networks = kwargs.get('virtual_networks') self._next_link = kwargs.get('next_link') @property def next_link(self): """ Gets the URL to get the next set of results. """ return self._next_link @next_link.setter def next_link(self, value): self._next_link = value @property def virtual_networks(self): """ Gets list of VirtualNetworks in a resource group """ return self._virtual_networks @virtual_networks.setter def virtual_networks(self, value): self._virtual_networks = value class VirtualNetworkGetResponse(AzureOperationResponse): """ Response for GetVirtualNetworks API service calls. """ def __init__(self, **kwargs): super(VirtualNetworkGetResponse, self).__init__(**kwargs) self._virtual_network = kwargs.get('virtual_network') @property def virtual_network(self): """ Gets a VirtualNetwork in a resource group """ return self._virtual_network @virtual_network.setter def virtual_network(self, value): self._virtual_network = value class VirtualNetworkPutResponse(UpdateOperationResponse): """ Response for PutVirtualNetworks API service calls. """ def __init__(self, **kwargs): super(VirtualNetworkPutResponse, self).__init__(**kwargs) self._virtual_network = kwargs.get('virtual_network') @property def virtual_network(self): """ Gets a VirtualNetwork in a resource group """ return self._virtual_network @virtual_network.setter def virtual_network(self, value): self._virtual_network = value class VirtualNetwork(TopLevelResource): """ Virtual Network resource """ def __init__(self, **kwargs): super(VirtualNetwork, self).__init__(**kwargs) self._address_space = kwargs.get('address_space') self._dhcp_options = kwargs.get('dhcp_options') self._subnets = kwargs.get('subnets') self._provisioning_state = kwargs.get('provisioning_state') @property def address_space(self): """ Gets or sets AddressSpace that contains an array of IP address ranges that can be used by subnets """ return self._address_space @address_space.setter def address_space(self, value): self._address_space = value @property def dhcp_options(self): """ Gets or sets DHCPOptions that contains an array of DNS servers available to VMs deployed in the virtual network """ return self._dhcp_options @dhcp_options.setter def dhcp_options(self, value): self._dhcp_options = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def subnets(self): """ Gets or sets List of subnets in a VirtualNetwork """ return self._subnets @subnets.setter def subnets(self, value): self._subnets = value class ResourceProperties(object): def __init__(self, **kwargs): self._provisioning_state = kwargs.get('provisioning_state') @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class ProvisioningState(object): """ Provisioning state of the resource """ updating = 'Updating' deleting = 'Deleting' failed = 'Failed' succeeded = 'Succeeded' class IpAllocationMethod(object): """ IP address allocation method """ static = 'Static' dynamic = 'Dynamic' class FrontendIpConfiguration(ChildResource): """ Frontend IP address of the load balancer """ def __init__(self, **kwargs): super(FrontendIpConfiguration, self).__init__(**kwargs) self._private_ip_address = kwargs.get('private_ip_address') self._private_ip_allocation_method = kwargs.get('private_ip_allocation_method') self._subnet = kwargs.get('subnet') self._public_ip_address = kwargs.get('public_ip_address') self._inbound_nat_rules = kwargs.get('inbound_nat_rules') self._load_balancing_rules = kwargs.get('load_balancing_rules') self._provisioning_state = kwargs.get('provisioning_state') @property def inbound_nat_rules(self): """ Read only.Inbound rules URIs that use this frontend IP """ return self._inbound_nat_rules @inbound_nat_rules.setter def inbound_nat_rules(self, value): self._inbound_nat_rules = value @property def load_balancing_rules(self): """ Gets Load Balancing rules URIs that use this frontend IP """ return self._load_balancing_rules @load_balancing_rules.setter def load_balancing_rules(self, value): self._load_balancing_rules = value @property def private_ip_address(self): """ Gets or sets the IP address of the Load Balancer.This is only specified if a specific private IP address shall be allocated from the subnet specified in subnetRef """ return self._private_ip_address @private_ip_address.setter def private_ip_address(self, value): self._private_ip_address = value @property def private_ip_allocation_method(self): """ Gets or sets PrivateIP allocation method (Static/Dynamic) """ return self._private_ip_allocation_method @private_ip_allocation_method.setter def private_ip_allocation_method(self, value): self._private_ip_allocation_method = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def public_ip_address(self): """ Gets or sets the reference of the PublicIP resource """ return self._public_ip_address @public_ip_address.setter def public_ip_address(self, value): self._public_ip_address = value @property def subnet(self): """ Gets or sets the reference of the subnet resource.A subnet from wher the load balancer gets its private frontend address """ return self._subnet @subnet.setter def subnet(self, value): self._subnet = value class TransportProtocol(object): """ Provisioning state of the resource """ udp = 'Udp' tcp = 'Tcp' class LoadDistribution(object): """ The load distribution policy """ default = 'Default' source_ip = 'SourceIP' source_ip_protocol = 'SourceIPProtocol' class NetworkInterfaceIpConfiguration(ChildResource): """ IPConfiguration in a NetworkInterface """ def __init__(self, **kwargs): super(NetworkInterfaceIpConfiguration, self).__init__(**kwargs) self._private_ip_address = kwargs.get('private_ip_address') self._private_ip_allocation_method = kwargs.get('private_ip_allocation_method') self._subnet = kwargs.get('subnet') self._public_ip_address = kwargs.get('public_ip_address') self._load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools') self._load_balancer_inbound_nat_rules = kwargs.get('load_balancer_inbound_nat_rules') self._provisioning_state = kwargs.get('provisioning_state') @property def load_balancer_backend_address_pools(self): """ Gets or sets the reference of LoadBalancerBackendAddressPool resource """ return self._load_balancer_backend_address_pools @load_balancer_backend_address_pools.setter def load_balancer_backend_address_pools(self, value): self._load_balancer_backend_address_pools = value @property def load_balancer_inbound_nat_rules(self): """ Gets or sets list of references of LoadBalancerInboundNatRules """ return self._load_balancer_inbound_nat_rules @load_balancer_inbound_nat_rules.setter def load_balancer_inbound_nat_rules(self, value): self._load_balancer_inbound_nat_rules = value @property def private_ip_address(self): """ Gets or sets the privateIPAddress of the Network Interface IP Configuration """ return self._private_ip_address @private_ip_address.setter def private_ip_address(self, value): self._private_ip_address = value @property def private_ip_allocation_method(self): """ Gets or sets PrivateIP allocation method (Static/Dynamic) """ return self._private_ip_allocation_method @private_ip_allocation_method.setter def private_ip_allocation_method(self, value): self._private_ip_allocation_method = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def public_ip_address(self): """ Gets or sets the reference of the PublicIP resource """ return self._public_ip_address @public_ip_address.setter def public_ip_address(self, value): self._public_ip_address = value @property def subnet(self): """ Gets or sets the reference of the subnet resource """ return self._subnet @subnet.setter def subnet(self, value): self._subnet = value class LoadBalancingRule(ChildResource): """ Rules of the load balancer """ def __init__(self, **kwargs): super(LoadBalancingRule, self).__init__(**kwargs) self._frontend_ip_configuration = kwargs.get('frontend_ip_configuration') self._backend_address_pool = kwargs.get('backend_address_pool') self._probe = kwargs.get('probe') self._protocol = kwargs.get('protocol') self._load_distribution = kwargs.get('load_distribution') self._frontend_port = kwargs.get('frontend_port') self._backend_port = kwargs.get('backend_port') self._idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes') self._enable_floating_ip = kwargs.get('enable_floating_ip') self._provisioning_state = kwargs.get('provisioning_state') @property def backend_address_pool(self): """ Gets or sets a reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs """ return self._backend_address_pool @backend_address_pool.setter def backend_address_pool(self, value): self._backend_address_pool = value @property def backend_port(self): """ Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal compotnent on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API """ return self._backend_port @backend_port.setter def backend_port(self, value): self._backend_port = value @property def enable_floating_ip(self): """ Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint """ return self._enable_floating_ip @enable_floating_ip.setter def enable_floating_ip(self, value): self._enable_floating_ip = value @property def frontend_ip_configuration(self): """ Gets or sets a reference to frontend IP Addresses """ return self._frontend_ip_configuration @frontend_ip_configuration.setter def frontend_ip_configuration(self, value): self._frontend_ip_configuration = value @property def frontend_port(self): """ Gets or sets the port for the external endpoint. You can specify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive """ return self._frontend_port @frontend_port.setter def frontend_port(self, value): self._frontend_port = value @property def idle_timeout_in_minutes(self): """ Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This emlement is only used when the protocol is set to Tcp """ return self._idle_timeout_in_minutes @idle_timeout_in_minutes.setter def idle_timeout_in_minutes(self, value): self._idle_timeout_in_minutes = value @property def load_distribution(self): """ Gets or sets the load distribution policy for this rule """ return self._load_distribution @load_distribution.setter def load_distribution(self, value): self._load_distribution = value @property def probe(self): """ Gets or sets the reference of the load balancer probe used by the Load Balancing rule. """ return self._probe @probe.setter def probe(self, value): self._probe = value @property def protocol(self): """ Gets or sets the transport protocol for the external endpoint. Possible values are Udp or Tcp """ return self._protocol @protocol.setter def protocol(self, value): self._protocol = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class BackendAddressPool(ChildResource): """ Pool of backend IP addresseses """ def __init__(self, **kwargs): super(BackendAddressPool, self).__init__(**kwargs) self._backend_ip_configurations = kwargs.get('backend_ip_configurations') self._load_balancing_rules = kwargs.get('load_balancing_rules') self._provisioning_state = kwargs.get('provisioning_state') @property def backend_ip_configurations(self): """ Gets collection of references to IPs defined in NICs """ return self._backend_ip_configurations @backend_ip_configurations.setter def backend_ip_configurations(self, value): self._backend_ip_configurations = value @property def load_balancing_rules(self): """ Gets Load Balancing rules that use this Backend Address Pool """ return self._load_balancing_rules @load_balancing_rules.setter def load_balancing_rules(self, value): self._load_balancing_rules = value @property def provisioning_state(self): """ Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class ProbeProtocol(object): """ Protocol for load balancer probe """ http = 'Http' tcp = 'Tcp' class Probe(ChildResource): """ Load balancer Probe """ def __init__(self, **kwargs): super(Probe, self).__init__(**kwargs) self._load_balancing_rules = kwargs.get('load_balancing_rules') self._protocol = kwargs.get('protocol') self._port = kwargs.get('port') self._interval_in_seconds = kwargs.get('interval_in_seconds') self._number_of_probes = kwargs.get('number_of_probes') self._request_path = kwargs.get('request_path') self._provisioning_state = kwargs.get('provisioning_state') @property def interval_in_seconds(self): """ Gets or sets the interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5 """ return self._interval_in_seconds @interval_in_seconds.setter def interval_in_seconds(self, value): self._interval_in_seconds = value @property def load_balancing_rules(self): """ Gets Load balancer rules that use this probe """ return self._load_balancing_rules @load_balancing_rules.setter def load_balancing_rules(self, value): self._load_balancing_rules = value @property def number_of_probes(self): """ Gets or sets the number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endponints to be taken out of rotation faster or slower than the typical times used in Azure. """ return self._number_of_probes @number_of_probes.setter def number_of_probes(self, value): self._number_of_probes = value @property def port(self): """ Gets or sets Port for communicating the probe. Possible values range from 1 to 65535, inclusive. """ return self._port @port.setter def port(self, value): self._port = value @property def protocol(self): """ Gets or sets the protocol of the end point. Possible values are http pr Tcp. If Tcp is specified, a received ACK is required for the probe to be successful. If http is specified,a 200 OK response from the specifies URI is required for the probe to be successful """ return self._protocol @protocol.setter def protocol(self, value): self._protocol = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def request_path(self): """ Gets or sets the URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value """ return self._request_path @request_path.setter def request_path(self, value): self._request_path = value class InboundNatRule(ChildResource): """ Inbound NAT rule of the loadbalancer """ def __init__(self, **kwargs): super(InboundNatRule, self).__init__(**kwargs) self._frontend_ip_configuration = kwargs.get('frontend_ip_configuration') self._backend_ip_configuration = kwargs.get('backend_ip_configuration') self._protocol = kwargs.get('protocol') self._frontend_port = kwargs.get('frontend_port') self._backend_port = kwargs.get('backend_port') self._idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes') self._enable_floating_ip = kwargs.get('enable_floating_ip') self._provisioning_state = kwargs.get('provisioning_state') @property def backend_ip_configuration(self): """ Gets or sets a reference to a private ip address defined on a NetworkInterface of a VM. Traffic sent to frontendPort of each of the frontendIPConfigurations is forwarded to the backed IP """ return self._backend_ip_configuration @backend_ip_configuration.setter def backend_ip_configuration(self, value): self._backend_ip_configuration = value @property def backend_port(self): """ Gets or sets a port used for internal connections on the endpoint. The localPort attribute maps the eternal port of the endpoint to an internal port on a role. This is useful in scenarios where a role must communicate to an internal compotnent on a port that is different from the one that is exposed externally. If not specified, the value of localPort is the same as the port attribute. Set the value of localPort to '*' to automatically assign an unallocated port that is discoverable using the runtime API """ return self._backend_port @backend_port.setter def backend_port(self, value): self._backend_port = value @property def enable_floating_ip(self): """ Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn availability Group. This setting is required when using the SQL Always ON availability Groups in SQL server. This setting can't be changed after you create the endpoint """ return self._enable_floating_ip @enable_floating_ip.setter def enable_floating_ip(self, value): self._enable_floating_ip = value @property def frontend_ip_configuration(self): """ Gets or sets a reference to frontend IP Addresses """ return self._frontend_ip_configuration @frontend_ip_configuration.setter def frontend_ip_configuration(self, value): self._frontend_ip_configuration = value @property def frontend_port(self): """ Gets or sets the port for the external endpoint. You can spcify any port number you choose, but the port numbers specified for each role in the service must be unique. Possible values range between 1 and 65535, inclusive """ return self._frontend_port @frontend_port.setter def frontend_port(self, value): self._frontend_port = value @property def idle_timeout_in_minutes(self): """ Gets or sets the timeout for the Tcp idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This emlement is only used when the protocol is set to Tcp """ return self._idle_timeout_in_minutes @idle_timeout_in_minutes.setter def idle_timeout_in_minutes(self, value): self._idle_timeout_in_minutes = value @property def protocol(self): """ Gets or sets the transport potocol for the external endpoint. Possible values are Udp or Tcp """ return self._protocol @protocol.setter def protocol(self, value): self._protocol = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value class VirtualNetworkGatewayIpConfiguration(ChildResource): """ IpConfiguration for Virtual network gateway """ def __init__(self, **kwargs): super(VirtualNetworkGatewayIpConfiguration, self).__init__(**kwargs) self._private_ip_address = kwargs.get('private_ip_address') self._private_ip_allocation_method = kwargs.get('private_ip_allocation_method') self._subnet = kwargs.get('subnet') self._public_ip_address = kwargs.get('public_ip_address') self._provisioning_state = kwargs.get('provisioning_state') @property def private_ip_address(self): """ Gets or sets the privateIPAddress of the Network Interface IP Configuration """ return self._private_ip_address @private_ip_address.setter def private_ip_address(self, value): self._private_ip_address = value @property def private_ip_allocation_method(self): """ Gets or sets PrivateIP allocation method (Static/Dynamic) """ return self._private_ip_allocation_method @private_ip_allocation_method.setter def private_ip_allocation_method(self, value): self._private_ip_allocation_method = value @property def provisioning_state(self): """ Gets or sets Provisioning state of the PublicIP resource Updating/Deleting/Failed """ return self._provisioning_state @provisioning_state.setter def provisioning_state(self, value): self._provisioning_state = value @property def public_ip_address(self): """ Gets or sets the reference of the PublicIP resource """ return self._public_ip_address @public_ip_address.setter def public_ip_address(self, value): self._public_ip_address = value @property def subnet(self): """ Gets or sets the reference of the subnet resource """ return self._subnet @subnet.setter def subnet(self, value): self._subnet = value class SecurityRuleProtocol(object): """ Protocol for network security rule """ tcp = 'Tcp' udp = 'Udp' all = '*' class SecurityRuleAccess(object): """ Access for network security rule """ allow = 'Allow' deny = 'Deny' class SecurityRuleDirection(object): """ Dircetion of network security rule """ inbound = 'Inbound' outbound = 'Outbound' class VirtualNetworkGatewayConnectionType(object): """ The different connection types that a virtual network gateway can have. """ ipsec = 'IPsec' vnet2_vnet = 'Vnet2Vnet' dedicated = 'Dedicated' vpn_client = 'VPNClient' class VirtualNetworkGatewaySize(object): """ The different SKUs that a gateway can have. """ default = 'Default' high_performance = 'HighPerformance' class VpnGatewayType(object): static_routing = 'StaticRouting' dynamic_routing = 'DynamicRouting' class Error(object): def __init__(self, **kwargs): self._code = kwargs.get('code') self._message = kwargs.get('message') self._target = kwargs.get('target') self._details = kwargs.get('details') self._inner_error = kwargs.get('inner_error') @property def code(self): return self._code @code.setter def code(self, value): self._code = value @property def details(self): return self._details @details.setter def details(self, value): self._details = value @property def inner_error(self): return self._inner_error @inner_error.setter def inner_error(self, value): self._inner_error = value @property def message(self): return self._message @message.setter def message(self, value): self._message = value @property def target(self): return self._target @target.setter def target(self, value): self._target = value class ErrorDetails(object): def __init__(self, **kwargs): self._code = kwargs.get('code') self._target = kwargs.get('target') self._message = kwargs.get('message') @property def code(self): return self._code @code.setter def code(self, value): self._code = value @property def message(self): return self._message @message.setter def message(self, value): self._message = value @property def target(self): return self._target @target.setter def target(self, value): self._target = value class OperationStatus(object): """ The status of the asynchronous request. """ in_progress = 'InProgress' succeeded = 'Succeeded' failed = 'Failed' class AddressSpace(object): """ AddressSpace contains an array of IP address ranges that can be used by subnets """ def __init__(self, **kwargs): self._address_prefixes = kwargs.get('address_prefixes') @property def address_prefixes(self): """ Gets or sets List of address blocks reserved for this virtual network in CIDR notation """ return self._address_prefixes @address_prefixes.setter def address_prefixes(self, value): self._address_prefixes = value class DnsSettings(object): """ Dns Settings of a resource """ def __init__(self, **kwargs): self._dns_servers = kwargs.get('dns_servers') self._applied_dns_servers = kwargs.get('applied_dns_servers') @property def applied_dns_servers(self): """ Gets or sets list of Applied DNS servers IP addresses """ return self._applied_dns_servers @applied_dns_servers.setter def applied_dns_servers(self, value): self._applied_dns_servers = value @property def dns_servers(self): """ Gets or sets list of DNS servers IP addresses """ return self._dns_servers @dns_servers.setter def dns_servers(self, value): self._dns_servers = value class PublicIpAddressDnsSettings(object): """ Contains FQDN of the DNS record associated with the public IP address """ def __init__(self, **kwargs): self._domain_name_label = kwargs.get('domain_name_label') self._fqdn = kwargs.get('fqdn') self._reverse_fqdn = kwargs.get('reverse_fqdn') @property def domain_name_label(self): """ Gets or sets the Domain name label.The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. """ return self._domain_name_label @domain_name_label.setter def domain_name_label(self, value): self._domain_name_label = value @property def fqdn(self): """ Gets the FQDN, Fully qualified domain name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone. """ return self._fqdn @fqdn.setter def fqdn(self, value): self._fqdn = value @property def reverse_fqdn(self): """ Gets or Sests the Reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. """ return self._reverse_fqdn @reverse_fqdn.setter def reverse_fqdn(self, value): self._reverse_fqdn = value class Usage(object): """ Describes Network Resource Usage. """ def __init__(self, **kwargs): self._unit = kwargs.get('unit') self._current_value = kwargs.get('current_value') self._limit = kwargs.get('limit') self._name = kwargs.get('name') @property def current_value(self): """ Gets or sets the current value of the usage. """ return self._current_value @current_value.setter def current_value(self, value): self._current_value = value @property def limit(self): """ Gets or sets the limit of usage. """ return self._limit @limit.setter def limit(self, value): self._limit = value @property def name(self): """ Gets or sets the name of the type of usage. """ return self._name @name.setter def name(self, value): self._name = value @property def unit(self): """ Gets or sets an enum describing the unit of measurement. """ return self._unit @unit.setter def unit(self, value): self._unit = value class UsageUnit(object): """ The usage unit. """ count = 'Count' class UsageName(object): """ The Usage Names. """ def __init__(self, **kwargs): self._value = kwargs.get('value') self._localized_value = kwargs.get('localized_value') @property def localized_value(self): """ Gets or sets a localized string describing the resource name. """ return self._localized_value @localized_value.setter def localized_value(self, value): self._localized_value = value @property def value(self): """ Gets or sets a string describing the resource name. """ return self._value @value.setter def value(self, value): self._value = value class DhcpOptions(object): """ DHCPOptions contains an array of DNS servers available to VMs deployed in the virtual networkStandard DHCP option for a subnet overrides VNET DHCP options. """ def __init__(self, **kwargs): self._dns_servers = kwargs.get('dns_servers') @property def dns_servers(self): """ Gets or sets list of DNS servers IP addresses """ return self._dns_servers @dns_servers.setter def dns_servers(self, value): self._dns_servers = value class NetworkResourceProviderClient(Service): """ The Windows Azure Network management API provides a RESTful set of web services that interact with Windows Azure Networks service to manage your network resrources. The API has entities that capture the relationship between an end user and the Windows Azure Networks service. """ @property def api_version(self): """ Gets the API version. """ return self._api_version @property def long_running_operation_initial_timeout(self): """ Gets or sets the initial timeout for Long Running Operations. """ return self._long_running_operation_initial_timeout @long_running_operation_initial_timeout.setter def long_running_operation_initial_timeout(self, value): self._long_running_operation_initial_timeout = value @property def long_running_operation_retry_timeout(self): """ Gets or sets the retry timeout for Long Running Operations. """ return self._long_running_operation_retry_timeout @long_running_operation_retry_timeout.setter def long_running_operation_retry_timeout(self, value): self._long_running_operation_retry_timeout = value @property def load_balancers(self): """ The Network Resource Provider API includes operations for managing the load balancers for your subscription. """ return self._load_balancers @property def local_network_gateways(self): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. """ return self._local_network_gateways @property def network_interfaces(self): """ The Network Resource Provider API includes operations for managing the subnets for your subscription. """ return self._network_interfaces @property def network_security_groups(self): """ The Network Resource Provider API includes operations for managing the NetworkSecurityGroups for your subscription. """ return self._network_security_groups @property def public_ip_addresses(self): """ The Network Resource Provider API includes operations for managing the PublicIPAddress for your subscription. """ return self._public_ip_addresses @property def security_rules(self): """ The Network Resource Provider API includes operations for managing the SecurityRules for your subscription. """ return self._security_rules @property def subnets(self): """ The Network Resource Provider API includes operations for managing the subnets for your subscription. """ return self._subnets @property def usages(self): """ Operations for listing usage. """ return self._usages @property def virtual_network_gateway_connections(self): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. """ return self._virtual_network_gateway_connections @property def virtual_network_gateways(self): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. """ return self._virtual_network_gateways @property def virtual_networks(self): """ The Network Resource Provider API includes operations for managing the Virtual Networks for your subscription. """ return self._virtual_networks def __init__(self, credentials, **kwargs): super(NetworkResourceProviderClient, self).__init__(credentials, **kwargs) if getattr(self, '_base_uri', None) is None: self._base_uri = 'https://management.azure.com/' if getattr(self, '_api_version', None) is None: self._api_version = '2015-05-01-preview' if getattr(self, '_long_running_operation_initial_timeout', None) is None: self._long_running_operation_initial_timeout = -1 if getattr(self, '_long_running_operation_retry_timeout', None) is None: self._long_running_operation_retry_timeout = -1 self._load_balancers = LoadBalancerOperations(self) self._local_network_gateways = LocalNetworkGatewayOperations(self) self._network_interfaces = NetworkInterfaceOperations(self) self._network_security_groups = NetworkSecurityGroupOperations(self) self._public_ip_addresses = PublicIpAddressOperations(self) self._security_rules = SecurityRuleOperations(self) self._subnets = SubnetOperations(self) self._usages = UsageOperations(self) self._virtual_network_gateway_connections = VirtualNetworkGatewayConnectionOperations(self) self._virtual_network_gateways = VirtualNetworkGatewayOperations(self) self._virtual_networks = VirtualNetworkOperations(self) def check_dns_name_availability(self, location, domain_name_label): """ Checks whether a domain name in the cloudapp.net zone is available for use. Args: location (string): The location of the domain name domain_name_label (string): The domain name to be verified. It must conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. Returns: DnsNameAvailabilityResponse: Response for CheckDnsNameAvailability Api servive call """ # Validate if location is None: raise ValueError('location cannot be None.') if domain_name_label is None: raise ValueError('domain_name_label cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.credentials.subscription_id is not None: url = url + quote(self.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/locations/' url = url + quote(location) url = url + '/CheckDnsNameAvailability' query_parameters = [] query_parameters.append('domainNameLabel=' + quote(domain_name_label)) query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = DnsNameAvailabilityResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: available_value = response_doc.get('available', None) if available_value is not None: available_instance = available_value result.dns_name_availability = available_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def get_long_running_operation_status(self, azure_async_operation): """ The Get Operation Status operation returns the status of the specified operation. After calling an asynchronous operation, you can call Get Operation Status to determine whether the operation has succeeded, failed, or is still in progress. Args: azure_async_operation (string): Location value returned by the Begin operation. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ # Validate if azure_async_operation is None: raise ValueError('azure_async_operation cannot be None.') # Tracing # Construct URL url = '' url = url + azure_async_operation url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['x-ms-version'] = '2015-05-01-preview' # Send Request response = self.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 202: response_content = body result = AzureAsyncOperationResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: status_value = response_doc.get('status', None) if status_value is not None: status_instance = status_value result.status = status_instance error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class LoadBalancerOperations(object): """ The Network Resource Provider API includes operations for managing the load balancers for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, load_balancer_name, parameters): """ The Put LoadBalancer operation creates/updates a LoadBalancer Args: resource_group_name (string): The name of the resource group. load_balancer_name (string): The name of the loadBalancer. parameters (LoadBalancer): Parameters supplied to the create/delete LoadBalancer operation Returns: LoadBalancerPutResponse: Response of a PUT Load Balancer operation """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if load_balancer_name is None: raise ValueError('load_balancer_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.inbound_nat_rules is not None: for inbound_nat_rules_parameter_item in parameters.inbound_nat_rules: if inbound_nat_rules_parameter_item.enable_floating_ip is None: raise ValueError('parameters.inbound_nat_rules.enable_floating_ip cannot be None.') if inbound_nat_rules_parameter_item.frontend_port is None: raise ValueError('parameters.inbound_nat_rules.frontend_port cannot be None.') if inbound_nat_rules_parameter_item.protocol is None: raise ValueError('parameters.inbound_nat_rules.protocol cannot be None.') if parameters.load_balancing_rules is not None: for load_balancing_rules_parameter_item in parameters.load_balancing_rules: if load_balancing_rules_parameter_item.backend_address_pool is None: raise ValueError('parameters.load_balancing_rules.backend_address_pool cannot be None.') if load_balancing_rules_parameter_item.enable_floating_ip is None: raise ValueError('parameters.load_balancing_rules.enable_floating_ip cannot be None.') if load_balancing_rules_parameter_item.frontend_port is None: raise ValueError('parameters.load_balancing_rules.frontend_port cannot be None.') if load_balancing_rules_parameter_item.protocol is None: raise ValueError('parameters.load_balancing_rules.protocol cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') if parameters.probes is not None: for probes_parameter_item in parameters.probes: if probes_parameter_item.port is None: raise ValueError('parameters.probes.port cannot be None.') if probes_parameter_item.protocol is None: raise ValueError('parameters.probes.protocol cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/loadBalancers/' url = url + quote(load_balancer_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None load_balancer_json_format_value = {} request_doc = load_balancer_json_format_value properties_value = {} load_balancer_json_format_value['properties'] = properties_value if parameters.frontend_ip_configurations is not None: frontend_ip_configurations_array = [] for frontend_ip_configurations_item in parameters.frontend_ip_configurations: frontend_ip_configuration_json_format_value = {} frontend_ip_configurations_array.append(frontend_ip_configuration_json_format_value) properties_value2 = {} frontend_ip_configuration_json_format_value['properties'] = properties_value2 if frontend_ip_configurations_item.private_ip_address is not None: properties_value2['privateIPAddress'] = frontend_ip_configurations_item.private_ip_address if frontend_ip_configurations_item.private_ip_allocation_method is not None: properties_value2['privateIPAllocationMethod'] = frontend_ip_configurations_item.private_ip_allocation_method if frontend_ip_configurations_item.subnet is not None: subnet_value = {} properties_value2['subnet'] = subnet_value if frontend_ip_configurations_item.subnet.id is not None: subnet_value['id'] = frontend_ip_configurations_item.subnet.id if frontend_ip_configurations_item.public_ip_address is not None: public_ip_address_value = {} properties_value2['publicIPAddress'] = public_ip_address_value if frontend_ip_configurations_item.public_ip_address.id is not None: public_ip_address_value['id'] = frontend_ip_configurations_item.public_ip_address.id if frontend_ip_configurations_item.inbound_nat_rules is not None: inbound_nat_rules_array = [] for inbound_nat_rules_item in frontend_ip_configurations_item.inbound_nat_rules: resource_id_value = {} inbound_nat_rules_array.append(resource_id_value) if inbound_nat_rules_item.id is not None: resource_id_value['id'] = inbound_nat_rules_item.id properties_value2['inboundNatRules'] = inbound_nat_rules_array if frontend_ip_configurations_item.load_balancing_rules is not None: load_balancing_rules_array = [] for load_balancing_rules_item in frontend_ip_configurations_item.load_balancing_rules: resource_id_value2 = {} load_balancing_rules_array.append(resource_id_value2) if load_balancing_rules_item.id is not None: resource_id_value2['id'] = load_balancing_rules_item.id properties_value2['loadBalancingRules'] = load_balancing_rules_array if frontend_ip_configurations_item.provisioning_state is not None: properties_value2['provisioningState'] = frontend_ip_configurations_item.provisioning_state if frontend_ip_configurations_item.name is not None: frontend_ip_configuration_json_format_value['name'] = frontend_ip_configurations_item.name if frontend_ip_configurations_item.etag is not None: frontend_ip_configuration_json_format_value['etag'] = frontend_ip_configurations_item.etag if frontend_ip_configurations_item.id is not None: frontend_ip_configuration_json_format_value['id'] = frontend_ip_configurations_item.id properties_value['frontendIPConfigurations'] = frontend_ip_configurations_array if parameters.backend_address_pools is not None: backend_address_pools_array = [] for backend_address_pools_item in parameters.backend_address_pools: backend_address_pool_json_format_value = {} backend_address_pools_array.append(backend_address_pool_json_format_value) properties_value3 = {} backend_address_pool_json_format_value['properties'] = properties_value3 if backend_address_pools_item.backend_ip_configurations is not None: backend_ip_configurations_array = [] for backend_ip_configurations_item in backend_address_pools_item.backend_ip_configurations: resource_id_value3 = {} backend_ip_configurations_array.append(resource_id_value3) if backend_ip_configurations_item.id is not None: resource_id_value3['id'] = backend_ip_configurations_item.id properties_value3['backendIPConfigurations'] = backend_ip_configurations_array if backend_address_pools_item.load_balancing_rules is not None: load_balancing_rules_array2 = [] for load_balancing_rules_item2 in backend_address_pools_item.load_balancing_rules: resource_id_value4 = {} load_balancing_rules_array2.append(resource_id_value4) if load_balancing_rules_item2.id is not None: resource_id_value4['id'] = load_balancing_rules_item2.id properties_value3['loadBalancingRules'] = load_balancing_rules_array2 if backend_address_pools_item.provisioning_state is not None: properties_value3['provisioningState'] = backend_address_pools_item.provisioning_state if backend_address_pools_item.name is not None: backend_address_pool_json_format_value['name'] = backend_address_pools_item.name if backend_address_pools_item.etag is not None: backend_address_pool_json_format_value['etag'] = backend_address_pools_item.etag if backend_address_pools_item.id is not None: backend_address_pool_json_format_value['id'] = backend_address_pools_item.id properties_value['backendAddressPools'] = backend_address_pools_array if parameters.load_balancing_rules is not None: load_balancing_rules_array3 = [] for load_balancing_rules_item3 in parameters.load_balancing_rules: load_balancing_rule_json_format_value = {} load_balancing_rules_array3.append(load_balancing_rule_json_format_value) properties_value4 = {} load_balancing_rule_json_format_value['properties'] = properties_value4 if load_balancing_rules_item3.frontend_ip_configuration is not None: frontend_ip_configuration_value = {} properties_value4['frontendIPConfiguration'] = frontend_ip_configuration_value if load_balancing_rules_item3.frontend_ip_configuration.id is not None: frontend_ip_configuration_value['id'] = load_balancing_rules_item3.frontend_ip_configuration.id backend_address_pool_value = {} properties_value4['backendAddressPool'] = backend_address_pool_value if load_balancing_rules_item3.backend_address_pool.id is not None: backend_address_pool_value['id'] = load_balancing_rules_item3.backend_address_pool.id if load_balancing_rules_item3.probe is not None: probe_value = {} properties_value4['probe'] = probe_value if load_balancing_rules_item3.probe.id is not None: probe_value['id'] = load_balancing_rules_item3.probe.id properties_value4['protocol'] = load_balancing_rules_item3.protocol if load_balancing_rules_item3.load_distribution is not None: properties_value4['loadDistribution'] = load_balancing_rules_item3.load_distribution properties_value4['frontendPort'] = load_balancing_rules_item3.frontend_port if load_balancing_rules_item3.backend_port is not None: properties_value4['backendPort'] = load_balancing_rules_item3.backend_port if load_balancing_rules_item3.idle_timeout_in_minutes is not None: properties_value4['idleTimeoutInMinutes'] = load_balancing_rules_item3.idle_timeout_in_minutes properties_value4['enableFloatingIP'] = load_balancing_rules_item3.enable_floating_ip if load_balancing_rules_item3.provisioning_state is not None: properties_value4['provisioningState'] = load_balancing_rules_item3.provisioning_state if load_balancing_rules_item3.name is not None: load_balancing_rule_json_format_value['name'] = load_balancing_rules_item3.name if load_balancing_rules_item3.etag is not None: load_balancing_rule_json_format_value['etag'] = load_balancing_rules_item3.etag if load_balancing_rules_item3.id is not None: load_balancing_rule_json_format_value['id'] = load_balancing_rules_item3.id properties_value['loadBalancingRules'] = load_balancing_rules_array3 if parameters.probes is not None: probes_array = [] for probes_item in parameters.probes: probe_json_format_value = {} probes_array.append(probe_json_format_value) properties_value5 = {} probe_json_format_value['properties'] = properties_value5 if probes_item.load_balancing_rules is not None: load_balancing_rules_array4 = [] for load_balancing_rules_item4 in probes_item.load_balancing_rules: resource_id_value5 = {} load_balancing_rules_array4.append(resource_id_value5) if load_balancing_rules_item4.id is not None: resource_id_value5['id'] = load_balancing_rules_item4.id properties_value5['loadBalancingRules'] = load_balancing_rules_array4 properties_value5['protocol'] = probes_item.protocol properties_value5['port'] = probes_item.port if probes_item.interval_in_seconds is not None: properties_value5['intervalInSeconds'] = probes_item.interval_in_seconds if probes_item.number_of_probes is not None: properties_value5['numberOfProbes'] = probes_item.number_of_probes if probes_item.request_path is not None: properties_value5['requestPath'] = probes_item.request_path if probes_item.provisioning_state is not None: properties_value5['provisioningState'] = probes_item.provisioning_state if probes_item.name is not None: probe_json_format_value['name'] = probes_item.name if probes_item.etag is not None: probe_json_format_value['etag'] = probes_item.etag if probes_item.id is not None: probe_json_format_value['id'] = probes_item.id properties_value['probes'] = probes_array if parameters.inbound_nat_rules is not None: inbound_nat_rules_array2 = [] for inbound_nat_rules_item2 in parameters.inbound_nat_rules: inbound_nat_rule_json_format_value = {} inbound_nat_rules_array2.append(inbound_nat_rule_json_format_value) properties_value6 = {} inbound_nat_rule_json_format_value['properties'] = properties_value6 if inbound_nat_rules_item2.frontend_ip_configuration is not None: frontend_ip_configuration_value2 = {} properties_value6['frontendIPConfiguration'] = frontend_ip_configuration_value2 if inbound_nat_rules_item2.frontend_ip_configuration.id is not None: frontend_ip_configuration_value2['id'] = inbound_nat_rules_item2.frontend_ip_configuration.id if inbound_nat_rules_item2.backend_ip_configuration is not None: backend_ip_configuration_value = {} properties_value6['backendIPConfiguration'] = backend_ip_configuration_value if inbound_nat_rules_item2.backend_ip_configuration.id is not None: backend_ip_configuration_value['id'] = inbound_nat_rules_item2.backend_ip_configuration.id properties_value6['protocol'] = inbound_nat_rules_item2.protocol properties_value6['frontendPort'] = inbound_nat_rules_item2.frontend_port if inbound_nat_rules_item2.backend_port is not None: properties_value6['backendPort'] = inbound_nat_rules_item2.backend_port if inbound_nat_rules_item2.idle_timeout_in_minutes is not None: properties_value6['idleTimeoutInMinutes'] = inbound_nat_rules_item2.idle_timeout_in_minutes properties_value6['enableFloatingIP'] = inbound_nat_rules_item2.enable_floating_ip if inbound_nat_rules_item2.provisioning_state is not None: properties_value6['provisioningState'] = inbound_nat_rules_item2.provisioning_state if inbound_nat_rules_item2.name is not None: inbound_nat_rule_json_format_value['name'] = inbound_nat_rules_item2.name if inbound_nat_rules_item2.etag is not None: inbound_nat_rule_json_format_value['etag'] = inbound_nat_rules_item2.etag if inbound_nat_rules_item2.id is not None: inbound_nat_rule_json_format_value['id'] = inbound_nat_rules_item2.id properties_value['inboundNatRules'] = inbound_nat_rules_array2 if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: load_balancer_json_format_value['etag'] = parameters.etag if parameters.id is not None: load_balancer_json_format_value['id'] = parameters.id if parameters.name is not None: load_balancer_json_format_value['name'] = parameters.name if parameters.type is not None: load_balancer_json_format_value['type'] = parameters.type load_balancer_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value load_balancer_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = LoadBalancerPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: load_balancer_instance = LoadBalancer(backend_address_pools=[], frontend_ip_configurations=[], inbound_nat_rules=[], load_balancing_rules=[], probes=[], tags={}) result.load_balancer = load_balancer_instance properties_value7 = response_doc.get('properties', None) if properties_value7 is not None: frontend_ip_configurations_array2 = properties_value7.get('frontendIPConfigurations', None) if frontend_ip_configurations_array2 is not None: for frontend_ip_configurations_value in frontend_ip_configurations_array2: frontend_ip_configuration_json_format_instance = FrontendIpConfiguration(inbound_nat_rules=[], load_balancing_rules=[]) load_balancer_instance.frontend_ip_configurations.append(frontend_ip_configuration_json_format_instance) properties_value8 = frontend_ip_configurations_value.get('properties', None) if properties_value8 is not None: private_ip_address_value = properties_value8.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value frontend_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value8.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value frontend_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value2 = properties_value8.get('subnet', None) if subnet_value2 is not None: subnet_instance = ResourceId() frontend_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value2.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value2 = properties_value8.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance = ResourceId() frontend_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value2.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 inbound_nat_rules_array3 = properties_value8.get('inboundNatRules', None) if inbound_nat_rules_array3 is not None: for inbound_nat_rules_value in inbound_nat_rules_array3: resource_id_instance = ResourceId() frontend_ip_configuration_json_format_instance.inbound_nat_rules.append(resource_id_instance) id_value3 = inbound_nat_rules_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 load_balancing_rules_array5 = properties_value8.get('loadBalancingRules', None) if load_balancing_rules_array5 is not None: for load_balancing_rules_value in load_balancing_rules_array5: resource_id_instance2 = ResourceId() frontend_ip_configuration_json_format_instance.load_balancing_rules.append(resource_id_instance2) id_value4 = load_balancing_rules_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value = properties_value8.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value frontend_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = frontend_ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value frontend_ip_configuration_json_format_instance.name = name_instance etag_value = frontend_ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value frontend_ip_configuration_json_format_instance.etag = etag_instance id_value5 = frontend_ip_configurations_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 frontend_ip_configuration_json_format_instance.id = id_instance5 backend_address_pools_array2 = properties_value7.get('backendAddressPools', None) if backend_address_pools_array2 is not None: for backend_address_pools_value in backend_address_pools_array2: backend_address_pool_json_format_instance = BackendAddressPool(backend_ip_configurations=[], load_balancing_rules=[]) load_balancer_instance.backend_address_pools.append(backend_address_pool_json_format_instance) properties_value9 = backend_address_pools_value.get('properties', None) if properties_value9 is not None: backend_ip_configurations_array2 = properties_value9.get('backendIPConfigurations', None) if backend_ip_configurations_array2 is not None: for backend_ip_configurations_value in backend_ip_configurations_array2: resource_id_instance3 = ResourceId() backend_address_pool_json_format_instance.backend_ip_configurations.append(resource_id_instance3) id_value6 = backend_ip_configurations_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance3.id = id_instance6 load_balancing_rules_array6 = properties_value9.get('loadBalancingRules', None) if load_balancing_rules_array6 is not None: for load_balancing_rules_value2 in load_balancing_rules_array6: resource_id_instance4 = ResourceId() backend_address_pool_json_format_instance.load_balancing_rules.append(resource_id_instance4) id_value7 = load_balancing_rules_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 resource_id_instance4.id = id_instance7 provisioning_state_value2 = properties_value9.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 backend_address_pool_json_format_instance.provisioning_state = provisioning_state_instance2 name_value2 = backend_address_pools_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 backend_address_pool_json_format_instance.name = name_instance2 etag_value2 = backend_address_pools_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 backend_address_pool_json_format_instance.etag = etag_instance2 id_value8 = backend_address_pools_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 backend_address_pool_json_format_instance.id = id_instance8 load_balancing_rules_array7 = properties_value7.get('loadBalancingRules', None) if load_balancing_rules_array7 is not None: for load_balancing_rules_value3 in load_balancing_rules_array7: load_balancing_rule_json_format_instance = LoadBalancingRule() load_balancer_instance.load_balancing_rules.append(load_balancing_rule_json_format_instance) properties_value10 = load_balancing_rules_value3.get('properties', None) if properties_value10 is not None: frontend_ip_configuration_value3 = properties_value10.get('frontendIPConfiguration', None) if frontend_ip_configuration_value3 is not None: frontend_ip_configuration_instance = ResourceId() load_balancing_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance id_value9 = frontend_ip_configuration_value3.get('id', None) if id_value9 is not None: id_instance9 = id_value9 frontend_ip_configuration_instance.id = id_instance9 backend_address_pool_value2 = properties_value10.get('backendAddressPool', None) if backend_address_pool_value2 is not None: backend_address_pool_instance = ResourceId() load_balancing_rule_json_format_instance.backend_address_pool = backend_address_pool_instance id_value10 = backend_address_pool_value2.get('id', None) if id_value10 is not None: id_instance10 = id_value10 backend_address_pool_instance.id = id_instance10 probe_value2 = properties_value10.get('probe', None) if probe_value2 is not None: probe_instance = ResourceId() load_balancing_rule_json_format_instance.probe = probe_instance id_value11 = probe_value2.get('id', None) if id_value11 is not None: id_instance11 = id_value11 probe_instance.id = id_instance11 protocol_value = properties_value10.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value load_balancing_rule_json_format_instance.protocol = protocol_instance load_distribution_value = properties_value10.get('loadDistribution', None) if load_distribution_value is not None: load_distribution_instance = load_distribution_value load_balancing_rule_json_format_instance.load_distribution = load_distribution_instance frontend_port_value = properties_value10.get('frontendPort', None) if frontend_port_value is not None: frontend_port_instance = frontend_port_value load_balancing_rule_json_format_instance.frontend_port = frontend_port_instance backend_port_value = properties_value10.get('backendPort', None) if backend_port_value is not None: backend_port_instance = backend_port_value load_balancing_rule_json_format_instance.backend_port = backend_port_instance idle_timeout_in_minutes_value = properties_value10.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value load_balancing_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance enable_floating_ip_value = properties_value10.get('enableFloatingIP', None) if enable_floating_ip_value is not None: enable_floating_ip_instance = enable_floating_ip_value load_balancing_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance provisioning_state_value3 = properties_value10.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 load_balancing_rule_json_format_instance.provisioning_state = provisioning_state_instance3 name_value3 = load_balancing_rules_value3.get('name', None) if name_value3 is not None: name_instance3 = name_value3 load_balancing_rule_json_format_instance.name = name_instance3 etag_value3 = load_balancing_rules_value3.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 load_balancing_rule_json_format_instance.etag = etag_instance3 id_value12 = load_balancing_rules_value3.get('id', None) if id_value12 is not None: id_instance12 = id_value12 load_balancing_rule_json_format_instance.id = id_instance12 probes_array2 = properties_value7.get('probes', None) if probes_array2 is not None: for probes_value in probes_array2: probe_json_format_instance = Probe(load_balancing_rules=[]) load_balancer_instance.probes.append(probe_json_format_instance) properties_value11 = probes_value.get('properties', None) if properties_value11 is not None: load_balancing_rules_array8 = properties_value11.get('loadBalancingRules', None) if load_balancing_rules_array8 is not None: for load_balancing_rules_value4 in load_balancing_rules_array8: resource_id_instance5 = ResourceId() probe_json_format_instance.load_balancing_rules.append(resource_id_instance5) id_value13 = load_balancing_rules_value4.get('id', None) if id_value13 is not None: id_instance13 = id_value13 resource_id_instance5.id = id_instance13 protocol_value2 = properties_value11.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 probe_json_format_instance.protocol = protocol_instance2 port_value = properties_value11.get('port', None) if port_value is not None: port_instance = port_value probe_json_format_instance.port = port_instance interval_in_seconds_value = properties_value11.get('intervalInSeconds', None) if interval_in_seconds_value is not None: interval_in_seconds_instance = interval_in_seconds_value probe_json_format_instance.interval_in_seconds = interval_in_seconds_instance number_of_probes_value = properties_value11.get('numberOfProbes', None) if number_of_probes_value is not None: number_of_probes_instance = number_of_probes_value probe_json_format_instance.number_of_probes = number_of_probes_instance request_path_value = properties_value11.get('requestPath', None) if request_path_value is not None: request_path_instance = request_path_value probe_json_format_instance.request_path = request_path_instance provisioning_state_value4 = properties_value11.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 probe_json_format_instance.provisioning_state = provisioning_state_instance4 name_value4 = probes_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 probe_json_format_instance.name = name_instance4 etag_value4 = probes_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 probe_json_format_instance.etag = etag_instance4 id_value14 = probes_value.get('id', None) if id_value14 is not None: id_instance14 = id_value14 probe_json_format_instance.id = id_instance14 inbound_nat_rules_array4 = properties_value7.get('inboundNatRules', None) if inbound_nat_rules_array4 is not None: for inbound_nat_rules_value2 in inbound_nat_rules_array4: inbound_nat_rule_json_format_instance = InboundNatRule() load_balancer_instance.inbound_nat_rules.append(inbound_nat_rule_json_format_instance) properties_value12 = inbound_nat_rules_value2.get('properties', None) if properties_value12 is not None: frontend_ip_configuration_value4 = properties_value12.get('frontendIPConfiguration', None) if frontend_ip_configuration_value4 is not None: frontend_ip_configuration_instance2 = ResourceId() inbound_nat_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance2 id_value15 = frontend_ip_configuration_value4.get('id', None) if id_value15 is not None: id_instance15 = id_value15 frontend_ip_configuration_instance2.id = id_instance15 backend_ip_configuration_value2 = properties_value12.get('backendIPConfiguration', None) if backend_ip_configuration_value2 is not None: backend_ip_configuration_instance = ResourceId() inbound_nat_rule_json_format_instance.backend_ip_configuration = backend_ip_configuration_instance id_value16 = backend_ip_configuration_value2.get('id', None) if id_value16 is not None: id_instance16 = id_value16 backend_ip_configuration_instance.id = id_instance16 protocol_value3 = properties_value12.get('protocol', None) if protocol_value3 is not None: protocol_instance3 = protocol_value3 inbound_nat_rule_json_format_instance.protocol = protocol_instance3 frontend_port_value2 = properties_value12.get('frontendPort', None) if frontend_port_value2 is not None: frontend_port_instance2 = frontend_port_value2 inbound_nat_rule_json_format_instance.frontend_port = frontend_port_instance2 backend_port_value2 = properties_value12.get('backendPort', None) if backend_port_value2 is not None: backend_port_instance2 = backend_port_value2 inbound_nat_rule_json_format_instance.backend_port = backend_port_instance2 idle_timeout_in_minutes_value2 = properties_value12.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value2 is not None: idle_timeout_in_minutes_instance2 = idle_timeout_in_minutes_value2 inbound_nat_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance2 enable_floating_ip_value2 = properties_value12.get('enableFloatingIP', None) if enable_floating_ip_value2 is not None: enable_floating_ip_instance2 = enable_floating_ip_value2 inbound_nat_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance2 provisioning_state_value5 = properties_value12.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 inbound_nat_rule_json_format_instance.provisioning_state = provisioning_state_instance5 name_value5 = inbound_nat_rules_value2.get('name', None) if name_value5 is not None: name_instance5 = name_value5 inbound_nat_rule_json_format_instance.name = name_instance5 etag_value5 = inbound_nat_rules_value2.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 inbound_nat_rule_json_format_instance.etag = etag_instance5 id_value17 = inbound_nat_rules_value2.get('id', None) if id_value17 is not None: id_instance17 = id_value17 inbound_nat_rule_json_format_instance.id = id_instance17 provisioning_state_value6 = properties_value7.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 load_balancer_instance.provisioning_state = provisioning_state_instance6 etag_value6 = response_doc.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 load_balancer_instance.etag = etag_instance6 id_value18 = response_doc.get('id', None) if id_value18 is not None: id_instance18 = id_value18 load_balancer_instance.id = id_instance18 name_value6 = response_doc.get('name', None) if name_value6 is not None: name_instance6 = name_value6 load_balancer_instance.name = name_instance6 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value load_balancer_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value load_balancer_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] load_balancer_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) return result def begin_deleting(self, resource_group_name, load_balancer_name): """ The delete loadbalancer operation deletes the specified loadbalancer. Args: resource_group_name (string): The name of the resource group. load_balancer_name (string): The name of the loadBalancer. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if load_balancer_name is None: raise ValueError('load_balancer_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/loadBalancers/' url = url + quote(load_balancer_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, load_balancer_name, parameters): """ The Put LoadBalancer operation creates/updates a LoadBalancer Args: resource_group_name (string): The name of the resource group. load_balancer_name (string): The name of the loadBalancer. parameters (LoadBalancer): Parameters supplied to the create/update LoadBalancer operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.load_balancers.begin_create_or_updating(resource_group_name, load_balancer_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, load_balancer_name): """ Args: resource_group_name (string): The name of the resource group. load_balancer_name (string): The name of the loadBalancer. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.load_balancers.begin_deleting(resource_group_name, load_balancer_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, load_balancer_name): """ The Get ntework interface operation retreives information about the specified network interface. Args: resource_group_name (string): The name of the resource group. load_balancer_name (string): The name of the loadBalancer. Returns: LoadBalancerGetResponse: Response of a GET Load Balancer operation """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if load_balancer_name is None: raise ValueError('load_balancer_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/loadBalancers/' url = url + quote(load_balancer_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = LoadBalancerGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: load_balancer_instance = LoadBalancer(backend_address_pools=[], frontend_ip_configurations=[], inbound_nat_rules=[], load_balancing_rules=[], probes=[], tags={}) result.load_balancer = load_balancer_instance properties_value = response_doc.get('properties', None) if properties_value is not None: frontend_ip_configurations_array = properties_value.get('frontendIPConfigurations', None) if frontend_ip_configurations_array is not None: for frontend_ip_configurations_value in frontend_ip_configurations_array: frontend_ip_configuration_json_format_instance = FrontendIpConfiguration(inbound_nat_rules=[], load_balancing_rules=[]) load_balancer_instance.frontend_ip_configurations.append(frontend_ip_configuration_json_format_instance) properties_value2 = frontend_ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value frontend_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value frontend_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() frontend_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() frontend_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 inbound_nat_rules_array = properties_value2.get('inboundNatRules', None) if inbound_nat_rules_array is not None: for inbound_nat_rules_value in inbound_nat_rules_array: resource_id_instance = ResourceId() frontend_ip_configuration_json_format_instance.inbound_nat_rules.append(resource_id_instance) id_value3 = inbound_nat_rules_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 load_balancing_rules_array = properties_value2.get('loadBalancingRules', None) if load_balancing_rules_array is not None: for load_balancing_rules_value in load_balancing_rules_array: resource_id_instance2 = ResourceId() frontend_ip_configuration_json_format_instance.load_balancing_rules.append(resource_id_instance2) id_value4 = load_balancing_rules_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value frontend_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = frontend_ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value frontend_ip_configuration_json_format_instance.name = name_instance etag_value = frontend_ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value frontend_ip_configuration_json_format_instance.etag = etag_instance id_value5 = frontend_ip_configurations_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 frontend_ip_configuration_json_format_instance.id = id_instance5 backend_address_pools_array = properties_value.get('backendAddressPools', None) if backend_address_pools_array is not None: for backend_address_pools_value in backend_address_pools_array: backend_address_pool_json_format_instance = BackendAddressPool(backend_ip_configurations=[], load_balancing_rules=[]) load_balancer_instance.backend_address_pools.append(backend_address_pool_json_format_instance) properties_value3 = backend_address_pools_value.get('properties', None) if properties_value3 is not None: backend_ip_configurations_array = properties_value3.get('backendIPConfigurations', None) if backend_ip_configurations_array is not None: for backend_ip_configurations_value in backend_ip_configurations_array: resource_id_instance3 = ResourceId() backend_address_pool_json_format_instance.backend_ip_configurations.append(resource_id_instance3) id_value6 = backend_ip_configurations_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance3.id = id_instance6 load_balancing_rules_array2 = properties_value3.get('loadBalancingRules', None) if load_balancing_rules_array2 is not None: for load_balancing_rules_value2 in load_balancing_rules_array2: resource_id_instance4 = ResourceId() backend_address_pool_json_format_instance.load_balancing_rules.append(resource_id_instance4) id_value7 = load_balancing_rules_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 resource_id_instance4.id = id_instance7 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 backend_address_pool_json_format_instance.provisioning_state = provisioning_state_instance2 name_value2 = backend_address_pools_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 backend_address_pool_json_format_instance.name = name_instance2 etag_value2 = backend_address_pools_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 backend_address_pool_json_format_instance.etag = etag_instance2 id_value8 = backend_address_pools_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 backend_address_pool_json_format_instance.id = id_instance8 load_balancing_rules_array3 = properties_value.get('loadBalancingRules', None) if load_balancing_rules_array3 is not None: for load_balancing_rules_value3 in load_balancing_rules_array3: load_balancing_rule_json_format_instance = LoadBalancingRule() load_balancer_instance.load_balancing_rules.append(load_balancing_rule_json_format_instance) properties_value4 = load_balancing_rules_value3.get('properties', None) if properties_value4 is not None: frontend_ip_configuration_value = properties_value4.get('frontendIPConfiguration', None) if frontend_ip_configuration_value is not None: frontend_ip_configuration_instance = ResourceId() load_balancing_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance id_value9 = frontend_ip_configuration_value.get('id', None) if id_value9 is not None: id_instance9 = id_value9 frontend_ip_configuration_instance.id = id_instance9 backend_address_pool_value = properties_value4.get('backendAddressPool', None) if backend_address_pool_value is not None: backend_address_pool_instance = ResourceId() load_balancing_rule_json_format_instance.backend_address_pool = backend_address_pool_instance id_value10 = backend_address_pool_value.get('id', None) if id_value10 is not None: id_instance10 = id_value10 backend_address_pool_instance.id = id_instance10 probe_value = properties_value4.get('probe', None) if probe_value is not None: probe_instance = ResourceId() load_balancing_rule_json_format_instance.probe = probe_instance id_value11 = probe_value.get('id', None) if id_value11 is not None: id_instance11 = id_value11 probe_instance.id = id_instance11 protocol_value = properties_value4.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value load_balancing_rule_json_format_instance.protocol = protocol_instance load_distribution_value = properties_value4.get('loadDistribution', None) if load_distribution_value is not None: load_distribution_instance = load_distribution_value load_balancing_rule_json_format_instance.load_distribution = load_distribution_instance frontend_port_value = properties_value4.get('frontendPort', None) if frontend_port_value is not None: frontend_port_instance = frontend_port_value load_balancing_rule_json_format_instance.frontend_port = frontend_port_instance backend_port_value = properties_value4.get('backendPort', None) if backend_port_value is not None: backend_port_instance = backend_port_value load_balancing_rule_json_format_instance.backend_port = backend_port_instance idle_timeout_in_minutes_value = properties_value4.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value load_balancing_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance enable_floating_ip_value = properties_value4.get('enableFloatingIP', None) if enable_floating_ip_value is not None: enable_floating_ip_instance = enable_floating_ip_value load_balancing_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance provisioning_state_value3 = properties_value4.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 load_balancing_rule_json_format_instance.provisioning_state = provisioning_state_instance3 name_value3 = load_balancing_rules_value3.get('name', None) if name_value3 is not None: name_instance3 = name_value3 load_balancing_rule_json_format_instance.name = name_instance3 etag_value3 = load_balancing_rules_value3.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 load_balancing_rule_json_format_instance.etag = etag_instance3 id_value12 = load_balancing_rules_value3.get('id', None) if id_value12 is not None: id_instance12 = id_value12 load_balancing_rule_json_format_instance.id = id_instance12 probes_array = properties_value.get('probes', None) if probes_array is not None: for probes_value in probes_array: probe_json_format_instance = Probe(load_balancing_rules=[]) load_balancer_instance.probes.append(probe_json_format_instance) properties_value5 = probes_value.get('properties', None) if properties_value5 is not None: load_balancing_rules_array4 = properties_value5.get('loadBalancingRules', None) if load_balancing_rules_array4 is not None: for load_balancing_rules_value4 in load_balancing_rules_array4: resource_id_instance5 = ResourceId() probe_json_format_instance.load_balancing_rules.append(resource_id_instance5) id_value13 = load_balancing_rules_value4.get('id', None) if id_value13 is not None: id_instance13 = id_value13 resource_id_instance5.id = id_instance13 protocol_value2 = properties_value5.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 probe_json_format_instance.protocol = protocol_instance2 port_value = properties_value5.get('port', None) if port_value is not None: port_instance = port_value probe_json_format_instance.port = port_instance interval_in_seconds_value = properties_value5.get('intervalInSeconds', None) if interval_in_seconds_value is not None: interval_in_seconds_instance = interval_in_seconds_value probe_json_format_instance.interval_in_seconds = interval_in_seconds_instance number_of_probes_value = properties_value5.get('numberOfProbes', None) if number_of_probes_value is not None: number_of_probes_instance = number_of_probes_value probe_json_format_instance.number_of_probes = number_of_probes_instance request_path_value = properties_value5.get('requestPath', None) if request_path_value is not None: request_path_instance = request_path_value probe_json_format_instance.request_path = request_path_instance provisioning_state_value4 = properties_value5.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 probe_json_format_instance.provisioning_state = provisioning_state_instance4 name_value4 = probes_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 probe_json_format_instance.name = name_instance4 etag_value4 = probes_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 probe_json_format_instance.etag = etag_instance4 id_value14 = probes_value.get('id', None) if id_value14 is not None: id_instance14 = id_value14 probe_json_format_instance.id = id_instance14 inbound_nat_rules_array2 = properties_value.get('inboundNatRules', None) if inbound_nat_rules_array2 is not None: for inbound_nat_rules_value2 in inbound_nat_rules_array2: inbound_nat_rule_json_format_instance = InboundNatRule() load_balancer_instance.inbound_nat_rules.append(inbound_nat_rule_json_format_instance) properties_value6 = inbound_nat_rules_value2.get('properties', None) if properties_value6 is not None: frontend_ip_configuration_value2 = properties_value6.get('frontendIPConfiguration', None) if frontend_ip_configuration_value2 is not None: frontend_ip_configuration_instance2 = ResourceId() inbound_nat_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance2 id_value15 = frontend_ip_configuration_value2.get('id', None) if id_value15 is not None: id_instance15 = id_value15 frontend_ip_configuration_instance2.id = id_instance15 backend_ip_configuration_value = properties_value6.get('backendIPConfiguration', None) if backend_ip_configuration_value is not None: backend_ip_configuration_instance = ResourceId() inbound_nat_rule_json_format_instance.backend_ip_configuration = backend_ip_configuration_instance id_value16 = backend_ip_configuration_value.get('id', None) if id_value16 is not None: id_instance16 = id_value16 backend_ip_configuration_instance.id = id_instance16 protocol_value3 = properties_value6.get('protocol', None) if protocol_value3 is not None: protocol_instance3 = protocol_value3 inbound_nat_rule_json_format_instance.protocol = protocol_instance3 frontend_port_value2 = properties_value6.get('frontendPort', None) if frontend_port_value2 is not None: frontend_port_instance2 = frontend_port_value2 inbound_nat_rule_json_format_instance.frontend_port = frontend_port_instance2 backend_port_value2 = properties_value6.get('backendPort', None) if backend_port_value2 is not None: backend_port_instance2 = backend_port_value2 inbound_nat_rule_json_format_instance.backend_port = backend_port_instance2 idle_timeout_in_minutes_value2 = properties_value6.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value2 is not None: idle_timeout_in_minutes_instance2 = idle_timeout_in_minutes_value2 inbound_nat_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance2 enable_floating_ip_value2 = properties_value6.get('enableFloatingIP', None) if enable_floating_ip_value2 is not None: enable_floating_ip_instance2 = enable_floating_ip_value2 inbound_nat_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance2 provisioning_state_value5 = properties_value6.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 inbound_nat_rule_json_format_instance.provisioning_state = provisioning_state_instance5 name_value5 = inbound_nat_rules_value2.get('name', None) if name_value5 is not None: name_instance5 = name_value5 inbound_nat_rule_json_format_instance.name = name_instance5 etag_value5 = inbound_nat_rules_value2.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 inbound_nat_rule_json_format_instance.etag = etag_instance5 id_value17 = inbound_nat_rules_value2.get('id', None) if id_value17 is not None: id_instance17 = id_value17 inbound_nat_rule_json_format_instance.id = id_instance17 provisioning_state_value6 = properties_value.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 load_balancer_instance.provisioning_state = provisioning_state_instance6 etag_value6 = response_doc.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 load_balancer_instance.etag = etag_instance6 id_value18 = response_doc.get('id', None) if id_value18 is not None: id_instance18 = id_value18 load_balancer_instance.id = id_instance18 name_value6 = response_doc.get('name', None) if name_value6 is not None: name_instance6 = name_value6 load_balancer_instance.name = name_instance6 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value load_balancer_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value load_balancer_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] load_balancer_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List loadBalancer opertion retrieves all the loadbalancers in a resource group. Args: resource_group_name (string): The name of the resource group. Returns: LoadBalancerListResponse: Response for ListLoadBalancers Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/loadBalancers' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = LoadBalancerListResponse(load_balancers=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: load_balancer_json_format_instance = LoadBalancer(backend_address_pools=[], frontend_ip_configurations=[], inbound_nat_rules=[], load_balancing_rules=[], probes=[], tags={}) result.load_balancers.append(load_balancer_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: frontend_ip_configurations_array = properties_value.get('frontendIPConfigurations', None) if frontend_ip_configurations_array is not None: for frontend_ip_configurations_value in frontend_ip_configurations_array: frontend_ip_configuration_json_format_instance = FrontendIpConfiguration(inbound_nat_rules=[], load_balancing_rules=[]) load_balancer_json_format_instance.frontend_ip_configurations.append(frontend_ip_configuration_json_format_instance) properties_value2 = frontend_ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value frontend_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value frontend_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() frontend_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() frontend_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 inbound_nat_rules_array = properties_value2.get('inboundNatRules', None) if inbound_nat_rules_array is not None: for inbound_nat_rules_value in inbound_nat_rules_array: resource_id_instance = ResourceId() frontend_ip_configuration_json_format_instance.inbound_nat_rules.append(resource_id_instance) id_value3 = inbound_nat_rules_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 load_balancing_rules_array = properties_value2.get('loadBalancingRules', None) if load_balancing_rules_array is not None: for load_balancing_rules_value in load_balancing_rules_array: resource_id_instance2 = ResourceId() frontend_ip_configuration_json_format_instance.load_balancing_rules.append(resource_id_instance2) id_value4 = load_balancing_rules_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value frontend_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = frontend_ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value frontend_ip_configuration_json_format_instance.name = name_instance etag_value = frontend_ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value frontend_ip_configuration_json_format_instance.etag = etag_instance id_value5 = frontend_ip_configurations_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 frontend_ip_configuration_json_format_instance.id = id_instance5 backend_address_pools_array = properties_value.get('backendAddressPools', None) if backend_address_pools_array is not None: for backend_address_pools_value in backend_address_pools_array: backend_address_pool_json_format_instance = BackendAddressPool(backend_ip_configurations=[], load_balancing_rules=[]) load_balancer_json_format_instance.backend_address_pools.append(backend_address_pool_json_format_instance) properties_value3 = backend_address_pools_value.get('properties', None) if properties_value3 is not None: backend_ip_configurations_array = properties_value3.get('backendIPConfigurations', None) if backend_ip_configurations_array is not None: for backend_ip_configurations_value in backend_ip_configurations_array: resource_id_instance3 = ResourceId() backend_address_pool_json_format_instance.backend_ip_configurations.append(resource_id_instance3) id_value6 = backend_ip_configurations_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance3.id = id_instance6 load_balancing_rules_array2 = properties_value3.get('loadBalancingRules', None) if load_balancing_rules_array2 is not None: for load_balancing_rules_value2 in load_balancing_rules_array2: resource_id_instance4 = ResourceId() backend_address_pool_json_format_instance.load_balancing_rules.append(resource_id_instance4) id_value7 = load_balancing_rules_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 resource_id_instance4.id = id_instance7 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 backend_address_pool_json_format_instance.provisioning_state = provisioning_state_instance2 name_value2 = backend_address_pools_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 backend_address_pool_json_format_instance.name = name_instance2 etag_value2 = backend_address_pools_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 backend_address_pool_json_format_instance.etag = etag_instance2 id_value8 = backend_address_pools_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 backend_address_pool_json_format_instance.id = id_instance8 load_balancing_rules_array3 = properties_value.get('loadBalancingRules', None) if load_balancing_rules_array3 is not None: for load_balancing_rules_value3 in load_balancing_rules_array3: load_balancing_rule_json_format_instance = LoadBalancingRule() load_balancer_json_format_instance.load_balancing_rules.append(load_balancing_rule_json_format_instance) properties_value4 = load_balancing_rules_value3.get('properties', None) if properties_value4 is not None: frontend_ip_configuration_value = properties_value4.get('frontendIPConfiguration', None) if frontend_ip_configuration_value is not None: frontend_ip_configuration_instance = ResourceId() load_balancing_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance id_value9 = frontend_ip_configuration_value.get('id', None) if id_value9 is not None: id_instance9 = id_value9 frontend_ip_configuration_instance.id = id_instance9 backend_address_pool_value = properties_value4.get('backendAddressPool', None) if backend_address_pool_value is not None: backend_address_pool_instance = ResourceId() load_balancing_rule_json_format_instance.backend_address_pool = backend_address_pool_instance id_value10 = backend_address_pool_value.get('id', None) if id_value10 is not None: id_instance10 = id_value10 backend_address_pool_instance.id = id_instance10 probe_value = properties_value4.get('probe', None) if probe_value is not None: probe_instance = ResourceId() load_balancing_rule_json_format_instance.probe = probe_instance id_value11 = probe_value.get('id', None) if id_value11 is not None: id_instance11 = id_value11 probe_instance.id = id_instance11 protocol_value = properties_value4.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value load_balancing_rule_json_format_instance.protocol = protocol_instance load_distribution_value = properties_value4.get('loadDistribution', None) if load_distribution_value is not None: load_distribution_instance = load_distribution_value load_balancing_rule_json_format_instance.load_distribution = load_distribution_instance frontend_port_value = properties_value4.get('frontendPort', None) if frontend_port_value is not None: frontend_port_instance = frontend_port_value load_balancing_rule_json_format_instance.frontend_port = frontend_port_instance backend_port_value = properties_value4.get('backendPort', None) if backend_port_value is not None: backend_port_instance = backend_port_value load_balancing_rule_json_format_instance.backend_port = backend_port_instance idle_timeout_in_minutes_value = properties_value4.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value load_balancing_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance enable_floating_ip_value = properties_value4.get('enableFloatingIP', None) if enable_floating_ip_value is not None: enable_floating_ip_instance = enable_floating_ip_value load_balancing_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance provisioning_state_value3 = properties_value4.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 load_balancing_rule_json_format_instance.provisioning_state = provisioning_state_instance3 name_value3 = load_balancing_rules_value3.get('name', None) if name_value3 is not None: name_instance3 = name_value3 load_balancing_rule_json_format_instance.name = name_instance3 etag_value3 = load_balancing_rules_value3.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 load_balancing_rule_json_format_instance.etag = etag_instance3 id_value12 = load_balancing_rules_value3.get('id', None) if id_value12 is not None: id_instance12 = id_value12 load_balancing_rule_json_format_instance.id = id_instance12 probes_array = properties_value.get('probes', None) if probes_array is not None: for probes_value in probes_array: probe_json_format_instance = Probe(load_balancing_rules=[]) load_balancer_json_format_instance.probes.append(probe_json_format_instance) properties_value5 = probes_value.get('properties', None) if properties_value5 is not None: load_balancing_rules_array4 = properties_value5.get('loadBalancingRules', None) if load_balancing_rules_array4 is not None: for load_balancing_rules_value4 in load_balancing_rules_array4: resource_id_instance5 = ResourceId() probe_json_format_instance.load_balancing_rules.append(resource_id_instance5) id_value13 = load_balancing_rules_value4.get('id', None) if id_value13 is not None: id_instance13 = id_value13 resource_id_instance5.id = id_instance13 protocol_value2 = properties_value5.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 probe_json_format_instance.protocol = protocol_instance2 port_value = properties_value5.get('port', None) if port_value is not None: port_instance = port_value probe_json_format_instance.port = port_instance interval_in_seconds_value = properties_value5.get('intervalInSeconds', None) if interval_in_seconds_value is not None: interval_in_seconds_instance = interval_in_seconds_value probe_json_format_instance.interval_in_seconds = interval_in_seconds_instance number_of_probes_value = properties_value5.get('numberOfProbes', None) if number_of_probes_value is not None: number_of_probes_instance = number_of_probes_value probe_json_format_instance.number_of_probes = number_of_probes_instance request_path_value = properties_value5.get('requestPath', None) if request_path_value is not None: request_path_instance = request_path_value probe_json_format_instance.request_path = request_path_instance provisioning_state_value4 = properties_value5.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 probe_json_format_instance.provisioning_state = provisioning_state_instance4 name_value4 = probes_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 probe_json_format_instance.name = name_instance4 etag_value4 = probes_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 probe_json_format_instance.etag = etag_instance4 id_value14 = probes_value.get('id', None) if id_value14 is not None: id_instance14 = id_value14 probe_json_format_instance.id = id_instance14 inbound_nat_rules_array2 = properties_value.get('inboundNatRules', None) if inbound_nat_rules_array2 is not None: for inbound_nat_rules_value2 in inbound_nat_rules_array2: inbound_nat_rule_json_format_instance = InboundNatRule() load_balancer_json_format_instance.inbound_nat_rules.append(inbound_nat_rule_json_format_instance) properties_value6 = inbound_nat_rules_value2.get('properties', None) if properties_value6 is not None: frontend_ip_configuration_value2 = properties_value6.get('frontendIPConfiguration', None) if frontend_ip_configuration_value2 is not None: frontend_ip_configuration_instance2 = ResourceId() inbound_nat_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance2 id_value15 = frontend_ip_configuration_value2.get('id', None) if id_value15 is not None: id_instance15 = id_value15 frontend_ip_configuration_instance2.id = id_instance15 backend_ip_configuration_value = properties_value6.get('backendIPConfiguration', None) if backend_ip_configuration_value is not None: backend_ip_configuration_instance = ResourceId() inbound_nat_rule_json_format_instance.backend_ip_configuration = backend_ip_configuration_instance id_value16 = backend_ip_configuration_value.get('id', None) if id_value16 is not None: id_instance16 = id_value16 backend_ip_configuration_instance.id = id_instance16 protocol_value3 = properties_value6.get('protocol', None) if protocol_value3 is not None: protocol_instance3 = protocol_value3 inbound_nat_rule_json_format_instance.protocol = protocol_instance3 frontend_port_value2 = properties_value6.get('frontendPort', None) if frontend_port_value2 is not None: frontend_port_instance2 = frontend_port_value2 inbound_nat_rule_json_format_instance.frontend_port = frontend_port_instance2 backend_port_value2 = properties_value6.get('backendPort', None) if backend_port_value2 is not None: backend_port_instance2 = backend_port_value2 inbound_nat_rule_json_format_instance.backend_port = backend_port_instance2 idle_timeout_in_minutes_value2 = properties_value6.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value2 is not None: idle_timeout_in_minutes_instance2 = idle_timeout_in_minutes_value2 inbound_nat_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance2 enable_floating_ip_value2 = properties_value6.get('enableFloatingIP', None) if enable_floating_ip_value2 is not None: enable_floating_ip_instance2 = enable_floating_ip_value2 inbound_nat_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance2 provisioning_state_value5 = properties_value6.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 inbound_nat_rule_json_format_instance.provisioning_state = provisioning_state_instance5 name_value5 = inbound_nat_rules_value2.get('name', None) if name_value5 is not None: name_instance5 = name_value5 inbound_nat_rule_json_format_instance.name = name_instance5 etag_value5 = inbound_nat_rules_value2.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 inbound_nat_rule_json_format_instance.etag = etag_instance5 id_value17 = inbound_nat_rules_value2.get('id', None) if id_value17 is not None: id_instance17 = id_value17 inbound_nat_rule_json_format_instance.id = id_instance17 provisioning_state_value6 = properties_value.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 load_balancer_json_format_instance.provisioning_state = provisioning_state_instance6 etag_value6 = value_value.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 load_balancer_json_format_instance.etag = etag_instance6 id_value18 = value_value.get('id', None) if id_value18 is not None: id_instance18 = id_value18 load_balancer_json_format_instance.id = id_instance18 name_value6 = value_value.get('name', None) if name_value6 is not None: name_instance6 = name_value6 load_balancer_json_format_instance.name = name_instance6 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value load_balancer_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value load_balancer_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] load_balancer_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list_all(self): """ The List loadBalancer opertion retrieves all the loadbalancers in a subscription. Returns: LoadBalancerListResponse: Response for ListLoadBalancers Api service call """ # Validate # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/loadBalancers' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = LoadBalancerListResponse(load_balancers=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: load_balancer_json_format_instance = LoadBalancer(backend_address_pools=[], frontend_ip_configurations=[], inbound_nat_rules=[], load_balancing_rules=[], probes=[], tags={}) result.load_balancers.append(load_balancer_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: frontend_ip_configurations_array = properties_value.get('frontendIPConfigurations', None) if frontend_ip_configurations_array is not None: for frontend_ip_configurations_value in frontend_ip_configurations_array: frontend_ip_configuration_json_format_instance = FrontendIpConfiguration(inbound_nat_rules=[], load_balancing_rules=[]) load_balancer_json_format_instance.frontend_ip_configurations.append(frontend_ip_configuration_json_format_instance) properties_value2 = frontend_ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value frontend_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value frontend_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() frontend_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() frontend_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 inbound_nat_rules_array = properties_value2.get('inboundNatRules', None) if inbound_nat_rules_array is not None: for inbound_nat_rules_value in inbound_nat_rules_array: resource_id_instance = ResourceId() frontend_ip_configuration_json_format_instance.inbound_nat_rules.append(resource_id_instance) id_value3 = inbound_nat_rules_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 load_balancing_rules_array = properties_value2.get('loadBalancingRules', None) if load_balancing_rules_array is not None: for load_balancing_rules_value in load_balancing_rules_array: resource_id_instance2 = ResourceId() frontend_ip_configuration_json_format_instance.load_balancing_rules.append(resource_id_instance2) id_value4 = load_balancing_rules_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value frontend_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = frontend_ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value frontend_ip_configuration_json_format_instance.name = name_instance etag_value = frontend_ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value frontend_ip_configuration_json_format_instance.etag = etag_instance id_value5 = frontend_ip_configurations_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 frontend_ip_configuration_json_format_instance.id = id_instance5 backend_address_pools_array = properties_value.get('backendAddressPools', None) if backend_address_pools_array is not None: for backend_address_pools_value in backend_address_pools_array: backend_address_pool_json_format_instance = BackendAddressPool(backend_ip_configurations=[], load_balancing_rules=[]) load_balancer_json_format_instance.backend_address_pools.append(backend_address_pool_json_format_instance) properties_value3 = backend_address_pools_value.get('properties', None) if properties_value3 is not None: backend_ip_configurations_array = properties_value3.get('backendIPConfigurations', None) if backend_ip_configurations_array is not None: for backend_ip_configurations_value in backend_ip_configurations_array: resource_id_instance3 = ResourceId() backend_address_pool_json_format_instance.backend_ip_configurations.append(resource_id_instance3) id_value6 = backend_ip_configurations_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance3.id = id_instance6 load_balancing_rules_array2 = properties_value3.get('loadBalancingRules', None) if load_balancing_rules_array2 is not None: for load_balancing_rules_value2 in load_balancing_rules_array2: resource_id_instance4 = ResourceId() backend_address_pool_json_format_instance.load_balancing_rules.append(resource_id_instance4) id_value7 = load_balancing_rules_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 resource_id_instance4.id = id_instance7 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 backend_address_pool_json_format_instance.provisioning_state = provisioning_state_instance2 name_value2 = backend_address_pools_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 backend_address_pool_json_format_instance.name = name_instance2 etag_value2 = backend_address_pools_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 backend_address_pool_json_format_instance.etag = etag_instance2 id_value8 = backend_address_pools_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 backend_address_pool_json_format_instance.id = id_instance8 load_balancing_rules_array3 = properties_value.get('loadBalancingRules', None) if load_balancing_rules_array3 is not None: for load_balancing_rules_value3 in load_balancing_rules_array3: load_balancing_rule_json_format_instance = LoadBalancingRule() load_balancer_json_format_instance.load_balancing_rules.append(load_balancing_rule_json_format_instance) properties_value4 = load_balancing_rules_value3.get('properties', None) if properties_value4 is not None: frontend_ip_configuration_value = properties_value4.get('frontendIPConfiguration', None) if frontend_ip_configuration_value is not None: frontend_ip_configuration_instance = ResourceId() load_balancing_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance id_value9 = frontend_ip_configuration_value.get('id', None) if id_value9 is not None: id_instance9 = id_value9 frontend_ip_configuration_instance.id = id_instance9 backend_address_pool_value = properties_value4.get('backendAddressPool', None) if backend_address_pool_value is not None: backend_address_pool_instance = ResourceId() load_balancing_rule_json_format_instance.backend_address_pool = backend_address_pool_instance id_value10 = backend_address_pool_value.get('id', None) if id_value10 is not None: id_instance10 = id_value10 backend_address_pool_instance.id = id_instance10 probe_value = properties_value4.get('probe', None) if probe_value is not None: probe_instance = ResourceId() load_balancing_rule_json_format_instance.probe = probe_instance id_value11 = probe_value.get('id', None) if id_value11 is not None: id_instance11 = id_value11 probe_instance.id = id_instance11 protocol_value = properties_value4.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value load_balancing_rule_json_format_instance.protocol = protocol_instance load_distribution_value = properties_value4.get('loadDistribution', None) if load_distribution_value is not None: load_distribution_instance = load_distribution_value load_balancing_rule_json_format_instance.load_distribution = load_distribution_instance frontend_port_value = properties_value4.get('frontendPort', None) if frontend_port_value is not None: frontend_port_instance = frontend_port_value load_balancing_rule_json_format_instance.frontend_port = frontend_port_instance backend_port_value = properties_value4.get('backendPort', None) if backend_port_value is not None: backend_port_instance = backend_port_value load_balancing_rule_json_format_instance.backend_port = backend_port_instance idle_timeout_in_minutes_value = properties_value4.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value load_balancing_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance enable_floating_ip_value = properties_value4.get('enableFloatingIP', None) if enable_floating_ip_value is not None: enable_floating_ip_instance = enable_floating_ip_value load_balancing_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance provisioning_state_value3 = properties_value4.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 load_balancing_rule_json_format_instance.provisioning_state = provisioning_state_instance3 name_value3 = load_balancing_rules_value3.get('name', None) if name_value3 is not None: name_instance3 = name_value3 load_balancing_rule_json_format_instance.name = name_instance3 etag_value3 = load_balancing_rules_value3.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 load_balancing_rule_json_format_instance.etag = etag_instance3 id_value12 = load_balancing_rules_value3.get('id', None) if id_value12 is not None: id_instance12 = id_value12 load_balancing_rule_json_format_instance.id = id_instance12 probes_array = properties_value.get('probes', None) if probes_array is not None: for probes_value in probes_array: probe_json_format_instance = Probe(load_balancing_rules=[]) load_balancer_json_format_instance.probes.append(probe_json_format_instance) properties_value5 = probes_value.get('properties', None) if properties_value5 is not None: load_balancing_rules_array4 = properties_value5.get('loadBalancingRules', None) if load_balancing_rules_array4 is not None: for load_balancing_rules_value4 in load_balancing_rules_array4: resource_id_instance5 = ResourceId() probe_json_format_instance.load_balancing_rules.append(resource_id_instance5) id_value13 = load_balancing_rules_value4.get('id', None) if id_value13 is not None: id_instance13 = id_value13 resource_id_instance5.id = id_instance13 protocol_value2 = properties_value5.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 probe_json_format_instance.protocol = protocol_instance2 port_value = properties_value5.get('port', None) if port_value is not None: port_instance = port_value probe_json_format_instance.port = port_instance interval_in_seconds_value = properties_value5.get('intervalInSeconds', None) if interval_in_seconds_value is not None: interval_in_seconds_instance = interval_in_seconds_value probe_json_format_instance.interval_in_seconds = interval_in_seconds_instance number_of_probes_value = properties_value5.get('numberOfProbes', None) if number_of_probes_value is not None: number_of_probes_instance = number_of_probes_value probe_json_format_instance.number_of_probes = number_of_probes_instance request_path_value = properties_value5.get('requestPath', None) if request_path_value is not None: request_path_instance = request_path_value probe_json_format_instance.request_path = request_path_instance provisioning_state_value4 = properties_value5.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 probe_json_format_instance.provisioning_state = provisioning_state_instance4 name_value4 = probes_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 probe_json_format_instance.name = name_instance4 etag_value4 = probes_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 probe_json_format_instance.etag = etag_instance4 id_value14 = probes_value.get('id', None) if id_value14 is not None: id_instance14 = id_value14 probe_json_format_instance.id = id_instance14 inbound_nat_rules_array2 = properties_value.get('inboundNatRules', None) if inbound_nat_rules_array2 is not None: for inbound_nat_rules_value2 in inbound_nat_rules_array2: inbound_nat_rule_json_format_instance = InboundNatRule() load_balancer_json_format_instance.inbound_nat_rules.append(inbound_nat_rule_json_format_instance) properties_value6 = inbound_nat_rules_value2.get('properties', None) if properties_value6 is not None: frontend_ip_configuration_value2 = properties_value6.get('frontendIPConfiguration', None) if frontend_ip_configuration_value2 is not None: frontend_ip_configuration_instance2 = ResourceId() inbound_nat_rule_json_format_instance.frontend_ip_configuration = frontend_ip_configuration_instance2 id_value15 = frontend_ip_configuration_value2.get('id', None) if id_value15 is not None: id_instance15 = id_value15 frontend_ip_configuration_instance2.id = id_instance15 backend_ip_configuration_value = properties_value6.get('backendIPConfiguration', None) if backend_ip_configuration_value is not None: backend_ip_configuration_instance = ResourceId() inbound_nat_rule_json_format_instance.backend_ip_configuration = backend_ip_configuration_instance id_value16 = backend_ip_configuration_value.get('id', None) if id_value16 is not None: id_instance16 = id_value16 backend_ip_configuration_instance.id = id_instance16 protocol_value3 = properties_value6.get('protocol', None) if protocol_value3 is not None: protocol_instance3 = protocol_value3 inbound_nat_rule_json_format_instance.protocol = protocol_instance3 frontend_port_value2 = properties_value6.get('frontendPort', None) if frontend_port_value2 is not None: frontend_port_instance2 = frontend_port_value2 inbound_nat_rule_json_format_instance.frontend_port = frontend_port_instance2 backend_port_value2 = properties_value6.get('backendPort', None) if backend_port_value2 is not None: backend_port_instance2 = backend_port_value2 inbound_nat_rule_json_format_instance.backend_port = backend_port_instance2 idle_timeout_in_minutes_value2 = properties_value6.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value2 is not None: idle_timeout_in_minutes_instance2 = idle_timeout_in_minutes_value2 inbound_nat_rule_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance2 enable_floating_ip_value2 = properties_value6.get('enableFloatingIP', None) if enable_floating_ip_value2 is not None: enable_floating_ip_instance2 = enable_floating_ip_value2 inbound_nat_rule_json_format_instance.enable_floating_ip = enable_floating_ip_instance2 provisioning_state_value5 = properties_value6.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 inbound_nat_rule_json_format_instance.provisioning_state = provisioning_state_instance5 name_value5 = inbound_nat_rules_value2.get('name', None) if name_value5 is not None: name_instance5 = name_value5 inbound_nat_rule_json_format_instance.name = name_instance5 etag_value5 = inbound_nat_rules_value2.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 inbound_nat_rule_json_format_instance.etag = etag_instance5 id_value17 = inbound_nat_rules_value2.get('id', None) if id_value17 is not None: id_instance17 = id_value17 inbound_nat_rule_json_format_instance.id = id_instance17 provisioning_state_value6 = properties_value.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 load_balancer_json_format_instance.provisioning_state = provisioning_state_instance6 etag_value6 = value_value.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 load_balancer_json_format_instance.etag = etag_instance6 id_value18 = value_value.get('id', None) if id_value18 is not None: id_instance18 = id_value18 load_balancer_json_format_instance.id = id_instance18 name_value6 = value_value.get('name', None) if name_value6 is not None: name_instance6 = name_value6 load_balancer_json_format_instance.name = name_instance6 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value load_balancer_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value load_balancer_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] load_balancer_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class LocalNetworkGatewayOperations(object): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, local_network_gateway_name, parameters): """ The Put LocalNetworkGateway operation creates/updates a local network gateway in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. local_network_gateway_name (string): The name of the local network gateway. parameters (LocalNetworkGateway): Parameters supplied to the Begin Create or update Local Network Gateway operation through Network resource provider. Returns: LocalNetworkGatewayPutResponse: Response for PutLocalNetworkGateway Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if local_network_gateway_name is None: raise ValueError('local_network_gateway_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/localNetworkGateways/' url = url + quote(local_network_gateway_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None local_network_gateway_json_format_value = {} request_doc = local_network_gateway_json_format_value properties_value = {} local_network_gateway_json_format_value['properties'] = properties_value if parameters.gateway_ip_address is not None: properties_value['gatewayIpAddress'] = parameters.gateway_ip_address if parameters.local_network_site_address_space is not None: local_network_site_address_space_value = {} properties_value['localNetworkSiteAddressSpace'] = local_network_site_address_space_value if parameters.local_network_site_address_space.address_prefixes is not None: address_prefixes_array = [] for address_prefixes_item in parameters.local_network_site_address_space.address_prefixes: address_prefixes_array.append(address_prefixes_item) local_network_site_address_space_value['addressPrefixes'] = address_prefixes_array if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: local_network_gateway_json_format_value['etag'] = parameters.etag if parameters.id is not None: local_network_gateway_json_format_value['id'] = parameters.id if parameters.name is not None: local_network_gateway_json_format_value['name'] = parameters.name if parameters.type is not None: local_network_gateway_json_format_value['type'] = parameters.type local_network_gateway_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value local_network_gateway_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = LocalNetworkGatewayPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: local_network_gateway_instance = LocalNetworkGateway(tags={}) result.local_network_gateway = local_network_gateway_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: gateway_ip_address_value = properties_value2.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value2 = properties_value2.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value2 is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array2 = local_network_site_address_space_value2.get('addressPrefixes', None) if address_prefixes_array2 is not None: for address_prefixes_value in address_prefixes_array2: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value local_network_gateway_instance.provisioning_state = provisioning_state_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value local_network_gateway_instance.etag = etag_instance id_value = response_doc.get('id', None) if id_value is not None: id_instance = id_value local_network_gateway_instance.id = id_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value local_network_gateway_instance.name = name_instance type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value local_network_gateway_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value local_network_gateway_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] local_network_gateway_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, local_network_gateway_name): """ The Delete LocalNetworkGateway operation deletes the specifed local network Gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. local_network_gateway_name (string): The name of the local network gateway. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if local_network_gateway_name is None: raise ValueError('local_network_gateway_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/localNetworkGateways/' url = url + quote(local_network_gateway_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, local_network_gateway_name, parameters): """ The Put LocalNetworkGateway operation creates/updates a local network gateway in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. local_network_gateway_name (string): The name of the local network gateway. parameters (LocalNetworkGateway): Parameters supplied to the Begin Create or update Local Network Gateway operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.local_network_gateways.begin_create_or_updating(resource_group_name, local_network_gateway_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, local_network_gateway_name): """ The Delete LocalNetworkGateway operation deletes the specifed local network Gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. local_network_gateway_name (string): The name of the local network gateway. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.local_network_gateways.begin_deleting(resource_group_name, local_network_gateway_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, local_network_gateway_name): """ The Get LocalNetworkGateway operation retrieves information about the specified local network gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. local_network_gateway_name (string): The name of the local network gateway. Returns: LocalNetworkGatewayGetResponse: Response for GetLocalNetworkgateway Api servive call. """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if local_network_gateway_name is None: raise ValueError('local_network_gateway_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/localNetworkGateways/' url = url + quote(local_network_gateway_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = LocalNetworkGatewayGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: local_network_gateway_instance = LocalNetworkGateway(tags={}) result.local_network_gateway = local_network_gateway_instance properties_value = response_doc.get('properties', None) if properties_value is not None: gateway_ip_address_value = properties_value.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value = properties_value.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array = local_network_site_address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value local_network_gateway_instance.provisioning_state = provisioning_state_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value local_network_gateway_instance.etag = etag_instance id_value = response_doc.get('id', None) if id_value is not None: id_instance = id_value local_network_gateway_instance.id = id_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value local_network_gateway_instance.name = name_instance type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value local_network_gateway_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value local_network_gateway_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] local_network_gateway_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List LocalNetworkGateways opertion retrieves all the local network gateways stored. Args: resource_group_name (string): The name of the resource group. Returns: LocalNetworkGatewayListResponse: Response for ListLocalNetworkGateways Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/localNetworkGateways' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = LocalNetworkGatewayListResponse(local_network_gateways=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: local_network_gateway_json_format_instance = LocalNetworkGateway(tags={}) result.local_network_gateways.append(local_network_gateway_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: gateway_ip_address_value = properties_value.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway_json_format_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value = properties_value.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway_json_format_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array = local_network_site_address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value local_network_gateway_json_format_instance.provisioning_state = provisioning_state_instance etag_value = value_value.get('etag', None) if etag_value is not None: etag_instance = etag_value local_network_gateway_json_format_instance.etag = etag_instance id_value = value_value.get('id', None) if id_value is not None: id_instance = id_value local_network_gateway_json_format_instance.id = id_instance name_value = value_value.get('name', None) if name_value is not None: name_instance = name_value local_network_gateway_json_format_instance.name = name_instance type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value local_network_gateway_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value local_network_gateway_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] local_network_gateway_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class NetworkInterfaceOperations(object): """ The Network Resource Provider API includes operations for managing the subnets for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, network_interface_name, parameters): """ The Put NetworkInterface operation creates/updates a networkInterface Args: resource_group_name (string): The name of the resource group. network_interface_name (string): The name of the network interface. parameters (NetworkInterface): Parameters supplied to the create/update NetworkInterface operation Returns: NetworkInterfacePutResponse: Response for PutNetworkInterface Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_interface_name is None: raise ValueError('network_interface_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkInterfaces/' url = url + quote(network_interface_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None network_interface_json_format_value = {} request_doc = network_interface_json_format_value properties_value = {} network_interface_json_format_value['properties'] = properties_value if parameters.virtual_machine is not None: virtual_machine_value = {} properties_value['virtualMachine'] = virtual_machine_value if parameters.virtual_machine.id is not None: virtual_machine_value['id'] = parameters.virtual_machine.id if parameters.network_security_group is not None: network_security_group_value = {} properties_value['networkSecurityGroup'] = network_security_group_value if parameters.network_security_group.id is not None: network_security_group_value['id'] = parameters.network_security_group.id if parameters.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in parameters.ip_configurations: network_interface_ip_configuration_json_format_value = {} ip_configurations_array.append(network_interface_ip_configuration_json_format_value) properties_value2 = {} network_interface_ip_configuration_json_format_value['properties'] = properties_value2 if ip_configurations_item.private_ip_address is not None: properties_value2['privateIPAddress'] = ip_configurations_item.private_ip_address if ip_configurations_item.private_ip_allocation_method is not None: properties_value2['privateIPAllocationMethod'] = ip_configurations_item.private_ip_allocation_method if ip_configurations_item.subnet is not None: subnet_value = {} properties_value2['subnet'] = subnet_value if ip_configurations_item.subnet.id is not None: subnet_value['id'] = ip_configurations_item.subnet.id if ip_configurations_item.public_ip_address is not None: public_ip_address_value = {} properties_value2['publicIPAddress'] = public_ip_address_value if ip_configurations_item.public_ip_address.id is not None: public_ip_address_value['id'] = ip_configurations_item.public_ip_address.id if ip_configurations_item.load_balancer_backend_address_pools is not None: load_balancer_backend_address_pools_array = [] for load_balancer_backend_address_pools_item in ip_configurations_item.load_balancer_backend_address_pools: resource_id_value = {} load_balancer_backend_address_pools_array.append(resource_id_value) if load_balancer_backend_address_pools_item.id is not None: resource_id_value['id'] = load_balancer_backend_address_pools_item.id properties_value2['loadBalancerBackendAddressPools'] = load_balancer_backend_address_pools_array if ip_configurations_item.load_balancer_inbound_nat_rules is not None: load_balancer_inbound_nat_rules_array = [] for load_balancer_inbound_nat_rules_item in ip_configurations_item.load_balancer_inbound_nat_rules: resource_id_value2 = {} load_balancer_inbound_nat_rules_array.append(resource_id_value2) if load_balancer_inbound_nat_rules_item.id is not None: resource_id_value2['id'] = load_balancer_inbound_nat_rules_item.id properties_value2['loadBalancerInboundNatRules'] = load_balancer_inbound_nat_rules_array if ip_configurations_item.provisioning_state is not None: properties_value2['provisioningState'] = ip_configurations_item.provisioning_state if ip_configurations_item.name is not None: network_interface_ip_configuration_json_format_value['name'] = ip_configurations_item.name if ip_configurations_item.etag is not None: network_interface_ip_configuration_json_format_value['etag'] = ip_configurations_item.etag if ip_configurations_item.id is not None: network_interface_ip_configuration_json_format_value['id'] = ip_configurations_item.id properties_value['ipConfigurations'] = ip_configurations_array if parameters.dns_settings is not None: dns_settings_value = {} properties_value['dnsSettings'] = dns_settings_value if parameters.dns_settings.dns_servers is not None: dns_servers_array = [] for dns_servers_item in parameters.dns_settings.dns_servers: dns_servers_array.append(dns_servers_item) dns_settings_value['dnsServers'] = dns_servers_array if parameters.dns_settings.applied_dns_servers is not None: applied_dns_servers_array = [] for applied_dns_servers_item in parameters.dns_settings.applied_dns_servers: applied_dns_servers_array.append(applied_dns_servers_item) dns_settings_value['appliedDnsServers'] = applied_dns_servers_array if parameters.mac_address is not None: properties_value['macAddress'] = parameters.mac_address if parameters.primary is not None: properties_value['primary'] = parameters.primary if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: network_interface_json_format_value['etag'] = parameters.etag if parameters.id is not None: network_interface_json_format_value['id'] = parameters.id if parameters.name is not None: network_interface_json_format_value['name'] = parameters.name if parameters.type is not None: network_interface_json_format_value['type'] = parameters.type network_interface_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value network_interface_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = NetworkInterfacePutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: network_interface_instance = NetworkInterface(ip_configurations=[], tags={}) result.network_interface = network_interface_instance properties_value3 = response_doc.get('properties', None) if properties_value3 is not None: virtual_machine_value2 = properties_value3.get('virtualMachine', None) if virtual_machine_value2 is not None: virtual_machine_instance = ResourceId() network_interface_instance.virtual_machine = virtual_machine_instance id_value = virtual_machine_value2.get('id', None) if id_value is not None: id_instance = id_value virtual_machine_instance.id = id_instance network_security_group_value2 = properties_value3.get('networkSecurityGroup', None) if network_security_group_value2 is not None: network_security_group_instance = ResourceId() network_interface_instance.network_security_group = network_security_group_instance id_value2 = network_security_group_value2.get('id', None) if id_value2 is not None: id_instance2 = id_value2 network_security_group_instance.id = id_instance2 ip_configurations_array2 = properties_value3.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value in ip_configurations_array2: network_interface_ip_configuration_json_format_instance = NetworkInterfaceIpConfiguration(load_balancer_backend_address_pools=[], load_balancer_inbound_nat_rules=[]) network_interface_instance.ip_configurations.append(network_interface_ip_configuration_json_format_instance) properties_value4 = ip_configurations_value.get('properties', None) if properties_value4 is not None: private_ip_address_value = properties_value4.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value network_interface_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value4.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value network_interface_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value2 = properties_value4.get('subnet', None) if subnet_value2 is not None: subnet_instance = ResourceId() network_interface_ip_configuration_json_format_instance.subnet = subnet_instance id_value3 = subnet_value2.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 public_ip_address_value2 = properties_value4.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance = ResourceId() network_interface_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value4 = public_ip_address_value2.get('id', None) if id_value4 is not None: id_instance4 = id_value4 public_ip_address_instance.id = id_instance4 load_balancer_backend_address_pools_array2 = properties_value4.get('loadBalancerBackendAddressPools', None) if load_balancer_backend_address_pools_array2 is not None: for load_balancer_backend_address_pools_value in load_balancer_backend_address_pools_array2: resource_id_instance = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_backend_address_pools.append(resource_id_instance) id_value5 = load_balancer_backend_address_pools_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 resource_id_instance.id = id_instance5 load_balancer_inbound_nat_rules_array2 = properties_value4.get('loadBalancerInboundNatRules', None) if load_balancer_inbound_nat_rules_array2 is not None: for load_balancer_inbound_nat_rules_value in load_balancer_inbound_nat_rules_array2: resource_id_instance2 = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_inbound_nat_rules.append(resource_id_instance2) id_value6 = load_balancer_inbound_nat_rules_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance2.id = id_instance6 provisioning_state_value = properties_value4.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value network_interface_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value network_interface_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value network_interface_ip_configuration_json_format_instance.etag = etag_instance id_value7 = ip_configurations_value.get('id', None) if id_value7 is not None: id_instance7 = id_value7 network_interface_ip_configuration_json_format_instance.id = id_instance7 dns_settings_value2 = properties_value3.get('dnsSettings', None) if dns_settings_value2 is not None: dns_settings_instance = DnsSettings(applied_dns_servers=[], dns_servers=[]) network_interface_instance.dns_settings = dns_settings_instance dns_servers_array2 = dns_settings_value2.get('dnsServers', None) if dns_servers_array2 is not None: for dns_servers_value in dns_servers_array2: dns_settings_instance.dns_servers.append(dns_servers_value) applied_dns_servers_array2 = dns_settings_value2.get('appliedDnsServers', None) if applied_dns_servers_array2 is not None: for applied_dns_servers_value in applied_dns_servers_array2: dns_settings_instance.applied_dns_servers.append(applied_dns_servers_value) mac_address_value = properties_value3.get('macAddress', None) if mac_address_value is not None: mac_address_instance = mac_address_value network_interface_instance.mac_address = mac_address_instance primary_value = properties_value3.get('primary', None) if primary_value is not None: primary_instance = primary_value network_interface_instance.primary = primary_instance provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 network_interface_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 network_interface_instance.etag = etag_instance2 id_value8 = response_doc.get('id', None) if id_value8 is not None: id_instance8 = id_value8 network_interface_instance.id = id_instance8 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 network_interface_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value network_interface_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value network_interface_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] network_interface_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) return result def begin_deleting(self, resource_group_name, network_interface_name): """ The delete netwokInterface operation deletes the specified netwokInterface. Args: resource_group_name (string): The name of the resource group. network_interface_name (string): The name of the network interface. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_interface_name is None: raise ValueError('network_interface_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkInterfaces/' url = url + quote(network_interface_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, network_interface_name, parameters): """ The Put NetworkInterface operation creates/updates a networkInterface Args: resource_group_name (string): The name of the resource group. network_interface_name (string): The name of the network interface. parameters (NetworkInterface): Parameters supplied to the create/update NetworkInterface operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.network_interfaces.begin_create_or_updating(resource_group_name, network_interface_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, network_interface_name): """ Args: resource_group_name (string): The name of the resource group. network_interface_name (string): The name of the network interface. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.network_interfaces.begin_deleting(resource_group_name, network_interface_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, network_interface_name): """ The Get ntework interface operation retreives information about the specified network interface. Args: resource_group_name (string): The name of the resource group. network_interface_name (string): The name of the network interface. Returns: NetworkInterfaceGetResponse: Response for GetNetworkInterface Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_interface_name is None: raise ValueError('network_interface_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkInterfaces/' url = url + quote(network_interface_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkInterfaceGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: network_interface_instance = NetworkInterface(ip_configurations=[], tags={}) result.network_interface = network_interface_instance properties_value = response_doc.get('properties', None) if properties_value is not None: virtual_machine_value = properties_value.get('virtualMachine', None) if virtual_machine_value is not None: virtual_machine_instance = ResourceId() network_interface_instance.virtual_machine = virtual_machine_instance id_value = virtual_machine_value.get('id', None) if id_value is not None: id_instance = id_value virtual_machine_instance.id = id_instance network_security_group_value = properties_value.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() network_interface_instance.network_security_group = network_security_group_instance id_value2 = network_security_group_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 network_security_group_instance.id = id_instance2 ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: network_interface_ip_configuration_json_format_instance = NetworkInterfaceIpConfiguration(load_balancer_backend_address_pools=[], load_balancer_inbound_nat_rules=[]) network_interface_instance.ip_configurations.append(network_interface_ip_configuration_json_format_instance) properties_value2 = ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value network_interface_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value network_interface_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() network_interface_ip_configuration_json_format_instance.subnet = subnet_instance id_value3 = subnet_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() network_interface_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value4 = public_ip_address_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 public_ip_address_instance.id = id_instance4 load_balancer_backend_address_pools_array = properties_value2.get('loadBalancerBackendAddressPools', None) if load_balancer_backend_address_pools_array is not None: for load_balancer_backend_address_pools_value in load_balancer_backend_address_pools_array: resource_id_instance = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_backend_address_pools.append(resource_id_instance) id_value5 = load_balancer_backend_address_pools_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 resource_id_instance.id = id_instance5 load_balancer_inbound_nat_rules_array = properties_value2.get('loadBalancerInboundNatRules', None) if load_balancer_inbound_nat_rules_array is not None: for load_balancer_inbound_nat_rules_value in load_balancer_inbound_nat_rules_array: resource_id_instance2 = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_inbound_nat_rules.append(resource_id_instance2) id_value6 = load_balancer_inbound_nat_rules_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance2.id = id_instance6 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value network_interface_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value network_interface_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value network_interface_ip_configuration_json_format_instance.etag = etag_instance id_value7 = ip_configurations_value.get('id', None) if id_value7 is not None: id_instance7 = id_value7 network_interface_ip_configuration_json_format_instance.id = id_instance7 dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = DnsSettings(applied_dns_servers=[], dns_servers=[]) network_interface_instance.dns_settings = dns_settings_instance dns_servers_array = dns_settings_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dns_settings_instance.dns_servers.append(dns_servers_value) applied_dns_servers_array = dns_settings_value.get('appliedDnsServers', None) if applied_dns_servers_array is not None: for applied_dns_servers_value in applied_dns_servers_array: dns_settings_instance.applied_dns_servers.append(applied_dns_servers_value) mac_address_value = properties_value.get('macAddress', None) if mac_address_value is not None: mac_address_instance = mac_address_value network_interface_instance.mac_address = mac_address_instance primary_value = properties_value.get('primary', None) if primary_value is not None: primary_instance = primary_value network_interface_instance.primary = primary_instance provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 network_interface_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 network_interface_instance.etag = etag_instance2 id_value8 = response_doc.get('id', None) if id_value8 is not None: id_instance8 = id_value8 network_interface_instance.id = id_instance8 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 network_interface_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value network_interface_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value network_interface_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_interface_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List networkInterfaces opertion retrieves all the networkInterfaces in a resource group. Args: resource_group_name (string): The name of the resource group. Returns: NetworkInterfaceListResponse: Response for ListNetworkInterface Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkInterfaces' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkInterfaceListResponse(network_interfaces=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: network_interface_json_format_instance = NetworkInterface(ip_configurations=[], tags={}) result.network_interfaces.append(network_interface_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: virtual_machine_value = properties_value.get('virtualMachine', None) if virtual_machine_value is not None: virtual_machine_instance = ResourceId() network_interface_json_format_instance.virtual_machine = virtual_machine_instance id_value = virtual_machine_value.get('id', None) if id_value is not None: id_instance = id_value virtual_machine_instance.id = id_instance network_security_group_value = properties_value.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() network_interface_json_format_instance.network_security_group = network_security_group_instance id_value2 = network_security_group_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 network_security_group_instance.id = id_instance2 ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: network_interface_ip_configuration_json_format_instance = NetworkInterfaceIpConfiguration(load_balancer_backend_address_pools=[], load_balancer_inbound_nat_rules=[]) network_interface_json_format_instance.ip_configurations.append(network_interface_ip_configuration_json_format_instance) properties_value2 = ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value network_interface_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value network_interface_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() network_interface_ip_configuration_json_format_instance.subnet = subnet_instance id_value3 = subnet_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() network_interface_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value4 = public_ip_address_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 public_ip_address_instance.id = id_instance4 load_balancer_backend_address_pools_array = properties_value2.get('loadBalancerBackendAddressPools', None) if load_balancer_backend_address_pools_array is not None: for load_balancer_backend_address_pools_value in load_balancer_backend_address_pools_array: resource_id_instance = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_backend_address_pools.append(resource_id_instance) id_value5 = load_balancer_backend_address_pools_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 resource_id_instance.id = id_instance5 load_balancer_inbound_nat_rules_array = properties_value2.get('loadBalancerInboundNatRules', None) if load_balancer_inbound_nat_rules_array is not None: for load_balancer_inbound_nat_rules_value in load_balancer_inbound_nat_rules_array: resource_id_instance2 = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_inbound_nat_rules.append(resource_id_instance2) id_value6 = load_balancer_inbound_nat_rules_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance2.id = id_instance6 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value network_interface_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value network_interface_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value network_interface_ip_configuration_json_format_instance.etag = etag_instance id_value7 = ip_configurations_value.get('id', None) if id_value7 is not None: id_instance7 = id_value7 network_interface_ip_configuration_json_format_instance.id = id_instance7 dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = DnsSettings(applied_dns_servers=[], dns_servers=[]) network_interface_json_format_instance.dns_settings = dns_settings_instance dns_servers_array = dns_settings_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dns_settings_instance.dns_servers.append(dns_servers_value) applied_dns_servers_array = dns_settings_value.get('appliedDnsServers', None) if applied_dns_servers_array is not None: for applied_dns_servers_value in applied_dns_servers_array: dns_settings_instance.applied_dns_servers.append(applied_dns_servers_value) mac_address_value = properties_value.get('macAddress', None) if mac_address_value is not None: mac_address_instance = mac_address_value network_interface_json_format_instance.mac_address = mac_address_instance primary_value = properties_value.get('primary', None) if primary_value is not None: primary_instance = primary_value network_interface_json_format_instance.primary = primary_instance provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 network_interface_json_format_instance.provisioning_state = provisioning_state_instance2 etag_value2 = value_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 network_interface_json_format_instance.etag = etag_instance2 id_value8 = value_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 network_interface_json_format_instance.id = id_instance8 name_value2 = value_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 network_interface_json_format_instance.name = name_instance2 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value network_interface_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value network_interface_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_interface_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list_all(self): """ The List networkInterfaces opertion retrieves all the networkInterfaces in a subscription. Returns: NetworkInterfaceListResponse: Response for ListNetworkInterface Api service call """ # Validate # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkInterfaces' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkInterfaceListResponse(network_interfaces=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: network_interface_json_format_instance = NetworkInterface(ip_configurations=[], tags={}) result.network_interfaces.append(network_interface_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: virtual_machine_value = properties_value.get('virtualMachine', None) if virtual_machine_value is not None: virtual_machine_instance = ResourceId() network_interface_json_format_instance.virtual_machine = virtual_machine_instance id_value = virtual_machine_value.get('id', None) if id_value is not None: id_instance = id_value virtual_machine_instance.id = id_instance network_security_group_value = properties_value.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() network_interface_json_format_instance.network_security_group = network_security_group_instance id_value2 = network_security_group_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 network_security_group_instance.id = id_instance2 ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: network_interface_ip_configuration_json_format_instance = NetworkInterfaceIpConfiguration(load_balancer_backend_address_pools=[], load_balancer_inbound_nat_rules=[]) network_interface_json_format_instance.ip_configurations.append(network_interface_ip_configuration_json_format_instance) properties_value2 = ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value network_interface_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value network_interface_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() network_interface_ip_configuration_json_format_instance.subnet = subnet_instance id_value3 = subnet_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() network_interface_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value4 = public_ip_address_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 public_ip_address_instance.id = id_instance4 load_balancer_backend_address_pools_array = properties_value2.get('loadBalancerBackendAddressPools', None) if load_balancer_backend_address_pools_array is not None: for load_balancer_backend_address_pools_value in load_balancer_backend_address_pools_array: resource_id_instance = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_backend_address_pools.append(resource_id_instance) id_value5 = load_balancer_backend_address_pools_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 resource_id_instance.id = id_instance5 load_balancer_inbound_nat_rules_array = properties_value2.get('loadBalancerInboundNatRules', None) if load_balancer_inbound_nat_rules_array is not None: for load_balancer_inbound_nat_rules_value in load_balancer_inbound_nat_rules_array: resource_id_instance2 = ResourceId() network_interface_ip_configuration_json_format_instance.load_balancer_inbound_nat_rules.append(resource_id_instance2) id_value6 = load_balancer_inbound_nat_rules_value.get('id', None) if id_value6 is not None: id_instance6 = id_value6 resource_id_instance2.id = id_instance6 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value network_interface_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value network_interface_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value network_interface_ip_configuration_json_format_instance.etag = etag_instance id_value7 = ip_configurations_value.get('id', None) if id_value7 is not None: id_instance7 = id_value7 network_interface_ip_configuration_json_format_instance.id = id_instance7 dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = DnsSettings(applied_dns_servers=[], dns_servers=[]) network_interface_json_format_instance.dns_settings = dns_settings_instance dns_servers_array = dns_settings_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dns_settings_instance.dns_servers.append(dns_servers_value) applied_dns_servers_array = dns_settings_value.get('appliedDnsServers', None) if applied_dns_servers_array is not None: for applied_dns_servers_value in applied_dns_servers_array: dns_settings_instance.applied_dns_servers.append(applied_dns_servers_value) mac_address_value = properties_value.get('macAddress', None) if mac_address_value is not None: mac_address_instance = mac_address_value network_interface_json_format_instance.mac_address = mac_address_instance primary_value = properties_value.get('primary', None) if primary_value is not None: primary_instance = primary_value network_interface_json_format_instance.primary = primary_instance provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 network_interface_json_format_instance.provisioning_state = provisioning_state_instance2 etag_value2 = value_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 network_interface_json_format_instance.etag = etag_instance2 id_value8 = value_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 network_interface_json_format_instance.id = id_instance8 name_value2 = value_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 network_interface_json_format_instance.name = name_instance2 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value network_interface_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value network_interface_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_interface_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class NetworkSecurityGroupOperations(object): """ The Network Resource Provider API includes operations for managing the NetworkSecurityGroups for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, network_security_group_name, parameters): """ The Put NetworkSecurityGroup operation creates/updates a network security groupin the specified resource group. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. parameters (NetworkSecurityGroup): Parameters supplied to the create/update Network Security Group operation Returns: NetworkSecurityGroupPutResponse: Response for PUT NetworkSecurityGroups Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.default_security_rules is not None: for default_security_rules_parameter_item in parameters.default_security_rules: if default_security_rules_parameter_item.access is None: raise ValueError('parameters.default_security_rules.access cannot be None.') if default_security_rules_parameter_item.destination_address_prefix is None: raise ValueError('parameters.default_security_rules.destination_address_prefix cannot be None.') if default_security_rules_parameter_item.direction is None: raise ValueError('parameters.default_security_rules.direction cannot be None.') if default_security_rules_parameter_item.protocol is None: raise ValueError('parameters.default_security_rules.protocol cannot be None.') if default_security_rules_parameter_item.source_address_prefix is None: raise ValueError('parameters.default_security_rules.source_address_prefix cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') if parameters.security_rules is not None: for security_rules_parameter_item in parameters.security_rules: if security_rules_parameter_item.access is None: raise ValueError('parameters.security_rules.access cannot be None.') if security_rules_parameter_item.destination_address_prefix is None: raise ValueError('parameters.security_rules.destination_address_prefix cannot be None.') if security_rules_parameter_item.direction is None: raise ValueError('parameters.security_rules.direction cannot be None.') if security_rules_parameter_item.protocol is None: raise ValueError('parameters.security_rules.protocol cannot be None.') if security_rules_parameter_item.source_address_prefix is None: raise ValueError('parameters.security_rules.source_address_prefix cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None network_security_group_json_format_value = {} request_doc = network_security_group_json_format_value properties_value = {} network_security_group_json_format_value['properties'] = properties_value if parameters.security_rules is not None: security_rules_array = [] for security_rules_item in parameters.security_rules: security_rule_json_format_value = {} security_rules_array.append(security_rule_json_format_value) properties_value2 = {} security_rule_json_format_value['properties'] = properties_value2 if security_rules_item.description is not None: properties_value2['description'] = security_rules_item.description properties_value2['protocol'] = security_rules_item.protocol if security_rules_item.source_port_range is not None: properties_value2['sourcePortRange'] = security_rules_item.source_port_range if security_rules_item.destination_port_range is not None: properties_value2['destinationPortRange'] = security_rules_item.destination_port_range properties_value2['sourceAddressPrefix'] = security_rules_item.source_address_prefix properties_value2['destinationAddressPrefix'] = security_rules_item.destination_address_prefix properties_value2['access'] = security_rules_item.access if security_rules_item.priority is not None: properties_value2['priority'] = security_rules_item.priority properties_value2['direction'] = security_rules_item.direction if security_rules_item.provisioning_state is not None: properties_value2['provisioningState'] = security_rules_item.provisioning_state if security_rules_item.name is not None: security_rule_json_format_value['name'] = security_rules_item.name if security_rules_item.etag is not None: security_rule_json_format_value['etag'] = security_rules_item.etag if security_rules_item.id is not None: security_rule_json_format_value['id'] = security_rules_item.id properties_value['securityRules'] = security_rules_array if parameters.default_security_rules is not None: default_security_rules_array = [] for default_security_rules_item in parameters.default_security_rules: security_rule_json_format_value2 = {} default_security_rules_array.append(security_rule_json_format_value2) properties_value3 = {} security_rule_json_format_value2['properties'] = properties_value3 if default_security_rules_item.description is not None: properties_value3['description'] = default_security_rules_item.description properties_value3['protocol'] = default_security_rules_item.protocol if default_security_rules_item.source_port_range is not None: properties_value3['sourcePortRange'] = default_security_rules_item.source_port_range if default_security_rules_item.destination_port_range is not None: properties_value3['destinationPortRange'] = default_security_rules_item.destination_port_range properties_value3['sourceAddressPrefix'] = default_security_rules_item.source_address_prefix properties_value3['destinationAddressPrefix'] = default_security_rules_item.destination_address_prefix properties_value3['access'] = default_security_rules_item.access if default_security_rules_item.priority is not None: properties_value3['priority'] = default_security_rules_item.priority properties_value3['direction'] = default_security_rules_item.direction if default_security_rules_item.provisioning_state is not None: properties_value3['provisioningState'] = default_security_rules_item.provisioning_state if default_security_rules_item.name is not None: security_rule_json_format_value2['name'] = default_security_rules_item.name if default_security_rules_item.etag is not None: security_rule_json_format_value2['etag'] = default_security_rules_item.etag if default_security_rules_item.id is not None: security_rule_json_format_value2['id'] = default_security_rules_item.id properties_value['defaultSecurityRules'] = default_security_rules_array if parameters.network_interfaces is not None: network_interfaces_array = [] for network_interfaces_item in parameters.network_interfaces: resource_id_value = {} network_interfaces_array.append(resource_id_value) if network_interfaces_item.id is not None: resource_id_value['id'] = network_interfaces_item.id properties_value['networkInterfaces'] = network_interfaces_array if parameters.subnets is not None: subnets_array = [] for subnets_item in parameters.subnets: resource_id_value2 = {} subnets_array.append(resource_id_value2) if subnets_item.id is not None: resource_id_value2['id'] = subnets_item.id properties_value['subnets'] = subnets_array if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: network_security_group_json_format_value['etag'] = parameters.etag if parameters.id is not None: network_security_group_json_format_value['id'] = parameters.id if parameters.name is not None: network_security_group_json_format_value['name'] = parameters.name if parameters.type is not None: network_security_group_json_format_value['type'] = parameters.type network_security_group_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value network_security_group_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = NetworkSecurityGroupPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: network_security_group_instance = NetworkSecurityGroup(default_security_rules=[], network_interfaces=[], security_rules=[], subnets=[], tags={}) result.network_security_group = network_security_group_instance properties_value4 = response_doc.get('properties', None) if properties_value4 is not None: security_rules_array2 = properties_value4.get('securityRules', None) if security_rules_array2 is not None: for security_rules_value in security_rules_array2: security_rule_json_format_instance = SecurityRule() network_security_group_instance.security_rules.append(security_rule_json_format_instance) properties_value5 = security_rules_value.get('properties', None) if properties_value5 is not None: description_value = properties_value5.get('description', None) if description_value is not None: description_instance = description_value security_rule_json_format_instance.description = description_instance protocol_value = properties_value5.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_json_format_instance.protocol = protocol_instance source_port_range_value = properties_value5.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_json_format_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value5.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_json_format_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value5.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_json_format_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value5.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_json_format_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value5.get('access', None) if access_value is not None: access_instance = access_value security_rule_json_format_instance.access = access_instance priority_value = properties_value5.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_json_format_instance.priority = priority_instance direction_value = properties_value5.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_json_format_instance.direction = direction_instance provisioning_state_value = properties_value5.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_json_format_instance.provisioning_state = provisioning_state_instance name_value = security_rules_value.get('name', None) if name_value is not None: name_instance = name_value security_rule_json_format_instance.name = name_instance etag_value = security_rules_value.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_json_format_instance.etag = etag_instance id_value = security_rules_value.get('id', None) if id_value is not None: id_instance = id_value security_rule_json_format_instance.id = id_instance default_security_rules_array2 = properties_value4.get('defaultSecurityRules', None) if default_security_rules_array2 is not None: for default_security_rules_value in default_security_rules_array2: security_rule_json_format_instance2 = SecurityRule() network_security_group_instance.default_security_rules.append(security_rule_json_format_instance2) properties_value6 = default_security_rules_value.get('properties', None) if properties_value6 is not None: description_value2 = properties_value6.get('description', None) if description_value2 is not None: description_instance2 = description_value2 security_rule_json_format_instance2.description = description_instance2 protocol_value2 = properties_value6.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 security_rule_json_format_instance2.protocol = protocol_instance2 source_port_range_value2 = properties_value6.get('sourcePortRange', None) if source_port_range_value2 is not None: source_port_range_instance2 = source_port_range_value2 security_rule_json_format_instance2.source_port_range = source_port_range_instance2 destination_port_range_value2 = properties_value6.get('destinationPortRange', None) if destination_port_range_value2 is not None: destination_port_range_instance2 = destination_port_range_value2 security_rule_json_format_instance2.destination_port_range = destination_port_range_instance2 source_address_prefix_value2 = properties_value6.get('sourceAddressPrefix', None) if source_address_prefix_value2 is not None: source_address_prefix_instance2 = source_address_prefix_value2 security_rule_json_format_instance2.source_address_prefix = source_address_prefix_instance2 destination_address_prefix_value2 = properties_value6.get('destinationAddressPrefix', None) if destination_address_prefix_value2 is not None: destination_address_prefix_instance2 = destination_address_prefix_value2 security_rule_json_format_instance2.destination_address_prefix = destination_address_prefix_instance2 access_value2 = properties_value6.get('access', None) if access_value2 is not None: access_instance2 = access_value2 security_rule_json_format_instance2.access = access_instance2 priority_value2 = properties_value6.get('priority', None) if priority_value2 is not None: priority_instance2 = priority_value2 security_rule_json_format_instance2.priority = priority_instance2 direction_value2 = properties_value6.get('direction', None) if direction_value2 is not None: direction_instance2 = direction_value2 security_rule_json_format_instance2.direction = direction_instance2 provisioning_state_value2 = properties_value6.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 security_rule_json_format_instance2.provisioning_state = provisioning_state_instance2 name_value2 = default_security_rules_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 security_rule_json_format_instance2.name = name_instance2 etag_value2 = default_security_rules_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 security_rule_json_format_instance2.etag = etag_instance2 id_value2 = default_security_rules_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 security_rule_json_format_instance2.id = id_instance2 network_interfaces_array2 = properties_value4.get('networkInterfaces', None) if network_interfaces_array2 is not None: for network_interfaces_value in network_interfaces_array2: resource_id_instance = ResourceId() network_security_group_instance.network_interfaces.append(resource_id_instance) id_value3 = network_interfaces_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 subnets_array2 = properties_value4.get('subnets', None) if subnets_array2 is not None: for subnets_value in subnets_array2: resource_id_instance2 = ResourceId() network_security_group_instance.subnets.append(resource_id_instance2) id_value4 = subnets_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value3 = properties_value4.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 network_security_group_instance.provisioning_state = provisioning_state_instance3 etag_value3 = response_doc.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 network_security_group_instance.etag = etag_instance3 id_value5 = response_doc.get('id', None) if id_value5 is not None: id_instance5 = id_value5 network_security_group_instance.id = id_instance5 name_value3 = response_doc.get('name', None) if name_value3 is not None: name_instance3 = name_value3 network_security_group_instance.name = name_instance3 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value network_security_group_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value network_security_group_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] network_security_group_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, network_security_group_name): """ The Delete NetworkSecurityGroup operation deletes the specifed network security group Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, network_security_group_name, parameters): """ The Put NetworkSecurityGroup operation creates/updates a network security groupin the specified resource group. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. parameters (NetworkSecurityGroup): Parameters supplied to the create/update Network Security Group operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.network_security_groups.begin_create_or_updating(resource_group_name, network_security_group_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, network_security_group_name): """ The Delete NetworkSecurityGroup operation deletes the specifed network security group Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.network_security_groups.begin_deleting(resource_group_name, network_security_group_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, network_security_group_name): """ The Get NetworkSecurityGroups operation retrieves information about the specified network security group. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. Returns: NetworkSecurityGroupGetResponse: Response for GetNetworkSecurityGroup Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkSecurityGroupGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: network_security_group_instance = NetworkSecurityGroup(default_security_rules=[], network_interfaces=[], security_rules=[], subnets=[], tags={}) result.network_security_group = network_security_group_instance properties_value = response_doc.get('properties', None) if properties_value is not None: security_rules_array = properties_value.get('securityRules', None) if security_rules_array is not None: for security_rules_value in security_rules_array: security_rule_json_format_instance = SecurityRule() network_security_group_instance.security_rules.append(security_rule_json_format_instance) properties_value2 = security_rules_value.get('properties', None) if properties_value2 is not None: description_value = properties_value2.get('description', None) if description_value is not None: description_instance = description_value security_rule_json_format_instance.description = description_instance protocol_value = properties_value2.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_json_format_instance.protocol = protocol_instance source_port_range_value = properties_value2.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_json_format_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value2.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_json_format_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value2.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_json_format_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value2.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_json_format_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value2.get('access', None) if access_value is not None: access_instance = access_value security_rule_json_format_instance.access = access_instance priority_value = properties_value2.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_json_format_instance.priority = priority_instance direction_value = properties_value2.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_json_format_instance.direction = direction_instance provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_json_format_instance.provisioning_state = provisioning_state_instance name_value = security_rules_value.get('name', None) if name_value is not None: name_instance = name_value security_rule_json_format_instance.name = name_instance etag_value = security_rules_value.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_json_format_instance.etag = etag_instance id_value = security_rules_value.get('id', None) if id_value is not None: id_instance = id_value security_rule_json_format_instance.id = id_instance default_security_rules_array = properties_value.get('defaultSecurityRules', None) if default_security_rules_array is not None: for default_security_rules_value in default_security_rules_array: security_rule_json_format_instance2 = SecurityRule() network_security_group_instance.default_security_rules.append(security_rule_json_format_instance2) properties_value3 = default_security_rules_value.get('properties', None) if properties_value3 is not None: description_value2 = properties_value3.get('description', None) if description_value2 is not None: description_instance2 = description_value2 security_rule_json_format_instance2.description = description_instance2 protocol_value2 = properties_value3.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 security_rule_json_format_instance2.protocol = protocol_instance2 source_port_range_value2 = properties_value3.get('sourcePortRange', None) if source_port_range_value2 is not None: source_port_range_instance2 = source_port_range_value2 security_rule_json_format_instance2.source_port_range = source_port_range_instance2 destination_port_range_value2 = properties_value3.get('destinationPortRange', None) if destination_port_range_value2 is not None: destination_port_range_instance2 = destination_port_range_value2 security_rule_json_format_instance2.destination_port_range = destination_port_range_instance2 source_address_prefix_value2 = properties_value3.get('sourceAddressPrefix', None) if source_address_prefix_value2 is not None: source_address_prefix_instance2 = source_address_prefix_value2 security_rule_json_format_instance2.source_address_prefix = source_address_prefix_instance2 destination_address_prefix_value2 = properties_value3.get('destinationAddressPrefix', None) if destination_address_prefix_value2 is not None: destination_address_prefix_instance2 = destination_address_prefix_value2 security_rule_json_format_instance2.destination_address_prefix = destination_address_prefix_instance2 access_value2 = properties_value3.get('access', None) if access_value2 is not None: access_instance2 = access_value2 security_rule_json_format_instance2.access = access_instance2 priority_value2 = properties_value3.get('priority', None) if priority_value2 is not None: priority_instance2 = priority_value2 security_rule_json_format_instance2.priority = priority_instance2 direction_value2 = properties_value3.get('direction', None) if direction_value2 is not None: direction_instance2 = direction_value2 security_rule_json_format_instance2.direction = direction_instance2 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 security_rule_json_format_instance2.provisioning_state = provisioning_state_instance2 name_value2 = default_security_rules_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 security_rule_json_format_instance2.name = name_instance2 etag_value2 = default_security_rules_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 security_rule_json_format_instance2.etag = etag_instance2 id_value2 = default_security_rules_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 security_rule_json_format_instance2.id = id_instance2 network_interfaces_array = properties_value.get('networkInterfaces', None) if network_interfaces_array is not None: for network_interfaces_value in network_interfaces_array: resource_id_instance = ResourceId() network_security_group_instance.network_interfaces.append(resource_id_instance) id_value3 = network_interfaces_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: resource_id_instance2 = ResourceId() network_security_group_instance.subnets.append(resource_id_instance2) id_value4 = subnets_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value3 = properties_value.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 network_security_group_instance.provisioning_state = provisioning_state_instance3 etag_value3 = response_doc.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 network_security_group_instance.etag = etag_instance3 id_value5 = response_doc.get('id', None) if id_value5 is not None: id_instance5 = id_value5 network_security_group_instance.id = id_instance5 name_value3 = response_doc.get('name', None) if name_value3 is not None: name_instance3 = name_value3 network_security_group_instance.name = name_instance3 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value network_security_group_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value network_security_group_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_security_group_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The list NetworkSecurityGroups returns all network security groups in a resource group Args: resource_group_name (string): The name of the resource group. Returns: NetworkSecurityGroupListResponse: Response for ListNetworkSecurityGroups Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkSecurityGroupListResponse(network_security_groups=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: network_security_group_json_format_instance = NetworkSecurityGroup(default_security_rules=[], network_interfaces=[], security_rules=[], subnets=[], tags={}) result.network_security_groups.append(network_security_group_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: security_rules_array = properties_value.get('securityRules', None) if security_rules_array is not None: for security_rules_value in security_rules_array: security_rule_json_format_instance = SecurityRule() network_security_group_json_format_instance.security_rules.append(security_rule_json_format_instance) properties_value2 = security_rules_value.get('properties', None) if properties_value2 is not None: description_value = properties_value2.get('description', None) if description_value is not None: description_instance = description_value security_rule_json_format_instance.description = description_instance protocol_value = properties_value2.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_json_format_instance.protocol = protocol_instance source_port_range_value = properties_value2.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_json_format_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value2.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_json_format_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value2.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_json_format_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value2.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_json_format_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value2.get('access', None) if access_value is not None: access_instance = access_value security_rule_json_format_instance.access = access_instance priority_value = properties_value2.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_json_format_instance.priority = priority_instance direction_value = properties_value2.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_json_format_instance.direction = direction_instance provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_json_format_instance.provisioning_state = provisioning_state_instance name_value = security_rules_value.get('name', None) if name_value is not None: name_instance = name_value security_rule_json_format_instance.name = name_instance etag_value = security_rules_value.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_json_format_instance.etag = etag_instance id_value = security_rules_value.get('id', None) if id_value is not None: id_instance = id_value security_rule_json_format_instance.id = id_instance default_security_rules_array = properties_value.get('defaultSecurityRules', None) if default_security_rules_array is not None: for default_security_rules_value in default_security_rules_array: security_rule_json_format_instance2 = SecurityRule() network_security_group_json_format_instance.default_security_rules.append(security_rule_json_format_instance2) properties_value3 = default_security_rules_value.get('properties', None) if properties_value3 is not None: description_value2 = properties_value3.get('description', None) if description_value2 is not None: description_instance2 = description_value2 security_rule_json_format_instance2.description = description_instance2 protocol_value2 = properties_value3.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 security_rule_json_format_instance2.protocol = protocol_instance2 source_port_range_value2 = properties_value3.get('sourcePortRange', None) if source_port_range_value2 is not None: source_port_range_instance2 = source_port_range_value2 security_rule_json_format_instance2.source_port_range = source_port_range_instance2 destination_port_range_value2 = properties_value3.get('destinationPortRange', None) if destination_port_range_value2 is not None: destination_port_range_instance2 = destination_port_range_value2 security_rule_json_format_instance2.destination_port_range = destination_port_range_instance2 source_address_prefix_value2 = properties_value3.get('sourceAddressPrefix', None) if source_address_prefix_value2 is not None: source_address_prefix_instance2 = source_address_prefix_value2 security_rule_json_format_instance2.source_address_prefix = source_address_prefix_instance2 destination_address_prefix_value2 = properties_value3.get('destinationAddressPrefix', None) if destination_address_prefix_value2 is not None: destination_address_prefix_instance2 = destination_address_prefix_value2 security_rule_json_format_instance2.destination_address_prefix = destination_address_prefix_instance2 access_value2 = properties_value3.get('access', None) if access_value2 is not None: access_instance2 = access_value2 security_rule_json_format_instance2.access = access_instance2 priority_value2 = properties_value3.get('priority', None) if priority_value2 is not None: priority_instance2 = priority_value2 security_rule_json_format_instance2.priority = priority_instance2 direction_value2 = properties_value3.get('direction', None) if direction_value2 is not None: direction_instance2 = direction_value2 security_rule_json_format_instance2.direction = direction_instance2 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 security_rule_json_format_instance2.provisioning_state = provisioning_state_instance2 name_value2 = default_security_rules_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 security_rule_json_format_instance2.name = name_instance2 etag_value2 = default_security_rules_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 security_rule_json_format_instance2.etag = etag_instance2 id_value2 = default_security_rules_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 security_rule_json_format_instance2.id = id_instance2 network_interfaces_array = properties_value.get('networkInterfaces', None) if network_interfaces_array is not None: for network_interfaces_value in network_interfaces_array: resource_id_instance = ResourceId() network_security_group_json_format_instance.network_interfaces.append(resource_id_instance) id_value3 = network_interfaces_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: resource_id_instance2 = ResourceId() network_security_group_json_format_instance.subnets.append(resource_id_instance2) id_value4 = subnets_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value3 = properties_value.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 network_security_group_json_format_instance.provisioning_state = provisioning_state_instance3 etag_value3 = value_value.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 network_security_group_json_format_instance.etag = etag_instance3 id_value5 = value_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 network_security_group_json_format_instance.id = id_instance5 name_value3 = value_value.get('name', None) if name_value3 is not None: name_instance3 = name_value3 network_security_group_json_format_instance.name = name_instance3 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value network_security_group_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value network_security_group_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_security_group_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list_all(self): """ The list NetworkSecurityGroups returns all network security groups in a subscription Returns: NetworkSecurityGroupListResponse: Response for ListNetworkSecurityGroups Api servive call """ # Validate # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = NetworkSecurityGroupListResponse(network_security_groups=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: network_security_group_json_format_instance = NetworkSecurityGroup(default_security_rules=[], network_interfaces=[], security_rules=[], subnets=[], tags={}) result.network_security_groups.append(network_security_group_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: security_rules_array = properties_value.get('securityRules', None) if security_rules_array is not None: for security_rules_value in security_rules_array: security_rule_json_format_instance = SecurityRule() network_security_group_json_format_instance.security_rules.append(security_rule_json_format_instance) properties_value2 = security_rules_value.get('properties', None) if properties_value2 is not None: description_value = properties_value2.get('description', None) if description_value is not None: description_instance = description_value security_rule_json_format_instance.description = description_instance protocol_value = properties_value2.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_json_format_instance.protocol = protocol_instance source_port_range_value = properties_value2.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_json_format_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value2.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_json_format_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value2.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_json_format_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value2.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_json_format_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value2.get('access', None) if access_value is not None: access_instance = access_value security_rule_json_format_instance.access = access_instance priority_value = properties_value2.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_json_format_instance.priority = priority_instance direction_value = properties_value2.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_json_format_instance.direction = direction_instance provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_json_format_instance.provisioning_state = provisioning_state_instance name_value = security_rules_value.get('name', None) if name_value is not None: name_instance = name_value security_rule_json_format_instance.name = name_instance etag_value = security_rules_value.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_json_format_instance.etag = etag_instance id_value = security_rules_value.get('id', None) if id_value is not None: id_instance = id_value security_rule_json_format_instance.id = id_instance default_security_rules_array = properties_value.get('defaultSecurityRules', None) if default_security_rules_array is not None: for default_security_rules_value in default_security_rules_array: security_rule_json_format_instance2 = SecurityRule() network_security_group_json_format_instance.default_security_rules.append(security_rule_json_format_instance2) properties_value3 = default_security_rules_value.get('properties', None) if properties_value3 is not None: description_value2 = properties_value3.get('description', None) if description_value2 is not None: description_instance2 = description_value2 security_rule_json_format_instance2.description = description_instance2 protocol_value2 = properties_value3.get('protocol', None) if protocol_value2 is not None: protocol_instance2 = protocol_value2 security_rule_json_format_instance2.protocol = protocol_instance2 source_port_range_value2 = properties_value3.get('sourcePortRange', None) if source_port_range_value2 is not None: source_port_range_instance2 = source_port_range_value2 security_rule_json_format_instance2.source_port_range = source_port_range_instance2 destination_port_range_value2 = properties_value3.get('destinationPortRange', None) if destination_port_range_value2 is not None: destination_port_range_instance2 = destination_port_range_value2 security_rule_json_format_instance2.destination_port_range = destination_port_range_instance2 source_address_prefix_value2 = properties_value3.get('sourceAddressPrefix', None) if source_address_prefix_value2 is not None: source_address_prefix_instance2 = source_address_prefix_value2 security_rule_json_format_instance2.source_address_prefix = source_address_prefix_instance2 destination_address_prefix_value2 = properties_value3.get('destinationAddressPrefix', None) if destination_address_prefix_value2 is not None: destination_address_prefix_instance2 = destination_address_prefix_value2 security_rule_json_format_instance2.destination_address_prefix = destination_address_prefix_instance2 access_value2 = properties_value3.get('access', None) if access_value2 is not None: access_instance2 = access_value2 security_rule_json_format_instance2.access = access_instance2 priority_value2 = properties_value3.get('priority', None) if priority_value2 is not None: priority_instance2 = priority_value2 security_rule_json_format_instance2.priority = priority_instance2 direction_value2 = properties_value3.get('direction', None) if direction_value2 is not None: direction_instance2 = direction_value2 security_rule_json_format_instance2.direction = direction_instance2 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 security_rule_json_format_instance2.provisioning_state = provisioning_state_instance2 name_value2 = default_security_rules_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 security_rule_json_format_instance2.name = name_instance2 etag_value2 = default_security_rules_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 security_rule_json_format_instance2.etag = etag_instance2 id_value2 = default_security_rules_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 security_rule_json_format_instance2.id = id_instance2 network_interfaces_array = properties_value.get('networkInterfaces', None) if network_interfaces_array is not None: for network_interfaces_value in network_interfaces_array: resource_id_instance = ResourceId() network_security_group_json_format_instance.network_interfaces.append(resource_id_instance) id_value3 = network_interfaces_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 resource_id_instance.id = id_instance3 subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: resource_id_instance2 = ResourceId() network_security_group_json_format_instance.subnets.append(resource_id_instance2) id_value4 = subnets_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 resource_id_instance2.id = id_instance4 provisioning_state_value3 = properties_value.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 network_security_group_json_format_instance.provisioning_state = provisioning_state_instance3 etag_value3 = value_value.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 network_security_group_json_format_instance.etag = etag_instance3 id_value5 = value_value.get('id', None) if id_value5 is not None: id_instance5 = id_value5 network_security_group_json_format_instance.id = id_instance5 name_value3 = value_value.get('name', None) if name_value3 is not None: name_instance3 = name_value3 network_security_group_json_format_instance.name = name_instance3 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value network_security_group_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value network_security_group_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] network_security_group_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class PublicIpAddressOperations(object): """ The Network Resource Provider API includes operations for managing the PublicIPAddress for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, public_ip_address_name, parameters): """ The Put PublicIPAddress operation creates/updates a stable/dynamic PublicIP address Args: resource_group_name (string): The name of the resource group. public_ip_address_name (string): The name of the publicIpAddress. parameters (PublicIpAddress): Parameters supplied to the create/update PublicIPAddress operation Returns: PublicIpAddressPutResponse: Response for PutPublicIpAddress Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if public_ip_address_name is None: raise ValueError('public_ip_address_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') if parameters.public_ip_allocation_method is None: raise ValueError('parameters.public_ip_allocation_method cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/publicIPAddresses/' url = url + quote(public_ip_address_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None public_ip_address_json_format_value = {} request_doc = public_ip_address_json_format_value properties_value = {} public_ip_address_json_format_value['properties'] = properties_value properties_value['publicIPAllocationMethod'] = parameters.public_ip_allocation_method if parameters.ip_configuration is not None: ip_configuration_value = {} properties_value['ipConfiguration'] = ip_configuration_value if parameters.ip_configuration.id is not None: ip_configuration_value['id'] = parameters.ip_configuration.id if parameters.dns_settings is not None: dns_settings_value = {} properties_value['dnsSettings'] = dns_settings_value if parameters.dns_settings.domain_name_label is not None: dns_settings_value['domainNameLabel'] = parameters.dns_settings.domain_name_label if parameters.dns_settings.fqdn is not None: dns_settings_value['fqdn'] = parameters.dns_settings.fqdn if parameters.dns_settings.reverse_fqdn is not None: dns_settings_value['reverseFqdn'] = parameters.dns_settings.reverse_fqdn if parameters.ip_address is not None: properties_value['ipAddress'] = parameters.ip_address if parameters.idle_timeout_in_minutes is not None: properties_value['idleTimeoutInMinutes'] = parameters.idle_timeout_in_minutes if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: public_ip_address_json_format_value['etag'] = parameters.etag if parameters.id is not None: public_ip_address_json_format_value['id'] = parameters.id if parameters.name is not None: public_ip_address_json_format_value['name'] = parameters.name if parameters.type is not None: public_ip_address_json_format_value['type'] = parameters.type public_ip_address_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value public_ip_address_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = PublicIpAddressPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: public_ip_address_instance = PublicIpAddress(tags={}) result.public_ip_address = public_ip_address_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: public_ip_allocation_method_value = properties_value2.get('publicIPAllocationMethod', None) if public_ip_allocation_method_value is not None: public_ip_allocation_method_instance = public_ip_allocation_method_value public_ip_address_instance.public_ip_allocation_method = public_ip_allocation_method_instance ip_configuration_value2 = properties_value2.get('ipConfiguration', None) if ip_configuration_value2 is not None: ip_configuration_instance = ResourceId() public_ip_address_instance.ip_configuration = ip_configuration_instance id_value = ip_configuration_value2.get('id', None) if id_value is not None: id_instance = id_value ip_configuration_instance.id = id_instance dns_settings_value2 = properties_value2.get('dnsSettings', None) if dns_settings_value2 is not None: dns_settings_instance = PublicIpAddressDnsSettings() public_ip_address_instance.dns_settings = dns_settings_instance domain_name_label_value = dns_settings_value2.get('domainNameLabel', None) if domain_name_label_value is not None: domain_name_label_instance = domain_name_label_value dns_settings_instance.domain_name_label = domain_name_label_instance fqdn_value = dns_settings_value2.get('fqdn', None) if fqdn_value is not None: fqdn_instance = fqdn_value dns_settings_instance.fqdn = fqdn_instance reverse_fqdn_value = dns_settings_value2.get('reverseFqdn', None) if reverse_fqdn_value is not None: reverse_fqdn_instance = reverse_fqdn_value dns_settings_instance.reverse_fqdn = reverse_fqdn_instance ip_address_value = properties_value2.get('ipAddress', None) if ip_address_value is not None: ip_address_instance = ip_address_value public_ip_address_instance.ip_address = ip_address_instance idle_timeout_in_minutes_value = properties_value2.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value public_ip_address_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value public_ip_address_instance.provisioning_state = provisioning_state_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value public_ip_address_instance.etag = etag_instance id_value2 = response_doc.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value public_ip_address_instance.name = name_instance type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value public_ip_address_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value public_ip_address_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] public_ip_address_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, public_ip_address_name): """ The delete publicIpAddress operation deletes the specified publicIpAddress. Args: resource_group_name (string): The name of the resource group. public_ip_address_name (string): The name of the subnet. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if public_ip_address_name is None: raise ValueError('public_ip_address_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/publicIPAddresses/' url = url + quote(public_ip_address_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, public_ip_address_name, parameters): """ The Put PublicIPAddress operation creates/updates a stable/dynamic PublicIP address Args: resource_group_name (string): The name of the resource group. public_ip_address_name (string): The name of the publicIpAddress. parameters (PublicIpAddress): Parameters supplied to the create PublicIPAddress operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.public_ip_addresses.begin_create_or_updating(resource_group_name, public_ip_address_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, public_ip_address_name): """ The Get Role operation retrieves information about the specified virtual machine. Args: resource_group_name (string): The name of the resource group. public_ip_address_name (string): The name of the subnet. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.public_ip_addresses.begin_deleting(resource_group_name, public_ip_address_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, public_ip_address_name): """ The Get publicIpAddress operation retreives information about the specified pubicIpAddress Args: resource_group_name (string): The name of the resource group. public_ip_address_name (string): The name of the subnet. Returns: PublicIpAddressGetResponse: Response for GetPublicIpAddress Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if public_ip_address_name is None: raise ValueError('public_ip_address_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/publicIPAddresses/' url = url + quote(public_ip_address_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = PublicIpAddressGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: public_ip_address_instance = PublicIpAddress(tags={}) result.public_ip_address = public_ip_address_instance properties_value = response_doc.get('properties', None) if properties_value is not None: public_ip_allocation_method_value = properties_value.get('publicIPAllocationMethod', None) if public_ip_allocation_method_value is not None: public_ip_allocation_method_instance = public_ip_allocation_method_value public_ip_address_instance.public_ip_allocation_method = public_ip_allocation_method_instance ip_configuration_value = properties_value.get('ipConfiguration', None) if ip_configuration_value is not None: ip_configuration_instance = ResourceId() public_ip_address_instance.ip_configuration = ip_configuration_instance id_value = ip_configuration_value.get('id', None) if id_value is not None: id_instance = id_value ip_configuration_instance.id = id_instance dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = PublicIpAddressDnsSettings() public_ip_address_instance.dns_settings = dns_settings_instance domain_name_label_value = dns_settings_value.get('domainNameLabel', None) if domain_name_label_value is not None: domain_name_label_instance = domain_name_label_value dns_settings_instance.domain_name_label = domain_name_label_instance fqdn_value = dns_settings_value.get('fqdn', None) if fqdn_value is not None: fqdn_instance = fqdn_value dns_settings_instance.fqdn = fqdn_instance reverse_fqdn_value = dns_settings_value.get('reverseFqdn', None) if reverse_fqdn_value is not None: reverse_fqdn_instance = reverse_fqdn_value dns_settings_instance.reverse_fqdn = reverse_fqdn_instance ip_address_value = properties_value.get('ipAddress', None) if ip_address_value is not None: ip_address_instance = ip_address_value public_ip_address_instance.ip_address = ip_address_instance idle_timeout_in_minutes_value = properties_value.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value public_ip_address_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value public_ip_address_instance.provisioning_state = provisioning_state_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value public_ip_address_instance.etag = etag_instance id_value2 = response_doc.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value public_ip_address_instance.name = name_instance type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value public_ip_address_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value public_ip_address_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] public_ip_address_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List publicIpAddress opertion retrieves all the publicIpAddresses in a resource group. Args: resource_group_name (string): The name of the resource group. Returns: PublicIpAddressListResponse: Response for ListPublicIpAddresses Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/publicIPAddresses' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = PublicIpAddressListResponse(public_ip_addresses=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: public_ip_address_json_format_instance = PublicIpAddress(tags={}) result.public_ip_addresses.append(public_ip_address_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: public_ip_allocation_method_value = properties_value.get('publicIPAllocationMethod', None) if public_ip_allocation_method_value is not None: public_ip_allocation_method_instance = public_ip_allocation_method_value public_ip_address_json_format_instance.public_ip_allocation_method = public_ip_allocation_method_instance ip_configuration_value = properties_value.get('ipConfiguration', None) if ip_configuration_value is not None: ip_configuration_instance = ResourceId() public_ip_address_json_format_instance.ip_configuration = ip_configuration_instance id_value = ip_configuration_value.get('id', None) if id_value is not None: id_instance = id_value ip_configuration_instance.id = id_instance dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = PublicIpAddressDnsSettings() public_ip_address_json_format_instance.dns_settings = dns_settings_instance domain_name_label_value = dns_settings_value.get('domainNameLabel', None) if domain_name_label_value is not None: domain_name_label_instance = domain_name_label_value dns_settings_instance.domain_name_label = domain_name_label_instance fqdn_value = dns_settings_value.get('fqdn', None) if fqdn_value is not None: fqdn_instance = fqdn_value dns_settings_instance.fqdn = fqdn_instance reverse_fqdn_value = dns_settings_value.get('reverseFqdn', None) if reverse_fqdn_value is not None: reverse_fqdn_instance = reverse_fqdn_value dns_settings_instance.reverse_fqdn = reverse_fqdn_instance ip_address_value = properties_value.get('ipAddress', None) if ip_address_value is not None: ip_address_instance = ip_address_value public_ip_address_json_format_instance.ip_address = ip_address_instance idle_timeout_in_minutes_value = properties_value.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value public_ip_address_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value public_ip_address_json_format_instance.provisioning_state = provisioning_state_instance etag_value = value_value.get('etag', None) if etag_value is not None: etag_instance = etag_value public_ip_address_json_format_instance.etag = etag_instance id_value2 = value_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_json_format_instance.id = id_instance2 name_value = value_value.get('name', None) if name_value is not None: name_instance = name_value public_ip_address_json_format_instance.name = name_instance type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value public_ip_address_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value public_ip_address_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] public_ip_address_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list_all(self): """ The List publicIpAddress opertion retrieves all the publicIpAddresses in a subscription. Returns: PublicIpAddressListResponse: Response for ListPublicIpAddresses Api service call """ # Validate # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/publicIPAddresses' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = PublicIpAddressListResponse(public_ip_addresses=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: public_ip_address_json_format_instance = PublicIpAddress(tags={}) result.public_ip_addresses.append(public_ip_address_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: public_ip_allocation_method_value = properties_value.get('publicIPAllocationMethod', None) if public_ip_allocation_method_value is not None: public_ip_allocation_method_instance = public_ip_allocation_method_value public_ip_address_json_format_instance.public_ip_allocation_method = public_ip_allocation_method_instance ip_configuration_value = properties_value.get('ipConfiguration', None) if ip_configuration_value is not None: ip_configuration_instance = ResourceId() public_ip_address_json_format_instance.ip_configuration = ip_configuration_instance id_value = ip_configuration_value.get('id', None) if id_value is not None: id_instance = id_value ip_configuration_instance.id = id_instance dns_settings_value = properties_value.get('dnsSettings', None) if dns_settings_value is not None: dns_settings_instance = PublicIpAddressDnsSettings() public_ip_address_json_format_instance.dns_settings = dns_settings_instance domain_name_label_value = dns_settings_value.get('domainNameLabel', None) if domain_name_label_value is not None: domain_name_label_instance = domain_name_label_value dns_settings_instance.domain_name_label = domain_name_label_instance fqdn_value = dns_settings_value.get('fqdn', None) if fqdn_value is not None: fqdn_instance = fqdn_value dns_settings_instance.fqdn = fqdn_instance reverse_fqdn_value = dns_settings_value.get('reverseFqdn', None) if reverse_fqdn_value is not None: reverse_fqdn_instance = reverse_fqdn_value dns_settings_instance.reverse_fqdn = reverse_fqdn_instance ip_address_value = properties_value.get('ipAddress', None) if ip_address_value is not None: ip_address_instance = ip_address_value public_ip_address_json_format_instance.ip_address = ip_address_instance idle_timeout_in_minutes_value = properties_value.get('idleTimeoutInMinutes', None) if idle_timeout_in_minutes_value is not None: idle_timeout_in_minutes_instance = idle_timeout_in_minutes_value public_ip_address_json_format_instance.idle_timeout_in_minutes = idle_timeout_in_minutes_instance provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value public_ip_address_json_format_instance.provisioning_state = provisioning_state_instance etag_value = value_value.get('etag', None) if etag_value is not None: etag_instance = etag_value public_ip_address_json_format_instance.etag = etag_instance id_value2 = value_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_json_format_instance.id = id_instance2 name_value = value_value.get('name', None) if name_value is not None: name_instance = name_value public_ip_address_json_format_instance.name = name_instance type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value public_ip_address_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value public_ip_address_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] public_ip_address_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class SecurityRuleOperations(object): """ The Network Resource Provider API includes operations for managing the SecurityRules for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters): """ The Put network security rule operation creates/updates a security rule in the specified network security group Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. security_rule_name (string): The name of the security rule. security_rule_parameters (SecurityRule): Parameters supplied to the create/update network security rule operation Returns: SecurityRulePutResponse: Response for PUT SecurityRule Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') if security_rule_name is None: raise ValueError('security_rule_name cannot be None.') if security_rule_parameters is None: raise ValueError('security_rule_parameters cannot be None.') if security_rule_parameters.access is None: raise ValueError('security_rule_parameters.access cannot be None.') if security_rule_parameters.destination_address_prefix is None: raise ValueError('security_rule_parameters.destination_address_prefix cannot be None.') if security_rule_parameters.direction is None: raise ValueError('security_rule_parameters.direction cannot be None.') if security_rule_parameters.protocol is None: raise ValueError('security_rule_parameters.protocol cannot be None.') if security_rule_parameters.source_address_prefix is None: raise ValueError('security_rule_parameters.source_address_prefix cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) url = url + '/securityRules/' url = url + quote(security_rule_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None security_rule_json_format_value = {} request_doc = security_rule_json_format_value properties_value = {} security_rule_json_format_value['properties'] = properties_value if security_rule_parameters.description is not None: properties_value['description'] = security_rule_parameters.description properties_value['protocol'] = security_rule_parameters.protocol if security_rule_parameters.source_port_range is not None: properties_value['sourcePortRange'] = security_rule_parameters.source_port_range if security_rule_parameters.destination_port_range is not None: properties_value['destinationPortRange'] = security_rule_parameters.destination_port_range properties_value['sourceAddressPrefix'] = security_rule_parameters.source_address_prefix properties_value['destinationAddressPrefix'] = security_rule_parameters.destination_address_prefix properties_value['access'] = security_rule_parameters.access if security_rule_parameters.priority is not None: properties_value['priority'] = security_rule_parameters.priority properties_value['direction'] = security_rule_parameters.direction if security_rule_parameters.provisioning_state is not None: properties_value['provisioningState'] = security_rule_parameters.provisioning_state if security_rule_parameters.name is not None: security_rule_json_format_value['name'] = security_rule_parameters.name if security_rule_parameters.etag is not None: security_rule_json_format_value['etag'] = security_rule_parameters.etag if security_rule_parameters.id is not None: security_rule_json_format_value['id'] = security_rule_parameters.id request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = SecurityRulePutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: security_rule_instance = SecurityRule() result.security_rule = security_rule_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: description_value = properties_value2.get('description', None) if description_value is not None: description_instance = description_value security_rule_instance.description = description_instance protocol_value = properties_value2.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_instance.protocol = protocol_instance source_port_range_value = properties_value2.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value2.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value2.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value2.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value2.get('access', None) if access_value is not None: access_instance = access_value security_rule_instance.access = access_instance priority_value = properties_value2.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_instance.priority = priority_instance direction_value = properties_value2.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_instance.direction = direction_instance provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_instance.provisioning_state = provisioning_state_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value security_rule_instance.name = name_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_instance.etag = etag_instance id_value = response_doc.get('id', None) if id_value is not None: id_instance = id_value security_rule_instance.id = id_instance error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, network_security_group_name, security_rule_name): """ The delete network security rule operation deletes the specified network security rule. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. security_rule_name (string): The name of the security rule. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') if security_rule_name is None: raise ValueError('security_rule_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) url = url + '/securityRules/' url = url + quote(security_rule_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters): """ The Put network security rule operation creates/updates a security rule in the specified network security group Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. security_rule_name (string): The name of the security rule. security_rule_parameters (SecurityRule): Parameters supplied to the create/update network security rule operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.security_rules.begin_create_or_updating(resource_group_name, network_security_group_name, security_rule_name, security_rule_parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, network_security_group_name, security_rule_name): """ The delete network security rule operation deletes the specified network security rule. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. security_rule_name (string): The name of the security rule. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.security_rules.begin_deleting(resource_group_name, network_security_group_name, security_rule_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, network_security_group_name, security_rule_name): """ The Get NetworkSecurityRule operation retreives information about the specified network security rule. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. security_rule_name (string): The name of the security rule. Returns: SecurityRuleGetResponse: Response for GetSecurityRule Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') if security_rule_name is None: raise ValueError('security_rule_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) url = url + '/securityRules/' url = url + quote(security_rule_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = SecurityRuleGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: security_rule_instance = SecurityRule() result.security_rule = security_rule_instance properties_value = response_doc.get('properties', None) if properties_value is not None: description_value = properties_value.get('description', None) if description_value is not None: description_instance = description_value security_rule_instance.description = description_instance protocol_value = properties_value.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_instance.protocol = protocol_instance source_port_range_value = properties_value.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value.get('access', None) if access_value is not None: access_instance = access_value security_rule_instance.access = access_instance priority_value = properties_value.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_instance.priority = priority_instance direction_value = properties_value.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_instance.direction = direction_instance provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_instance.provisioning_state = provisioning_state_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value security_rule_instance.name = name_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_instance.etag = etag_instance id_value = response_doc.get('id', None) if id_value is not None: id_instance = id_value security_rule_instance.id = id_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name, network_security_group_name): """ The List network security rule opertion retrieves all the security rules in a network security group. Args: resource_group_name (string): The name of the resource group. network_security_group_name (string): The name of the network security group. Returns: SecurityRuleListResponse: Response for ListSecurityRule Api service callRetrieves all security rules that belongs to a network security group """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if network_security_group_name is None: raise ValueError('network_security_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/networkSecurityGroups/' url = url + quote(network_security_group_name) url = url + '/securityRules' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = SecurityRuleListResponse(security_rules=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: security_rule_json_format_instance = SecurityRule() result.security_rules.append(security_rule_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: description_value = properties_value.get('description', None) if description_value is not None: description_instance = description_value security_rule_json_format_instance.description = description_instance protocol_value = properties_value.get('protocol', None) if protocol_value is not None: protocol_instance = protocol_value security_rule_json_format_instance.protocol = protocol_instance source_port_range_value = properties_value.get('sourcePortRange', None) if source_port_range_value is not None: source_port_range_instance = source_port_range_value security_rule_json_format_instance.source_port_range = source_port_range_instance destination_port_range_value = properties_value.get('destinationPortRange', None) if destination_port_range_value is not None: destination_port_range_instance = destination_port_range_value security_rule_json_format_instance.destination_port_range = destination_port_range_instance source_address_prefix_value = properties_value.get('sourceAddressPrefix', None) if source_address_prefix_value is not None: source_address_prefix_instance = source_address_prefix_value security_rule_json_format_instance.source_address_prefix = source_address_prefix_instance destination_address_prefix_value = properties_value.get('destinationAddressPrefix', None) if destination_address_prefix_value is not None: destination_address_prefix_instance = destination_address_prefix_value security_rule_json_format_instance.destination_address_prefix = destination_address_prefix_instance access_value = properties_value.get('access', None) if access_value is not None: access_instance = access_value security_rule_json_format_instance.access = access_instance priority_value = properties_value.get('priority', None) if priority_value is not None: priority_instance = priority_value security_rule_json_format_instance.priority = priority_instance direction_value = properties_value.get('direction', None) if direction_value is not None: direction_instance = direction_value security_rule_json_format_instance.direction = direction_instance provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value security_rule_json_format_instance.provisioning_state = provisioning_state_instance name_value = value_value.get('name', None) if name_value is not None: name_instance = name_value security_rule_json_format_instance.name = name_instance etag_value = value_value.get('etag', None) if etag_value is not None: etag_instance = etag_value security_rule_json_format_instance.etag = etag_instance id_value = value_value.get('id', None) if id_value is not None: id_instance = id_value security_rule_json_format_instance.id = id_instance next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class SubnetOperations(object): """ The Network Resource Provider API includes operations for managing the subnets for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters): """ The Put Subnet operation creates/updates a subnet in thespecified virtual network Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. subnet_name (string): The name of the subnet. subnet_parameters (Subnet): Parameters supplied to the create/update Subnet operation Returns: SubnetPutResponse: Response for PutSubnet Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') if subnet_name is None: raise ValueError('subnet_name cannot be None.') if subnet_parameters is None: raise ValueError('subnet_parameters cannot be None.') if subnet_parameters.address_prefix is None: raise ValueError('subnet_parameters.address_prefix cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) url = url + '/subnets/' url = url + quote(subnet_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None subnet_json_format_value = {} request_doc = subnet_json_format_value properties_value = {} subnet_json_format_value['properties'] = properties_value properties_value['addressPrefix'] = subnet_parameters.address_prefix if subnet_parameters.network_security_group is not None: network_security_group_value = {} properties_value['networkSecurityGroup'] = network_security_group_value if subnet_parameters.network_security_group.id is not None: network_security_group_value['id'] = subnet_parameters.network_security_group.id if subnet_parameters.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in subnet_parameters.ip_configurations: resource_id_value = {} ip_configurations_array.append(resource_id_value) if ip_configurations_item.id is not None: resource_id_value['id'] = ip_configurations_item.id properties_value['ipConfigurations'] = ip_configurations_array if subnet_parameters.provisioning_state is not None: properties_value['provisioningState'] = subnet_parameters.provisioning_state if subnet_parameters.name is not None: subnet_json_format_value['name'] = subnet_parameters.name if subnet_parameters.etag is not None: subnet_json_format_value['etag'] = subnet_parameters.etag if subnet_parameters.id is not None: subnet_json_format_value['id'] = subnet_parameters.id request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = SubnetPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: subnet_instance = Subnet(ip_configurations=[]) result.subnet = subnet_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: address_prefix_value = properties_value2.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_instance.address_prefix = address_prefix_instance network_security_group_value2 = properties_value2.get('networkSecurityGroup', None) if network_security_group_value2 is not None: network_security_group_instance = ResourceId() subnet_instance.network_security_group = network_security_group_instance id_value = network_security_group_value2.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array2 = properties_value2.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value in ip_configurations_array2: resource_id_instance = ResourceId() subnet_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_instance.provisioning_state = provisioning_state_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value subnet_instance.name = name_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_instance.etag = etag_instance id_value3 = response_doc.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, virtual_network_name, subnet_name): """ The delete subnet operation deletes the specified subnet. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. subnet_name (string): The name of the subnet. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') if subnet_name is None: raise ValueError('subnet_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) url = url + '/subnets/' url = url + quote(subnet_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, virtual_network_name, subnet_name, subnet_parameters): """ The Put Subnet operation creates/updates a subnet in thespecified virtual network Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. subnet_name (string): The name of the subnet. subnet_parameters (Subnet): Parameters supplied to the create/update Subnet operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.subnets.begin_create_or_updating(resource_group_name, virtual_network_name, subnet_name, subnet_parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, virtual_network_name, subnet_name): """ The delete subnet operation deletes the specified subnet. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. subnet_name (string): The name of the subnet. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.subnets.begin_deleting(resource_group_name, virtual_network_name, subnet_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, virtual_network_name, subnet_name): """ The Get subnet operation retreives information about the specified subnet. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. subnet_name (string): The name of the subnet. Returns: SubnetGetResponse: Response for GetSubnet Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') if subnet_name is None: raise ValueError('subnet_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) url = url + '/subnets/' url = url + quote(subnet_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = SubnetGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: subnet_instance = Subnet(ip_configurations=[]) result.subnet = subnet_instance properties_value = response_doc.get('properties', None) if properties_value is not None: address_prefix_value = properties_value.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_instance.address_prefix = address_prefix_instance network_security_group_value = properties_value.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() subnet_instance.network_security_group = network_security_group_instance id_value = network_security_group_value.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: resource_id_instance = ResourceId() subnet_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_instance.provisioning_state = provisioning_state_instance name_value = response_doc.get('name', None) if name_value is not None: name_instance = name_value subnet_instance.name = name_instance etag_value = response_doc.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_instance.etag = etag_instance id_value3 = response_doc.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_instance.id = id_instance3 result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name, virtual_network_name): """ The List subnets opertion retrieves all the subnets in a virtual network. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. Returns: SubnetListResponse: Response for ListSubnets Api service callRetrieves all subnet that belongs to a virtual network """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) url = url + '/subnets' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = SubnetListResponse(subnets=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: subnet_json_format_instance = Subnet(ip_configurations=[]) result.subnets.append(subnet_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: address_prefix_value = properties_value.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_json_format_instance.address_prefix = address_prefix_instance network_security_group_value = properties_value.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() subnet_json_format_instance.network_security_group = network_security_group_instance id_value = network_security_group_value.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: resource_id_instance = ResourceId() subnet_json_format_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_json_format_instance.provisioning_state = provisioning_state_instance name_value = value_value.get('name', None) if name_value is not None: name_instance = name_value subnet_json_format_instance.name = name_instance etag_value = value_value.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_json_format_instance.etag = etag_instance id_value3 = value_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_json_format_instance.id = id_instance3 next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class UsageOperations(object): """ Operations for listing usage. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def list(self, location): """ Lists compute usages for a subscription. Args: location (string): The location upon which resource usage is queried. Returns: UsagesListResponse: The List Usages operation response. """ # Validate if location is None: raise ValueError('location cannot be None.') if location is not None and len(location) > 1000: raise IndexError('location is outside the valid range.') if (re.search('^[-\\w\\._]+$', location) is not None) == False: raise IndexError('location is outside the valid range.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/locations/' url = url + quote(location) url = url + '/usages' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = UsagesListResponse(usages=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: usage_instance = Usage() result.usages.append(usage_instance) unit_value = value_value.get('unit', None) if unit_value is not None: unit_instance = unit_value usage_instance.unit = unit_instance current_value_value = value_value.get('currentValue', None) if current_value_value is not None: current_value_instance = current_value_value usage_instance.current_value = current_value_instance limit_value = value_value.get('limit', None) if limit_value is not None: limit_instance = limit_value usage_instance.limit = limit_instance name_value = value_value.get('name', None) if name_value is not None: name_instance = UsageName() usage_instance.name = name_instance value_value2 = name_value.get('value', None) if value_value2 is not None: value_instance = value_value2 name_instance.value = value_instance localized_value_value = name_value.get('localizedValue', None) if localized_value_value is not None: localized_value_instance = localized_value_value name_instance.localized_value = localized_value_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result class VirtualNetworkGatewayConnectionOperations(object): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The Put VirtualNetworkGatewayConnection operation creates/updates a virtual network gateway connection in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The name of the virtual network gateway conenction. parameters (VirtualNetworkGatewayConnection): Parameters supplied to the Begin Create or update Virtual Network Gateway connection operation through Network resource provider. Returns: VirtualNetworkGatewayConnectionPutResponse: Response for CreateOrUpdateVirtualNetworkGatewayConnection Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_connection_name is None: raise ValueError('virtual_network_gateway_connection_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.local_network_gateway2 is not None: if parameters.local_network_gateway2.location is None: raise ValueError('parameters.local_network_gateway2.location cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') if parameters.virtual_network_gateway1 is not None: if parameters.virtual_network_gateway1.location is None: raise ValueError('parameters.virtual_network_gateway1.location cannot be None.') if parameters.virtual_network_gateway2 is not None: if parameters.virtual_network_gateway2.location is None: raise ValueError('parameters.virtual_network_gateway2.location cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(virtual_network_gateway_connection_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None virtual_network_gateway_connection_json_format_value = {} request_doc = virtual_network_gateway_connection_json_format_value properties_value = {} virtual_network_gateway_connection_json_format_value['properties'] = properties_value if parameters.virtual_network_gateway1 is not None: virtual_network_gateway1_value = {} properties_value['virtualNetworkGateway1'] = virtual_network_gateway1_value if parameters.virtual_network_gateway1.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in parameters.virtual_network_gateway1.ip_configurations: virtual_network_gateway_ip_configuration_value = {} ip_configurations_array.append(virtual_network_gateway_ip_configuration_value) if ip_configurations_item.private_ip_address is not None: virtual_network_gateway_ip_configuration_value['privateIPAddress'] = ip_configurations_item.private_ip_address if ip_configurations_item.private_ip_allocation_method is not None: virtual_network_gateway_ip_configuration_value['privateIPAllocationMethod'] = ip_configurations_item.private_ip_allocation_method if ip_configurations_item.subnet is not None: subnet_value = {} virtual_network_gateway_ip_configuration_value['subnet'] = subnet_value if ip_configurations_item.subnet.id is not None: subnet_value['id'] = ip_configurations_item.subnet.id if ip_configurations_item.public_ip_address is not None: public_ip_address_value = {} virtual_network_gateway_ip_configuration_value['publicIPAddress'] = public_ip_address_value if ip_configurations_item.public_ip_address.id is not None: public_ip_address_value['id'] = ip_configurations_item.public_ip_address.id if ip_configurations_item.provisioning_state is not None: virtual_network_gateway_ip_configuration_value['provisioningState'] = ip_configurations_item.provisioning_state if ip_configurations_item.name is not None: virtual_network_gateway_ip_configuration_value['name'] = ip_configurations_item.name if ip_configurations_item.etag is not None: virtual_network_gateway_ip_configuration_value['etag'] = ip_configurations_item.etag if ip_configurations_item.id is not None: virtual_network_gateway_ip_configuration_value['id'] = ip_configurations_item.id virtual_network_gateway1_value['ipConfigurations'] = ip_configurations_array if parameters.virtual_network_gateway1.gateway_size is not None: virtual_network_gateway1_value['gatewaySize'] = parameters.virtual_network_gateway1.gateway_size if parameters.virtual_network_gateway1.gateway_type is not None: virtual_network_gateway1_value['gatewayType'] = parameters.virtual_network_gateway1.gateway_type if parameters.virtual_network_gateway1.enable_bgp is not None: virtual_network_gateway1_value['enableBgp'] = parameters.virtual_network_gateway1.enable_bgp if parameters.virtual_network_gateway1.provisioning_state is not None: virtual_network_gateway1_value['provisioningState'] = parameters.virtual_network_gateway1.provisioning_state if parameters.virtual_network_gateway1.etag is not None: virtual_network_gateway1_value['etag'] = parameters.virtual_network_gateway1.etag if parameters.virtual_network_gateway1.id is not None: virtual_network_gateway1_value['id'] = parameters.virtual_network_gateway1.id if parameters.virtual_network_gateway1.name is not None: virtual_network_gateway1_value['name'] = parameters.virtual_network_gateway1.name if parameters.virtual_network_gateway1.type is not None: virtual_network_gateway1_value['type'] = parameters.virtual_network_gateway1.type virtual_network_gateway1_value['location'] = parameters.virtual_network_gateway1.location if parameters.virtual_network_gateway1.tags is not None: tags_dictionary = {} for tags_key in parameters.virtual_network_gateway1.tags: tags_value = parameters.virtual_network_gateway1.tags[tags_key] tags_dictionary[tags_key] = tags_value virtual_network_gateway1_value['tags'] = tags_dictionary if parameters.virtual_network_gateway2 is not None: virtual_network_gateway2_value = {} properties_value['virtualNetworkGateway2'] = virtual_network_gateway2_value if parameters.virtual_network_gateway2.ip_configurations is not None: ip_configurations_array2 = [] for ip_configurations_item2 in parameters.virtual_network_gateway2.ip_configurations: virtual_network_gateway_ip_configuration_value2 = {} ip_configurations_array2.append(virtual_network_gateway_ip_configuration_value2) if ip_configurations_item2.private_ip_address is not None: virtual_network_gateway_ip_configuration_value2['privateIPAddress'] = ip_configurations_item2.private_ip_address if ip_configurations_item2.private_ip_allocation_method is not None: virtual_network_gateway_ip_configuration_value2['privateIPAllocationMethod'] = ip_configurations_item2.private_ip_allocation_method if ip_configurations_item2.subnet is not None: subnet_value2 = {} virtual_network_gateway_ip_configuration_value2['subnet'] = subnet_value2 if ip_configurations_item2.subnet.id is not None: subnet_value2['id'] = ip_configurations_item2.subnet.id if ip_configurations_item2.public_ip_address is not None: public_ip_address_value2 = {} virtual_network_gateway_ip_configuration_value2['publicIPAddress'] = public_ip_address_value2 if ip_configurations_item2.public_ip_address.id is not None: public_ip_address_value2['id'] = ip_configurations_item2.public_ip_address.id if ip_configurations_item2.provisioning_state is not None: virtual_network_gateway_ip_configuration_value2['provisioningState'] = ip_configurations_item2.provisioning_state if ip_configurations_item2.name is not None: virtual_network_gateway_ip_configuration_value2['name'] = ip_configurations_item2.name if ip_configurations_item2.etag is not None: virtual_network_gateway_ip_configuration_value2['etag'] = ip_configurations_item2.etag if ip_configurations_item2.id is not None: virtual_network_gateway_ip_configuration_value2['id'] = ip_configurations_item2.id virtual_network_gateway2_value['ipConfigurations'] = ip_configurations_array2 if parameters.virtual_network_gateway2.gateway_size is not None: virtual_network_gateway2_value['gatewaySize'] = parameters.virtual_network_gateway2.gateway_size if parameters.virtual_network_gateway2.gateway_type is not None: virtual_network_gateway2_value['gatewayType'] = parameters.virtual_network_gateway2.gateway_type if parameters.virtual_network_gateway2.enable_bgp is not None: virtual_network_gateway2_value['enableBgp'] = parameters.virtual_network_gateway2.enable_bgp if parameters.virtual_network_gateway2.provisioning_state is not None: virtual_network_gateway2_value['provisioningState'] = parameters.virtual_network_gateway2.provisioning_state if parameters.virtual_network_gateway2.etag is not None: virtual_network_gateway2_value['etag'] = parameters.virtual_network_gateway2.etag if parameters.virtual_network_gateway2.id is not None: virtual_network_gateway2_value['id'] = parameters.virtual_network_gateway2.id if parameters.virtual_network_gateway2.name is not None: virtual_network_gateway2_value['name'] = parameters.virtual_network_gateway2.name if parameters.virtual_network_gateway2.type is not None: virtual_network_gateway2_value['type'] = parameters.virtual_network_gateway2.type virtual_network_gateway2_value['location'] = parameters.virtual_network_gateway2.location if parameters.virtual_network_gateway2.tags is not None: tags_dictionary2 = {} for tags_key2 in parameters.virtual_network_gateway2.tags: tags_value2 = parameters.virtual_network_gateway2.tags[tags_key2] tags_dictionary2[tags_key2] = tags_value2 virtual_network_gateway2_value['tags'] = tags_dictionary2 if parameters.local_network_gateway2 is not None: local_network_gateway2_value = {} properties_value['localNetworkGateway2'] = local_network_gateway2_value if parameters.local_network_gateway2.gateway_ip_address is not None: local_network_gateway2_value['gatewayIpAddress'] = parameters.local_network_gateway2.gateway_ip_address if parameters.local_network_gateway2.local_network_site_address_space is not None: local_network_site_address_space_value = {} local_network_gateway2_value['localNetworkSiteAddressSpace'] = local_network_site_address_space_value if parameters.local_network_gateway2.local_network_site_address_space.address_prefixes is not None: address_prefixes_array = [] for address_prefixes_item in parameters.local_network_gateway2.local_network_site_address_space.address_prefixes: address_prefixes_array.append(address_prefixes_item) local_network_site_address_space_value['addressPrefixes'] = address_prefixes_array if parameters.local_network_gateway2.provisioning_state is not None: local_network_gateway2_value['provisioningState'] = parameters.local_network_gateway2.provisioning_state if parameters.local_network_gateway2.etag is not None: local_network_gateway2_value['etag'] = parameters.local_network_gateway2.etag if parameters.local_network_gateway2.id is not None: local_network_gateway2_value['id'] = parameters.local_network_gateway2.id if parameters.local_network_gateway2.name is not None: local_network_gateway2_value['name'] = parameters.local_network_gateway2.name if parameters.local_network_gateway2.type is not None: local_network_gateway2_value['type'] = parameters.local_network_gateway2.type local_network_gateway2_value['location'] = parameters.local_network_gateway2.location if parameters.local_network_gateway2.tags is not None: tags_dictionary3 = {} for tags_key3 in parameters.local_network_gateway2.tags: tags_value3 = parameters.local_network_gateway2.tags[tags_key3] tags_dictionary3[tags_key3] = tags_value3 local_network_gateway2_value['tags'] = tags_dictionary3 if parameters.connection_type is not None: properties_value['connectionType'] = parameters.connection_type if parameters.routing_weight is not None: properties_value['routingWeight'] = parameters.routing_weight if parameters.shared_key is not None: properties_value['sharedKey'] = parameters.shared_key if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: virtual_network_gateway_connection_json_format_value['etag'] = parameters.etag if parameters.id is not None: virtual_network_gateway_connection_json_format_value['id'] = parameters.id if parameters.name is not None: virtual_network_gateway_connection_json_format_value['name'] = parameters.name if parameters.type is not None: virtual_network_gateway_connection_json_format_value['type'] = parameters.type virtual_network_gateway_connection_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary4 = {} for tags_key4 in parameters.tags: tags_value4 = parameters.tags[tags_key4] tags_dictionary4[tags_key4] = tags_value4 virtual_network_gateway_connection_json_format_value['tags'] = tags_dictionary4 request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = VirtualNetworkGatewayConnectionPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_gateway_connection_instance = VirtualNetworkGatewayConnection(tags={}) result.virtual_network_gateway_connection = virtual_network_gateway_connection_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: virtual_network_gateway1_value2 = properties_value2.get('virtualNetworkGateway1', None) if virtual_network_gateway1_value2 is not None: virtual_network_gateway1_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_instance.virtual_network_gateway1 = virtual_network_gateway1_instance ip_configurations_array3 = virtual_network_gateway1_value2.get('ipConfigurations', None) if ip_configurations_array3 is not None: for ip_configurations_value in ip_configurations_array3: virtual_network_gateway_ip_configuration_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway1_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance) private_ip_address_value = ip_configurations_value.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = ip_configurations_value.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value3 = ip_configurations_value.get('subnet', None) if subnet_value3 is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.subnet = subnet_instance id_value = subnet_value3.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value3 = ip_configurations_value.get('publicIPAddress', None) if public_ip_address_value3 is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value3.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = ip_configurations_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_instance.id = id_instance3 gateway_size_value = virtual_network_gateway1_value2.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway1_instance.gateway_size = gateway_size_instance gateway_type_value = virtual_network_gateway1_value2.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway1_instance.gateway_type = gateway_type_instance enable_bgp_value = virtual_network_gateway1_value2.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway1_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = virtual_network_gateway1_value2.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway1_instance.provisioning_state = provisioning_state_instance2 etag_value2 = virtual_network_gateway1_value2.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway1_instance.etag = etag_instance2 id_value4 = virtual_network_gateway1_value2.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway1_instance.id = id_instance4 name_value2 = virtual_network_gateway1_value2.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway1_instance.name = name_instance2 type_value = virtual_network_gateway1_value2.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway1_instance.type = type_instance location_value = virtual_network_gateway1_value2.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway1_instance.location = location_instance tags_sequence_element = virtual_network_gateway1_value2.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key5 = property tags_value5 = tags_sequence_element[property] virtual_network_gateway1_instance.tags[tags_key5] = tags_value5 virtual_network_gateway2_value2 = properties_value2.get('virtualNetworkGateway2', None) if virtual_network_gateway2_value2 is not None: virtual_network_gateway2_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_instance.virtual_network_gateway2 = virtual_network_gateway2_instance ip_configurations_array4 = virtual_network_gateway2_value2.get('ipConfigurations', None) if ip_configurations_array4 is not None: for ip_configurations_value2 in ip_configurations_array4: virtual_network_gateway_ip_configuration_instance2 = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway2_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance2) private_ip_address_value2 = ip_configurations_value2.get('privateIPAddress', None) if private_ip_address_value2 is not None: private_ip_address_instance2 = private_ip_address_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_address = private_ip_address_instance2 private_ip_allocation_method_value2 = ip_configurations_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value2 is not None: private_ip_allocation_method_instance2 = private_ip_allocation_method_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_allocation_method = private_ip_allocation_method_instance2 subnet_value4 = ip_configurations_value2.get('subnet', None) if subnet_value4 is not None: subnet_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.subnet = subnet_instance2 id_value5 = subnet_value4.get('id', None) if id_value5 is not None: id_instance5 = id_value5 subnet_instance2.id = id_instance5 public_ip_address_value4 = ip_configurations_value2.get('publicIPAddress', None) if public_ip_address_value4 is not None: public_ip_address_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.public_ip_address = public_ip_address_instance2 id_value6 = public_ip_address_value4.get('id', None) if id_value6 is not None: id_instance6 = id_value6 public_ip_address_instance2.id = id_instance6 provisioning_state_value3 = ip_configurations_value2.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 virtual_network_gateway_ip_configuration_instance2.provisioning_state = provisioning_state_instance3 name_value3 = ip_configurations_value2.get('name', None) if name_value3 is not None: name_instance3 = name_value3 virtual_network_gateway_ip_configuration_instance2.name = name_instance3 etag_value3 = ip_configurations_value2.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 virtual_network_gateway_ip_configuration_instance2.etag = etag_instance3 id_value7 = ip_configurations_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 virtual_network_gateway_ip_configuration_instance2.id = id_instance7 gateway_size_value2 = virtual_network_gateway2_value2.get('gatewaySize', None) if gateway_size_value2 is not None: gateway_size_instance2 = gateway_size_value2 virtual_network_gateway2_instance.gateway_size = gateway_size_instance2 gateway_type_value2 = virtual_network_gateway2_value2.get('gatewayType', None) if gateway_type_value2 is not None: gateway_type_instance2 = gateway_type_value2 virtual_network_gateway2_instance.gateway_type = gateway_type_instance2 enable_bgp_value2 = virtual_network_gateway2_value2.get('enableBgp', None) if enable_bgp_value2 is not None: enable_bgp_instance2 = enable_bgp_value2 virtual_network_gateway2_instance.enable_bgp = enable_bgp_instance2 provisioning_state_value4 = virtual_network_gateway2_value2.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 virtual_network_gateway2_instance.provisioning_state = provisioning_state_instance4 etag_value4 = virtual_network_gateway2_value2.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 virtual_network_gateway2_instance.etag = etag_instance4 id_value8 = virtual_network_gateway2_value2.get('id', None) if id_value8 is not None: id_instance8 = id_value8 virtual_network_gateway2_instance.id = id_instance8 name_value4 = virtual_network_gateway2_value2.get('name', None) if name_value4 is not None: name_instance4 = name_value4 virtual_network_gateway2_instance.name = name_instance4 type_value2 = virtual_network_gateway2_value2.get('type', None) if type_value2 is not None: type_instance2 = type_value2 virtual_network_gateway2_instance.type = type_instance2 location_value2 = virtual_network_gateway2_value2.get('location', None) if location_value2 is not None: location_instance2 = location_value2 virtual_network_gateway2_instance.location = location_instance2 tags_sequence_element2 = virtual_network_gateway2_value2.get('tags', None) if tags_sequence_element2 is not None: for property2 in tags_sequence_element2: tags_key6 = property2 tags_value6 = tags_sequence_element2[property2] virtual_network_gateway2_instance.tags[tags_key6] = tags_value6 local_network_gateway2_value2 = properties_value2.get('localNetworkGateway2', None) if local_network_gateway2_value2 is not None: local_network_gateway2_instance = LocalNetworkGateway(tags={}) virtual_network_gateway_connection_instance.local_network_gateway2 = local_network_gateway2_instance gateway_ip_address_value = local_network_gateway2_value2.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway2_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value2 = local_network_gateway2_value2.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value2 is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway2_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array2 = local_network_site_address_space_value2.get('addressPrefixes', None) if address_prefixes_array2 is not None: for address_prefixes_value in address_prefixes_array2: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value5 = local_network_gateway2_value2.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 local_network_gateway2_instance.provisioning_state = provisioning_state_instance5 etag_value5 = local_network_gateway2_value2.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 local_network_gateway2_instance.etag = etag_instance5 id_value9 = local_network_gateway2_value2.get('id', None) if id_value9 is not None: id_instance9 = id_value9 local_network_gateway2_instance.id = id_instance9 name_value5 = local_network_gateway2_value2.get('name', None) if name_value5 is not None: name_instance5 = name_value5 local_network_gateway2_instance.name = name_instance5 type_value3 = local_network_gateway2_value2.get('type', None) if type_value3 is not None: type_instance3 = type_value3 local_network_gateway2_instance.type = type_instance3 location_value3 = local_network_gateway2_value2.get('location', None) if location_value3 is not None: location_instance3 = location_value3 local_network_gateway2_instance.location = location_instance3 tags_sequence_element3 = local_network_gateway2_value2.get('tags', None) if tags_sequence_element3 is not None: for property3 in tags_sequence_element3: tags_key7 = property3 tags_value7 = tags_sequence_element3[property3] local_network_gateway2_instance.tags[tags_key7] = tags_value7 connection_type_value = properties_value2.get('connectionType', None) if connection_type_value is not None: connection_type_instance = connection_type_value virtual_network_gateway_connection_instance.connection_type = connection_type_instance routing_weight_value = properties_value2.get('routingWeight', None) if routing_weight_value is not None: routing_weight_instance = routing_weight_value virtual_network_gateway_connection_instance.routing_weight = routing_weight_instance shared_key_value = properties_value2.get('sharedKey', None) if shared_key_value is not None: shared_key_instance = shared_key_value virtual_network_gateway_connection_instance.shared_key = shared_key_instance provisioning_state_value6 = properties_value2.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 virtual_network_gateway_connection_instance.provisioning_state = provisioning_state_instance6 etag_value6 = response_doc.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 virtual_network_gateway_connection_instance.etag = etag_instance6 id_value10 = response_doc.get('id', None) if id_value10 is not None: id_instance10 = id_value10 virtual_network_gateway_connection_instance.id = id_instance10 name_value6 = response_doc.get('name', None) if name_value6 is not None: name_instance6 = name_value6 virtual_network_gateway_connection_instance.name = name_instance6 type_value4 = response_doc.get('type', None) if type_value4 is not None: type_instance4 = type_value4 virtual_network_gateway_connection_instance.type = type_instance4 location_value4 = response_doc.get('location', None) if location_value4 is not None: location_instance4 = location_value4 virtual_network_gateway_connection_instance.location = location_instance4 tags_sequence_element4 = response_doc.get('tags', None) if tags_sequence_element4 is not None: for property4 in tags_sequence_element4: tags_key8 = property4 tags_value8 = tags_sequence_element4[property4] virtual_network_gateway_connection_instance.tags[tags_key8] = tags_value8 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, virtual_network_gateway_connection_name): """ The Delete VirtualNetworkGatewayConnection operation deletes the specifed virtual network Gateway connection through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The name of the virtual network gateway connection. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_connection_name is None: raise ValueError('virtual_network_gateway_connection_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(virtual_network_gateway_connection_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_reset_shared_key(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The virtual network gateway connection reset shared key Name. parameters (ConnectionResetSharedKey): Parameters supplied to the Begin Reset Virtual Network Gateway connection shared key operation through Network resource provider. Returns: ConnectionResetSharedKeyPutResponse: Response for PutVirtualNetworkGatewayConnectionResetSharedKey Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_connection_name is None: raise ValueError('virtual_network_gateway_connection_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(virtual_network_gateway_connection_name) url = url + '/sharedkey/reset' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'POST' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None connection_reset_shared_key_json_format_value = {} request_doc = connection_reset_shared_key_json_format_value properties_value = {} connection_reset_shared_key_json_format_value['properties'] = properties_value if parameters.key_length is not None: properties_value['keyLength'] = parameters.key_length request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = ConnectionResetSharedKeyPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: connection_reset_shared_key_instance = ConnectionResetSharedKey() result.connection_reset_shared_key = connection_reset_shared_key_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: key_length_value = properties_value2.get('keyLength', None) if key_length_value is not None: key_length_instance = key_length_value connection_reset_shared_key_instance.key_length = key_length_instance error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_set_shared_key(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The virtual network gateway connection name. parameters (ConnectionSharedKey): Parameters supplied to the Begin Set Virtual Network Gateway conection Shared key operation throughNetwork resource provider. Returns: ConnectionSharedKeyPutResponse: Response for PutVirtualNetworkGatewayConnectionSharedKey Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_connection_name is None: raise ValueError('virtual_network_gateway_connection_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(virtual_network_gateway_connection_name) url = url + '/sharedkey' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None connection_shared_key_json_format_value = {} request_doc = connection_shared_key_json_format_value properties_value = {} connection_shared_key_json_format_value['properties'] = properties_value if parameters.value is not None: properties_value['value'] = parameters.value request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = ConnectionSharedKeyPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: connection_shared_key_instance = ConnectionSharedKey() result.connection_shared_key = connection_shared_key_instance properties_value2 = response_doc.get('properties', None) if properties_value2 is not None: value_value = properties_value2.get('value', None) if value_value is not None: value_instance = value_value connection_shared_key_instance.value = value_instance error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The CreateOrUpdate Virtual network Gateway connection creates a new or updates an existing virtualnetwork gateway connection through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The name of the virtual network gateway conenction. parameters (VirtualNetworkGatewayConnection): Parameters supplied to the Begin Create or update Virtual Network Gateway connection operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_network_gateway_connections.begin_create_or_updating(resource_group_name, virtual_network_gateway_connection_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, virtual_network_gateway_connection_name): """ The Delete VirtualNetworkGatewayConnection operation deletes the specifed virtual network Gateway connection through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The name of the virtual network gateway connection. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.virtual_network_gateway_connections.begin_deleting(resource_group_name, virtual_network_gateway_connection_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, virtual_network_gateway_connection_name): """ The Get VirtualNetworkGatewayConnection operation retrieves information about the specified virtual network gateway connection through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The name of the virtual network gateway connection. Returns: VirtualNetworkGatewayConnectionGetResponse: Response for GetVitualNetworkGatewayConnection Api servive call. """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_connection_name is None: raise ValueError('virtual_network_gateway_connection_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(virtual_network_gateway_connection_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkGatewayConnectionGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_gateway_connection_instance = VirtualNetworkGatewayConnection(tags={}) result.virtual_network_gateway_connection = virtual_network_gateway_connection_instance properties_value = response_doc.get('properties', None) if properties_value is not None: virtual_network_gateway1_value = properties_value.get('virtualNetworkGateway1', None) if virtual_network_gateway1_value is not None: virtual_network_gateway1_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_instance.virtual_network_gateway1 = virtual_network_gateway1_instance ip_configurations_array = virtual_network_gateway1_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: virtual_network_gateway_ip_configuration_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway1_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance) private_ip_address_value = ip_configurations_value.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = ip_configurations_value.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = ip_configurations_value.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = ip_configurations_value.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = ip_configurations_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_instance.id = id_instance3 gateway_size_value = virtual_network_gateway1_value.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway1_instance.gateway_size = gateway_size_instance gateway_type_value = virtual_network_gateway1_value.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway1_instance.gateway_type = gateway_type_instance enable_bgp_value = virtual_network_gateway1_value.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway1_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = virtual_network_gateway1_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway1_instance.provisioning_state = provisioning_state_instance2 etag_value2 = virtual_network_gateway1_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway1_instance.etag = etag_instance2 id_value4 = virtual_network_gateway1_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway1_instance.id = id_instance4 name_value2 = virtual_network_gateway1_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway1_instance.name = name_instance2 type_value = virtual_network_gateway1_value.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway1_instance.type = type_instance location_value = virtual_network_gateway1_value.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway1_instance.location = location_instance tags_sequence_element = virtual_network_gateway1_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_gateway1_instance.tags[tags_key] = tags_value virtual_network_gateway2_value = properties_value.get('virtualNetworkGateway2', None) if virtual_network_gateway2_value is not None: virtual_network_gateway2_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_instance.virtual_network_gateway2 = virtual_network_gateway2_instance ip_configurations_array2 = virtual_network_gateway2_value.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value2 in ip_configurations_array2: virtual_network_gateway_ip_configuration_instance2 = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway2_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance2) private_ip_address_value2 = ip_configurations_value2.get('privateIPAddress', None) if private_ip_address_value2 is not None: private_ip_address_instance2 = private_ip_address_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_address = private_ip_address_instance2 private_ip_allocation_method_value2 = ip_configurations_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value2 is not None: private_ip_allocation_method_instance2 = private_ip_allocation_method_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_allocation_method = private_ip_allocation_method_instance2 subnet_value2 = ip_configurations_value2.get('subnet', None) if subnet_value2 is not None: subnet_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.subnet = subnet_instance2 id_value5 = subnet_value2.get('id', None) if id_value5 is not None: id_instance5 = id_value5 subnet_instance2.id = id_instance5 public_ip_address_value2 = ip_configurations_value2.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.public_ip_address = public_ip_address_instance2 id_value6 = public_ip_address_value2.get('id', None) if id_value6 is not None: id_instance6 = id_value6 public_ip_address_instance2.id = id_instance6 provisioning_state_value3 = ip_configurations_value2.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 virtual_network_gateway_ip_configuration_instance2.provisioning_state = provisioning_state_instance3 name_value3 = ip_configurations_value2.get('name', None) if name_value3 is not None: name_instance3 = name_value3 virtual_network_gateway_ip_configuration_instance2.name = name_instance3 etag_value3 = ip_configurations_value2.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 virtual_network_gateway_ip_configuration_instance2.etag = etag_instance3 id_value7 = ip_configurations_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 virtual_network_gateway_ip_configuration_instance2.id = id_instance7 gateway_size_value2 = virtual_network_gateway2_value.get('gatewaySize', None) if gateway_size_value2 is not None: gateway_size_instance2 = gateway_size_value2 virtual_network_gateway2_instance.gateway_size = gateway_size_instance2 gateway_type_value2 = virtual_network_gateway2_value.get('gatewayType', None) if gateway_type_value2 is not None: gateway_type_instance2 = gateway_type_value2 virtual_network_gateway2_instance.gateway_type = gateway_type_instance2 enable_bgp_value2 = virtual_network_gateway2_value.get('enableBgp', None) if enable_bgp_value2 is not None: enable_bgp_instance2 = enable_bgp_value2 virtual_network_gateway2_instance.enable_bgp = enable_bgp_instance2 provisioning_state_value4 = virtual_network_gateway2_value.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 virtual_network_gateway2_instance.provisioning_state = provisioning_state_instance4 etag_value4 = virtual_network_gateway2_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 virtual_network_gateway2_instance.etag = etag_instance4 id_value8 = virtual_network_gateway2_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 virtual_network_gateway2_instance.id = id_instance8 name_value4 = virtual_network_gateway2_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 virtual_network_gateway2_instance.name = name_instance4 type_value2 = virtual_network_gateway2_value.get('type', None) if type_value2 is not None: type_instance2 = type_value2 virtual_network_gateway2_instance.type = type_instance2 location_value2 = virtual_network_gateway2_value.get('location', None) if location_value2 is not None: location_instance2 = location_value2 virtual_network_gateway2_instance.location = location_instance2 tags_sequence_element2 = virtual_network_gateway2_value.get('tags', None) if tags_sequence_element2 is not None: for property2 in tags_sequence_element2: tags_key2 = property2 tags_value2 = tags_sequence_element2[property2] virtual_network_gateway2_instance.tags[tags_key2] = tags_value2 local_network_gateway2_value = properties_value.get('localNetworkGateway2', None) if local_network_gateway2_value is not None: local_network_gateway2_instance = LocalNetworkGateway(tags={}) virtual_network_gateway_connection_instance.local_network_gateway2 = local_network_gateway2_instance gateway_ip_address_value = local_network_gateway2_value.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway2_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value = local_network_gateway2_value.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway2_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array = local_network_site_address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value5 = local_network_gateway2_value.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 local_network_gateway2_instance.provisioning_state = provisioning_state_instance5 etag_value5 = local_network_gateway2_value.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 local_network_gateway2_instance.etag = etag_instance5 id_value9 = local_network_gateway2_value.get('id', None) if id_value9 is not None: id_instance9 = id_value9 local_network_gateway2_instance.id = id_instance9 name_value5 = local_network_gateway2_value.get('name', None) if name_value5 is not None: name_instance5 = name_value5 local_network_gateway2_instance.name = name_instance5 type_value3 = local_network_gateway2_value.get('type', None) if type_value3 is not None: type_instance3 = type_value3 local_network_gateway2_instance.type = type_instance3 location_value3 = local_network_gateway2_value.get('location', None) if location_value3 is not None: location_instance3 = location_value3 local_network_gateway2_instance.location = location_instance3 tags_sequence_element3 = local_network_gateway2_value.get('tags', None) if tags_sequence_element3 is not None: for property3 in tags_sequence_element3: tags_key3 = property3 tags_value3 = tags_sequence_element3[property3] local_network_gateway2_instance.tags[tags_key3] = tags_value3 connection_type_value = properties_value.get('connectionType', None) if connection_type_value is not None: connection_type_instance = connection_type_value virtual_network_gateway_connection_instance.connection_type = connection_type_instance routing_weight_value = properties_value.get('routingWeight', None) if routing_weight_value is not None: routing_weight_instance = routing_weight_value virtual_network_gateway_connection_instance.routing_weight = routing_weight_instance shared_key_value = properties_value.get('sharedKey', None) if shared_key_value is not None: shared_key_instance = shared_key_value virtual_network_gateway_connection_instance.shared_key = shared_key_instance provisioning_state_value6 = properties_value.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 virtual_network_gateway_connection_instance.provisioning_state = provisioning_state_instance6 etag_value6 = response_doc.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 virtual_network_gateway_connection_instance.etag = etag_instance6 id_value10 = response_doc.get('id', None) if id_value10 is not None: id_instance10 = id_value10 virtual_network_gateway_connection_instance.id = id_instance10 name_value6 = response_doc.get('name', None) if name_value6 is not None: name_instance6 = name_value6 virtual_network_gateway_connection_instance.name = name_instance6 type_value4 = response_doc.get('type', None) if type_value4 is not None: type_instance4 = type_value4 virtual_network_gateway_connection_instance.type = type_instance4 location_value4 = response_doc.get('location', None) if location_value4 is not None: location_instance4 = location_value4 virtual_network_gateway_connection_instance.location = location_instance4 tags_sequence_element4 = response_doc.get('tags', None) if tags_sequence_element4 is not None: for property4 in tags_sequence_element4: tags_key4 = property4 tags_value4 = tags_sequence_element4[property4] virtual_network_gateway_connection_instance.tags[tags_key4] = tags_value4 result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def get_shared_key(self, resource_group_name, connection_shared_key_name): """ The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified virtual network gateway connection shared key through Network resource provider. Args: resource_group_name (string): The name of the resource group. connection_shared_key_name (string): The virtual network gateway connection shared key name. Returns: ConnectionSharedKeyResponse: Response for CheckConnectionSharedKey Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if connection_shared_key_name is None: raise ValueError('connection_shared_key_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections/' url = url + quote(connection_shared_key_name) url = url + '/sharedkey' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = ConnectionSharedKeyResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_value = response_doc.get('value', None) if value_value is not None: value_instance = value_value result.value = value_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections created. Args: resource_group_name (string): The name of the resource group. Returns: VirtualNetworkGatewayConnectionListResponse: Response for ListVirtualNetworkGatewayConnections Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/connections' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkGatewayConnectionListResponse(virtual_network_gateway_connections=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: virtual_network_gateway_connection_json_format_instance = VirtualNetworkGatewayConnection(tags={}) result.virtual_network_gateway_connections.append(virtual_network_gateway_connection_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: virtual_network_gateway1_value = properties_value.get('virtualNetworkGateway1', None) if virtual_network_gateway1_value is not None: virtual_network_gateway1_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_json_format_instance.virtual_network_gateway1 = virtual_network_gateway1_instance ip_configurations_array = virtual_network_gateway1_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: virtual_network_gateway_ip_configuration_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway1_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance) private_ip_address_value = ip_configurations_value.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = ip_configurations_value.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = ip_configurations_value.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = ip_configurations_value.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = ip_configurations_value.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_instance.id = id_instance3 gateway_size_value = virtual_network_gateway1_value.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway1_instance.gateway_size = gateway_size_instance gateway_type_value = virtual_network_gateway1_value.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway1_instance.gateway_type = gateway_type_instance enable_bgp_value = virtual_network_gateway1_value.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway1_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = virtual_network_gateway1_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway1_instance.provisioning_state = provisioning_state_instance2 etag_value2 = virtual_network_gateway1_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway1_instance.etag = etag_instance2 id_value4 = virtual_network_gateway1_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway1_instance.id = id_instance4 name_value2 = virtual_network_gateway1_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway1_instance.name = name_instance2 type_value = virtual_network_gateway1_value.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway1_instance.type = type_instance location_value = virtual_network_gateway1_value.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway1_instance.location = location_instance tags_sequence_element = virtual_network_gateway1_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_gateway1_instance.tags[tags_key] = tags_value virtual_network_gateway2_value = properties_value.get('virtualNetworkGateway2', None) if virtual_network_gateway2_value is not None: virtual_network_gateway2_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) virtual_network_gateway_connection_json_format_instance.virtual_network_gateway2 = virtual_network_gateway2_instance ip_configurations_array2 = virtual_network_gateway2_value.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value2 in ip_configurations_array2: virtual_network_gateway_ip_configuration_instance2 = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway2_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_instance2) private_ip_address_value2 = ip_configurations_value2.get('privateIPAddress', None) if private_ip_address_value2 is not None: private_ip_address_instance2 = private_ip_address_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_address = private_ip_address_instance2 private_ip_allocation_method_value2 = ip_configurations_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value2 is not None: private_ip_allocation_method_instance2 = private_ip_allocation_method_value2 virtual_network_gateway_ip_configuration_instance2.private_ip_allocation_method = private_ip_allocation_method_instance2 subnet_value2 = ip_configurations_value2.get('subnet', None) if subnet_value2 is not None: subnet_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.subnet = subnet_instance2 id_value5 = subnet_value2.get('id', None) if id_value5 is not None: id_instance5 = id_value5 subnet_instance2.id = id_instance5 public_ip_address_value2 = ip_configurations_value2.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance2 = ResourceId() virtual_network_gateway_ip_configuration_instance2.public_ip_address = public_ip_address_instance2 id_value6 = public_ip_address_value2.get('id', None) if id_value6 is not None: id_instance6 = id_value6 public_ip_address_instance2.id = id_instance6 provisioning_state_value3 = ip_configurations_value2.get('provisioningState', None) if provisioning_state_value3 is not None: provisioning_state_instance3 = provisioning_state_value3 virtual_network_gateway_ip_configuration_instance2.provisioning_state = provisioning_state_instance3 name_value3 = ip_configurations_value2.get('name', None) if name_value3 is not None: name_instance3 = name_value3 virtual_network_gateway_ip_configuration_instance2.name = name_instance3 etag_value3 = ip_configurations_value2.get('etag', None) if etag_value3 is not None: etag_instance3 = etag_value3 virtual_network_gateway_ip_configuration_instance2.etag = etag_instance3 id_value7 = ip_configurations_value2.get('id', None) if id_value7 is not None: id_instance7 = id_value7 virtual_network_gateway_ip_configuration_instance2.id = id_instance7 gateway_size_value2 = virtual_network_gateway2_value.get('gatewaySize', None) if gateway_size_value2 is not None: gateway_size_instance2 = gateway_size_value2 virtual_network_gateway2_instance.gateway_size = gateway_size_instance2 gateway_type_value2 = virtual_network_gateway2_value.get('gatewayType', None) if gateway_type_value2 is not None: gateway_type_instance2 = gateway_type_value2 virtual_network_gateway2_instance.gateway_type = gateway_type_instance2 enable_bgp_value2 = virtual_network_gateway2_value.get('enableBgp', None) if enable_bgp_value2 is not None: enable_bgp_instance2 = enable_bgp_value2 virtual_network_gateway2_instance.enable_bgp = enable_bgp_instance2 provisioning_state_value4 = virtual_network_gateway2_value.get('provisioningState', None) if provisioning_state_value4 is not None: provisioning_state_instance4 = provisioning_state_value4 virtual_network_gateway2_instance.provisioning_state = provisioning_state_instance4 etag_value4 = virtual_network_gateway2_value.get('etag', None) if etag_value4 is not None: etag_instance4 = etag_value4 virtual_network_gateway2_instance.etag = etag_instance4 id_value8 = virtual_network_gateway2_value.get('id', None) if id_value8 is not None: id_instance8 = id_value8 virtual_network_gateway2_instance.id = id_instance8 name_value4 = virtual_network_gateway2_value.get('name', None) if name_value4 is not None: name_instance4 = name_value4 virtual_network_gateway2_instance.name = name_instance4 type_value2 = virtual_network_gateway2_value.get('type', None) if type_value2 is not None: type_instance2 = type_value2 virtual_network_gateway2_instance.type = type_instance2 location_value2 = virtual_network_gateway2_value.get('location', None) if location_value2 is not None: location_instance2 = location_value2 virtual_network_gateway2_instance.location = location_instance2 tags_sequence_element2 = virtual_network_gateway2_value.get('tags', None) if tags_sequence_element2 is not None: for property2 in tags_sequence_element2: tags_key2 = property2 tags_value2 = tags_sequence_element2[property2] virtual_network_gateway2_instance.tags[tags_key2] = tags_value2 local_network_gateway2_value = properties_value.get('localNetworkGateway2', None) if local_network_gateway2_value is not None: local_network_gateway2_instance = LocalNetworkGateway(tags={}) virtual_network_gateway_connection_json_format_instance.local_network_gateway2 = local_network_gateway2_instance gateway_ip_address_value = local_network_gateway2_value.get('gatewayIpAddress', None) if gateway_ip_address_value is not None: gateway_ip_address_instance = gateway_ip_address_value local_network_gateway2_instance.gateway_ip_address = gateway_ip_address_instance local_network_site_address_space_value = local_network_gateway2_value.get('localNetworkSiteAddressSpace', None) if local_network_site_address_space_value is not None: local_network_site_address_space_instance = AddressSpace(address_prefixes=[]) local_network_gateway2_instance.local_network_site_address_space = local_network_site_address_space_instance address_prefixes_array = local_network_site_address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: local_network_site_address_space_instance.address_prefixes.append(address_prefixes_value) provisioning_state_value5 = local_network_gateway2_value.get('provisioningState', None) if provisioning_state_value5 is not None: provisioning_state_instance5 = provisioning_state_value5 local_network_gateway2_instance.provisioning_state = provisioning_state_instance5 etag_value5 = local_network_gateway2_value.get('etag', None) if etag_value5 is not None: etag_instance5 = etag_value5 local_network_gateway2_instance.etag = etag_instance5 id_value9 = local_network_gateway2_value.get('id', None) if id_value9 is not None: id_instance9 = id_value9 local_network_gateway2_instance.id = id_instance9 name_value5 = local_network_gateway2_value.get('name', None) if name_value5 is not None: name_instance5 = name_value5 local_network_gateway2_instance.name = name_instance5 type_value3 = local_network_gateway2_value.get('type', None) if type_value3 is not None: type_instance3 = type_value3 local_network_gateway2_instance.type = type_instance3 location_value3 = local_network_gateway2_value.get('location', None) if location_value3 is not None: location_instance3 = location_value3 local_network_gateway2_instance.location = location_instance3 tags_sequence_element3 = local_network_gateway2_value.get('tags', None) if tags_sequence_element3 is not None: for property3 in tags_sequence_element3: tags_key3 = property3 tags_value3 = tags_sequence_element3[property3] local_network_gateway2_instance.tags[tags_key3] = tags_value3 connection_type_value = properties_value.get('connectionType', None) if connection_type_value is not None: connection_type_instance = connection_type_value virtual_network_gateway_connection_json_format_instance.connection_type = connection_type_instance routing_weight_value = properties_value.get('routingWeight', None) if routing_weight_value is not None: routing_weight_instance = routing_weight_value virtual_network_gateway_connection_json_format_instance.routing_weight = routing_weight_instance shared_key_value = properties_value.get('sharedKey', None) if shared_key_value is not None: shared_key_instance = shared_key_value virtual_network_gateway_connection_json_format_instance.shared_key = shared_key_instance provisioning_state_value6 = properties_value.get('provisioningState', None) if provisioning_state_value6 is not None: provisioning_state_instance6 = provisioning_state_value6 virtual_network_gateway_connection_json_format_instance.provisioning_state = provisioning_state_instance6 etag_value6 = value_value.get('etag', None) if etag_value6 is not None: etag_instance6 = etag_value6 virtual_network_gateway_connection_json_format_instance.etag = etag_instance6 id_value10 = value_value.get('id', None) if id_value10 is not None: id_instance10 = id_value10 virtual_network_gateway_connection_json_format_instance.id = id_instance10 name_value6 = value_value.get('name', None) if name_value6 is not None: name_instance6 = name_value6 virtual_network_gateway_connection_json_format_instance.name = name_instance6 type_value4 = value_value.get('type', None) if type_value4 is not None: type_instance4 = type_value4 virtual_network_gateway_connection_json_format_instance.type = type_instance4 location_value4 = value_value.get('location', None) if location_value4 is not None: location_instance4 = location_value4 virtual_network_gateway_connection_json_format_instance.location = location_instance4 tags_sequence_element4 = value_value.get('tags', None) if tags_sequence_element4 is not None: for property4 in tags_sequence_element4: tags_key4 = property4 tags_value4 = tags_sequence_element4[property4] virtual_network_gateway_connection_json_format_instance.tags[tags_key4] = tags_value4 next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def reset_shared_key(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The Reset VirtualNetworkGatewayConnectionSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The virtual network gateway connection name. parameters (ConnectionResetSharedKey): Parameters supplied to the Begin Reset Virtual Network Gateway connection shared key operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_network_gateway_connections.begin_reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def set_shared_key(self, resource_group_name, virtual_network_gateway_connection_name, parameters): """ The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_connection_name (string): The virtual network gateway connection name. parameters (ConnectionSharedKey): Parameters supplied to the Begin Create or update Virtual Network Gateway connection shared key operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_network_gateway_connections.begin_set_shared_key(resource_group_name, virtual_network_gateway_connection_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result class VirtualNetworkGatewayOperations(object): """ The Network Resource Provider API includes operations for managing the Virtual network Gateway for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, virtual_network_gateway_name, parameters): """ The Put VirtualNetworkGateway operation creates/updates a virtual network gateway in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. parameters (VirtualNetworkGateway): Parameters supplied to the Begin Create or update Virtual Network Gateway operation through Network resource provider. Returns: VirtualNetworkGatewayPutResponse: Response for PutVirtualNetworkGateway Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_name is None: raise ValueError('virtual_network_gateway_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworkgateways/' url = url + quote(virtual_network_gateway_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None virtual_network_gateway_json_format_value = {} request_doc = virtual_network_gateway_json_format_value properties_value = {} virtual_network_gateway_json_format_value['properties'] = properties_value if parameters.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in parameters.ip_configurations: virtual_network_gateway_ip_configuration_json_format_value = {} ip_configurations_array.append(virtual_network_gateway_ip_configuration_json_format_value) properties_value2 = {} virtual_network_gateway_ip_configuration_json_format_value['properties'] = properties_value2 if ip_configurations_item.private_ip_address is not None: properties_value2['privateIPAddress'] = ip_configurations_item.private_ip_address if ip_configurations_item.private_ip_allocation_method is not None: properties_value2['privateIPAllocationMethod'] = ip_configurations_item.private_ip_allocation_method if ip_configurations_item.subnet is not None: subnet_value = {} properties_value2['subnet'] = subnet_value if ip_configurations_item.subnet.id is not None: subnet_value['id'] = ip_configurations_item.subnet.id if ip_configurations_item.public_ip_address is not None: public_ip_address_value = {} properties_value2['publicIPAddress'] = public_ip_address_value if ip_configurations_item.public_ip_address.id is not None: public_ip_address_value['id'] = ip_configurations_item.public_ip_address.id if ip_configurations_item.provisioning_state is not None: properties_value2['provisioningState'] = ip_configurations_item.provisioning_state if ip_configurations_item.name is not None: virtual_network_gateway_ip_configuration_json_format_value['name'] = ip_configurations_item.name if ip_configurations_item.etag is not None: virtual_network_gateway_ip_configuration_json_format_value['etag'] = ip_configurations_item.etag if ip_configurations_item.id is not None: virtual_network_gateway_ip_configuration_json_format_value['id'] = ip_configurations_item.id properties_value['ipConfigurations'] = ip_configurations_array if parameters.gateway_size is not None: properties_value['gatewaySize'] = parameters.gateway_size if parameters.gateway_type is not None: properties_value['gatewayType'] = parameters.gateway_type if parameters.enable_bgp is not None: properties_value['enableBgp'] = parameters.enable_bgp if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: virtual_network_gateway_json_format_value['etag'] = parameters.etag if parameters.id is not None: virtual_network_gateway_json_format_value['id'] = parameters.id if parameters.name is not None: virtual_network_gateway_json_format_value['name'] = parameters.name if parameters.type is not None: virtual_network_gateway_json_format_value['type'] = parameters.type virtual_network_gateway_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value virtual_network_gateway_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = VirtualNetworkGatewayPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_gateway_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) result.virtual_network_gateway = virtual_network_gateway_instance properties_value3 = response_doc.get('properties', None) if properties_value3 is not None: ip_configurations_array2 = properties_value3.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value in ip_configurations_array2: virtual_network_gateway_ip_configuration_json_format_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_json_format_instance) properties_value4 = ip_configurations_value.get('properties', None) if properties_value4 is not None: private_ip_address_value = properties_value4.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value4.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value2 = properties_value4.get('subnet', None) if subnet_value2 is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value2.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value2 = properties_value4.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value2.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = properties_value4.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_json_format_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_json_format_instance.id = id_instance3 gateway_size_value = properties_value3.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway_instance.gateway_size = gateway_size_instance gateway_type_value = properties_value3.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway_instance.gateway_type = gateway_type_instance enable_bgp_value = properties_value3.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway_instance.etag = etag_instance2 id_value4 = response_doc.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway_instance.id = id_instance4 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] virtual_network_gateway_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, virtual_network_gateway_name): """ The Delete VirtualNetworkGateway operation deletes the specifed virtual network Gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_name is None: raise ValueError('virtual_network_gateway_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualNetworkGateways/' url = url + quote(virtual_network_gateway_name) url = url + '/' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_reset(self, resource_group_name, virtual_network_gateway_name, parameters): """ The Reset VirtualNetworkGateway operation resets the primary of the virtual network gatewayin the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. parameters (VirtualNetworkGateway): Parameters supplied to the Begin Reset Virtual Network Gateway operation through Network resource provider. Returns: VirtualNetworkGatewayPutResponse: Response for PutVirtualNetworkGateway Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_name is None: raise ValueError('virtual_network_gateway_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworkgateways/' url = url + quote(virtual_network_gateway_name) url = url + '/reset' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'POST' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None virtual_network_gateway_json_format_value = {} request_doc = virtual_network_gateway_json_format_value properties_value = {} virtual_network_gateway_json_format_value['properties'] = properties_value if parameters.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in parameters.ip_configurations: virtual_network_gateway_ip_configuration_json_format_value = {} ip_configurations_array.append(virtual_network_gateway_ip_configuration_json_format_value) properties_value2 = {} virtual_network_gateway_ip_configuration_json_format_value['properties'] = properties_value2 if ip_configurations_item.private_ip_address is not None: properties_value2['privateIPAddress'] = ip_configurations_item.private_ip_address if ip_configurations_item.private_ip_allocation_method is not None: properties_value2['privateIPAllocationMethod'] = ip_configurations_item.private_ip_allocation_method if ip_configurations_item.subnet is not None: subnet_value = {} properties_value2['subnet'] = subnet_value if ip_configurations_item.subnet.id is not None: subnet_value['id'] = ip_configurations_item.subnet.id if ip_configurations_item.public_ip_address is not None: public_ip_address_value = {} properties_value2['publicIPAddress'] = public_ip_address_value if ip_configurations_item.public_ip_address.id is not None: public_ip_address_value['id'] = ip_configurations_item.public_ip_address.id if ip_configurations_item.provisioning_state is not None: properties_value2['provisioningState'] = ip_configurations_item.provisioning_state if ip_configurations_item.name is not None: virtual_network_gateway_ip_configuration_json_format_value['name'] = ip_configurations_item.name if ip_configurations_item.etag is not None: virtual_network_gateway_ip_configuration_json_format_value['etag'] = ip_configurations_item.etag if ip_configurations_item.id is not None: virtual_network_gateway_ip_configuration_json_format_value['id'] = ip_configurations_item.id properties_value['ipConfigurations'] = ip_configurations_array if parameters.gateway_size is not None: properties_value['gatewaySize'] = parameters.gateway_size if parameters.gateway_type is not None: properties_value['gatewayType'] = parameters.gateway_type if parameters.enable_bgp is not None: properties_value['enableBgp'] = parameters.enable_bgp if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: virtual_network_gateway_json_format_value['etag'] = parameters.etag if parameters.id is not None: virtual_network_gateway_json_format_value['id'] = parameters.id if parameters.name is not None: virtual_network_gateway_json_format_value['name'] = parameters.name if parameters.type is not None: virtual_network_gateway_json_format_value['type'] = parameters.type virtual_network_gateway_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value virtual_network_gateway_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = VirtualNetworkGatewayPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_gateway_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) result.virtual_network_gateway = virtual_network_gateway_instance properties_value3 = response_doc.get('properties', None) if properties_value3 is not None: ip_configurations_array2 = properties_value3.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value in ip_configurations_array2: virtual_network_gateway_ip_configuration_json_format_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_json_format_instance) properties_value4 = ip_configurations_value.get('properties', None) if properties_value4 is not None: private_ip_address_value = properties_value4.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value4.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value2 = properties_value4.get('subnet', None) if subnet_value2 is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value2.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value2 = properties_value4.get('publicIPAddress', None) if public_ip_address_value2 is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value2.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = properties_value4.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_json_format_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_json_format_instance.id = id_instance3 gateway_size_value = properties_value3.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway_instance.gateway_size = gateway_size_instance gateway_type_value = properties_value3.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway_instance.gateway_type = gateway_type_instance enable_bgp_value = properties_value3.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway_instance.etag = etag_instance2 id_value4 = response_doc.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway_instance.id = id_instance4 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] virtual_network_gateway_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, virtual_network_gateway_name, parameters): """ The Put VirtualNetworkGateway operation creates/updates a virtual network gateway in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. parameters (VirtualNetworkGateway): Parameters supplied to the Begin Create or update Virtual Network Gateway operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_network_gateways.begin_create_or_updating(resource_group_name, virtual_network_gateway_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, virtual_network_gateway_name): """ The Delete VirtualNetworkGateway operation deletes the specifed virtual network Gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.virtual_network_gateways.begin_deleting(resource_group_name, virtual_network_gateway_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, virtual_network_gateway_name): """ The Get VirtualNetworkGateway operation retrieves information about the specified virtual network gateway through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. Returns: VirtualNetworkGatewayGetResponse: Response for GetVitualNetworkgateway Api servive call. """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_gateway_name is None: raise ValueError('virtual_network_gateway_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualNetworkGateways/' url = url + quote(virtual_network_gateway_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkGatewayGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_gateway_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) result.virtual_network_gateway = virtual_network_gateway_instance properties_value = response_doc.get('properties', None) if properties_value is not None: ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: virtual_network_gateway_ip_configuration_json_format_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_json_format_instance) properties_value2 = ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_json_format_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_json_format_instance.id = id_instance3 gateway_size_value = properties_value.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway_instance.gateway_size = gateway_size_instance gateway_type_value = properties_value.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway_instance.gateway_type = gateway_type_instance enable_bgp_value = properties_value.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway_instance.etag = etag_instance2 id_value4 = response_doc.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway_instance.id = id_instance4 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_gateway_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The List VirtualNetworkGateways opertion retrieves all the virtual network gateways stored. Args: resource_group_name (string): The name of the resource group. Returns: VirtualNetworkGatewayListResponse: Response for ListVirtualNetworkGateways Api service call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualNetworkGateways' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkGatewayListResponse(virtual_network_gateways=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: virtual_network_gateway_json_format_instance = VirtualNetworkGateway(ip_configurations=[], tags={}) result.virtual_network_gateways.append(virtual_network_gateway_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: ip_configurations_array = properties_value.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: virtual_network_gateway_ip_configuration_json_format_instance = VirtualNetworkGatewayIpConfiguration() virtual_network_gateway_json_format_instance.ip_configurations.append(virtual_network_gateway_ip_configuration_json_format_instance) properties_value2 = ip_configurations_value.get('properties', None) if properties_value2 is not None: private_ip_address_value = properties_value2.get('privateIPAddress', None) if private_ip_address_value is not None: private_ip_address_instance = private_ip_address_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_address = private_ip_address_instance private_ip_allocation_method_value = properties_value2.get('privateIPAllocationMethod', None) if private_ip_allocation_method_value is not None: private_ip_allocation_method_instance = private_ip_allocation_method_value virtual_network_gateway_ip_configuration_json_format_instance.private_ip_allocation_method = private_ip_allocation_method_instance subnet_value = properties_value2.get('subnet', None) if subnet_value is not None: subnet_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.subnet = subnet_instance id_value = subnet_value.get('id', None) if id_value is not None: id_instance = id_value subnet_instance.id = id_instance public_ip_address_value = properties_value2.get('publicIPAddress', None) if public_ip_address_value is not None: public_ip_address_instance = ResourceId() virtual_network_gateway_ip_configuration_json_format_instance.public_ip_address = public_ip_address_instance id_value2 = public_ip_address_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 public_ip_address_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value virtual_network_gateway_ip_configuration_json_format_instance.provisioning_state = provisioning_state_instance name_value = ip_configurations_value.get('name', None) if name_value is not None: name_instance = name_value virtual_network_gateway_ip_configuration_json_format_instance.name = name_instance etag_value = ip_configurations_value.get('etag', None) if etag_value is not None: etag_instance = etag_value virtual_network_gateway_ip_configuration_json_format_instance.etag = etag_instance id_value3 = ip_configurations_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 virtual_network_gateway_ip_configuration_json_format_instance.id = id_instance3 gateway_size_value = properties_value.get('gatewaySize', None) if gateway_size_value is not None: gateway_size_instance = gateway_size_value virtual_network_gateway_json_format_instance.gateway_size = gateway_size_instance gateway_type_value = properties_value.get('gatewayType', None) if gateway_type_value is not None: gateway_type_instance = gateway_type_value virtual_network_gateway_json_format_instance.gateway_type = gateway_type_instance enable_bgp_value = properties_value.get('enableBgp', None) if enable_bgp_value is not None: enable_bgp_instance = enable_bgp_value virtual_network_gateway_json_format_instance.enable_bgp = enable_bgp_instance provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_gateway_json_format_instance.provisioning_state = provisioning_state_instance2 etag_value2 = value_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_gateway_json_format_instance.etag = etag_instance2 id_value4 = value_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_gateway_json_format_instance.id = id_instance4 name_value2 = value_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_gateway_json_format_instance.name = name_instance2 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value virtual_network_gateway_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value virtual_network_gateway_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_gateway_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def reset(self, resource_group_name, virtual_network_gateway_name, parameters): """ The Reset VirtualNetworkGateway operation resets the primary of the virtual network gateway in the specified resource group through Network resource provider. Args: resource_group_name (string): The name of the resource group. virtual_network_gateway_name (string): The name of the virtual network gateway. parameters (VirtualNetworkGateway): Parameters supplied to the Begin Reset Virtual Network Gateway operation through Network resource provider. Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_network_gateways.begin_reset(resource_group_name, virtual_network_gateway_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result class VirtualNetworkOperations(object): """ The Network Resource Provider API includes operations for managing the Virtual Networks for your subscription. __NOTE__: An instance of this class is automatically created for an instance of the [NetworkResourceProviderClient] """ def __init__(self, client): self._client = client @property def client(self): """ Gets a reference to the Microsoft.Azure.Management.Network.NetworkResourceProviderClient. """ return self._client def begin_create_or_updating(self, resource_group_name, virtual_network_name, parameters): """ The Put VirtualNetwork operation creates/updates a virtual network in the specified resource group. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. parameters (VirtualNetwork): Parameters supplied to the create/update Virtual Network operation Returns: VirtualNetworkPutResponse: Response for PutVirtualNetworks API service calls. """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') if parameters is None: raise ValueError('parameters cannot be None.') if parameters.location is None: raise ValueError('parameters.location cannot be None.') if parameters.subnets is not None: for subnets_parameter_item in parameters.subnets: if subnets_parameter_item.address_prefix is None: raise ValueError('parameters.subnets.address_prefix cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'PUT' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Serialize Request request_content = None request_doc = None virtual_network_json_format_value = {} request_doc = virtual_network_json_format_value properties_value = {} virtual_network_json_format_value['properties'] = properties_value if parameters.address_space is not None: address_space_value = {} properties_value['addressSpace'] = address_space_value if parameters.address_space.address_prefixes is not None: address_prefixes_array = [] for address_prefixes_item in parameters.address_space.address_prefixes: address_prefixes_array.append(address_prefixes_item) address_space_value['addressPrefixes'] = address_prefixes_array if parameters.dhcp_options is not None: dhcp_options_value = {} properties_value['dhcpOptions'] = dhcp_options_value if parameters.dhcp_options.dns_servers is not None: dns_servers_array = [] for dns_servers_item in parameters.dhcp_options.dns_servers: dns_servers_array.append(dns_servers_item) dhcp_options_value['dnsServers'] = dns_servers_array if parameters.subnets is not None: subnets_array = [] for subnets_item in parameters.subnets: subnet_json_format_value = {} subnets_array.append(subnet_json_format_value) properties_value2 = {} subnet_json_format_value['properties'] = properties_value2 properties_value2['addressPrefix'] = subnets_item.address_prefix if subnets_item.network_security_group is not None: network_security_group_value = {} properties_value2['networkSecurityGroup'] = network_security_group_value if subnets_item.network_security_group.id is not None: network_security_group_value['id'] = subnets_item.network_security_group.id if subnets_item.ip_configurations is not None: ip_configurations_array = [] for ip_configurations_item in subnets_item.ip_configurations: resource_id_value = {} ip_configurations_array.append(resource_id_value) if ip_configurations_item.id is not None: resource_id_value['id'] = ip_configurations_item.id properties_value2['ipConfigurations'] = ip_configurations_array if subnets_item.provisioning_state is not None: properties_value2['provisioningState'] = subnets_item.provisioning_state if subnets_item.name is not None: subnet_json_format_value['name'] = subnets_item.name if subnets_item.etag is not None: subnet_json_format_value['etag'] = subnets_item.etag if subnets_item.id is not None: subnet_json_format_value['id'] = subnets_item.id properties_value['subnets'] = subnets_array if parameters.provisioning_state is not None: properties_value['provisioningState'] = parameters.provisioning_state if parameters.etag is not None: virtual_network_json_format_value['etag'] = parameters.etag if parameters.id is not None: virtual_network_json_format_value['id'] = parameters.id if parameters.name is not None: virtual_network_json_format_value['name'] = parameters.name if parameters.type is not None: virtual_network_json_format_value['type'] = parameters.type virtual_network_json_format_value['location'] = parameters.location if parameters.tags is not None: tags_dictionary = {} for tags_key in parameters.tags: tags_value = parameters.tags[tags_key] tags_dictionary[tags_key] = tags_value virtual_network_json_format_value['tags'] = tags_dictionary request_content = json.dumps(request_doc) http_request.data = request_content http_request.headers['Content-Length'] = len(request_content) # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 201: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200 or status_code == 201: response_content = body result = VirtualNetworkPutResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_instance = VirtualNetwork(subnets=[], tags={}) result.virtual_network = virtual_network_instance properties_value3 = response_doc.get('properties', None) if properties_value3 is not None: address_space_value2 = properties_value3.get('addressSpace', None) if address_space_value2 is not None: address_space_instance = AddressSpace(address_prefixes=[]) virtual_network_instance.address_space = address_space_instance address_prefixes_array2 = address_space_value2.get('addressPrefixes', None) if address_prefixes_array2 is not None: for address_prefixes_value in address_prefixes_array2: address_space_instance.address_prefixes.append(address_prefixes_value) dhcp_options_value2 = properties_value3.get('dhcpOptions', None) if dhcp_options_value2 is not None: dhcp_options_instance = DhcpOptions(dns_servers=[]) virtual_network_instance.dhcp_options = dhcp_options_instance dns_servers_array2 = dhcp_options_value2.get('dnsServers', None) if dns_servers_array2 is not None: for dns_servers_value in dns_servers_array2: dhcp_options_instance.dns_servers.append(dns_servers_value) subnets_array2 = properties_value3.get('subnets', None) if subnets_array2 is not None: for subnets_value in subnets_array2: subnet_json_format_instance = Subnet(ip_configurations=[]) virtual_network_instance.subnets.append(subnet_json_format_instance) properties_value4 = subnets_value.get('properties', None) if properties_value4 is not None: address_prefix_value = properties_value4.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_json_format_instance.address_prefix = address_prefix_instance network_security_group_value2 = properties_value4.get('networkSecurityGroup', None) if network_security_group_value2 is not None: network_security_group_instance = ResourceId() subnet_json_format_instance.network_security_group = network_security_group_instance id_value = network_security_group_value2.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array2 = properties_value4.get('ipConfigurations', None) if ip_configurations_array2 is not None: for ip_configurations_value in ip_configurations_array2: resource_id_instance = ResourceId() subnet_json_format_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value4.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_json_format_instance.provisioning_state = provisioning_state_instance name_value = subnets_value.get('name', None) if name_value is not None: name_instance = name_value subnet_json_format_instance.name = name_instance etag_value = subnets_value.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_json_format_instance.etag = etag_instance id_value3 = subnets_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_json_format_instance.id = id_instance3 provisioning_state_value2 = properties_value3.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_instance.etag = etag_instance2 id_value4 = response_doc.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_instance.id = id_instance4 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value virtual_network_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value virtual_network_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key2 = property tags_value2 = tags_sequence_element[property] virtual_network_instance.tags[tags_key2] = tags_value2 error_value = response_doc.get('error', None) if error_value is not None: error_instance = Error(details=[]) result.error = error_instance code_value = error_value.get('code', None) if code_value is not None: code_instance = code_value error_instance.code = code_instance message_value = error_value.get('message', None) if message_value is not None: message_instance = message_value error_instance.message = message_instance target_value = error_value.get('target', None) if target_value is not None: target_instance = target_value error_instance.target = target_instance details_array = error_value.get('details', None) if details_array is not None: for details_value in details_array: error_details_instance = ErrorDetails() error_instance.details.append(error_details_instance) code_value2 = details_value.get('code', None) if code_value2 is not None: code_instance2 = code_value2 error_details_instance.code = code_instance2 target_value2 = details_value.get('target', None) if target_value2 is not None: target_instance2 = target_value2 error_details_instance.target = target_instance2 message_value2 = details_value.get('message', None) if message_value2 is not None: message_instance2 = message_value2 error_details_instance.message = message_instance2 inner_error_value = error_value.get('innerError', None) if inner_error_value is not None: inner_error_instance = inner_error_value error_instance.inner_error = inner_error_instance result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def begin_deleting(self, resource_group_name, virtual_network_name): """ The Delete VirtualNetwork operation deletes the specifed virtual network Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. Returns: UpdateOperationResponse: If the resource provide needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below.The message should be localized per the Accept-Language header specified in the original request such thatit could be directly be exposed to users """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'DELETE' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200 and status_code != 202 and status_code != 204: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response result = UpdateOperationResponse() result.status_code = status_code result.azure_async_operation = response.headers.get('azure-asyncoperation') result.retry_after = int(response.headers.get('retry-after', '0')) result.request_id = response.headers.get('x-ms-request-id') return result def create_or_update(self, resource_group_name, virtual_network_name, parameters): """ The Put VirtualNetwork operation creates/updates a virtual networkin the specified resource group. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. parameters (VirtualNetwork): Parameters supplied to the create/update Virtual Network operation Returns: AzureAsyncOperationResponse: The response body contains the status of the specified asynchronous operation, indicating whether it has succeeded, is inprogress, or has failed. Note that this status is distinct from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous operation succeeded, the response body includes the HTTP status code for the successful request. If the asynchronous operation failed, the response body includes the HTTP status code for the failed request and error information regarding the failure. """ client2 = self.client response = client2.virtual_networks.begin_create_or_updating(resource_group_name, virtual_network_name, parameters) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def delete(self, resource_group_name, virtual_network_name): """ The Delete VirtualNetwork operation deletes the specifed virtual network Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. Returns: AzureOperationResponse: A standard service response including an HTTP status code and request ID. """ client2 = self.client response = client2.virtual_networks.begin_deleting(resource_group_name, virtual_network_name) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = response.retry_after if delay_in_seconds == 0: delay_in_seconds = 30 if client2.long_running_operation_initial_timeout >= 0: delay_in_seconds = client2.long_running_operation_initial_timeout while (result.status != OperationStatus.in_progress) == False: time.sleep(delay_in_seconds) result = client2.get_long_running_operation_status(response.azure_async_operation) delay_in_seconds = result.retry_after if delay_in_seconds == 0: delay_in_seconds = 15 if client2.long_running_operation_retry_timeout >= 0: delay_in_seconds = client2.long_running_operation_retry_timeout return result def get(self, resource_group_name, virtual_network_name): """ The Get VirtualNetwork operation retrieves information about the specified virtual network. Args: resource_group_name (string): The name of the resource group. virtual_network_name (string): The name of the virtual network. Returns: VirtualNetworkGetResponse: Response for GetVirtualNetworks API service calls. """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') if virtual_network_name is None: raise ValueError('virtual_network_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks/' url = url + quote(virtual_network_name) query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkGetResponse() response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: virtual_network_instance = VirtualNetwork(subnets=[], tags={}) result.virtual_network = virtual_network_instance properties_value = response_doc.get('properties', None) if properties_value is not None: address_space_value = properties_value.get('addressSpace', None) if address_space_value is not None: address_space_instance = AddressSpace(address_prefixes=[]) virtual_network_instance.address_space = address_space_instance address_prefixes_array = address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: address_space_instance.address_prefixes.append(address_prefixes_value) dhcp_options_value = properties_value.get('dhcpOptions', None) if dhcp_options_value is not None: dhcp_options_instance = DhcpOptions(dns_servers=[]) virtual_network_instance.dhcp_options = dhcp_options_instance dns_servers_array = dhcp_options_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dhcp_options_instance.dns_servers.append(dns_servers_value) subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: subnet_json_format_instance = Subnet(ip_configurations=[]) virtual_network_instance.subnets.append(subnet_json_format_instance) properties_value2 = subnets_value.get('properties', None) if properties_value2 is not None: address_prefix_value = properties_value2.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_json_format_instance.address_prefix = address_prefix_instance network_security_group_value = properties_value2.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() subnet_json_format_instance.network_security_group = network_security_group_instance id_value = network_security_group_value.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array = properties_value2.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: resource_id_instance = ResourceId() subnet_json_format_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_json_format_instance.provisioning_state = provisioning_state_instance name_value = subnets_value.get('name', None) if name_value is not None: name_instance = name_value subnet_json_format_instance.name = name_instance etag_value = subnets_value.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_json_format_instance.etag = etag_instance id_value3 = subnets_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_json_format_instance.id = id_instance3 provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_instance.provisioning_state = provisioning_state_instance2 etag_value2 = response_doc.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_instance.etag = etag_instance2 id_value4 = response_doc.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_instance.id = id_instance4 name_value2 = response_doc.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_instance.name = name_instance2 type_value = response_doc.get('type', None) if type_value is not None: type_instance = type_value virtual_network_instance.type = type_instance location_value = response_doc.get('location', None) if location_value is not None: location_instance = location_value virtual_network_instance.location = location_instance tags_sequence_element = response_doc.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_instance.tags[tags_key] = tags_value result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list(self, resource_group_name): """ The list VirtualNetwork returns all Virtual Networks in a resource group Args: resource_group_name (string): The name of the resource group. Returns: VirtualNetworkListResponse: Response for ListVirtualNetworks Api servive call """ # Validate if resource_group_name is None: raise ValueError('resource_group_name cannot be None.') # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/resourceGroups/' url = url + quote(resource_group_name) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkListResponse(virtual_networks=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: virtual_network_json_format_instance = VirtualNetwork(subnets=[], tags={}) result.virtual_networks.append(virtual_network_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: address_space_value = properties_value.get('addressSpace', None) if address_space_value is not None: address_space_instance = AddressSpace(address_prefixes=[]) virtual_network_json_format_instance.address_space = address_space_instance address_prefixes_array = address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: address_space_instance.address_prefixes.append(address_prefixes_value) dhcp_options_value = properties_value.get('dhcpOptions', None) if dhcp_options_value is not None: dhcp_options_instance = DhcpOptions(dns_servers=[]) virtual_network_json_format_instance.dhcp_options = dhcp_options_instance dns_servers_array = dhcp_options_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dhcp_options_instance.dns_servers.append(dns_servers_value) subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: subnet_json_format_instance = Subnet(ip_configurations=[]) virtual_network_json_format_instance.subnets.append(subnet_json_format_instance) properties_value2 = subnets_value.get('properties', None) if properties_value2 is not None: address_prefix_value = properties_value2.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_json_format_instance.address_prefix = address_prefix_instance network_security_group_value = properties_value2.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() subnet_json_format_instance.network_security_group = network_security_group_instance id_value = network_security_group_value.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array = properties_value2.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: resource_id_instance = ResourceId() subnet_json_format_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_json_format_instance.provisioning_state = provisioning_state_instance name_value = subnets_value.get('name', None) if name_value is not None: name_instance = name_value subnet_json_format_instance.name = name_instance etag_value = subnets_value.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_json_format_instance.etag = etag_instance id_value3 = subnets_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_json_format_instance.id = id_instance3 provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_json_format_instance.provisioning_state = provisioning_state_instance2 etag_value2 = value_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_json_format_instance.etag = etag_instance2 id_value4 = value_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_json_format_instance.id = id_instance4 name_value2 = value_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_json_format_instance.name = name_instance2 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value virtual_network_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value virtual_network_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result def list_all(self): """ The list VirtualNetwork returns all Virtual Networks in a subscription Returns: VirtualNetworkListResponse: Response for ListVirtualNetworks Api servive call """ # Validate # Tracing # Construct URL url = '' url = url + '/subscriptions/' if self.client.credentials.subscription_id is not None: url = url + quote(self.client.credentials.subscription_id) url = url + '/providers/' url = url + 'Microsoft.Network' url = url + '/virtualnetworks' query_parameters = [] query_parameters.append('api-version=2015-05-01-preview') if len(query_parameters) > 0: url = url + '?' + '&'.join(query_parameters) base_url = self.client.base_uri # Trim '/' character from the end of baseUrl and beginning of url. if base_url[len(base_url) - 1] == '/': base_url = base_url[0 : len(base_url) - 1] if url[0] == '/': url = url[1 : ] url = base_url + '/' + url url = url.replace(' ', '%20') # Create HTTP transport objects http_request = Request() http_request.url = url http_request.method = 'GET' # Set Headers http_request.headers['Content-Type'] = 'application/json' # Send Request response = self.client.send_request(http_request) body = response.content status_code = response.status_code if status_code != 200: error = AzureHttpError(body, response.status_code) raise error # Create Result result = None # Deserialize Response if status_code == 200: response_content = body result = VirtualNetworkListResponse(virtual_networks=[]) response_doc = None if response_content: response_doc = json.loads(response_content.decode()) if response_doc is not None: value_array = response_doc.get('value', None) if value_array is not None: for value_value in value_array: virtual_network_json_format_instance = VirtualNetwork(subnets=[], tags={}) result.virtual_networks.append(virtual_network_json_format_instance) properties_value = value_value.get('properties', None) if properties_value is not None: address_space_value = properties_value.get('addressSpace', None) if address_space_value is not None: address_space_instance = AddressSpace(address_prefixes=[]) virtual_network_json_format_instance.address_space = address_space_instance address_prefixes_array = address_space_value.get('addressPrefixes', None) if address_prefixes_array is not None: for address_prefixes_value in address_prefixes_array: address_space_instance.address_prefixes.append(address_prefixes_value) dhcp_options_value = properties_value.get('dhcpOptions', None) if dhcp_options_value is not None: dhcp_options_instance = DhcpOptions(dns_servers=[]) virtual_network_json_format_instance.dhcp_options = dhcp_options_instance dns_servers_array = dhcp_options_value.get('dnsServers', None) if dns_servers_array is not None: for dns_servers_value in dns_servers_array: dhcp_options_instance.dns_servers.append(dns_servers_value) subnets_array = properties_value.get('subnets', None) if subnets_array is not None: for subnets_value in subnets_array: subnet_json_format_instance = Subnet(ip_configurations=[]) virtual_network_json_format_instance.subnets.append(subnet_json_format_instance) properties_value2 = subnets_value.get('properties', None) if properties_value2 is not None: address_prefix_value = properties_value2.get('addressPrefix', None) if address_prefix_value is not None: address_prefix_instance = address_prefix_value subnet_json_format_instance.address_prefix = address_prefix_instance network_security_group_value = properties_value2.get('networkSecurityGroup', None) if network_security_group_value is not None: network_security_group_instance = ResourceId() subnet_json_format_instance.network_security_group = network_security_group_instance id_value = network_security_group_value.get('id', None) if id_value is not None: id_instance = id_value network_security_group_instance.id = id_instance ip_configurations_array = properties_value2.get('ipConfigurations', None) if ip_configurations_array is not None: for ip_configurations_value in ip_configurations_array: resource_id_instance = ResourceId() subnet_json_format_instance.ip_configurations.append(resource_id_instance) id_value2 = ip_configurations_value.get('id', None) if id_value2 is not None: id_instance2 = id_value2 resource_id_instance.id = id_instance2 provisioning_state_value = properties_value2.get('provisioningState', None) if provisioning_state_value is not None: provisioning_state_instance = provisioning_state_value subnet_json_format_instance.provisioning_state = provisioning_state_instance name_value = subnets_value.get('name', None) if name_value is not None: name_instance = name_value subnet_json_format_instance.name = name_instance etag_value = subnets_value.get('etag', None) if etag_value is not None: etag_instance = etag_value subnet_json_format_instance.etag = etag_instance id_value3 = subnets_value.get('id', None) if id_value3 is not None: id_instance3 = id_value3 subnet_json_format_instance.id = id_instance3 provisioning_state_value2 = properties_value.get('provisioningState', None) if provisioning_state_value2 is not None: provisioning_state_instance2 = provisioning_state_value2 virtual_network_json_format_instance.provisioning_state = provisioning_state_instance2 etag_value2 = value_value.get('etag', None) if etag_value2 is not None: etag_instance2 = etag_value2 virtual_network_json_format_instance.etag = etag_instance2 id_value4 = value_value.get('id', None) if id_value4 is not None: id_instance4 = id_value4 virtual_network_json_format_instance.id = id_instance4 name_value2 = value_value.get('name', None) if name_value2 is not None: name_instance2 = name_value2 virtual_network_json_format_instance.name = name_instance2 type_value = value_value.get('type', None) if type_value is not None: type_instance = type_value virtual_network_json_format_instance.type = type_instance location_value = value_value.get('location', None) if location_value is not None: location_instance = location_value virtual_network_json_format_instance.location = location_instance tags_sequence_element = value_value.get('tags', None) if tags_sequence_element is not None: for property in tags_sequence_element: tags_key = property tags_value = tags_sequence_element[property] virtual_network_json_format_instance.tags[tags_key] = tags_value next_link_value = response_doc.get('nextLink', None) if next_link_value is not None: next_link_instance = next_link_value result.next_link = next_link_instance result.status_code = status_code result.request_id = response.headers.get('x-ms-request-id') return result
51.773039
202
0.541829
80,104
883,714
5.611043
0.011335
0.019278
0.034681
0.01872
0.933808
0.913567
0.887812
0.86959
0.854886
0.842109
0
0.011676
0.409767
883,714
17,068
203
51.776072
0.850036
0.011959
0
0.842096
0
0
0.04385
0.009554
0
0
0
0
0
0
null
null
0
0.00082
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
ce371a6065c905c0d1fa90d8a87a25e8b478d6a3
2,214
py
Python
writing/migrations/0002_auto_20170425_0015.py
audiua/shkolyar_django
a2de2dc0a42e6bdd51321f857c0aa1106c51ba80
[ "MIT" ]
1
2017-04-22T11:00:07.000Z
2017-04-22T11:00:07.000Z
writing/migrations/0002_auto_20170425_0015.py
audiua/shkolyar_django
a2de2dc0a42e6bdd51321f857c0aa1106c51ba80
[ "MIT" ]
6
2017-04-20T17:49:39.000Z
2017-04-22T11:55:07.000Z
writing/migrations/0002_auto_20170425_0015.py
audiua/shkolyar_django
a2de2dc0a42e6bdd51321f857c0aa1106c51ba80
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-24 21:15 from __future__ import unicode_literals from django.db import migrations, models import unixtimestampfield.fields class Migration(migrations.Migration): dependencies = [ ('writing', '0001_initial'), ] operations = [ migrations.AlterField( model_name='writing', name='create_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now_add=True, default=0.0), ), migrations.AlterField( model_name='writing', name='public_time', field=unixtimestampfield.fields.UnixTimeStampField(default=1493068531), ), migrations.AlterField( model_name='writing', name='slug', field=models.SlugField(max_length=255), ), migrations.AlterField( model_name='writing', name='update_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now=True, default=0.0), ), migrations.AlterField( model_name='writingclas', name='create_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now_add=True, default=0.0), ), migrations.AlterField( model_name='writingclas', name='slug', field=models.SlugField(max_length=255), ), migrations.AlterField( model_name='writingclas', name='update_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now=True, default=0.0), ), migrations.AlterField( model_name='writingsubject', name='create_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now_add=True, default=0.0), ), migrations.AlterField( model_name='writingsubject', name='slug', field=models.SlugField(max_length=255), ), migrations.AlterField( model_name='writingsubject', name='update_time', field=unixtimestampfield.fields.UnixTimeStampField(auto_now=True, default=0.0), ), ]
33.044776
95
0.602078
201
2,214
6.457711
0.263682
0.154083
0.192604
0.223421
0.818952
0.779661
0.691063
0.691063
0.691063
0.691063
0
0.032422
0.289521
2,214
66
96
33.545455
0.792753
0.02981
0
0.813559
1
0
0.098368
0
0
0
0
0
0
1
0
false
0
0.050847
0
0.101695
0
0
0
0
null
0
1
1
1
1
0
0
0
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
020abc4bdd3b836503a765dfc1cfeadb963ae863
60
py
Python
test.py
Teresito/tensorflow-yolov4-tflite
fe3516643796b633e1087b05ee02406f45cc56c2
[ "MIT" ]
null
null
null
test.py
Teresito/tensorflow-yolov4-tflite
fe3516643796b633e1087b05ee02406f45cc56c2
[ "MIT" ]
null
null
null
test.py
Teresito/tensorflow-yolov4-tflite
fe3516643796b633e1087b05ee02406f45cc56c2
[ "MIT" ]
null
null
null
#import tensorflow as tf import cv2 import tensorflow as tf
15
24
0.816667
10
60
4.9
0.5
0.653061
0.734694
0.816327
0
0
0
0
0
0
0
0.02
0.166667
60
3
25
20
0.96
0.383333
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
0257e9a98ef8a2c31aaa1b1a8469512c4d5b9120
1,592
py
Python
organizations/decorators.py
philippeowagner/django-organizations
0c2dd98b5c5af0e3de7cbd4a23567213c5222ac6
[ "BSD-2-Clause" ]
1
2017-09-06T08:19:18.000Z
2017-09-06T08:19:18.000Z
organizations/decorators.py
philippeowagner/django-organizations
0c2dd98b5c5af0e3de7cbd4a23567213c5222ac6
[ "BSD-2-Clause" ]
null
null
null
organizations/decorators.py
philippeowagner/django-organizations
0c2dd98b5c5af0e3de7cbd4a23567213c5222ac6
[ "BSD-2-Clause" ]
null
null
null
from django.contrib.auth.decorators import user_passes_test, REDIRECT_FIELD_NAME from organizations.models import OrganizationUser def organizations_member_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): """ Decorator for views that checks that the user is logged in if the current user is a member of an organisation, redirecting to the log-in page if necessary. To activate the organisation check, set ORGANIZATIONS_MEMBER_REQUIRED = True in your project settings. """ actual_decorator = user_passes_test( lambda u: u.is_authenticated() and bool(OrganizationUser.objects.filter(user=u).count()), login_url=login_url, redirect_field_name=redirect_field_name ) if function: return actual_decorator(function) return actual_decorator def organizations_admin_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): """ Decorator for views that checks that the user is logged in if the current user is a member of an organisation with admin rights, redirecting to the log-in page if necessary. To activate the organisation check, set ORGANIZATIONS_MEMBER_REQUIRED = True in your project settings. """ actual_decorator = user_passes_test( lambda u: u.is_authenticated() and bool(OrganizationUser.objects.filter(user=u, is_admin=True).count()), login_url=login_url, redirect_field_name=redirect_field_name ) if function: return actual_decorator(function) return actual_decorator
44.222222
133
0.751884
213
1,592
5.399061
0.29108
0.101739
0.133043
0.086957
0.841739
0.841739
0.841739
0.841739
0.841739
0.841739
0
0
0.188442
1,592
35
134
45.485714
0.890093
0.337312
0
0.6
0
0
0
0
0
0
0
0
0
1
0.1
false
0.15
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
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
7
5a4cded89b04d091fc90d357018d3e8c17afd1d6
12,198
py
Python
src/blender/blender_autocomplete-master/2.92/bl_ui/properties_paint_common.py
JonasWard/ClayAdventures
a716445ac690e4792e70658319aa1d5299f9c9e9
[ "MIT" ]
1
2020-03-25T10:55:10.000Z
2020-03-25T10:55:10.000Z
src/blender/blender_autocomplete-master/2.92/bl_ui/properties_paint_common.py
JonasWard/ClayAdventures
a716445ac690e4792e70658319aa1d5299f9c9e9
[ "MIT" ]
null
null
null
src/blender/blender_autocomplete-master/2.92/bl_ui/properties_paint_common.py
JonasWard/ClayAdventures
a716445ac690e4792e70658319aa1d5299f9c9e9
[ "MIT" ]
null
null
null
import sys import typing import bpy_types class UnifiedPaintPanel: def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class VIEW3D_MT_tools_projectpaint_clone(bpy_types.Menu, bpy_types._GenericUI): bl_label = None ''' ''' bl_rna = None ''' ''' id_data = None ''' ''' def append(self, draw_func): ''' ''' pass def as_pointer(self): ''' ''' pass def bl_rna_get_subclass(self): ''' ''' pass def bl_rna_get_subclass_py(self): ''' ''' pass def draw(self, context): ''' ''' pass def draw_collapsible(self, context, layout): ''' ''' pass def draw_preset(self, _context): ''' ''' pass def driver_add(self): ''' ''' pass def driver_remove(self): ''' ''' pass def get(self): ''' ''' pass def is_extended(self): ''' ''' pass def is_property_hidden(self): ''' ''' pass def is_property_overridable_library(self): ''' ''' pass def is_property_readonly(self): ''' ''' pass def is_property_set(self): ''' ''' pass def items(self): ''' ''' pass def keyframe_delete(self): ''' ''' pass def keyframe_insert(self): ''' ''' pass def keys(self): ''' ''' pass def path_from_id(self): ''' ''' pass def path_menu(self, searchpaths, operator, props_default, prop_filepath, filter_ext, filter_path, display_name, add_operator): ''' ''' pass def path_resolve(self): ''' ''' pass def pop(self): ''' ''' pass def prepend(self, draw_func): ''' ''' pass def property_overridable_library_set(self): ''' ''' pass def property_unset(self): ''' ''' pass def remove(self, draw_func): ''' ''' pass def type_recast(self): ''' ''' pass def values(self): ''' ''' pass class BrushPanel(UnifiedPaintPanel): def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class BrushSelectPanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' def draw(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class ClonePanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def draw_header(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class ColorPalettePanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class DisplayPanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def draw_header(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class FalloffPanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class SmoothStrokePanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def draw_header(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class StrokePanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' bl_ui_units_x = None ''' ''' def draw(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass class TextureMaskPanel(BrushPanel, UnifiedPaintPanel): bl_label = None ''' ''' bl_options = None ''' ''' def draw(self, context): ''' ''' pass def get_brush_mode(self, context): ''' ''' pass def paint_settings(self, context): ''' ''' pass def poll(self, context): ''' ''' pass def prop_unified(self, layout, context, brush, prop_name, unified_name, pressure_name, icon, text, slider, header): ''' ''' pass def prop_unified_color(self, parent, context, brush, prop_name, text): ''' ''' pass def prop_unified_color_picker(self, parent, context, brush, prop_name, value_slider): ''' ''' pass def brush_basic__draw_color_selector(context, layout, brush, gp_settings, props): ''' ''' pass def brush_basic_gpencil_paint_settings(layout, context, brush, compact): ''' ''' pass def brush_basic_gpencil_sculpt_settings(layout, context, brush, compact): ''' ''' pass def brush_basic_gpencil_vertex_settings(layout, _context, brush, compact): ''' ''' pass def brush_basic_gpencil_weight_settings(layout, _context, brush, compact): ''' ''' pass def brush_basic_texpaint_settings(layout, context, brush, compact): ''' ''' pass def brush_mask_texture_settings(layout, brush): ''' ''' pass def brush_settings(layout, context, brush, popover): ''' ''' pass def brush_settings_advanced(layout, context, brush, popover): ''' ''' pass def brush_shared_settings(layout, context, brush, popover): ''' ''' pass def brush_texture_settings(layout, brush, sculpt): ''' ''' pass def draw_color_settings(context, layout, brush, color_type): ''' ''' pass
15.343396
79
0.467208
1,080
12,198
5.031481
0.103704
0.128819
0.115937
0.139124
0.803644
0.767022
0.767022
0.744939
0.71071
0.701509
0
0.00014
0.412855
12,198
794
80
15.36272
0.758587
0
0
0.787004
0
0
0
0
0
0
0
0
0
1
0.400722
false
0.400722
0.01083
0
0.519856
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
1
0
1
0
0
1
0
0
10
5a6baac2de23afc582d7ccc96506bf977348bb8b
24,809
py
Python
tests/open_alchemy/models_file/artifacts/test_database/test_database_relationship.py
rgreinho/OpenAlchemy
23202bdecb94763d09b6d9e84eb9b29506c811ae
[ "Apache-2.0" ]
null
null
null
tests/open_alchemy/models_file/artifacts/test_database/test_database_relationship.py
rgreinho/OpenAlchemy
23202bdecb94763d09b6d9e84eb9b29506c811ae
[ "Apache-2.0" ]
53
2020-12-30T15:32:55.000Z
2022-03-31T10:07:00.000Z
tests/open_alchemy/models_file/artifacts/test_database/test_database_relationship.py
rgreinho/OpenAlchemy
23202bdecb94763d09b6d9e84eb9b29506c811ae
[ "Apache-2.0" ]
null
null
null
"""Tests for type_.""" # pylint: disable=protected-access,unused-import import typing # noqa: F401 import pytest import sqlalchemy from sqlalchemy.ext import declarative import open_alchemy from open_alchemy import models_file from open_alchemy import schemas @pytest.mark.models_file def test_model_database_type_many_to_one(engine, sessionmaker): """ GIVEN spec for a many to one relationship WHEN spec is constructed with model factory and queried THEN the referenced type is a single object that is nullable and the back reference is an array that is not nullable. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "tables", "type": "object", }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_table": {"$ref": "#/components/schemas/RefTable"}, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") ref_model = model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) assert "RefTable" in schemas_artifacts ref_model_schemas_artifacts = schemas_artifacts["RefTable"] ref_model_models_artifacts = models_file._artifacts.calculate( artifacts=ref_model_schemas_artifacts, name="RefTable" ) assert len(ref_model_models_artifacts.sqlalchemy.columns) == 3 tables_column_artifacts = ref_model_models_artifacts.sqlalchemy.columns[2] assert tables_column_artifacts.name == "tables" calculated_backref_type_str = tables_column_artifacts.type assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_table_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_table_column_artifacts.name == "ref_table" calculated_type_str = ref_table_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of model and ref_model ref_model_instance1 = ref_model(id=11, name="ref table name 1") model_instance1 = model(id=12, name="table name 1", ref_table=ref_model_instance1) session.add(ref_model_instance1) session.add(model_instance1) session.flush() # Creating instance of model with None ref_model model_instance2 = model(id=22, name="table name 2", ref_table=None) session.add(model_instance2) session.flush() # Querying session queried_models = session.query(model).all() assert queried_models[0].ref_table is not None assert queried_models[1].ref_table is None # Check that returned type is correct assert calculated_type_str == 'typing.Optional["TRefTable"]' # Creating instance of ref_model without models ref_model_instance3 = ref_model(id=31, name="ref table name 3") session.add(ref_model_instance3) # Creating instance of ref_model without empty models ref_model_instance4 = ref_model(id=41, name="ref table name 4", tables=[]) session.add(ref_model_instance4) # Creating instance of ref_model with single model ref_model_instance5 = ref_model( id=51, name="ref table name 5", tables=[model(id=52, name="table name 5")] ) session.add(ref_model_instance5) session.flush() # Querying session queried_ref_models = session.query(ref_model).all() assert len(queried_ref_models[1].tables) == 0 assert len(queried_ref_models[2].tables) == 0 assert len(queried_ref_models[3].tables) == 1 # Try constructing null for models with pytest.raises(TypeError): ref_model(id=41, name="ref table name 4", tables=None) assert calculated_backref_type_str == 'typing.Sequence["TTable"]' @pytest.mark.models_file def test_model_database_type_many_to_one_not_nullable(engine, sessionmaker): """ GIVEN spec with many to one relationship that is not nullable WHEN models are constructed and None is passed for the object reference THEN sqlalchemy.exc.IntegrityError is raised. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "tables", "type": "object", }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_table": { "allOf": [ {"$ref": "#/components/schemas/RefTable"}, {"nullable": False}, ], }, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_table_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_table_column_artifacts.name == "ref_table" calculated_type_str = ref_table_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of model with None ref_model model_instance = model(id=12, name="table name 1", ref_table=None) session.add(model_instance) with pytest.raises(sqlalchemy.exc.IntegrityError): session.flush() # Check that returned type is correct assert calculated_type_str == '"TRefTable"' @pytest.mark.models_file def test_model_database_type_one_to_one(engine, sessionmaker): """ GIVEN spec for a one to one relationship WHEN spec is constructed with model factory and queried THEN the referenced type is a single object that is nullable and the back reference is an single object that is nullable. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "table", "x-uselist": False, "type": "object", }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_table": {"$ref": "#/components/schemas/RefTable"}, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") ref_model = model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) assert "RefTable" in schemas_artifacts ref_model_schemas_artifacts = schemas_artifacts["RefTable"] ref_model_models_artifacts = models_file._artifacts.calculate( artifacts=ref_model_schemas_artifacts, name="RefTable" ) assert len(ref_model_models_artifacts.sqlalchemy.columns) == 3 table_column_artifacts = ref_model_models_artifacts.sqlalchemy.columns[2] assert table_column_artifacts.name == "table" calculated_backref_type_str = table_column_artifacts.type assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_table_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_table_column_artifacts.name == "ref_table" calculated_type_str = ref_table_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of model and ref_model ref_model_instance1 = ref_model(id=11, name="ref table name 1") model_instance1 = model(id=12, name="table name 1", ref_table=ref_model_instance1) session.add(ref_model_instance1) session.add(model_instance1) session.flush() # Creating instance of model with None ref_model model_instance2 = model(id=22, name="table name 2", ref_table=None) session.add(model_instance2) session.flush() # Querying session queried_models = session.query(model).all() assert queried_models[0].ref_table is not None assert queried_models[1].ref_table is None # Check that returned type is correct assert calculated_type_str == 'typing.Optional["TRefTable"]' # Creating instance of ref_model without model ref_model_instance3 = ref_model(id=31, name="ref table name 3") session.add(ref_model_instance3) # Creating instance of ref_model with model ref_model_instance4 = ref_model( id=41, name="ref table name 4", table=model(id=42, name="table name 4") ) session.add(ref_model_instance4) session.flush() # Querying session queried_ref_models = session.query(ref_model).all() assert queried_ref_models[1].table is None assert queried_ref_models[2].table is not None assert calculated_backref_type_str == 'typing.Optional["TTable"]' @pytest.mark.models_file def test_model_database_type_one_to_one_not_nullable(engine, sessionmaker): """ GIVEN spec with one to one relationship that is not nullable WHEN models are constructed and None is passed for the object reference THEN sqlalchemy.exc.IntegrityError is raised for the relationship and not for the back reference which is still a single object that is nullable. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "table", "type": "object", "x-uselist": False, }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_table": { "allOf": [ {"$ref": "#/components/schemas/RefTable"}, {"nullable": False}, ] }, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") ref_model = model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) assert "RefTable" in schemas_artifacts ref_model_schemas_artifacts = schemas_artifacts["RefTable"] ref_model_models_artifacts = models_file._artifacts.calculate( artifacts=ref_model_schemas_artifacts, name="RefTable" ) assert len(ref_model_models_artifacts.sqlalchemy.columns) == 3 table_column_artifacts = ref_model_models_artifacts.sqlalchemy.columns[2] assert table_column_artifacts.name == "table" calculated_backref_type_str = table_column_artifacts.type assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_table_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_table_column_artifacts.name == "ref_table" calculated_type_str = ref_table_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of ref_model without model ref_model_instance1 = ref_model(id=11, name="ref table name 1") session.add(ref_model_instance1) # Creating instance of ref_model with model ref_model_instance2 = ref_model( id=21, name="ref table name 2", table=model(id=22, name="table name 2") ) session.add(ref_model_instance2) session.flush() # Querying session queried_ref_models = session.query(ref_model).all() assert queried_ref_models[0].table is None assert queried_ref_models[1].table is not None assert calculated_backref_type_str == 'typing.Optional["TTable"]' # Creating models base.metadata.create_all(engine) # Creating instance of model with None ref_model model_instance = model(id=32, name="table name 3", ref_table=None) session = sessionmaker() session.add(model_instance) with pytest.raises(sqlalchemy.exc.IntegrityError): session.flush() # Check that returned type is correct assert calculated_type_str == '"TRefTable"' @pytest.mark.models_file def test_model_database_type_one_to_many(engine, sessionmaker): """ GIVEN spec for a one to many relationship WHEN spec is constructed with model factory and queried THEN the referenced type is an array that is not nullable and the back reference is an object that is nullable. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "table", "type": "object", }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_tables": { "type": "array", "items": {"$ref": "#/components/schemas/RefTable"}, }, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") ref_model = model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) assert "RefTable" in schemas_artifacts ref_model_schemas_artifacts = schemas_artifacts["RefTable"] ref_model_models_artifacts = models_file._artifacts.calculate( artifacts=ref_model_schemas_artifacts, name="RefTable" ) assert len(ref_model_models_artifacts.sqlalchemy.columns) == 3 table_column_artifacts = ref_model_models_artifacts.sqlalchemy.columns[2] assert table_column_artifacts.name == "table" calculated_backref_type_str = table_column_artifacts.type assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_tables_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_tables_column_artifacts.name == "ref_tables" calculated_type_str = ref_tables_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of model without ref_models model_instance1 = model(id=11, name="ref table name 1") session.add(model_instance1) # Creating instance of model without empty ref_models model_instance2 = model(id=21, name="ref table name 2", ref_tables=[]) session.add(model_instance2) # Creating instance of model with single ref_model model_instance3 = model( id=31, name="ref table name 3", ref_tables=[ref_model(id=32, name="table name 3")], ) session.add(model_instance3) session.flush() # Querying session queried_models = session.query(model).all() assert len(queried_models[0].ref_tables) == 0 assert len(queried_models[1].ref_tables) == 0 assert len(queried_models[2].ref_tables) == 1 # Try constructing null for models with pytest.raises(TypeError): model(id=41, name="ref table name 4", ref_tables=None) assert calculated_type_str == 'typing.Sequence["TRefTable"]' # Creating instance of ref_model with model ref_model_instance5 = ref_model( id=51, name="ref table name 5", table=model(id=52, name="table name 5") ) session.add(ref_model_instance5) # Creating instance of ref_model with None model ref_model_instance6 = ref_model(id=61, name="ref table name 6", table=None) session.add(ref_model_instance6) session.flush() # Querying session queried_models = session.query(ref_model).all() assert queried_models[1].table is not None assert queried_models[2].table is None assert calculated_backref_type_str == 'typing.Optional["TTable"]' @pytest.mark.models_file def test_model_database_type_many_to_many(engine, sessionmaker): """ GIVEN spec for a many to many relationship WHEN spec is constructed with model factory and queried THEN the referenced and back reference type is an array that is not nullable. """ # Defining specification spec = { "components": { "schemas": { "RefTable": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, }, "x-tablename": "ref_table", "x-backref": "tables", "type": "object", "x-secondary": "association", }, "Table": { "properties": { "id": {"type": "integer", "x-primary-key": True}, "name": {"type": "string"}, "ref_tables": { "type": "array", "items": {"$ref": "#/components/schemas/RefTable"}, }, }, "x-tablename": "table", "type": "object", }, } } } # Creating model factory base = declarative.declarative_base() model_factory = open_alchemy.init_model_factory(spec=spec, base=base) model = model_factory(name="Table") ref_model = model_factory(name="RefTable") # Calculate the expected type schemas_artifacts = schemas.artifacts.get_from_schemas( schemas=spec["components"]["schemas"], stay_within_model=False ) # Expecting 3 due to association assert "RefTable" in schemas_artifacts ref_model_schemas_artifacts = schemas_artifacts["RefTable"] ref_model_models_artifacts = models_file._artifacts.calculate( artifacts=ref_model_schemas_artifacts, name="RefTable" ) assert len(ref_model_models_artifacts.sqlalchemy.columns) == 3 tables_column_artifacts = ref_model_models_artifacts.sqlalchemy.columns[2] assert tables_column_artifacts.name == "tables" calculated_backref_type_str = tables_column_artifacts.type assert "Table" in schemas_artifacts model_schemas_artifacts = schemas_artifacts["Table"] model_models_artifacts = models_file._artifacts.calculate( artifacts=model_schemas_artifacts, name="Table" ) assert len(model_models_artifacts.sqlalchemy.columns) == 3 ref_tables_column_artifacts = model_models_artifacts.sqlalchemy.columns[2] assert ref_tables_column_artifacts.name == "ref_tables" calculated_type_str = ref_tables_column_artifacts.type # Creating models base.metadata.create_all(engine) session = sessionmaker() # Creating instance of model without ref_models model_instance1 = model(id=11, name="ref table name 1") session.add(model_instance1) # Creating instance of model without empty ref_models model_instance2 = model(id=21, name="ref table name 2", ref_tables=[]) session.add(model_instance2) # Creating instance of model with single ref_model model_instance3 = model( id=31, name="ref table name 3", ref_tables=[ref_model(id=32, name="table name 3")], ) session.add(model_instance3) session.flush() # Querying session queried_models = session.query(model).all() assert len(queried_models[0].ref_tables) == 0 assert len(queried_models[1].ref_tables) == 0 assert len(queried_models[2].ref_tables) == 1 # Try constructing null for models with pytest.raises(TypeError): model(id=41, name="ref table name 4", ref_tables=None) assert calculated_type_str == 'typing.Sequence["TRefTable"]' # Creating instance of ref_model without models ref_model_instance5 = ref_model(id=51, name="ref table name 5") session.add(ref_model_instance5) # Creating instance of ref_model without empty models ref_model_instance6 = ref_model(id=61, name="ref table name 6", tables=[]) session.add(ref_model_instance6) # Creating instance of ref_model with single model ref_model_instance7 = ref_model( id=71, name="ref table name 7", tables=[model(id=72, name="table name 7")] ) session.add(ref_model_instance7) session.flush() # Querying session queried_ref_models = session.query(ref_model).all() assert len(queried_ref_models[1].tables) == 0 assert len(queried_ref_models[2].tables) == 0 assert len(queried_ref_models[3].tables) == 1 # Try constructing null for models with pytest.raises(TypeError): ref_model(id=81, name="ref table name 8", tables=None) assert calculated_backref_type_str == 'typing.Sequence["TTable"]'
38.88558
87
0.630578
2,815
24,809
5.320071
0.056483
0.055021
0.044071
0.025641
0.959802
0.951055
0.950454
0.93543
0.917001
0.904714
0
0.012166
0.267766
24,809
637
88
38.946625
0.812232
0.141441
0
0.762712
0
0
0.133969
0.019505
0
0
0
0
0.139831
1
0.012712
false
0
0.014831
0
0.027542
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
ce812102c5c88ddbe48e54317767755a9cea7d6e
105
py
Python
cnuchatbot/chatbotapp/cnudata/cafeteria/studenthall1_info.py
ChanhyukPark-Tech/CnuChatBot
c204b7f037a7dc8a2ca7f398a84aae68df245327
[ "MIT" ]
null
null
null
cnuchatbot/chatbotapp/cnudata/cafeteria/studenthall1_info.py
ChanhyukPark-Tech/CnuChatBot
c204b7f037a7dc8a2ca7f398a84aae68df245327
[ "MIT" ]
null
null
null
cnuchatbot/chatbotapp/cnudata/cafeteria/studenthall1_info.py
ChanhyukPark-Tech/CnuChatBot
c204b7f037a7dc8a2ca7f398a84aae68df245327
[ "MIT" ]
null
null
null
from chatbotapp.common.kakaojsonformat import * from chatbotapp.common.variables.cafeteria import *
15
51
0.809524
11
105
7.727273
0.636364
0.329412
0.470588
0
0
0
0
0
0
0
0
0
0.12381
105
6
52
17.5
0.923913
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
ce858d76c3b53c6aa4930ec79d6bee6d6e8cb592
9,475
py
Python
figures/python/compare.py
watermarkhu/tqe_paper_ufbb
f9b171049e028ace58be3ab4a01cddac94f7e01e
[ "CC-BY-4.0" ]
null
null
null
figures/python/compare.py
watermarkhu/tqe_paper_ufbb
f9b171049e028ace58be3ab4a01cddac94f7e01e
[ "CC-BY-4.0" ]
null
null
null
figures/python/compare.py
watermarkhu/tqe_paper_ufbb
f9b171049e028ace58be3ab4a01cddac94f7e01e
[ "CC-BY-4.0" ]
1
2020-09-11T15:53:16.000Z
2020-09-11T15:53:16.000Z
from fitread import read_data from style import get_colors, get_markers2, get_linestyles, plot_style import matplotlib.pyplot as plt from matplotlib.lines import Line2D from scipy import optimize import numpy as np lw=1 def plot_compare( names, csv_names, xaxis, probs, latts, feature, plot_error=False, dim=1, xm=1, ms=5, normy=None, xname=None, yname="", output="", fitname="", folder="/home/watermarkhu/mep/mep-thesis/pgfplots/", show_legend=True, markers=None, colors=None, linestyles=None, gridcolor="k", **kwargs ): if fitname == "": fit = None else: if fitname in globals(): fit = globals()[fitname]() else: print("fit does not exist") fit = None if not markers: markers = get_markers2() if not colors: colors = get_colors() if not linestyles: linestyles = get_linestyles() xchoice = dict(p="p", P="p", l="L", L="L") ychoice = dict(p="L", P="L", l="p", L="p") xchoice, ychoice = xchoice[xaxis], ychoice[xaxis] xlabels, ylabels = (probs, latts) if xaxis == "p" else (latts, probs) if xlabels: xlabels = sorted(xlabels) if xname is None: xname = xchoice data, leg1, leg2 = [], [], [] for i, (name, x) in enumerate(zip(csv_names, names)): ls = linestyles[x] leg1.append(Line2D([0], [0], ls=ls, color=colors[x], label=x, lw=lw)) data.append(read_data(name)) if not ylabels: ylabels = set() for df in data: for item in df.index.get_level_values(ychoice): ylabels.add(round(item, 6)) ylabels = sorted(list(ylabels)) xset = set() for i, (df,name) in enumerate(zip(data,names)): indices = [round(x, 6) for x in df.index.get_level_values(ychoice)] ls = linestyles[name] for j, ylabel in enumerate(ylabels): marker = markers[name] # color = colors[ylabel] color = colors[name] if name == "MWPM" and normy is not None: ylabel = normy d = df.loc[[x == ylabel for x in indices]] index = [round(v, 6) for v in d.index.get_level_values(xchoice)] d = d.reset_index(drop=True) d["index"] = index d = d.set_index("index") if not xlabels: X = index xset = xset.union(set(X)) else: X = [x for x in xlabels if x in d.index.values] column = feature if feature in df else f"{feature}_m" Y = [d.loc[x, column] for x in X] if dim != 1: X = [x**dim for x in X] # print(ylabel, X, Y) # if fit is not None: guess, min, max = fit.guesses() res = optimize.curve_fit( fit.func, X, Y, guess, bounds=[min, max]) step = abs(int((X[-1] - X[0])/100)) pn = np.array(range(X[0], X[-1] + step, step)) ft = fit.func(pn, *res[0]) plt.plot(pn, ft, ls=ls, c=color, lw=lw) plt.plot(X, Y, lw=0, c=color, marker=marker, ms=ms, fillstyle="none") print(f"{ychoice} = {ylabel}", fit.show(*res[0])) else: plt.plot(X, Y, ls=ls, c=color, marker=marker, ms=ms, fillstyle="none", lw=lw) if i == 0: leg2.append(Line2D([0], [0], ls=ls, c=color, marker=marker, lw=lw, ms=ms, fillstyle="none", label=f"{ychoice}={ylabel}")) if plot_error and f"{feature}_v" in d: E = list(d.loc[:, f"{feature}_v"]) ym = [y - e for y, e in zip(Y, E)] yp = [y + e for y, e in zip(Y, E)] plt.fill_between(X, ym, yp, alpha=0.1, facecolor=color, edgecolor=color, ls=ls, lw=2) xnames = sorted(list(xset)) if not xlabels else xlabels xticks = [x**dim for x in xnames] xnames = [round(x*xm, 3) for x in xnames] plt.xticks(xticks, xnames) if show_legend: L1 = plt.legend(handles=leg1, loc="upper left") plt.gca().add_artist(L1) if len(probs) > 1: L2 = plt.legend(handles=leg2, loc="upper left", ncol=3) plt.gca().add_artist(L2) plot_style(plt.gca(), "", xname, yname, gridcolor=gridcolor) # plt.title("Comparison of matching weight") plt.tight_layout() if output: plt.savefig(folder + "{}.pgf".format(output)) def plot_compare2( names, csv_names, xaxis, probs, latts, feature, plot_error=False, dim=1, xm=1, ms=5, normy=None, yname="", xname=None, output="", fitname="", folder="/home/watermarkhu/mep/mep-thesis/pgfplots/", show_legend=True, show_normline=True, markers=None, colors=None, linestyles=None, gridcolor="k", **kwargs ): if fitname == "": fit = None else: if fitname in globals(): fit = globals()[fitname]() else: print("fit does not exist") fit = None if not markers: markers = get_markers2() if not colors: colors = get_colors() if not linestyles: linestyles = get_linestyles() xchoice = dict(p="p", P="p", l="L", L="L") ychoice = dict(p="L", P="L", l="p", L="p") xchoice, ychoice = xchoice[xaxis], ychoice[xaxis] xlabels, ylabels = (probs, latts) if xaxis == "p" else (latts, probs) if xlabels: xlabels = sorted(xlabels) if xname is None: xname = xchoice data, leg1, leg2 = [], [], [] for i, (name, x) in enumerate(zip(csv_names, names)): data.append(read_data(name)) if i != 0: ls = linestyles[x] leg1.append(Line2D([0], [0], ls=ls, color=colors[x], label=x, lw=lw)) if not ylabels: ylabels = set() for df in data: for item in df.index.get_level_values(ychoice): ylabels.add(round(item, 6)) ylabels = sorted(list(ylabels)) xset = set() for i, (df, name) in enumerate(zip(data, names)): indices = [round(x, 6) for x in df.index.get_level_values(ychoice)] ls = linestyles[name] print(i, name) for j, ylabel in enumerate(ylabels): marker = markers[name] # color = colors[ylabel] color = colors[name] if i == 0 and normy is not None: ylabel = normy d = df.loc[[x == ylabel for x in indices]] index = [round(v, 6) for v in d.index.get_level_values(xchoice)] d = d.reset_index(drop=True) d["index"] = index d = d.set_index("index") if not xlabels: X = index xset = xset.union(set(X)) else: X = [x for x in xlabels if x in d.index.values] column = feature if feature in df else f"{feature}_m" Y = [d.loc[x, column] for x in X] if dim != 1: X = [x**dim for x in X] if i == 0: Ynorm = Y marker="None" if not show_normline: continue Y = [y1/y2 for y1, y2 in zip(Y,Ynorm)] # print(ylabel, X, Y) # if fit is not None: guess, min, max = fit.guesses() res = optimize.curve_fit( fit.func, X, Y, guess, bounds=[min, max]) step = abs(int((X[-1] - X[0])/100)) pn = np.array(range(X[0], X[-1] + step, step)) ft = fit.func(pn, *res[0]) plt.plot(pn, ft, ls=ls, c=color, lw=lw) plt.plot(X, Y, lw=0, c=color, marker=marker, ms=ms, fillstyle="none") print(f"{ychoice} = {ylabel}", fit.show(*res[0])) else: plt.plot(X, Y, ls=ls, c=color, marker=marker, lw=lw, ms=ms, fillstyle="none") if i == 0: leg2.append(Line2D([0], [0], ls=ls, c=color, marker=marker, ms=ms, fillstyle="none", label=f"{ychoice}={ylabel}", lw=lw)) if plot_error and f"{feature}_v" in d: E = list(d.loc[:, f"{feature}_v"]) ym = [y - e for y, e in zip(Y, E)] yp = [y + e for y, e in zip(Y, E)] plt.fill_between(X, ym, yp, alpha=0.1, facecolor=color, edgecolor=color, ls=ls, lw=2) xnames = sorted(list(xset)) if not xlabels else xlabels xticks = [x**dim for x in xnames] xnames = [round(x*xm, 3) for x in xnames] plt.xticks(xticks, xnames) if show_legend: L1 = plt.legend(handles=leg1, loc="center right", bbox_to_anchor=(1, 0.4)) plt.gca().add_artist(L1) if len(probs) > 1: L2 = plt.legend(handles=leg2, ncol=3) plt.gca().add_artist(L2) plot_style(plt.gca(), "", xchoice, yname, gridcolor=gridcolor) # plt.title("Comparison of matching weight, normalized to MWPM") plt.tight_layout() if output: plt.savefig(folder + "{}.pgf".format(output))
30.271565
96
0.502164
1,267
9,475
3.704025
0.138911
0.011507
0.017899
0.024292
0.911144
0.910718
0.900916
0.900916
0.892819
0.868528
0
0.015829
0.359894
9,475
312
97
30.36859
0.757955
0.020158
0
0.872
0
0
0.040755
0.009057
0
0
0
0
0
1
0.008
false
0
0.024
0
0.032
0.02
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
0c7bfa4e0f02f4b8b4fa67ec5a0f33f5f72d23f3
150
py
Python
jvd/src/trees/__init__.py
ccDev-Labs/JARV1S-Disassembler
ee41eb493c15a66b4695b6f24039c38471b7eb47
[ "Apache-2.0" ]
null
null
null
jvd/src/trees/__init__.py
ccDev-Labs/JARV1S-Disassembler
ee41eb493c15a66b4695b6f24039c38471b7eb47
[ "Apache-2.0" ]
null
null
null
jvd/src/trees/__init__.py
ccDev-Labs/JARV1S-Disassembler
ee41eb493c15a66b4695b6f24039c38471b7eb47
[ "Apache-2.0" ]
null
null
null
from jvd.src.trees.java import JavaASTExtractor from jvd.src.trees.python import PythonASTExtractor from jvd.src.trees.c_cpp import JoernCPPExtractor
37.5
51
0.86
22
150
5.818182
0.545455
0.164063
0.234375
0.351563
0
0
0
0
0
0
0
0
0.08
150
3
52
50
0.927536
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
0c9599da593406f6dd35948032e808397b1696fc
140
py
Python
sidekick/admin.py
praekeltfoundation/rp-sidekick
01f2d1ced8caefb39c93112f74baac70dbe943bc
[ "BSD-3-Clause" ]
1
2018-10-05T21:47:43.000Z
2018-10-05T21:47:43.000Z
sidekick/admin.py
praekeltfoundation/rp-sidekick
01f2d1ced8caefb39c93112f74baac70dbe943bc
[ "BSD-3-Clause" ]
114
2018-08-14T14:37:20.000Z
2020-07-31T15:56:51.000Z
sidekick/admin.py
praekeltfoundation/rp-sidekick
01f2d1ced8caefb39c93112f74baac70dbe943bc
[ "BSD-3-Clause" ]
null
null
null
from django.contrib import admin from .models import Consent, Organization admin.site.register(Organization) admin.site.register(Consent)
20
41
0.828571
18
140
6.444444
0.555556
0.293103
0.362069
0.5
0
0
0
0
0
0
0
0
0.092857
140
6
42
23.333333
0.913386
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
7
0b9b4625c407262306c27e9070dab2b07e213b65
9,199
py
Python
CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py
malbouis/cmssw
16173a30d3f0c9ecc5419c474bb4d272c58b65c8
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py
gartung/cmssw
3072dde3ce94dcd1791d778988198a44cde02162
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
CalibMuon/CSCCalibration/python/CSCL1TPLookupTableEP_cff.py
gartung/cmssw
3072dde3ce94dcd1791d778988198a44cde02162
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms CSCL1TPLookupTableEP = cms.ESSource( "CSCL1TPLookupTableEP", ## CCLUT positionLUTFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat0_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat1_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat2_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat3_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodePosOffsetLUT_pat4_v1.txt" ), slopeLUTFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat0_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat1_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat2_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat3_v1.txt", "L1Trigger/CSCTriggerPrimitives/data/CCLUT/CSCComparatorCodeSlopeLUT_pat4_v1.txt" ), ## convert pad number to 1/2-strip in ME1a padToHsME1aFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_odd.txt", ), ## convert pad number to 1/2-strip in ME1b padToHsME1bFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_odd.txt", ), ## convert pad number to 1/2-strip in ME21 padToHsME21Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_odd.txt", ), ## convert pad number to 1/8-strip in ME1a padToEsME1aFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_odd.txt", ), ## convert pad number to 1/8-strip in ME1b padToEsME1bFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_odd.txt", ), ## convert pad number to 1/8-strip in ME21 padToEsME21Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_odd.txt", ), ## convert eta partition to minimum wiregroup in ME11 rollToMinWgME11Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", ), ## convert eta partition to maximum wiregroup in ME11 rollToMaxWgME11Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", ), ## convert eta partition to minimum wiregroup in ME21 rollToMinWgME21Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", ), ## convert eta partition to maximum wiregroup in ME21 rollToMaxWgME21Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", ), # lookup tables for the GEM-CSC slope correction gemCscSlopeCorrectionFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_even_GE11_layer2.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCSlopeCorr_ME11_odd_GE11_layer2.txt", ), # lookup tables for the GEM-CSC slope correction gemCscSlopeCosiFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_even_GE11_layer2.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_2to1_SlopeShift_ME11_odd_GE11_layer2.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_even_GE11_layer2.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/CSCconsistency_3to1_SlopeShift_ME11_odd_GE11_layer2.txt", ), # lookup tables for the GEM-CSC slope correction gemCscSlopeCosiCorrectionFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_even_GE11_layer2.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer1.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/SlopeCorrection/FacingChambers/GEMCSCconsistentSlopeCorr_ME11_odd_GE11_layer2.txt", ), # convert differences in 1/8-strip numbers between GEM and CSC to Run-3 slopes esDiffToSlopeME1aFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1a_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1a_odd.txt", ), esDiffToSlopeME1bFiles = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME1b_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME1b_odd.txt", ), esDiffToSlopeME21Files = cms.vstring( "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L1_ME21_odd.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_even.txt", "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/BendingAngle/GEMCSCLUT_es_diff_slope_L2_ME21_odd.txt", ), )
74.788618
141
0.809545
974
9,199
7.321355
0.101643
0.268406
0.305427
0.306268
0.919647
0.910391
0.896929
0.813911
0.809704
0.771
0
0.039936
0.109903
9,199
122
142
75.401639
0.830972
0.072508
0
0.169811
0
0
0.789418
0.787066
0
1
0
0
0
1
0
false
0
0.009434
0
0.009434
0
0
0
0
null
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
12
0bb4c5193178618cedf9e5ca0d0821aca06ee94a
32,485
py
Python
tests/models/boundary/test_get_intersection_of_two_boundaries.py
EderVs/Voronoi-Diagrams
6e69f9b6eb516dee12d66f187cf267a7b527da5f
[ "MIT" ]
3
2021-11-12T17:43:08.000Z
2022-01-03T02:47:34.000Z
tests/models/boundary/test_get_intersection_of_two_boundaries.py
EderVs/Voronoi-Diagrams
6e69f9b6eb516dee12d66f187cf267a7b527da5f
[ "MIT" ]
3
2021-11-19T20:12:31.000Z
2021-11-19T20:14:39.000Z
tests/models/boundary/test_get_intersection_of_two_boundaries.py
EderVs/Voronoi-Diagrams
6e69f9b6eb516dee12d66f187cf267a7b527da5f
[ "MIT" ]
null
null
null
"""Test get boundaries intersection point.""" # Standard from typing import List, Any from random import randint # Models from voronoi_diagrams.models import ( PointBisector, Point, Site, PointBoundary, WeightedSite, WeightedPointBoundary, WeightedPointBisector, ) # Math from decimal import Decimal # General Utils from general_utils.numbers import are_close class TestGetIntersectionInPointBoundary: """Test get intersections in PointBoundary.""" def test_two_boundaries(self): """Test get intersection with 3 positive fixed sites.""" p = Site(Decimal(0), Decimal(0)) q = Site(Decimal(2), Decimal(2)) r = Site(Decimal(2), Decimal(-2)) bisector_pq = PointBisector(sites=(p, q)) bisector_pr = PointBisector(sites=(p, r)) boundary_pq_plus = PointBoundary(bisector_pq, True) boundary_pr_plus = PointBoundary(bisector_pr, True) intersections = boundary_pr_plus.get_intersections(boundary_pq_plus) assert intersections assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal(2) assert intersection.y == Decimal(0) assert intersection_star.x == Decimal(2) assert intersection_star.y == Decimal(2) intersections2 = boundary_pq_plus.get_intersections(boundary_pr_plus) assert intersections2 assert len(intersections2) == 1 intersection2 = intersections2[0] intersection2, intersection2_star = intersection2 assert intersection2.x == Decimal(2) assert intersection2.y == Decimal(0) assert intersection2_star.x == Decimal(2) assert intersection2_star.y == Decimal(2) class TestParallelBisectorsIntersectionPoint: """Test that there are no intersections.""" def test_bisectors_with_slope_0(self): """Test when the bisectors are horizontal.""" p = Site(Decimal(0), Decimal(0)) q = Site(Decimal(2), Decimal(2)) r = Site(Decimal(2), Decimal(-2)) bisector_pq = PointBisector(sites=(p, q)) bisector_pr = PointBisector(sites=(q, r)) boundary_pq_plus = PointBoundary(bisector_pq, False) boundary_pr_minus = PointBoundary(bisector_pr, True) intersections = boundary_pr_minus.get_intersections(boundary_pq_plus) assert not intersections def test_bisectors_with_infinity_slope(self): """Test when the bisectors are vertical.""" p = Site(Decimal(0), Decimal(0)) q = Site(Decimal(1), Decimal(0)) r = Site(Decimal(2), Decimal(0)) bisector_pq = PointBisector(sites=(p, q)) bisector_pr = PointBisector(sites=(q, r)) boundary_pq_plus = PointBoundary(bisector_pq, False) boundary_pr_minus = PointBoundary(bisector_pr, True) intersections = boundary_pr_minus.get_intersections(boundary_pq_plus) assert not intersections def test_parallel_bisectors(self): """Test when the bisectors are diagonals.""" p = Site(Decimal(0), Decimal(0)) q = Site(Decimal(1), Decimal(1)) r = Site(Decimal(2), Decimal(2)) bisector_pq = PointBisector(sites=(p, q)) bisector_pr = PointBisector(sites=(q, r)) boundary_pq_plus = PointBoundary(bisector_pq, False) boundary_pr_minus = PointBoundary(bisector_pr, True) intersections = boundary_pr_minus.get_intersections(boundary_pq_plus) assert not intersections class TestGetIntersectionInWeightedPointBoundary: """Test get intersection in WeightedPointBoundary.""" def test_two_normal_boundaries(self): """Test get intersection with 3 positive fixed sites.""" p = WeightedSite(Decimal(50), Decimal(20), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(-10), Decimal(30), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "26.071357865127087194423438631929457187652587890625" ) assert intersection.y == Decimal( "56.97399440432361217290235799737274646759033203125" ) assert intersection_star.x == Decimal( "26.071357865127087194423438631929457187652587890625" ) assert intersection_star.y == Decimal("107.0155222687127964860201311") intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(-8), Decimal(30), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(20), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "142.2824956122580033479607664048671722412109375" ) assert intersection.y == Decimal( "237.595493857161244477538275532424449920654296875" ) assert intersection_star.x == Decimal( "142.2824956122580033479607664048671722412109375" ) assert intersection_star.y == Decimal("499.8779894694192013325998825") intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "-46.1192303061356625448752311058342456817626953125" ) assert intersection.y == Decimal( "-26.1669224285899275628253235481679439544677734375" ) assert intersection_star.x == Decimal( "-46.1192303061356625448752311058342456817626953125" ) assert intersection_star.y == Decimal("47.71384726527440049937736671") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_concave_to_y_boundary(self): """Test get intersection with 3 positive fixed sites.""" # qr is concave to y. p = WeightedSite(Decimal(50), Decimal(25), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(10), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "-195.64751728601504510152153670787811279296875" ) assert intersection.y == Decimal( "737.2008338612932902833563275635242462158203125" ) assert intersection_star.x == Decimal( "-195.64751728601504510152153670787811279296875" ) assert intersection_star.y == Decimal("1496.575063910015190799840426") intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 # Both are concave to y. p = WeightedSite(Decimal(40), Decimal(10), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(10), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(11.5), Decimal(10.07), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(11.2), Decimal(8), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "11.4773547011539189810491734533570706844329833984375" ) assert intersection.y == Decimal( "9.522707454740849897234511445276439189910888671875" ) assert intersection_star.x == Decimal( "11.4773547011539189810491734533570706844329833984375" ) assert intersection_star.y == Decimal("16.07046829640067737307526993") intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "1.0997085109018398529912019512266851961612701416015625" ) assert intersection.y == Decimal( "16.7276506075346560464822687208652496337890625" ) assert intersection_star.x == Decimal( "1.0997085109018398529912019512266851961612701416015625" ) assert intersection_star.y == Decimal("35.07634991840194240564230971") intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 # pq is concave to y. p = WeightedSite(Decimal(40), Decimal(10), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(19), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "38.110951833897416918262024410068988800048828125" ) assert intersection.y == Decimal( "68.6352892425572207457662443630397319793701171875" ) assert intersection_star.x == Decimal( "38.110951833897416918262024410068988800048828125" ) assert intersection_star.y == Decimal("133.3010002459383107400476452") intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_boundary_stopped(self): """Test get intersection with 3 positive fixed sites.""" # qr is stopped. # pq is normal. p = WeightedSite(Decimal(0), Decimal(20), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(13), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "10.17385250288240428062636055983603000640869140625" ) assert intersection.y == Decimal( "23.5941894450834155350094079039990901947021484375" ) assert intersection_star.x == Decimal( "10.17385250288240428062636055983603000640869140625" ) assert intersection_star.y == Decimal("40.38425304626468173189701465") intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 # Viceversa intersections = boundary_pq_plus.get_intersections(boundary_qr_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert are_close( intersection.x, Decimal("10.17385250288240428062636055983603000640869140625"), Decimal("0.00000001"), ) assert are_close( intersection.y, Decimal("23.5941894450834155350094079039990901947021484375"), Decimal("0.00000001"), ) assert are_close( intersection_star.x, Decimal("10.17385250288240428062636055983603000640869140625"), Decimal("0.00000001"), ) assert are_close( intersection_star.y, Decimal("40.38425304626468173189701465"), Decimal("0.00000001"), ) intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 # qr is stopped. # pq is stopped. p = WeightedSite(Decimal(11), Decimal(14), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(13), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert are_close( intersection.x, Decimal("8.9482758620689590856045469990931451320648193359375"), Decimal("0.00000001"), ) assert are_close( intersection.y, Decimal("11.5251044932079214078157747280783951282501220703125"), Decimal("0.00000001"), ) assert are_close( intersection_star.x, Decimal("8.9482758620689590856045469990931451320648193359375"), Decimal("0.00000001"), ) assert are_close( intersection_star.y, Decimal("20.73986415882965699538744224"), Decimal("0.00000001"), ) # Viceversa intersections = boundary_pq_minus.get_intersections(boundary_qr_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert are_close( intersection.x, Decimal("8.9482758620689590856045469990931451320648193359375"), Decimal("0.00000001"), ) assert are_close( intersection.y, Decimal("11.5251044932079214078157747280783951282501220703125"), Decimal("0.00000001"), ) assert are_close( intersection_star.x, Decimal("8.9482758620689590856045469990931451320648193359375"), Decimal("0.00000001"), ) assert are_close( intersection_star.y, Decimal("20.73986415882965699538744224"), Decimal("0.00000001"), ) intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(27), Decimal(14), Decimal(6)) q = WeightedSite(Decimal(16), Decimal(10), Decimal(2)) r = WeightedSite(Decimal(5), Decimal(13), Decimal(5)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_sites_without_weight(self): """Test get intersection with 3 positive fixed sites.""" p = WeightedSite(Decimal(40), Decimal(2), Decimal(0)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(1)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(0)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "28.102044708167113640229217708110809326171875" ) assert intersection.y == Decimal( "19.979552926265565560015602386556565761566162109375" ) assert intersection_star.x == Decimal( "28.102044708167113640229217708110809326171875" ) assert intersection_star.y == Decimal("41.53936887136552600734798861") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(40), Decimal(2), Decimal(0)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(0)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "28.160220994475139377755112946033477783203125" ) assert intersection.y == Decimal( "19.397790055248616880589906941168010234832763671875" ) assert intersection_star.x == Decimal( "28.160220994475139377755112946033477783203125" ) assert intersection_star.y == Decimal("40.44211151511457928961840373") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(40), Decimal(2), Decimal(1)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(0)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "29.237523029892987125322179053910076618194580078125" ) assert intersection.y == Decimal( "18.887489091103322635945005458779633045196533203125" ) assert intersection_star.x == Decimal( "29.237523029892987125322179053910076618194580078125" ) assert intersection_star.y == Decimal("39.91292787117044096096486319") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(40), Decimal(2), Decimal(1)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(1)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "28.218323696394005395404747105203568935394287109375" ) assert intersection.y == Decimal( "18.81676302800800471004549763165414333343505859375" ) assert intersection_star.x == Decimal( "28.218323696394005395404747105203568935394287109375" ) assert intersection_star.y == Decimal("40.34994142860942754088607165") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_horizonal_bisector(self): """Test get intersection with 3 positive fixed sites.""" p = WeightedSite(Decimal(38), Decimal(2), Decimal(0)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(1)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "25.705669523894808747854767716489732265472412109375" ) assert intersection.y == Decimal( "20.000000000000046185277824406512081623077392578125" ) assert intersection_star.x == Decimal( "25.705669523894808747854767716489732265472412109375" ) assert intersection_star.y == Decimal("41.79794856989274689184053680") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 p = WeightedSite(Decimal(38), Decimal(2), Decimal(0)) q = WeightedSite(Decimal(38), Decimal(38), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(0)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal( "26.888888888888889283634853200055658817291259765625" ) assert intersection.y == Decimal("20") assert intersection_star.x == Decimal( "26.888888888888889283634853200055658817291259765625" ) assert intersection_star.y == Decimal("41.15317446917735752620224829") intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_vertical_bisector(self): """Test get intersection with 3 positive fixed sites.""" p = WeightedSite(Decimal(38), Decimal(2), Decimal(0)) q = WeightedSite(Decimal(20), Decimal(2), Decimal(0)) r = WeightedSite(Decimal(20), Decimal(0), Decimal(0)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_plus = WeightedPointBoundary(bisector_pq, True) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_plus = WeightedPointBoundary(bisector_qr, True) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_plus.get_intersections(boundary_pq_plus) assert len(intersections) == 1 intersection = intersections[0] intersection, intersection_star = intersection assert intersection.x == Decimal("29") assert intersection.y == Decimal("1") assert intersection_star.x == Decimal("29") assert intersection_star.y == Decimal("10.05538513813741662657380817") intersections = boundary_qr_plus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 0 intersections = boundary_qr_minus.get_intersections(boundary_pq_plus) assert len(intersections) == 0 def test_special_case(self): """Test get intersection with 3 positive fixed sites.""" p = WeightedSite(Decimal(88), Decimal(80), Decimal(0)) q = WeightedSite(Decimal(95), Decimal(15), Decimal(3)) r = WeightedSite(Decimal(78), Decimal(13), Decimal(1)) bisector_pq = WeightedPointBisector(sites=(p, q)) bisector_qr = WeightedPointBisector(sites=(q, r)) boundary_pq_minus = WeightedPointBoundary(bisector_pq, False) boundary_qr_minus = WeightedPointBoundary(bisector_qr, False) intersections = boundary_qr_minus.get_intersections(boundary_pq_minus) assert len(intersections) == 1
45.306834
78
0.687702
3,162
32,485
6.831436
0.05661
0.14291
0.082218
0.085459
0.898523
0.864312
0.752141
0.744734
0.744734
0.742466
0
0.136208
0.225489
32,485
716
79
45.370112
0.722337
0.026751
0
0.745875
0
0
0.099404
0.095376
0
0
0
0
0.257426
1
0.018152
false
0
0.008251
0
0.031353
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
f0158f4319dd532749aec4b9f62506632c187139
127
py
Python
alerter/src/alerter/alert_severities/__init__.py
SimplyVC/panic
2f5c327ea0d14b6a49dc8f4599a255048bc2ff6d
[ "Apache-2.0" ]
41
2019-08-23T12:40:42.000Z
2022-03-28T11:06:02.000Z
alerter/src/alerter/alert_severities/__init__.py
SimplyVC/panic
2f5c327ea0d14b6a49dc8f4599a255048bc2ff6d
[ "Apache-2.0" ]
147
2019-08-30T22:09:48.000Z
2022-03-30T08:46:26.000Z
alerter/src/alerter/alert_severities/__init__.py
SimplyVC/panic
2f5c327ea0d14b6a49dc8f4599a255048bc2ff6d
[ "Apache-2.0" ]
3
2019-09-03T21:12:28.000Z
2021-08-18T14:27:56.000Z
from src.alerter.alert_severities.severity import Severity from src.alerter.alert_severities.severity_code import SeverityCode
42.333333
67
0.889764
17
127
6.470588
0.529412
0.127273
0.254545
0.345455
0.672727
0.672727
0
0
0
0
0
0
0.062992
127
2
68
63.5
0.92437
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
f03224360b79f57cf202c6fde01759dcf78ed292
4,372
py
Python
marking/grammar_rules/tests/test_comma_rules.py
OpenCovenant/quill
441c368227436b2f21cbd86a234e672ddf327eed
[ "MIT" ]
3
2022-02-15T17:26:29.000Z
2022-02-17T15:44:07.000Z
marking/grammar_rules/tests/test_comma_rules.py
OpenCovenant/quill
441c368227436b2f21cbd86a234e672ddf327eed
[ "MIT" ]
null
null
null
marking/grammar_rules/tests/test_comma_rules.py
OpenCovenant/quill
441c368227436b2f21cbd86a234e672ddf327eed
[ "MIT" ]
1
2022-03-27T19:26:34.000Z
2022-03-27T19:26:34.000Z
from django.test import TestCase from marking.grammar_rules.comma_rules import check_for_a_comma_rule, check_for_comma_before_or_and_rule, \ check_for_a_nonspace_after_comma from utils.utils import FROM_KEY, TO_KEY, TYPO_KEY, TYPE_KEY, SUBTYPE_KEY, DESCRIPTION_KEY, SUGGESTIONS_KEY, \ DISPLAY_KEY, ACTION_KEY class CommasTestCase(TestCase): def test_a_comma(self): text = "Këngëtares i pëlqente jo vetëm mikpritja, por edhe atmosfera." self.assertEqual(check_for_a_comma_rule(text, text), []) # def test_another_comma(self): # text = "Këngëtares i pëlqente jo vetëm mikpritja por edhe atmosfera." # suggestion = {DISPLAY_KEY: '... ikpritja, por edhe ...', ACTION_KEY: ''} # TODO # expected_marking = [{FROM_KEY: 0, TO_KEY: 60, TYPE_KEY: TYPO_KEY, # SUBTYPE_KEY: 'gabim gramatikor, shenja pikësimi', # DESCRIPTION_KEY: 'vendoset presje mes gjymtyrëve homogjene që bashkohen nga lidhëza ' # 'dyshe "jo vetëm ..., por edhe ..."', # SUGGESTIONS_KEY: [suggestion]}] # self.assertEqual(check_for_a_comma_rule(text, text), expected_marking) def test_anotheasasdqwedr_comma(self): text = "Arka duhet të mbushet me fruta, ose edhe me perime." self.assertEqual(check_for_comma_before_or_and_rule(text, text), []) # def test_anotheasdr_comma(self): # text = "Arka duhet të mbushet me fruta ose edhe me perime." # suggestion = {DISPLAY_KEY: '... me fruta, ose edhe ...', ACTION_KEY: ''} # TODO # expected_marking = [{FROM_KEY: 0, TO_KEY: 50, TYPE_KEY: TYPO_KEY, # SUBTYPE_KEY: 'gabim gramatikor, shenja pikësimi', # DESCRIPTION_KEY: 'vendoset presje mes gjymtyrëve homogjene që bashkohen me lidhëzën' # ' veçuese "ose" të ndjekur nga pjëseza përforcuese "edhe"', # SUGGESTIONS_KEY: [suggestion]}] # self.assertEqual(check_for_comma_before_or_and_rule(text, text), expected_marking) def test_check_for_a_nasdonspace_after_comma1(self): sentence = "Këngëtares i pëlqente jo vetëm mikpritja, por edhe atmosfera." self.assertEqual(check_for_a_nonspace_after_comma(sentence), []) def test_check_for_a_nasdonspace_after_coasdmma1(self): sentence = "Këngëtares i pëlqente jo vetëm mikpritja, por edhe atmosfera." a = check_for_a_nonspace_after_comma(sentence) self.assertEqual(check_for_a_nonspace_after_comma(sentence), []) def test_check_for_a_nasdonspace_after_coasdmma1_non_breaking_space(self): sentence = "Këngëtares i pëlqente jo vetëm mikpritja, por edhe atmosfera." a = check_for_a_nonspace_after_comma(sentence) self.assertEqual(check_for_a_nonspace_after_comma(sentence), []) # TODO ” def test_t234(self): sentence = "John Doe, “The birth of corruption and the politics of anti-corruption in " \ "Albania, 1991–2005,” Nationalities Papers 41, no. 6 (2018)." self.assertEqual(check_for_a_nonspace_after_comma(sentence), []) # TODO » def test_t2345(self): sentence = "John Doe, «The birth of corruption and the politics of anti-corruption in " \ "Albania, 1991–2005,» Nationalities Papers 41, no. 6 (2018)." self.assertEqual(check_for_a_nonspace_after_comma(sentence), []) # def test_a_comma(self): # text = ", ose edhe" # words = fetch_all_words(text) # self.assertEqual(words, [text]) # # def test_a_comma(self): # text = ", " # words = fetch_all_words(text) # self.assertEqual(words, [text]) # # def test_a_comma(self): # text = ',"' # words = fetch_all_words(text) # self.assertEqual(words, [text]) # # def test_a_comma(self): # text = ',a' # words = fetch_all_words(text) # self.assertEqual(words, [text]) # # def test_a_comma(self): # text = ',1' # words = fetch_all_words(text) # self.assertEqual(words, [text]) # # def test_a_comma(self): # text = '22.1,1' # words = fetch_all_words(text) # self.assertEqual(words, [text])
47.010753
116
0.634263
536
4,372
4.88806
0.214552
0.051908
0.048092
0.079008
0.821756
0.809542
0.79084
0.753817
0.732443
0.710305
0
0.015868
0.264867
4,372
92
117
47.521739
0.79776
0.462717
0
0.322581
0
0
0.244667
0
0
0
0
0.01087
0.225806
1
0.225806
false
0
0.096774
0
0.354839
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
1
0
0
1
0
0
0
0
0
0
0
8
f03cb5369ab047a3e5f6831b3bbef4bd1f0df9ee
3,438
py
Python
tests/test_03_util.py
IdentityPython/oiccli
98b9b1e4926936cdec5a5d4d00da278ba673c741
[ "Apache-2.0" ]
3
2019-01-22T17:57:34.000Z
2019-09-12T02:53:59.000Z
tests/test_03_util.py
IdentityPython/oidcservice
98b9b1e4926936cdec5a5d4d00da278ba673c741
[ "Apache-2.0" ]
5
2019-08-08T12:17:19.000Z
2019-12-02T07:08:32.000Z
tests/test_03_util.py
IdentityPython/oidcservice
98b9b1e4926936cdec5a5d4d00da278ba673c741
[ "Apache-2.0" ]
4
2018-06-22T07:09:56.000Z
2020-01-10T03:49:26.000Z
import json from urllib.parse import parse_qs, urlsplit from oidcmsg.oauth2 import AccessTokenRequest, AuthorizationRequest from oidcservice import util from oidcservice.util import JSON_ENCODED, URL_ENCODED __author__ = 'Roland Hedberg' def test_get_http_url(): url = u'https://localhost:8092/authorization' method = 'GET' values = {'acr_values': 'PASSWORD', 'state': 'urn:uuid:92d81fb3-72e8-4e6c-9173-c360b782148a', 'redirect_uri': 'https://localhost:8666/919D3F697FDAAF138124B83E09ECB0B7', 'response_type': 'code', 'client_id': 'ok8tx7ulVlNV', 'scope': 'openid profile email address phone'} request = AuthorizationRequest(**values) _url = util.get_http_url(url, request, method) _part = urlsplit(_url) _req = parse_qs(_part.query) assert set(_req.keys()) == {'acr_values', 'state', 'redirect_uri', 'response_type', 'client_id', 'scope'} def test_get_http_body_default_encoding(): values = { 'redirect_uri': 'https://localhost:8666/919D3F697FDAAF138124B83E09ECB0B7', 'code': 'Je1iKfPN1vCiN7L43GiXAuAWGAnm0mzA7QIjl' '/YLBBZDB9wefNExQlLDUIIDM2rT' '2t+gwuoRoapEXJyY2wrvg9cWTW2vxsZU+SuWzZlMDXc=', 'grant_type': 'authorization_code'} request = AccessTokenRequest(**values) body = util.get_http_body(request) _req = parse_qs(body) assert set(_req.keys()) == {'code', 'grant_type', 'redirect_uri'} def test_get_http_body_url_encoding(): values = { 'redirect_uri': 'https://localhost:8666/919D3F697FDAAF138124B83E09ECB0B7', 'code': 'Je1iKfPN1vCiN7L43GiXAuAWGAnm0mzA7QIjl' '/YLBBZDB9wefNExQlLDUIIDM2rT' '2t+gwuoRoapEXJyY2wrvg9cWTW2vxsZU+SuWzZlMDXc=', 'grant_type': 'authorization_code'} request = AccessTokenRequest(**values) body = util.get_http_body(request, URL_ENCODED) _req = parse_qs(body) assert set(_req.keys()) == {'code', 'grant_type', 'redirect_uri'} def test_get_http_body_json(): values = { 'redirect_uri': 'https://localhost:8666/919D3F697FDAAF138124B83E09ECB0B7', 'code': 'Je1iKfPN1vCiN7L43GiXAuAWGAnm0mzA7QIjl' '/YLBBZDB9wefNExQlLDUIIDM2rT' '2t+gwuoRoapEXJyY2wrvg9cWTW2vxsZU+SuWzZlMDXc=', 'grant_type': 'authorization_code'} request = AccessTokenRequest(**values) body = util.get_http_body(request, JSON_ENCODED) _req = json.loads(body) assert set(_req.keys()) == {'code', 'grant_type', 'redirect_uri'} def test_get_http_url_with_qp(): url = u'https://localhost:8092/authorization?test=testslice' method = 'GET' values = {'acr_values': 'PASSWORD', 'state': 'urn:uuid:92d81fb3-72e8-4e6c-9173-c360b782148a', 'redirect_uri': 'https://localhost:8666/919D3F697FDAAF138124B83E09ECB0B7', 'response_type': 'code', 'client_id': 'ok8tx7ulVlNV', 'scope': 'openid profile email address phone'} request = AuthorizationRequest(**values) _url = util.get_http_url(url, request, method) _part = urlsplit(_url) _req = parse_qs(_part.query) assert set(_req.keys()) == {'acr_values', 'state', 'redirect_uri', 'response_type', 'client_id', 'scope', 'test'}
36.189474
76
0.642525
328
3,438
6.448171
0.228659
0.033097
0.031206
0.033097
0.873759
0.855792
0.822695
0.822695
0.822695
0.822695
0
0.080835
0.233566
3,438
94
77
36.574468
0.721822
0
0
0.726027
0
0
0.390343
0.120419
0
0
0
0
0.068493
1
0.068493
false
0.027397
0.068493
0
0.136986
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
b2cf8dd7da2312705f54a9e4f3d3098211eba8c3
3,320
py
Python
test/features/test_generate_all_services_pages.py
alphagov/transactions-explorer
1e780cd8b4f2923f527812e97c581ef2982b6077
[ "MIT" ]
1
2017-03-31T15:05:42.000Z
2017-03-31T15:05:42.000Z
test/features/test_generate_all_services_pages.py
gds-attic/transactions-explorer
1e780cd8b4f2923f527812e97c581ef2982b6077
[ "MIT" ]
null
null
null
test/features/test_generate_all_services_pages.py
gds-attic/transactions-explorer
1e780cd8b4f2923f527812e97c581ef2982b6077
[ "MIT" ]
2
2019-08-29T11:33:36.000Z
2021-04-10T20:07:44.000Z
from hamcrest import * from test.features import BrowserTest from test.features.support import table_from class GenerateAllServicesPages(BrowserTest): def test_all_services_table(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-transactions-per-year/descending") table = table_from(self.browser.find_by_css('tbody tr')) assert_that(table, is_([ [u'Ministry of Silly Walks', u'10%', u'\xa3482m', u'25%', u'4,820,000,000'], [u'Department of Electronic Freedom', u'84.7%', u'\xa3157m', u'17.5%', u'21,117,614'], [u'Agency for Beautiful Code', u'100%', u'\xa3482k', u'25%', u'4,839,291'], [u'Lower Order Workgroups', u'', u'', u'', u'29,127'] ])) def test_first_element_sort_by_department_descending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-department/descending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Ministry of Silly Walks")) def test_first_element_sort_by_department_ascending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-department/ascending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Agency for Beautiful Code")) def test_first_element_sort_by_digit_take_up_descending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-digital-takeup/descending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Agency for Beautiful Code")) def test_first_element_sort_by_digit_take_up_ascending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-digital-takeup/ascending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Ministry of Silly Walks")) def test_first_element_sort_by_total_cost_descending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-cost/descending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Ministry of Silly Walks")) def test_first_element_sort_by_total_cost_ascending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-cost/ascending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Agency for Beautiful Code")) def test_first_element_sort_by_data_coverage_descending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-data-coverage/descending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Agency for Beautiful Code")) def test_first_element_sort_by_data_coverage_ascending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-data-coverage/ascending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Department of Electronic Freedom")) def test_first_element_sort_by_volume_descending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-transactions-per-year/descending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Ministry of Silly Walks")) def test_first_element_sort_by_volume_ascending(self): self.browser.visit("http://0.0.0.0:8000/all-services/by-transactions-per-year/ascending") assert_that(self.browser.find_by_css('tbody tr th a').text, is_(u"Lower Order Workgroups"))
56.271186
109
0.712952
537
3,320
4.189944
0.154562
0.029333
0.029333
0.097778
0.864889
0.828444
0.818222
0.769778
0.769778
0.769778
0
0.050753
0.139458
3,320
58
110
57.241379
0.736787
0
0
0.232558
1
0.255814
0.36988
0
0
0
0
0
0.255814
1
0.255814
false
0
0.069767
0
0.348837
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
1
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
9
6504aa0e61fe82c4feefc4d7a0412da81809aac1
1,596
py
Python
cse/migrations/0009_auto_20190502_1708.py
BIJOY-SUST/sust-medical-center
ff57ca3e4547571d1e9f2e62a7a80799090d43b3
[ "Apache-2.0" ]
2
2020-12-05T05:13:38.000Z
2022-02-27T12:08:17.000Z
cse/migrations/0009_auto_20190502_1708.py
BIJOY-SUST/sust-medical-center
ff57ca3e4547571d1e9f2e62a7a80799090d43b3
[ "Apache-2.0" ]
null
null
null
cse/migrations/0009_auto_20190502_1708.py
BIJOY-SUST/sust-medical-center
ff57ca3e4547571d1e9f2e62a7a80799090d43b3
[ "Apache-2.0" ]
4
2020-05-08T08:40:12.000Z
2021-03-28T11:05:50.000Z
# Generated by Django 2.2 on 2019-05-02 17:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cse', '0008_auto_20190502_1552'), ] operations = [ migrations.AddField( model_name='customuser', name='age', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='blood_group', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='department', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='designation', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='gender', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='mobile_no', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='tel_no', field=models.CharField(default=None, max_length=20), ), migrations.AddField( model_name='customuser', name='user_type', field=models.CharField(default=None, max_length=20), ), ]
29.555556
64
0.559524
152
1,596
5.723684
0.302632
0.165517
0.211494
0.248276
0.767816
0.767816
0.72069
0.72069
0.672414
0.672414
0
0.042672
0.324561
1,596
53
65
30.113208
0.764378
0.026942
0
0.680851
1
0
0.110251
0.014829
0
0
0
0
0
1
0
false
0
0.021277
0
0.085106
0
0
0
0
null
0
1
1
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
e8d9a2cf4abda9beda55b05a6faee004fb8229b7
80
py
Python
ilf/fuzzers/sym_plus/__init__.py
RainOfPhone/ilf
83c34c2147f05a26fde81f94acb58fe5719b05a2
[ "Apache-2.0" ]
2
2022-02-24T10:05:54.000Z
2022-03-21T06:29:56.000Z
ilf/fuzzers/sym_plus/__init__.py
RainOfPhone/ilf
83c34c2147f05a26fde81f94acb58fe5719b05a2
[ "Apache-2.0" ]
null
null
null
ilf/fuzzers/sym_plus/__init__.py
RainOfPhone/ilf
83c34c2147f05a26fde81f94acb58fe5719b05a2
[ "Apache-2.0" ]
null
null
null
from .obs_sym_plus import ObsSymPlus from .policy_sym_plus import PolicySymPlus
26.666667
42
0.875
12
80
5.5
0.666667
0.212121
0.393939
0
0
0
0
0
0
0
0
0
0.1
80
2
43
40
0.916667
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
e8ef76992395c52eabe76928627b6b7f870cdb1e
810
py
Python
tests/test_interfaces.py
mrteathyme/pipewire_python
a00ae7fba7f9179118ce835a80df2fcd8b0812f0
[ "MIT" ]
9
2021-06-17T19:20:54.000Z
2022-02-23T09:45:06.000Z
tests/test_interfaces.py
mrteathyme/pipewire_python
a00ae7fba7f9179118ce835a80df2fcd8b0812f0
[ "MIT" ]
11
2021-06-23T23:46:15.000Z
2022-01-22T04:33:13.000Z
tests/test_interfaces.py
mrteathyme/pipewire_python
a00ae7fba7f9179118ce835a80df2fcd8b0812f0
[ "MIT" ]
3
2021-11-16T06:20:57.000Z
2022-03-20T07:24:17.000Z
from pipewire_python.controller import Controller def test_interfaces(): # Client audio_controller = Controller() list_interfaces_client = audio_controller.get_list_interfaces( type_interfaces="Client", filtered_by_type=True, verbose=True ) print(list_interfaces_client) # check if dict assert type(list_interfaces_client) == dict # not empty dict # empty on CI/CD assert len(list_interfaces_client) >= 0 # All audio_controller = Controller() list_interfaces_client = audio_controller.get_list_interfaces( filtered_by_type=False, verbose=True ) print(list_interfaces_client) # check if dict assert type(list_interfaces_client) == dict # not empty dict # empty on CI/CD assert len(list_interfaces_client) >= 0
27
69
0.716049
100
810
5.49
0.31
0.291439
0.291439
0.169399
0.76867
0.76867
0.76867
0.76867
0.76867
0.76867
0
0.003135
0.212346
810
29
70
27.931034
0.857367
0.120988
0
0.625
0
0
0.008535
0
0
0
0
0
0.25
1
0.0625
false
0
0.0625
0
0.125
0.125
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
332549eb1748804b8264b450882693da4496d088
3,208
py
Python
userbot/modules/oi.py
oxyda-fox/XBot-Remix
3d97bea5395b223fc89a8cc6cb699cc624ccc967
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
userbot/modules/oi.py
oxyda-fox/XBot-Remix
3d97bea5395b223fc89a8cc6cb699cc624ccc967
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
userbot/modules/oi.py
oxyda-fox/XBot-Remix
3d97bea5395b223fc89a8cc6cb699cc624ccc967
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
#Encript Marshal By XVenom #https://github.com/xvenom15 import marshal exec(marshal.loads(b'\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00s\x80\x00\x00\x00d\x00d\x01l\x00Z\x00d\x00d\x01l\x01Z\x01d\x00d\x01l\x02Z\x02d\x00d\x02l\x02m\x03Z\x03\x01\x00d\x00d\x03l\x04m\x05Z\x05m\x06Z\x06\x01\x00d\x00d\x04l\x07m\x08Z\x08\x01\x00e\x08d\x05d\x06d\x07\x8d\x02d\x08d\t\x84\x00\x83\x01Z\te\x08d\x05d\nd\x07\x8d\x02d\x0bd\t\x84\x00\x83\x01Z\te\x08d\x05d\x0cd\x07\x8d\x02d\rd\t\x84\x00\x83\x01Z\td\x01S\x00)\x0e\xe9\x00\x00\x00\x00N)\x01\xda\x05sleep)\x02\xda\x08CMD_HELP\xda\tZALG_LIST)\x01\xda\x08registerTz\x0f^.oi(?: |$)(.*))\x02Z\x08outgoingZ\x07patternc\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\xc3\x00\x00\x00sX\x00\x00\x00|\x00j\x00\xa0\x01d\x01\xa1\x01}\x01t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x03\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x04\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x01\x83\x01\x01\x00|\x00\xa0\x03d\x05\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00)\x06N\xe9\x01\x00\x00\x00\xe9\x03\x00\x00\x00z\x16`Muka kalian Burik...`\xfa\x0f`Kayak Jemboot`z\x1e`Muka Gw Gak Burik Kek Kalian`\xa9\x04Z\rpattern_match\xda\x05groupr\x02\x00\x00\x00Z\x04edit\xa9\x02Z\x05typew\xda\x07message\xa9\x00r\r\x00\x00\x00\xda\x00\xda\ntypewriter\x08\x00\x00\x00s\x0e\x00\x00\x00\x00\x02\x0c\x01\x08\x01\x10\x01\x08\x01\x10\x01\x08\x01r\x0f\x00\x00\x00z\x0f^.io(?: |$)(.*)c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\xc3\x00\x00\x00sX\x00\x00\x00|\x00j\x00\xa0\x01d\x01\xa1\x01}\x01t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x03\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x04\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x01\x83\x01\x01\x00|\x00\xa0\x03d\x05\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00)\x06Nr\x06\x00\x00\x00r\x07\x00\x00\x00z\x13`Muka Gue Burik...`r\x08\x00\x00\x00z\x1b`Muka Gw Burik Kek Jembott`r\t\x00\x00\x00r\x0b\x00\x00\x00r\r\x00\x00\x00r\r\x00\x00\x00r\x0e\x00\x00\x00r\x0f\x00\x00\x00\x13\x00\x00\x00s\x0e\x00\x00\x00\x00\x02\x0c\x01\x08\x01\x10\x01\x08\x01\x10\x01\x08\x01z\x0f^.ll(?: |$)(.*)c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\xc3\x00\x00\x00sX\x00\x00\x00|\x00j\x00\xa0\x01d\x01\xa1\x01}\x01t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x03\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x02\x83\x01\x01\x00|\x00\xa0\x03d\x04\xa1\x01I\x00d\x00H\x00\x01\x00t\x02d\x01\x83\x01\x01\x00|\x00\xa0\x03d\x05\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00)\x06Nr\x06\x00\x00\x00r\x07\x00\x00\x00z\x1c`Lucinta Luna Berbatang ...`z\x10`Tapi Gua sukaa`z\x15`I love memek Oplass`r\t\x00\x00\x00r\x0b\x00\x00\x00r\r\x00\x00\x00r\r\x00\x00\x00r\x0e\x00\x00\x00r\x0f\x00\x00\x00\x1e\x00\x00\x00s\x0e\x00\x00\x00\x00\x02\x0c\x01\x08\x01\x10\x01\x08\x01\x10\x01\x08\x01)\nZ\x07asyncio\xda\x02re\xda\x04timer\x02\x00\x00\x00Z\x07userbotr\x03\x00\x00\x00r\x04\x00\x00\x00Z\x0euserbot.eventsr\x05\x00\x00\x00r\x0f\x00\x00\x00r\r\x00\x00\x00r\r\x00\x00\x00r\r\x00\x00\x00r\x0e\x00\x00\x00\xda\x08<module>\x01\x00\x00\x00s\x16\x00\x00\x00\x08\x01\x08\x01\x08\x01\x0c\x01\x10\x01\x0c\x02\n\x01\n\n\n\x01\n\n\n\x01'))
802
3,137
0.754676
711
3,208
3.400844
0.194093
0.330025
0.245658
0.208437
0.605459
0.593466
0.581472
0.580232
0.56038
0.56038
0
0.36461
0.009975
3,208
4
3,137
802
0.396725
0.016209
0
0
0
0.5
0.986688
0.946434
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
null
0
0
0
0
0
0
1
0
1
0
0
0
0
13
6828caa0f076c7dc44fc3d5cb6c29965875a2e8a
7,440
py
Python
web/tests/test_event_search.py
alessandrobogliolo/coding-events
9e34a937c4503f8fb6e406142bd4ef43075ad6dc
[ "MIT" ]
9
2015-01-21T21:37:57.000Z
2017-10-13T07:27:49.000Z
web/tests/test_event_search.py
alessandrobogliolo/coding-events
9e34a937c4503f8fb6e406142bd4ef43075ad6dc
[ "MIT" ]
58
2015-04-30T11:01:56.000Z
2017-11-05T19:23:43.000Z
web/tests/test_event_search.py
alessandrobogliolo/coding-events
9e34a937c4503f8fb6e406142bd4ef43075ad6dc
[ "MIT" ]
17
2015-08-15T14:59:29.000Z
2020-06-25T05:20:47.000Z
# -*- coding: utf-8 -*- import pytest from django.core.urlresolvers import reverse from web.tests import EventFactory, ApprovedEventFactory, PastEventFactory @pytest.mark.django_db def test_search_show_only_approved(db, client): approved_event = ApprovedEventFactory.create() unapproved_event = EventFactory.create() response = client.get('/search/') assert approved_event.get_absolute_url() in response.content assert unapproved_event.get_absolute_url() not in response.content map(lambda x: x.delete(), [approved_event, unapproved_event]) def test_search_do_not_show_past_events(db, client): future_event = ApprovedEventFactory.create() past_event = PastEventFactory.create(status='APPROVED') response = client.get('/search/') assert future_event.get_absolute_url() in response.content assert past_event.get_absolute_url() not in response.content map(lambda x: x.delete(), [future_event, past_event]) def test_search_show_past_events(db, client): future_event = ApprovedEventFactory.create() past_event = PastEventFactory.create(status='APPROVED') response = client.get('/search/?past=yes') assert future_event.get_absolute_url() in response.content assert past_event.get_absolute_url() in response.content map(lambda x: x.delete(), [future_event, past_event]) def test_search_events_with_search_query_all_countries_multiple_results( db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") approved2 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="AT") response = client.get( reverse('web.search_events'), { 'q': 'arglebargle', 'country': '00'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content assert approved2.get_absolute_url() in response.content map(lambda x: x.delete(), [approved1, approved2]) def test_search_events_with_search_query(db, client): approved1 = ApprovedEventFactory.create( title='Event Arglebargle - Approved') response = client.get( reverse('web.search_events'), { 'q': 'arglebargle'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content approved1.delete() def test_search_events_search_in_location(db, client): approved1 = ApprovedEventFactory.create( title='Event Arglebargle - Approved') response = client.get( reverse('web.search_events'), { 'q': 'kersnikova'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content approved1.delete() def test_search_events_search_in_wrong_location(db, client): approved1 = ApprovedEventFactory.create( title='Event Arglebargle - Approved') response = client.get( reverse('web.search_events'), { 'q': 'celovška'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() not in response.content approved1.delete() def test_search_events_search_in_wrong_location_again(db, client): approved1 = ApprovedEventFactory.create( title='Event Arglebargle - Approved') response = client.get( reverse('web.search_events'), { 'q': 'Celovška 1'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() not in response.content approved1.delete() def test_search_events_with_unicode_tag_in_search_query(db, client): approved1 = ApprovedEventFactory.create( tags=[u"jabolčna čežana", u"José", "Django"]) response = client.get( reverse('web.search_events'), { 'q': 'čežana'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content approved1.delete() def test_search_events_with_search_query_multiple_events_current_country_only( db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") approved2 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="AT") response = client.get( reverse('web.search_events'), { 'q': 'arglebargle'}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content assert approved2.get_absolute_url() not in response.content map(lambda x: x.delete(), [approved1, approved2]) def test_search_with_audience(db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") response = client.get( reverse('web.search_events'), { 'audience': 1}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content approved1.delete() def test_search_with_audience_multiple_events(db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") # default audience 1 approved2 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI", audience=[ 1, 2]) approved3 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="AT", audience=[ 1, 2]) approved4 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI", audience=[3]) response = client.get( reverse('web.search_events'), { 'audience': 1}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content assert approved2.get_absolute_url() in response.content assert approved3.get_absolute_url() not in response.content assert approved4.get_absolute_url() not in response.content map(lambda x: x.delete(), [approved1, approved2, approved3, approved4]) def test_search_with_theme(db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI", theme=[2]) response = client.get( reverse('web.search_events'), { 'theme': 2}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content approved1.delete() def test_search_with_theme_multiple_events(db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") approved2 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI", theme=[2]) response = client.get( reverse('web.search_events'), { 'theme': 1}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content assert approved2.get_absolute_url() not in response.content map(lambda x: x.delete(), [approved1, approved2]) def test_search_with_theme_multiple_events_all_countries(db, client): approved1 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="SI") approved2 = ApprovedEventFactory.create( title="Event Arglebargle - Approved", country="AT") response = client.get( reverse('web.search_events'), { 'country': '00', 'theme': 1}, REMOTE_ADDR='93.103.53.11') assert approved1.get_absolute_url() in response.content assert approved2.get_absolute_url() in response.content map(lambda x: x.delete(), [approved1, approved2])
33.818182
78
0.694892
867
7,440
5.755479
0.100346
0.05511
0.07014
0.12986
0.886373
0.872946
0.872946
0.838677
0.809419
0.778758
0
0.030494
0.188978
7,440
219
79
33.972603
0.796487
0.005376
0
0.709677
0
0
0.1456
0
0
0
0
0
0.16129
1
0.096774
false
0
0.019355
0
0.116129
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
687e57446d611ab5bb36d11b9f79c9824dca87d9
11,717
py
Python
ALGORITHM/Starcraft/common/rollout.py
Harold0/hmp
4745e1d3e56c7f08947c839526e6827daa3e6048
[ "MIT" ]
null
null
null
ALGORITHM/Starcraft/common/rollout.py
Harold0/hmp
4745e1d3e56c7f08947c839526e6827daa3e6048
[ "MIT" ]
null
null
null
ALGORITHM/Starcraft/common/rollout.py
Harold0/hmp
4745e1d3e56c7f08947c839526e6827daa3e6048
[ "MIT" ]
null
null
null
import numpy as np import torch from torch.distributions import one_hot_categorical import time class RolloutWorker: def __init__(self, env, agents, args): self.env = env self.agents = agents self.episode_limit = args.episode_limit self.n_actions = args.n_actions self.n_agents = args.n_agents # TODO:参数需要衔接 self.state_shape = args.state_shape self.obs_shape = args.obs_shape self.args = args self.epsilon = args.epsilon self.anneal_epsilon = args.anneal_epsilon self.min_epsilon = args.min_epsilon print('Init RolloutWorker') def generate_episode(self, episode_num=None, evaluate=False): if self.args.replay_dir != '' and evaluate and episode_num == 0: # prepare for save replay of evaluation self.env.close() o, u, r, s, avail_u, u_onehot, terminate, padded = [], [], [], [], [], [], [], [] # TODO:!!!初始 self.env.reset() terminated = False win_tag = False step = 0 episode_reward = 0 # cumulative rewards last_action = np.zeros((self.args.n_agents, self.args.n_actions)) self.agents.policy.init_hidden(1) # TODO: !!!初始 # epsilon 修改epsilon epsilon = 0 if evaluate else self.epsilon if self.args.epsilon_anneal_scale == 'episode': epsilon = epsilon - self.anneal_epsilon if epsilon > self.min_epsilon else epsilon # sample z for maven ? if self.args.alg == 'maven': state = self.env.get_state() state = torch.tensor(state, dtype=torch.float32) if self.args.cuda: state = state.cuda() z_prob = self.agents.policy.z_policy(state) maven_z = one_hot_categorical.OneHotCategorical(z_prob).sample() maven_z = list(maven_z.cpu()) while not terminated and step < self.episode_limit: # time.sleep(0d and step < self.episo.2) obs = self.env.get_obs() state = self.env.get_state() # state 训练时可见,执行时没有 actions, avail_actions, actions_onehot = [], [], [] for agent_id in range(self.n_agents): avail_action = self.env.get_avail_agent_actions(agent_id) # TODO: 这里需要处理 if self.args.alg == 'maven': action = self.agents.choose_action(obs[agent_id], last_action[agent_id], agent_id, avail_action, epsilon, maven_z, evaluate) else: action = self.agents.choose_action(obs[agent_id], last_action[agent_id], agent_id, avail_action, epsilon, evaluate) # generate onehot vector of th action action_onehot = np.zeros(self.args.n_actions) # 很少的9个离散动作, 这个后面可能需要转成attention的形式 action_onehot[action] = 1 actions.append(action) actions_onehot.append(action_onehot) avail_actions.append(avail_action) # TODO: 会出现再buffer中吗? last_action[agent_id] = action_onehot reward, terminated, info = self.env.step(actions) win_tag = True if terminated and 'battle_won' in info and info['battle_won'] else False ############################## o.append(obs) s.append(state) u.append(np.reshape(actions, [self.n_agents, 1])) u_onehot.append(actions_onehot) avail_u.append(avail_actions) r.append([reward]) terminate.append([terminated]) padded.append([0.]) ############################## episode_reward += reward step += 1 if self.args.epsilon_anneal_scale == 'step': epsilon = epsilon - self.anneal_epsilon if epsilon > self.min_epsilon else epsilon # 处理epside结束的后续 # last obs :这样是因为step不返回观测量,需要get_obs才可以,这里应该是获取最后时刻的obs_next # print('episode_reward', episode_reward) obs = self.env.get_obs() state = self.env.get_state() o.append(obs) s.append(state) o_next = o[1:] s_next = s[1:] o = o[:-1] s = s[:-1] # get avail_action for last obs,because target_q needs avail_action in training avail_actions = [] for agent_id in range(self.n_agents): avail_action = self.env.get_avail_agent_actions(agent_id) avail_actions.append(avail_action) avail_u.append(avail_actions) avail_u_next = avail_u[1:] avail_u = avail_u[:-1] # 提前死光的情况,不能凑够完整的60步 # if step < self.episode_limit,padding for i in range(step, self.episode_limit): o.append(np.zeros((self.n_agents, self.obs_shape))) u.append(np.zeros([self.n_agents, 1])) s.append(np.zeros(self.state_shape)) r.append([0.]) o_next.append(np.zeros((self.n_agents, self.obs_shape))) s_next.append(np.zeros(self.state_shape)) u_onehot.append(np.zeros((self.n_agents, self.n_actions))) avail_u.append(np.zeros((self.n_agents, self.n_actions))) avail_u_next.append(np.zeros((self.n_agents, self.n_actions))) padded.append([1.]) terminate.append([1.]) episode = dict(o=o.copy(), s=s.copy(), u=u.copy(), r=r.copy(), avail_u=avail_u.copy(), o_next=o_next.copy(), s_next=s_next.copy(), avail_u_next=avail_u_next.copy(), u_onehot=u_onehot.copy(), padded=padded.copy(), terminated=terminate.copy() ) # add episode dim for key in episode.keys(): episode[key] = np.array([episode[key]]) if not evaluate: self.epsilon = epsilon if self.args.alg == 'maven': episode['z'] = np.array([maven_z.copy()]) if evaluate and episode_num == self.args.evaluate_epoch - 1 and self.args.replay_dir != '': self.env.save_replay() self.env.close() return episode, episode_reward, win_tag, step # RolloutWorker for communication class CommRolloutWorker: def __init__(self, env, agents, args): self.env = env self.agents = agents self.episode_limit = args.episode_limit self.n_actions = args.n_actions self.n_agents = args.n_agents self.state_shape = args.state_shape self.obs_shape = args.obs_shape self.args = args self.epsilon = args.epsilon self.anneal_epsilon = args.anneal_epsilon self.min_epsilon = args.min_epsilon print('Init CommRolloutWorker') def generate_episode(self, episode_num=None, evaluate=False): if self.args.replay_dir != '' and evaluate and episode_num == 0: # prepare for save replay self.env.close() o, u, r, s, avail_u, u_onehot, terminate, padded = [], [], [], [], [], [], [], [] self.env.reset() terminated = False win_tag = False step = 0 episode_reward = 0 last_action = np.zeros((self.args.n_agents, self.args.n_actions)) self.agents.policy.init_hidden(1) epsilon = 0 if evaluate else self.epsilon if self.args.epsilon_anneal_scale == 'episode': epsilon = epsilon - self.anneal_epsilon if epsilon > self.min_epsilon else epsilon while not terminated and step < self.episode_limit: # time.sleep(0.2) obs = self.env.get_obs() state = self.env.get_state() actions, avail_actions, actions_onehot = [], [], [] # get the weights of all actions for all agents weights = self.agents.get_action_weights(np.array(obs), last_action) # choose action for each agent, agent wise !! for agent_id in range(self.n_agents): avail_action = self.env.get_avail_agent_actions(agent_id) action = self.agents.choose_action(weights[agent_id], avail_action, epsilon, evaluate) # generate onehot vector of th action action_onehot = np.zeros(self.args.n_actions) action_onehot[action] = 1 actions.append(action) actions_onehot.append(action_onehot) avail_actions.append(avail_action) last_action[agent_id] = action_onehot reward, terminated, info = self.env.step(actions) win_tag = True if terminated and 'battle_won' in info and info['battle_won'] else False o.append(obs) s.append(state) u.append(np.reshape(actions, [self.n_agents, 1])) u_onehot.append(actions_onehot) avail_u.append(avail_actions) r.append([reward]) terminate.append([terminated]) padded.append([0.]) episode_reward += reward step += 1 # if terminated: # time.sleep(1) if self.args.epsilon_anneal_scale == 'step': epsilon = epsilon - self.anneal_epsilon if epsilon > self.min_epsilon else epsilon # last obs # print('episode_reward', episode_reward) obs = self.env.get_obs() state = self.env.get_state() o.append(obs) s.append(state) o_next = o[1:] s_next = s[1:] o = o[:-1] s = s[:-1] # get avail_action for last obs,because target_q needs avail_action in training avail_actions = [] for agent_id in range(self.n_agents): avail_action = self.env.get_avail_agent_actions(agent_id) avail_actions.append(avail_action) avail_u.append(avail_actions) avail_u_next = avail_u[1:] avail_u = avail_u[:-1] # if step < self.episode_limit,padding for i in range(step, self.episode_limit): o.append(np.zeros((self.n_agents, self.obs_shape))) u.append(np.zeros([self.n_agents, 1])) s.append(np.zeros(self.state_shape)) r.append([0.]) o_next.append(np.zeros((self.n_agents, self.obs_shape))) s_next.append(np.zeros(self.state_shape)) u_onehot.append(np.zeros((self.n_agents, self.n_actions))) avail_u.append(np.zeros((self.n_agents, self.n_actions))) avail_u_next.append(np.zeros((self.n_agents, self.n_actions))) padded.append([1.]) terminate.append([1.]) episode = dict(o=o.copy(), s=s.copy(), u=u.copy(), r=r.copy(), avail_u=avail_u.copy(), o_next=o_next.copy(), s_next=s_next.copy(), avail_u_next=avail_u_next.copy(), u_onehot=u_onehot.copy(), padded=padded.copy(), terminated=terminate.copy() ) # add episode dim for key in episode.keys(): episode[key] = np.array([episode[key]]) if not evaluate: self.epsilon = epsilon # print('Epsilon is ', self.epsilon) if evaluate and episode_num == self.args.evaluate_epoch - 1 and self.args.replay_dir != '': self.env.save_replay() self.env.close() return episode, episode_reward, win_tag, step
43.236162
113
0.563882
1,431
11,717
4.406709
0.100629
0.022201
0.034887
0.043134
0.870282
0.84713
0.842372
0.842372
0.842372
0.842372
0
0.006322
0.324998
11,717
270
114
43.396296
0.790998
0.085431
0
0.901786
0
0
0.01111
0
0
0
0
0.003704
0
1
0.017857
false
0
0.017857
0
0.053571
0.008929
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
6899ec055880601de23e75819caf6b5b48a8d284
2,579
py
Python
utils/scripts/OOOlevelGen/src/levels/Rise_Above.py
fullscreennl/monkeyswipe
c56192e202674dd5ab18023f6cf14cf51e95fbd0
[ "MIT" ]
null
null
null
utils/scripts/OOOlevelGen/src/levels/Rise_Above.py
fullscreennl/monkeyswipe
c56192e202674dd5ab18023f6cf14cf51e95fbd0
[ "MIT" ]
null
null
null
utils/scripts/OOOlevelGen/src/levels/Rise_Above.py
fullscreennl/monkeyswipe
c56192e202674dd5ab18023f6cf14cf51e95fbd0
[ "MIT" ]
null
null
null
import LevelBuilder from sprites import * def render(name,bg): lb = LevelBuilder.LevelBuilder(name+".plist",background=bg) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=86, y=36,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=125, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=174, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=205, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=239, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=271, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=316, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Friend.FriendSprite(classname = 'AccelFriendSprite', x=360, y=16,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 ).setName('Friend')) lb.addObject(Hero.HeroSprite(x=341, y=164,width=32,height=32)) lb.addObject(Beam.BeamSprite(x=339, y=312,width=25,height=14,angle='0',restitution=0.2,static='true',friction=0.5,density=20 ).setName('Beam')) lb.addObject(Joints.DistanceJoint(body1='Beam',body2='Hero',damping='0.2',freq='2' )) lb.addObject(Star.StarSprite(x=300, y=48,width=32,height=32)) lb.addObject(Enemy.EnemySprite(x=335, y=43,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 )) lb.addObject(Enemy.EnemySprite(x=182, y=69,width=32,height=32,angle='0',restitution=0.2,static='false',friction=0.5,density=20 )) lb.addObject(Beam.BeamSprite(x=448, y=36,width=127,height=14,angle='45',restitution=0.2,static='true',friction=0.5,density=20 ).setName('Beam_2')) lb.addObject(Beam.BeamSprite(x=37, y=36,width=127,height=14,angle='-45',restitution=0.2,static='true',friction=0.5,density=20 ).setName('Beam_2')) lb.render()
117.227273
186
0.734781
407
2,579
4.651106
0.179361
0.092974
0.089276
0.130481
0.849974
0.803487
0.772847
0.743265
0.743265
0.743265
0
0.097692
0.059325
2,579
21
187
122.809524
0.682605
0
0
0
0
0
0.114773
0
0
0
0
0
0
1
0.047619
false
0
0.095238
0
0.142857
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
d7b4335ce191944ecb35b16a07387a4c19796ef8
1,991
py
Python
co2/readoutputs.py
kojitominaga/scratch
5eaf4de30c89ff1e855a6be493105d1201f07f74
[ "FSFAP" ]
null
null
null
co2/readoutputs.py
kojitominaga/scratch
5eaf4de30c89ff1e855a6be493105d1201f07f74
[ "FSFAP" ]
null
null
null
co2/readoutputs.py
kojitominaga/scratch
5eaf4de30c89ff1e855a6be493105d1201f07f74
[ "FSFAP" ]
null
null
null
import os outputfiles = [f for f in os.listdir('.') if ('output_' in f) and (not ('UIO' in f))] lakeid = [int(fn.split('.')[0].split('_')[1]) for fn in outputfiles] summary = [] for fi in range(len(outputfiles)): fn = outputfiles[fi] id = lakeid[fi] f = open(fn, 'rU') output = f.read() f.close() species = output.split('----------------------------Distribution of species----------------------------')[1].split('------------------------------Saturation indices-------------------------------')[0] co2 = float(species.split('CO2')[1].split()[0]) saturation = output.split('------------------------------Saturation indices-------------------------------')[1].split('------------------')[0] co2g = float(saturation.split('CO2(g)')[1].split()[0]) summary = summary + ['%d,%g,%g' % (id, co2, co2g)] f = open('CO2 PHREEQC for 76 (not 77) COMSAT lakes UMB.csv', 'w') f.write('ID,CO2_PHREEQC,logpCO2_PHREEQC\n') f.write('\n'.join(summary)) f.close() outputfiles = [f for f in os.listdir('.') if ('output_' in f) and ('UIO' in f)] lakeid = [int(fn.split('.')[0].split('_')[1]) for fn in outputfiles] summary = [] for fi in range(len(outputfiles)): fn = outputfiles[fi] id = lakeid[fi] f = open(fn, 'rU') output = f.read() f.close() species = output.split('----------------------------Distribution of species----------------------------')[1].split('------------------------------Saturation indices-------------------------------')[0] co2 = float(species.split('CO2')[1].split()[0]) saturation = output.split('------------------------------Saturation indices-------------------------------')[1].split('------------------')[0] co2g = float(saturation.split('CO2(g)')[1].split()[0]) summary = summary + ['%d,%g,%g' % (id, co2, co2g)] f = open('CO2 PHREEQC for 76 (not 77) COMSAT lakes UIO.csv', 'w') f.write('ID,CO2_PHREEQC,logpCO2_PHREEQC\n') f.write('\n'.join(summary)) f.close()
40.632653
204
0.482672
243
1,991
3.921811
0.201646
0.050367
0.044071
0.033578
0.982162
0.982162
0.982162
0.982162
0.982162
0.982162
0
0.027043
0.145655
1,991
48
205
41.479167
0.533216
0
0
0.871795
0
0
0.371673
0.264189
0
0
0
0
0
1
0
false
0
0.025641
0
0.025641
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
d7b897278a9a18ca577ab019b430b6ff36d73069
176
py
Python
src/phoenix_letter/common/credentials.py
quixand/phoenix-letter
8578f70cf5168eb64f1608ed3422b55307fe6514
[ "MIT" ]
14
2019-06-10T14:54:24.000Z
2022-03-02T11:17:30.000Z
src/phoenix_letter/common/credentials.py
quixand/phoenix-letter
8578f70cf5168eb64f1608ed3422b55307fe6514
[ "MIT" ]
37
2018-12-23T06:00:49.000Z
2022-03-01T12:01:53.000Z
src/phoenix_letter/common/credentials.py
quixand/phoenix-letter
8578f70cf5168eb64f1608ed3422b55307fe6514
[ "MIT" ]
6
2019-10-30T12:25:31.000Z
2020-10-12T00:30:43.000Z
from getpass import getpass def get_credentials(): access_key = getpass("AWS Access Key:") secret_key = getpass("AWS Secret Key:") return access_key, secret_key
19.555556
43
0.715909
24
176
5.041667
0.458333
0.223141
0.214876
0.297521
0
0
0
0
0
0
0
0
0.193182
176
8
44
22
0.852113
0
0
0
0
0
0.170455
0
0
0
0
0
0
1
0.2
false
0.6
0.2
0
0.6
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
7
d7dbc087f29c0b8b509c2d4508a6a87e8baa0fd5
9,272
py
Python
tests/test_cfgfilter.py
redhat-openstack/oslo.config
37b6d32f43c2f0f11a87674a8dc1278af09fdec9
[ "Apache-1.1" ]
null
null
null
tests/test_cfgfilter.py
redhat-openstack/oslo.config
37b6d32f43c2f0f11a87674a8dc1278af09fdec9
[ "Apache-1.1" ]
null
null
null
tests/test_cfgfilter.py
redhat-openstack/oslo.config
37b6d32f43c2f0f11a87674a8dc1278af09fdec9
[ "Apache-1.1" ]
null
null
null
# Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslotest import base as test_base from oslo.config import cfg from oslo.config import cfgfilter class BaseTestCase(test_base.BaseTestCase): def setUp(self, conf=None): super(BaseTestCase, self).setUp() if conf is None: self.conf = cfg.ConfigOpts() else: self.conf = conf self.fconf = cfgfilter.ConfigFilter(self.conf) class RegisterTestCase(BaseTestCase): def test_register_opt_default(self): self.fconf.register_opt(cfg.StrOpt('foo', default='bar')) self.assertEqual('bar', self.fconf.foo) self.assertEqual('bar', self.fconf['foo']) self.assertIn('foo', self.fconf) self.assertEqual(['foo'], list(self.fconf)) self.assertEqual(1, len(self.fconf)) self.assertNotIn('foo', self.conf) self.assertEqual(0, len(self.conf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'foo') def test_register_opt_none_default(self): self.fconf.register_opt(cfg.StrOpt('foo')) self.assertIsNone(self.fconf.foo) self.assertIsNone(self.fconf['foo']) self.assertIn('foo', self.fconf) self.assertEqual(['foo'], list(self.fconf)) self.assertEqual(1, len(self.fconf)) self.assertNotIn('foo', self.conf) self.assertEqual(0, len(self.conf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'foo') def test_register_grouped_opt_default(self): self.fconf.register_opt(cfg.StrOpt('foo', default='bar'), group='blaa') self.assertEqual('bar', self.fconf.blaa.foo) self.assertEqual('bar', self.fconf['blaa']['foo']) self.assertIn('blaa', self.fconf) self.assertIn('foo', self.fconf.blaa) self.assertEqual(['blaa'], list(self.fconf)) self.assertEqual(['foo'], list(self.fconf.blaa)) self.assertEqual(1, len(self.fconf)) self.assertEqual(1, len(self.fconf.blaa)) self.assertNotIn('blaa', self.conf) self.assertEqual(0, len(self.conf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'blaa') def test_register_grouped_opt_none_default(self): self.fconf.register_opt(cfg.StrOpt('foo'), group='blaa') self.assertIsNone(self.fconf.blaa.foo) self.assertIsNone(self.fconf['blaa']['foo']) self.assertIn('blaa', self.fconf) self.assertIn('foo', self.fconf.blaa) self.assertEqual(['blaa'], list(self.fconf)) self.assertEqual(['foo'], list(self.fconf.blaa)) self.assertEqual(1, len(self.fconf)) self.assertEqual(1, len(self.fconf.blaa)) self.assertNotIn('blaa', self.conf) self.assertEqual(0, len(self.conf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'blaa') def test_register_group(self): group = cfg.OptGroup('blaa') self.fconf.register_group(group) self.fconf.register_opt(cfg.StrOpt('foo'), group=group) self.assertIsNone(self.fconf.blaa.foo) self.assertIsNone(self.fconf['blaa']['foo']) self.assertIn('blaa', self.fconf) self.assertIn('foo', self.fconf.blaa) self.assertEqual(['blaa'], list(self.fconf)) self.assertEqual(['foo'], list(self.fconf.blaa)) self.assertEqual(1, len(self.fconf)) self.assertEqual(1, len(self.fconf.blaa)) self.assertNotIn('blaa', self.conf) self.assertEqual(0, len(self.conf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'blaa') def test_register_opts(self): self.fconf.register_opts([cfg.StrOpt('foo'), cfg.StrOpt('bar')]) self.assertIn('foo', self.fconf) self.assertIn('bar', self.fconf) self.assertNotIn('foo', self.conf) self.assertNotIn('bar', self.conf) def test_register_cli_opt(self): self.fconf.register_cli_opt(cfg.StrOpt('foo')) self.assertIn('foo', self.fconf) self.assertNotIn('foo', self.conf) def test_register_cli_opts(self): self.fconf.register_cli_opts([cfg.StrOpt('foo'), cfg.StrOpt('bar')]) self.assertIn('foo', self.fconf) self.assertIn('bar', self.fconf) self.assertNotIn('foo', self.conf) self.assertNotIn('bar', self.conf) def test_register_opts_grouped(self): self.fconf.register_opts([cfg.StrOpt('foo'), cfg.StrOpt('bar')], group='blaa') self.assertIn('foo', self.fconf.blaa) self.assertIn('bar', self.fconf.blaa) self.assertNotIn('blaa', self.conf) def test_register_cli_opt_grouped(self): self.fconf.register_cli_opt(cfg.StrOpt('foo'), group='blaa') self.assertIn('foo', self.fconf.blaa) self.assertNotIn('blaa', self.conf) def test_register_cli_opts_grouped(self): self.fconf.register_cli_opts([cfg.StrOpt('foo'), cfg.StrOpt('bar')], group='blaa') self.assertIn('foo', self.fconf.blaa) self.assertIn('bar', self.fconf.blaa) self.assertNotIn('blaa', self.conf) def test_unknown_opt(self): self.assertNotIn('foo', self.fconf) self.assertEqual(0, len(self.fconf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.fconf, 'foo') self.assertNotIn('blaa', self.conf) def test_blocked_opt(self): self.conf.register_opt(cfg.StrOpt('foo')) self.assertIn('foo', self.conf) self.assertEqual(1, len(self.conf)) self.assertIsNone(self.conf.foo) self.assertNotIn('foo', self.fconf) self.assertEqual(0, len(self.fconf)) self.assertRaises(cfg.NoSuchOptError, getattr, self.fconf, 'foo') def test_already_registered_opt(self): self.conf.register_opt(cfg.StrOpt('foo')) self.fconf.register_opt(cfg.StrOpt('foo')) self.assertIn('foo', self.conf) self.assertEqual(1, len(self.conf)) self.assertIsNone(self.conf.foo) self.assertIn('foo', self.fconf) self.assertEqual(1, len(self.fconf)) self.assertIsNone(self.fconf.foo) self.conf.set_override('foo', 'bar') self.assertEqual('bar', self.conf.foo) self.assertEqual('bar', self.fconf.foo) def test_already_registered_opts(self): self.conf.register_opts([cfg.StrOpt('foo'), cfg.StrOpt('fu')]) self.fconf.register_opts([cfg.StrOpt('foo'), cfg.StrOpt('bu')]) self.assertIn('foo', self.conf) self.assertIn('fu', self.conf) self.assertNotIn('bu', self.conf) self.assertEqual(2, len(self.conf)) self.assertIsNone(self.conf.foo) self.assertIsNone(self.conf.fu) self.assertIn('foo', self.fconf) self.assertIn('bu', self.fconf) self.assertNotIn('fu', self.fconf) self.assertEqual(2, len(self.fconf)) self.assertIsNone(self.fconf.foo) self.assertIsNone(self.fconf.bu) self.conf.set_override('foo', 'bar') self.assertEqual('bar', self.conf.foo) self.assertEqual('bar', self.fconf.foo) def test_already_registered_cli_opt(self): self.conf.register_cli_opt(cfg.StrOpt('foo')) self.fconf.register_cli_opt(cfg.StrOpt('foo')) self.assertIn('foo', self.conf) self.assertEqual(1, len(self.conf)) self.assertIsNone(self.conf.foo) self.assertIn('foo', self.fconf) self.assertEqual(1, len(self.fconf)) self.assertIsNone(self.fconf.foo) self.conf.set_override('foo', 'bar') self.assertEqual('bar', self.conf.foo) self.assertEqual('bar', self.fconf.foo) def test_already_registered_cli_opts(self): self.conf.register_cli_opts([cfg.StrOpt('foo'), cfg.StrOpt('fu')]) self.fconf.register_cli_opts([cfg.StrOpt('foo'), cfg.StrOpt('bu')]) self.assertIn('foo', self.conf) self.assertIn('fu', self.conf) self.assertNotIn('bu', self.conf) self.assertEqual(2, len(self.conf)) self.assertIsNone(self.conf.foo) self.assertIsNone(self.conf.fu) self.assertIn('foo', self.fconf) self.assertIn('bu', self.fconf) self.assertNotIn('fu', self.fconf) self.assertEqual(2, len(self.fconf)) self.assertIsNone(self.fconf.foo) self.assertIsNone(self.fconf.bu) self.conf.set_override('foo', 'bar') self.assertEqual('bar', self.conf.foo) self.assertEqual('bar', self.fconf.foo)
37.844898
78
0.625108
1,160
9,272
4.918966
0.100862
0.140379
0.082019
0.066597
0.854364
0.842972
0.838591
0.801788
0.78251
0.763056
0
0.00447
0.22789
9,272
244
79
38
0.792569
0.062338
0
0.73913
0
0
0.046429
0
0
0
0
0
0.657609
1
0.097826
false
0
0.016304
0
0.125
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
8
d7fabc4533404eba8bb4028633b38317329eea58
1,153
py
Python
controllers/controllers.py
horaciosanrafael/gppto
d029548550ebb62722cf748b5a570bc5c16801c6
[ "MIT" ]
null
null
null
controllers/controllers.py
horaciosanrafael/gppto
d029548550ebb62722cf748b5a570bc5c16801c6
[ "MIT" ]
null
null
null
controllers/controllers.py
horaciosanrafael/gppto
d029548550ebb62722cf748b5a570bc5c16801c6
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # from odoo import http # class /home/horacio/odoo1303/misapps/gpppto(http.Controller): # @http.route('//home/horacio/odoo1303/misapps/gpppto//home/horacio/odoo1303/misapps/gpppto/', auth='public') # def index(self, **kw): # return "Hello, world" # @http.route('//home/horacio/odoo1303/misapps/gpppto//home/horacio/odoo1303/misapps/gpppto/objects/', auth='public') # def list(self, **kw): # return http.request.render('/home/horacio/odoo1303/misapps/gpppto.listing', { # 'root': '//home/horacio/odoo1303/misapps/gpppto//home/horacio/odoo1303/misapps/gpppto', # 'objects': http.request.env['/home/horacio/odoo1303/misapps/gpppto./home/horacio/odoo1303/misapps/gpppto'].search([]), # }) # @http.route('//home/horacio/odoo1303/misapps/gpppto//home/horacio/odoo1303/misapps/gpppto/objects/<model("/home/horacio/odoo1303/misapps/gpppto./home/horacio/odoo1303/misapps/gpppto"):obj>/', auth='public') # def object(self, obj, **kw): # return http.request.render('/home/horacio/odoo1303/misapps/gpppto.object', { # 'object': obj # })
52.409091
212
0.664354
135
1,153
5.674074
0.259259
0.215405
0.372063
0.509138
0.754569
0.712794
0.712794
0.712794
0.712794
0.712794
0
0.061678
0.142238
1,153
21
213
54.904762
0.712841
0.966175
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
1
1
1
0
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
0
1
0
0
0
0
0
0
10
cc0d61662249578a6e79ca0d5ae078fbf261ea84
1,990
py
Python
prediksi/migrations/0004_auto_20191121_2332.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
prediksi/migrations/0004_auto_20191121_2332.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
prediksi/migrations/0004_auto_20191121_2332.py
valiantkevin/prediksi-saham-randomforest
927fba182e30c228300a55cb5f57b16f0147db76
[ "MIT" ]
null
null
null
# Generated by Django 2.2.5 on 2019-11-21 16:32 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('prediksi', '0003_resultstocks'), ] operations = [ migrations.DeleteModel( name='ResultStocks', ), migrations.AddField( model_name='stocks', name='grouped1', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='grouped20', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='grouped5', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='onehot1', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='onehot20', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='onehot5', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='plain1', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='plain20', field=models.IntegerField(default=0), preserve_default=False, ), migrations.AddField( model_name='stocks', name='plain5', field=models.IntegerField(default=0), preserve_default=False, ), ]
28.028169
49
0.533166
166
1,990
6.277108
0.259036
0.15547
0.198656
0.233205
0.760077
0.760077
0.724568
0.724568
0.675624
0.675624
0
0.031373
0.359296
1,990
70
50
28.428571
0.785882
0.022613
0
0.71875
1
0
0.080803
0
0
0
0
0
0
1
0
false
0
0.015625
0
0.0625
0
0
0
0
null
0
1
1
0
1
1
1
0
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
cc12b66f5e970d2c465eb6b2a868db076c0d3aa1
15,146
py
Python
beaconrunner/eth2spec/test/custody_game/block_processing/test_process_chunk_challenge.py
casparschwa/beaconrunner
d5430e08b120462beea19f65a4cf335ec9eb9134
[ "MIT" ]
2,161
2018-09-20T09:40:27.000Z
2021-08-17T16:48:29.000Z
tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_chunk_challenge.py
sthagen/eth2.0-specs
27b0d1f32e4ce430dd13b447c273a0f64b637066
[ "CC0-1.0" ]
1,573
2018-09-22T06:33:19.000Z
2021-08-18T00:54:44.000Z
tests/core/pyspec/eth2spec/test/custody_game/block_processing/test_process_chunk_challenge.py
sthagen/eth2.0-specs
27b0d1f32e4ce430dd13b447c273a0f64b637066
[ "CC0-1.0" ]
502
2018-09-22T04:37:36.000Z
2021-08-17T09:34:45.000Z
from eth2spec.test.helpers.custody import ( get_valid_chunk_challenge, get_valid_custody_chunk_response, get_sample_shard_transition, ) from eth2spec.test.helpers.attestations import ( get_valid_attestation, ) from eth2spec.test.helpers.constants import ( CUSTODY_GAME, MINIMAL, ) from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot from eth2spec.test.context import ( expect_assertion_error, disable_process_reveal_deadlines, spec_state_test, with_phases, with_presets, ) from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing def run_chunk_challenge_processing(spec, state, custody_chunk_challenge, valid=True): """ Run ``process_chunk_challenge``, yielding: - pre-state ('pre') - CustodyBitChallenge ('custody_chunk_challenge') - post-state ('post'). If ``valid == False``, run expecting ``AssertionError`` """ yield 'pre', state yield 'custody_chunk_challenge', custody_chunk_challenge if not valid: expect_assertion_error(lambda: spec.process_chunk_challenge(state, custody_chunk_challenge)) yield 'post', None return spec.process_chunk_challenge(state, custody_chunk_challenge) assert state.custody_chunk_challenge_records[state.custody_chunk_challenge_index - 1].responder_index == \ custody_chunk_challenge.responder_index assert state.custody_chunk_challenge_records[state.custody_chunk_challenge_index - 1].chunk_index == \ custody_chunk_challenge.chunk_index yield 'post', state def run_custody_chunk_response_processing(spec, state, custody_response, valid=True): """ Run ``process_chunk_challenge_response``, yielding: - pre-state ('pre') - CustodyResponse ('custody_response') - post-state ('post'). If ``valid == False``, run expecting ``AssertionError`` """ yield 'pre', state yield 'custody_response', custody_response if not valid: expect_assertion_error(lambda: spec.process_custody_response(state, custody_response)) yield 'post', None return spec.process_chunk_challenge_response(state, custody_response) assert state.custody_chunk_challenge_records[custody_response.challenge_index] == spec.CustodyChunkChallengeRecord() yield 'post', state @with_phases([CUSTODY_GAME]) @spec_state_test @with_presets([MINIMAL], reason="too slow") @disable_process_reveal_deadlines def test_challenge_appended(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1 shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) yield from run_chunk_challenge_processing(spec, state, challenge) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_challenge_empty_element_replaced(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1 shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) state.custody_chunk_challenge_records.append(spec.CustodyChunkChallengeRecord()) yield from run_chunk_challenge_processing(spec, state, challenge) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_duplicate_challenge(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1 shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) _, _, _ = run_chunk_challenge_processing(spec, state, challenge) yield from run_chunk_challenge_processing(spec, state, challenge, valid=False) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_second_challenge(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + 1) # Make len(offset_slots) == 1 shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * spec.EPOCHS_PER_CUSTODY_PERIOD) challenge0 = get_valid_chunk_challenge(spec, state, attestation, shard_transition, chunk_index=0) _, _, _ = run_chunk_challenge_processing(spec, state, challenge0) challenge1 = get_valid_chunk_challenge(spec, state, attestation, shard_transition, chunk_index=1) yield from run_chunk_challenge_processing(spec, state, challenge1) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_multiple_epochs_custody(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 3) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) yield from run_chunk_challenge_processing(spec, state, challenge) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_many_epochs_custody(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 20) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) yield from run_chunk_challenge_processing(spec, state, challenge) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_off_chain_attestation(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) yield from run_chunk_challenge_processing(spec, state, challenge) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_custody_response(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) _, _, _ = run_chunk_challenge_processing(spec, state, challenge) chunk_challenge_index = state.custody_chunk_challenge_index - 1 custody_response = get_valid_custody_chunk_response( spec, state, challenge, chunk_challenge_index, block_length_or_custody_data=2**15 // 3) yield from run_custody_chunk_response_processing(spec, state, custody_response) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_custody_response_chunk_index_2(spec, state): transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition, chunk_index=2) _, _, _ = run_chunk_challenge_processing(spec, state, challenge) chunk_challenge_index = state.custody_chunk_challenge_index - 1 custody_response = get_valid_custody_chunk_response( spec, state, challenge, chunk_challenge_index, block_length_or_custody_data=2**15 // 3) yield from run_custody_chunk_response_processing(spec, state, custody_response) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_custody_response_multiple_epochs(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 3) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) _, _, _ = run_chunk_challenge_processing(spec, state, challenge) chunk_challenge_index = state.custody_chunk_challenge_index - 1 custody_response = get_valid_custody_chunk_response( spec, state, challenge, chunk_challenge_index, block_length_or_custody_data=2**15 // 3) yield from run_custody_chunk_response_processing(spec, state, custody_response) @with_phases([CUSTODY_GAME]) @spec_state_test @disable_process_reveal_deadlines @with_presets([MINIMAL], reason="too slow") def test_custody_response_many_epochs(spec, state): transition_to_valid_shard_slot(spec, state) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * 20) shard = 0 offset_slots = spec.get_offset_slots(state, shard) shard_transition = get_sample_shard_transition(spec, state.slot, [2**15 // 3] * len(offset_slots)) attestation = get_valid_attestation(spec, state, index=shard, signed=True, shard_transition=shard_transition) transition_to(spec, state, state.slot + spec.MIN_ATTESTATION_INCLUSION_DELAY) _, _, _ = run_attestation_processing(spec, state, attestation) transition_to(spec, state, state.slot + spec.SLOTS_PER_EPOCH * (spec.EPOCHS_PER_CUSTODY_PERIOD - 1)) challenge = get_valid_chunk_challenge(spec, state, attestation, shard_transition) _, _, _ = run_chunk_challenge_processing(spec, state, challenge) chunk_challenge_index = state.custody_chunk_challenge_index - 1 custody_response = get_valid_custody_chunk_response( spec, state, challenge, chunk_challenge_index, block_length_or_custody_data=2**15 // 3) yield from run_custody_chunk_response_processing(spec, state, custody_response)
40.605898
120
0.749505
1,911
15,146
5.535322
0.050235
0.112309
0.048402
0.063528
0.893364
0.885139
0.865476
0.862261
0.843449
0.824069
0
0.008867
0.15859
15,146
372
121
40.715054
0.821171
0.033408
0
0.790323
0
0
0.010224
0.001578
0
0
0
0
0.024194
1
0.052419
false
0
0.024194
0
0.084677
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
0be637d979a1b4029dc88be65d124c241092cb12
34
py
Python
tests/test_smoke.py
messa/baq
388f0d5f28e88d1cd8656f4508baf9acb06a7508
[ "MIT" ]
1
2021-03-26T13:15:21.000Z
2021-03-26T13:15:21.000Z
tests/test_smoke.py
messa/baq
388f0d5f28e88d1cd8656f4508baf9acb06a7508
[ "MIT" ]
null
null
null
tests/test_smoke.py
messa/baq
388f0d5f28e88d1cd8656f4508baf9acb06a7508
[ "MIT" ]
null
null
null
def test_import(): import baq
11.333333
18
0.676471
5
34
4.4
0.8
0
0
0
0
0
0
0
0
0
0
0
0.235294
34
2
19
17
0.846154
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0
1
0
1.5
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
0408c52b5998ded0fb3544d97e56ecbd315a6a0b
159
py
Python
tests/motion/does_not_have_motion_class/__init__.py
dadaloop82/viseron
1c6c446a4856e16c0e2ed6b9323d169fbdcae20f
[ "MIT" ]
399
2020-08-31T21:13:07.000Z
2022-03-31T18:54:26.000Z
tests/motion/does_not_have_motion_class/__init__.py
dadaloop82/viseron
1c6c446a4856e16c0e2ed6b9323d169fbdcae20f
[ "MIT" ]
157
2020-09-01T18:59:56.000Z
2022-03-25T07:14:19.000Z
tests/motion/does_not_have_motion_class/__init__.py
dadaloop82/viseron
1c6c446a4856e16c0e2ed6b9323d169fbdcae20f
[ "MIT" ]
53
2020-09-01T07:35:59.000Z
2022-03-28T23:21:16.000Z
"""Dummy class that does not have MotionDetection class.""" class motiondetection: """Dummy class that does not have MotionDetection class.""" pass
19.875
63
0.716981
19
159
6
0.421053
0.175439
0.245614
0.315789
0.789474
0.789474
0.789474
0.789474
0
0
0
0
0.188679
159
7
64
22.714286
0.883721
0.672956
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
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
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
9
04092c06ef198aa63c078b300b9d9ea285674364
4,345
py
Python
task1a/10class/utils.py
satyarth934/DCASE2020_task1
a72234d9456086f1024f119505fc84801a383813
[ "MIT" ]
64
2020-07-01T15:03:19.000Z
2022-03-26T06:39:19.000Z
task1a/10class/utils.py
satyarth934/DCASE2020_task1
a72234d9456086f1024f119505fc84801a383813
[ "MIT" ]
19
2020-08-10T08:14:50.000Z
2022-01-20T08:44:58.000Z
task1a/10class/utils.py
satyarth934/DCASE2020_task1
a72234d9456086f1024f119505fc84801a383813
[ "MIT" ]
29
2020-07-05T04:37:30.000Z
2022-03-18T18:47:20.000Z
import numpy as np import pandas as pd import pickle import os def load_data_2020(feat_path, csv_path, feat_dim, file_type): with open(csv_path, 'r') as text_file: lines = text_file.read().split('\n') for idx, elem in enumerate(lines): lines[idx] = lines[idx].split('\t') lines[idx][0] = lines[idx][0].split('/')[-1].split('.')[0] # remove first line lines = lines[1:] lines = [elem for elem in lines if elem != ['']] for idx, elem in enumerate(lines): lines[idx][-1] = lines[idx][-1].split('\r')[0] label_info = np.array(lines) data_df = pd.read_csv(csv_path, sep='\t', encoding='ASCII') ClassNames = np.unique(data_df['scene_label']) labels = data_df['scene_label'].astype('category').cat.codes.values feat_mtx = [] for [filename, labnel] in label_info: filepath = feat_path + '/' + filename + '.logmel' with open(filepath,'rb') as f: temp=pickle.load(f, encoding='latin1') feat_mtx.append(temp['feat_data']) feat_mtx = np.array(feat_mtx) return feat_mtx, labels def load_data_2020_splitted(feat_path, csv_path, feat_dim, idxlines, file_type): with open(csv_path, 'r') as text_file: lines = text_file.read().split('\n') for idx, elem in enumerate(lines): lines[idx] = lines[idx].split('\t') lines[idx][0] = lines[idx][0].split('/')[-1].split('.')[0] # remove first line lines = lines[1:] lines = [lines[i] for i in idxlines] lines = [elem for elem in lines if elem != ['']] for idx, elem in enumerate(lines): lines[idx][-1] = lines[idx][-1].split('\r')[0] label_info = np.array(lines) data_df = pd.read_csv(csv_path, sep='\t', encoding='ASCII') ClassNames = np.unique(data_df['scene_label']) labels = data_df['scene_label'].astype('category').cat.codes.values labels = [labels[i] for i in idxlines] feat_mtx = [] for [filename, label] in label_info: filepath = feat_path + '/' + filename + '.' + 'logmel' with open(filepath,'rb') as f: temp=pickle.load(f, encoding='latin1') feat_mtx.append(temp['feat_data']) feat_mtx = np.array(feat_mtx) return feat_mtx, labels def deltas(X_in): X_out = (X_in[:,:,2:,:]-X_in[:,:,:-2,:])/10.0 X_out = X_out[:,:,1:-1,:]+(X_in[:,:,4:,:]-X_in[:,:,:-4,:])/5.0 return X_out def load_data_2020_test(feat_path, csv_path, csv_path_true, feat_dim, file_type): with open(csv_path_true, 'r') as text_file: lines = text_file.read().split('\n') for idx, elem in enumerate(lines): lines[idx] = lines[idx].split('\t') lines[idx][0] = lines[idx][0].split('/')[-1].split('.')[0] # remove first line lines = lines[1:] lines = [elem for elem in lines if elem != ['']] for idx, elem in enumerate(lines): lines[idx][-1] = lines[idx][-1].split('\r')[0] label_info_true = np.array(lines) with open(csv_path, 'r') as text_file: lines = text_file.read().split('\n') for idx, elem in enumerate(lines): lines[idx] = lines[idx].split('\t') lines[idx][0] = lines[idx][0].split('/')[-1].split('.')[0] # remove first line lines = lines[1:] lines = [elem for elem in lines if elem != ['']] for idx, elem in enumerate(lines): lines[idx][-1] = lines[idx][-1].split('\r')[0] label_info = np.array(lines) data_df = pd.read_csv(csv_path, sep='\t', encoding='ASCII') ClassNames = np.unique(data_df['scene_label']) labels = data_df['scene_label'].astype('category').cat.codes.values feat_mtx = [] for [filename, label] in label_info: print(filename) filepath = feat_path + '/' + label_info_true[int(filename)][0] + '.logmel' print(filepath) with open(filepath,'rb') as f: #print(filepath) temp=pickle.load(f, encoding='latin1') feat_mtx.append(temp['feat_data']) feat_mtx = np.array(feat_mtx) return feat_mtx, labels
36.512605
86
0.55443
599
4,345
3.861436
0.131886
0.083009
0.034587
0.041505
0.860787
0.847817
0.822741
0.822741
0.789883
0.789883
0
0.018778
0.27687
4,345
118
87
36.822034
0.717377
0.019793
0
0.761364
0
0
0.052223
0
0
0
0
0
0
1
0.045455
false
0
0.045455
0
0.136364
0.022727
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
f099291b7ed766e31cdc989ac4bd6ea6d31a4422
72
py
Python
paz/models/classification/__init__.py
niqbal996/paz
f27205907367415d5b21f90e1a1d1d1ce598e889
[ "MIT" ]
300
2020-10-29T08:02:05.000Z
2022-03-30T21:47:32.000Z
paz/models/classification/__init__.py
albertofernandezvillan/paz
9fbd50b993f37e1e807297a29c6044c09967c9cc
[ "MIT" ]
30
2020-10-29T12:40:32.000Z
2022-03-31T14:06:35.000Z
paz/models/classification/__init__.py
albertofernandezvillan/paz
9fbd50b993f37e1e807297a29c6044c09967c9cc
[ "MIT" ]
62
2020-10-29T12:34:13.000Z
2022-03-29T05:21:45.000Z
from .xception import build_xception from .xception import MiniXception
24
36
0.861111
9
72
6.777778
0.555556
0.393443
0.590164
0
0
0
0
0
0
0
0
0
0.111111
72
2
37
36
0.953125
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
f0b6b85893291d2d8f323b7ce4fb7ece91c194cf
9,491
py
Python
proofpoint_tap/komand_proofpoint_tap/actions/get_blocked_clicks/schema.py
GreyNoise-Intelligence/insightconnect-plugins
2ba3121d42fd96e1267bb095bc76b962678c1f56
[ "MIT" ]
null
null
null
proofpoint_tap/komand_proofpoint_tap/actions/get_blocked_clicks/schema.py
GreyNoise-Intelligence/insightconnect-plugins
2ba3121d42fd96e1267bb095bc76b962678c1f56
[ "MIT" ]
null
null
null
proofpoint_tap/komand_proofpoint_tap/actions/get_blocked_clicks/schema.py
GreyNoise-Intelligence/insightconnect-plugins
2ba3121d42fd96e1267bb095bc76b962678c1f56
[ "MIT" ]
null
null
null
# GENERATED BY KOMAND SDK - DO NOT EDIT import insightconnect_plugin_runtime import json class Component: DESCRIPTION = "Fetch events for clicks to malicious URLs blocked in the specified time period" class Input: THREAT_STATUS = "threat_status" TIME_END = "time_end" TIME_START = "time_start" URL = "url" class Output: RESULTS = "results" class GetBlockedClicksInput(insightconnect_plugin_runtime.Input): schema = json.loads(""" { "type": "object", "title": "Variables", "properties": { "threat_status": { "type": "string", "title": "Threat Status", "description": "The threat statuses which will be returned in the data. If no value is specified, active and cleared threats are returned", "enum": [ "active", "cleared", "falsePositive" ], "order": 4 }, "time_end": { "type": "string", "title": "Time End", "description": "The end of the data retrieval period as ISO8601-formatted date e.g 2021-04-20T22:00:00Z. If left empty, it will be calculated from the 'time_start' parameter. If the 'time_start' parameter is empty, data from one hour before the current API server time will be returned. The minimum time range is thirty seconds. The maximum time range is one hour", "order": 2 }, "time_start": { "type": "string", "title": "Time Start", "description": "The start of the data retrieval period as ISO8601-formatted date e.g 2021-04-20T21:00:00Z. If left empty, it will be calculated from the 'time_end' parameter. If the 'time_end' parameter is empty, data from one hour before the current API server time will be returned. The minimum time range is thirty seconds. The maximum time range is one hour", "order": 1 }, "url": { "type": "string", "title": "URL", "description": "The URL for which the results will be returned. Returns all results if left empty", "order": 3 } } } """) def __init__(self): super(self.__class__, self).__init__(self.schema) class GetBlockedClicksOutput(insightconnect_plugin_runtime.Output): schema = json.loads(""" { "type": "object", "title": "Variables", "properties": { "results": { "$ref": "#/definitions/blocked_clicks", "title": "Results", "description": "The results containing blocked clicks", "order": 1 } }, "required": [ "results" ], "definitions": { "blocked_clicks": { "type": "object", "title": "blocked_clicks", "properties": { "clicksBlocked": { "type": "array", "title": "Clicks Blocked", "description": "An array containing all clicks to URL threats which were blocked", "items": { "$ref": "#/definitions/clicks" }, "order": 1 }, "queryEndTime": { "type": "string", "title": "Query End Time", "description": "The time at which the period queried for data ended", "order": 2 } }, "definitions": { "clicks": { "type": "object", "title": "clicks", "properties": { "GUID": { "type": "string", "title": "GUID", "description": "The ID of the message within PPS", "order": 5 }, "campaignId": { "type": "string", "title": "Campaign ID", "description": "An identifier for the campaign of which the threat is a member", "order": 1 }, "classification": { "type": "string", "title": "Classification", "description": "The threat category of the malicious URL", "order": 2 }, "clickIP": { "type": "string", "title": "Click IP", "description": "The external IP address of the user who clicked on the link", "order": 3 }, "clickTime": { "type": "string", "title": "Click Time", "description": "The time the user clicked on the URL", "order": 4 }, "id": { "type": "string", "title": "ID", "description": "The unique id of the click", "order": 6 }, "recipient": { "type": "string", "title": "Recipient", "description": "The email address of the recipient", "order": 7 }, "sender": { "type": "string", "title": "Sender", "description": "The email address of the sender. The user-part is hashed. The domain-part is cleartext", "order": 8 }, "senderIP": { "type": "string", "title": "Sender IP", "description": "The IP address of the sender", "order": 9 }, "threatId": { "type": "string", "title": "Threat ID", "description": "The unique identifier associated with this threat", "order": 10 }, "threatStatus": { "type": "string", "title": "Threat Status", "description": "The current state of the threat", "order": 11 }, "threatTime": { "type": "string", "title": "Threat Time", "description": "Proofpoint identified the URL as a threat at this time", "order": 12 }, "threatUrl": { "type": "string", "title": "Threat URL", "description": "A link to the entry on the TAP Dashboard for the particular threat", "order": 13 }, "url": { "type": "string", "title": "URL", "description": "The malicious URL which was clicked", "order": 14 }, "userAgent": { "type": "string", "title": "User Agent", "description": "The User-Agent header from the clicker's HTTP request", "order": 15 } } } } }, "clicks": { "type": "object", "title": "clicks", "properties": { "GUID": { "type": "string", "title": "GUID", "description": "The ID of the message within PPS", "order": 5 }, "campaignId": { "type": "string", "title": "Campaign ID", "description": "An identifier for the campaign of which the threat is a member", "order": 1 }, "classification": { "type": "string", "title": "Classification", "description": "The threat category of the malicious URL", "order": 2 }, "clickIP": { "type": "string", "title": "Click IP", "description": "The external IP address of the user who clicked on the link", "order": 3 }, "clickTime": { "type": "string", "title": "Click Time", "description": "The time the user clicked on the URL", "order": 4 }, "id": { "type": "string", "title": "ID", "description": "The unique id of the click", "order": 6 }, "recipient": { "type": "string", "title": "Recipient", "description": "The email address of the recipient", "order": 7 }, "sender": { "type": "string", "title": "Sender", "description": "The email address of the sender. The user-part is hashed. The domain-part is cleartext", "order": 8 }, "senderIP": { "type": "string", "title": "Sender IP", "description": "The IP address of the sender", "order": 9 }, "threatId": { "type": "string", "title": "Threat ID", "description": "The unique identifier associated with this threat", "order": 10 }, "threatStatus": { "type": "string", "title": "Threat Status", "description": "The current state of the threat", "order": 11 }, "threatTime": { "type": "string", "title": "Threat Time", "description": "Proofpoint identified the URL as a threat at this time", "order": 12 }, "threatUrl": { "type": "string", "title": "Threat URL", "description": "A link to the entry on the TAP Dashboard for the particular threat", "order": 13 }, "url": { "type": "string", "title": "URL", "description": "The malicious URL which was clicked", "order": 14 }, "userAgent": { "type": "string", "title": "User Agent", "description": "The User-Agent header from the clicker's HTTP request", "order": 15 } } } } } """) def __init__(self): super(self.__class__, self).__init__(self.schema)
31.427152
371
0.487514
908
9,491
5.045154
0.202643
0.076403
0.114604
0.041257
0.744379
0.744379
0.744379
0.727789
0.706396
0.706396
0
0.014409
0.378464
9,491
301
372
31.531561
0.762163
0.003898
0
0.670139
1
0.020833
0.937791
0.010051
0
0
0
0
0
1
0.006944
false
0
0.006944
0
0.059028
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
f0e3c8cd16a4fa82c53ccfbad25ad5b3339b3e91
9,443
py
Python
gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py
RenfengLiu/vulkan_test_applications
04359b7184ad94659810213ff63ae71296426182
[ "Apache-2.0" ]
55
2017-06-20T13:54:31.000Z
2022-02-08T23:58:11.000Z
gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py
RenfengLiu/vulkan_test_applications
04359b7184ad94659810213ff63ae71296426182
[ "Apache-2.0" ]
53
2017-06-15T19:23:07.000Z
2022-03-30T19:56:30.000Z
gapid_tests/resource_creation_tests/CreateResetDestroyCommandPool_test/CreateResetDestroyCommandPool_test.py
RenfengLiu/vulkan_test_applications
04359b7184ad94659810213ff63ae71296426182
[ "Apache-2.0" ]
42
2017-06-15T19:05:40.000Z
2022-03-30T14:15:25.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from gapit_test_framework import gapit_test, require, require_equal from gapit_test_framework import require_not_equal, GapitTest from gapit_test_framework import get_read_offset_function, get_write_offset_function from vulkan_constants import * from struct_offsets import VulkanStruct, UINT32_T, POINTER, HANDLE, DEVICE_SIZE from struct_offsets import ARRAY, CHAR COMMAND_POOL_CREATE_INFO = [ ("sType", UINT32_T), ("pNext", POINTER), ("flags", UINT32_T), ("queueFamilyIndex", UINT32_T), ] COMMAND_POOL = [("handle", HANDLE)] @gapit_test("CreateResetDestroyCommandPool_test") class TransientBitCommandPool(GapitTest): def expect(self): """1. Expects a command pool created with VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, then reseted with flag of value 0, and finally destroyed""" architecture = self.architecture create_command_pool = require(self.nth_call_of("vkCreateCommandPool", 1)) device = create_command_pool.int_device require_not_equal(0, device) require_not_equal(0, create_command_pool.hex_pCreateInfo) require_equal(0, create_command_pool.hex_pAllocator) require_not_equal(0, create_command_pool.hex_pCommandPool) require_equal(VK_SUCCESS, int(create_command_pool.return_val)) create_info = VulkanStruct( architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( create_command_pool, create_command_pool.hex_pCreateInfo)) require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, create_info.sType) require_equal(0, create_info.pNext) require_equal(VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, create_info.flags) require_equal(0, create_info.queueFamilyIndex) command_pool = VulkanStruct( architecture, COMMAND_POOL, get_write_offset_function( create_command_pool, create_command_pool.hex_pCommandPool)) require_not_equal(0, command_pool.handle) reset_pool = require(self.next_call_of("vkResetCommandPool")) require_equal(device, reset_pool.int_device) require_equal(command_pool.handle, reset_pool.int_commandPool) require_equal(0, reset_pool.flags) destroy_command_pool = require(self.next_call_of( "vkDestroyCommandPool")) require_equal(device, destroy_command_pool.int_device) require_equal( command_pool.handle, destroy_command_pool.int_commandPool) @gapit_test("CreateResetDestroyCommandPool_test") class ResetCommandBufferBitCommandPool(GapitTest): def expect(self): """2. Expects a command pool created with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, then reseted with flag of value 0, and finally destroyed""" architecture = self.architecture create_command_pool = require(self.nth_call_of("vkCreateCommandPool", 2)) device = create_command_pool.int_device require_not_equal(0, device) require_not_equal(0, create_command_pool.hex_pCreateInfo) require_equal(0, create_command_pool.hex_pAllocator) require_not_equal(0, create_command_pool.hex_pCommandPool) require_equal(VK_SUCCESS, int(create_command_pool.return_val)) create_info = VulkanStruct( architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( create_command_pool, create_command_pool.hex_pCreateInfo)) require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, create_info.sType) require_equal(0, create_info.pNext) require_equal(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, create_info.flags) require_equal(0, create_info.queueFamilyIndex) command_pool = VulkanStruct( architecture, COMMAND_POOL, get_write_offset_function( create_command_pool, create_command_pool.hex_pCommandPool)) require_not_equal(0, command_pool.handle) reset_pool = require(self.next_call_of("vkResetCommandPool")) require_equal(device, reset_pool.int_device) require_equal(command_pool.handle, reset_pool.int_commandPool) require_equal(0, reset_pool.flags) destroy_command_pool = require(self.next_call_of( "vkDestroyCommandPool")) require_equal(device, destroy_command_pool.int_device) require_equal( command_pool.handle, destroy_command_pool.int_commandPool) @gapit_test("CreateResetDestroyCommandPool_test") class ResetCommandBufferBitTransientBitCommandPool(GapitTest): def expect(self): """3. Expects a command pool created with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, then reset with flag of value VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, and finally destroyed""" architecture = self.architecture create_command_pool = require(self.nth_call_of("vkCreateCommandPool", 3)) device = create_command_pool.int_device require_not_equal(0, device) require_not_equal(0, create_command_pool.hex_pCreateInfo) require_equal(0, create_command_pool.hex_pAllocator) require_not_equal(0, create_command_pool.hex_pCommandPool) require_equal(VK_SUCCESS, int(create_command_pool.return_val)) create_info = VulkanStruct( architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( create_command_pool, create_command_pool.hex_pCreateInfo)) require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, create_info.sType) require_equal(0, create_info.pNext) require_equal(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, create_info.flags) require_equal(0, create_info.queueFamilyIndex) command_pool = VulkanStruct( architecture, COMMAND_POOL, get_write_offset_function( create_command_pool, create_command_pool.hex_pCommandPool)) require_not_equal(0, command_pool.handle) reset_pool = require(self.next_call_of("vkResetCommandPool")) require_equal(device, reset_pool.int_device) require_equal(command_pool.handle, reset_pool.int_commandPool) require_equal(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, reset_pool.flags) destroy_command_pool = require(self.next_call_of( "vkDestroyCommandPool")) require_equal(device, destroy_command_pool.int_device) require_equal( command_pool.handle, destroy_command_pool.int_commandPool) @gapit_test("CreateResetDestroyCommandPool_test") class EmptyBitCommandPool(GapitTest): def expect(self): """4. Expects a command pool created with empty flag bit, then reseted with VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, and finally destroyed""" architecture = self.architecture create_command_pool = require(self.nth_call_of("vkCreateCommandPool", 4)) device = create_command_pool.int_device require_not_equal(0, device) require_not_equal(0, create_command_pool.hex_pCreateInfo) require_equal(0, create_command_pool.hex_pAllocator) require_not_equal(0, create_command_pool.hex_pCommandPool) require_equal(VK_SUCCESS, int(create_command_pool.return_val)) create_info = VulkanStruct( architecture, COMMAND_POOL_CREATE_INFO, get_read_offset_function( create_command_pool, create_command_pool.hex_pCreateInfo)) require_equal(VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, create_info.sType) require_equal(0, create_info.pNext) require_equal(0, create_info.flags) require_equal(0, create_info.queueFamilyIndex) command_pool = VulkanStruct( architecture, COMMAND_POOL, get_write_offset_function( create_command_pool, create_command_pool.hex_pCommandPool)) require_not_equal(0, command_pool.handle) reset_pool = require(self.next_call_of("vkResetCommandPool")) require_equal(device, reset_pool.int_device) require_equal(command_pool.handle, reset_pool.int_commandPool) require_equal(VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT, reset_pool.flags) destroy_command_pool = require(self.next_call_of( "vkDestroyCommandPool")) require_equal(device, destroy_command_pool.int_device) require_equal( command_pool.handle, destroy_command_pool.int_commandPool)
45.181818
84
0.719263
1,115
9,443
5.664574
0.129148
0.170678
0.107663
0.063331
0.838664
0.817764
0.813015
0.810956
0.810956
0.810956
0
0.007706
0.216668
9,443
208
85
45.399038
0.846154
0.126231
0
0.816327
0
0
0.049227
0.016695
0
0
0
0
0
1
0.027211
false
0
0.040816
0
0.095238
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
9be847fbcd524c64d491874fe0f32f253cef71e1
34,377
py
Python
tests/unit_tests/gui/mainWmixin/test_tabSatSearch.py
mworion/MountWizzard4
4e06b29ec2ef70be40e114b911b7bdf2f858a4b1
[ "Apache-2.0" ]
16
2020-01-11T22:32:26.000Z
2022-03-31T15:18:14.000Z
tests/unit_tests/gui/mainWmixin/test_tabSatSearch.py
mworion/MountWizzard4
4e06b29ec2ef70be40e114b911b7bdf2f858a4b1
[ "Apache-2.0" ]
196
2020-01-16T13:56:01.000Z
2022-03-29T02:06:51.000Z
tests/unit_tests/gui/mainWmixin/test_tabSatSearch.py
mworion/MountWizzard4
4e06b29ec2ef70be40e114b911b7bdf2f858a4b1
[ "Apache-2.0" ]
6
2019-12-01T19:39:33.000Z
2021-05-27T13:14:20.000Z
############################################################ # -*- coding: utf-8 -*- # # # # # # # # # ## ## # ## # # # # # # # # # # # # # # # ## # ## ## ###### # # # # # # # # # Python-based Tool for interaction with the 10micron mounts # GUI with PyQT5 for python # # written in python3, (c) 2019-2021 by mworion # Licence APL2.0 # ########################################################### # standard libraries import pytest from unittest import mock import os # external packages import skyfield.timelib from PyQt5.QtCore import QObject from PyQt5.QtCore import QThreadPool, QRect from PyQt5.QtCore import pyqtSignal, QModelIndex from PyQt5.QtWidgets import QTableWidgetItem from skyfield.api import EarthSatellite, Angle, wgs84 from skyfield.units import Distance, Velocity, AngleRate, Rate from sgp4.exporter import export_tle import numpy as np # local import from tests.unit_tests.unitTestAddOns.baseTestSetupMixins import App from gui.utilities.toolsQtWidget import MWidget from gui.widgets.main_ui import Ui_MainWindow from gui.mainWmixin.tabSatSearch import SatSearch from gui.mainWmixin.tabSatTrack import SatTrack from logic.databaseProcessing.dataWriter import DataWriter @pytest.fixture(autouse=True, scope='module') def module(qapp): yield @pytest.fixture(autouse=True, scope='function') def function(module): class Mixin(MWidget, SatSearch, SatTrack): def __init__(self): super().__init__() self.app = App() self.databaseProcessing = DataWriter(self.app) self.threadPool = QThreadPool() self.ui = Ui_MainWindow() self.closing = False self.ui.setupUi(self) SatSearch.__init__(self) SatTrack.__init__(self) window = Mixin() yield window window.closing = True def test_sources(function): assert len(function.satelliteSourceURLs) == 14 def test_initConfig_1(function): class Test: installPath = '' function.app.automation = Test() suc = function.initConfig() assert suc assert function.installPath == 'tests/workDir/data' def test_initConfig_2(function): function.app.automation = None suc = function.initConfig() assert suc assert function.installPath == 'tests/workDir/data' def test_initConfig_3(function): function.app.automation.installPath = 'test' suc = function.initConfig() assert suc assert function.installPath == 'test' def test_storeConfig_1(function): suc = function.storeConfig() assert suc def test_enableGuiFunctions_1(function): with mock.patch.object(function.app.mount.firmware, 'checkNewer', return_value=None): suc = function.enableGuiFunctions() assert not suc def test_enableGuiFunctions_2(function): with mock.patch.object(function.app.mount.firmware, 'checkNewer', return_value=True): suc = function.enableGuiFunctions() assert suc def test_chooseSatellite_1(function): satTab = function.ui.listSatelliteNames function.ui.switchToTrackingTab.setChecked(True) function.app.deviceStat['mount'] = True with mock.patch.object(satTab, 'item'): with mock.patch.object(function, 'extractSatelliteData'): with mock.patch.object(function, 'showSatPasses'): suc = function.chooseSatellite() assert suc def test_chooseSatellite_2(function): satTab = function.ui.listSatelliteNames function.ui.switchToTrackingTab.setChecked(False) function.app.deviceStat['mount'] = False with mock.patch.object(satTab, 'item'): with mock.patch.object(function, 'extractSatelliteData'): with mock.patch.object(function, 'showSatPasses'): suc = function.chooseSatellite() assert suc def test_getSatelliteDataFromDatabase_1(function): class Name: name = '' jdStart = 1 jdEnd = 1 flip = False message = '' altitude = None azimuth = None function.app.mount.satellite.tleParams = Name() suc = function.getSatelliteDataFromDatabase() assert not suc def test_findSunlit(function): class SAT: class FRAME: def __init__(self, x): pass @staticmethod def is_sunlit(x): return True at = FRAME sat = SAT() eph = None tEv = None val = function.findSunlit(sat, eph, tEv) assert val def test_findSatUp_1(function): class SAT: @staticmethod def find_events(x, y, z, altitude_degrees): return [], [] sat = SAT() val = function.findSatUp(sat, 0, 0, 0, alt=0) assert not val[0] assert not len(val[1]) def test_findSatUp_2(function): class SAT: @staticmethod def find_events(x, y, z, altitude_degrees): return np.array([5, 7, 7]), np.array([1, 0, 0]) sat = SAT() val = function.findSatUp(sat, 0, 0, 0, alt=0) assert val[0] assert val[1] == [5] def test_findRangeRate(function): tle = ["NOAA 8", "1 13923U 83022A 20076.90417581 .00000005 00000-0 19448-4 0 9998", "2 13923 98.6122 63.2579 0016304 96.9736 263.3301 14.28696485924954"] sat = EarthSatellite(tle[1], tle[2], name=tle[0]) loc = wgs84.latlon(latitude_degrees=49, longitude_degrees=-11) tEv = function.app.mount.obsSite.ts.tt_jd(2459215.5) val = function.findRangeRate(sat, loc, tEv) assert round(val[0], 3) == 5694.271 assert round(val[1], 3) == -0.678 assert round(val[2], 3) == 0.004 assert round(val[3], 3) == 0.079 def test_calcSatSunPhase_1(function): tle = ["NOAA 8", "1 13923U 83022A 20076.90417581 .00000005 00000-0 19448-4 0 9998", "2 13923 98.6122 63.2579 0016304 96.9736 263.3301 14.28696485924954"] sat = EarthSatellite(tle[1], tle[2], name=tle[0]) loc = wgs84.latlon(latitude_degrees=49, longitude_degrees=-11) ephemeris = function.app.ephemeris tEv = function.app.mount.obsSite.ts.tt_jd(2459215.5) val = function.calcSatSunPhase(sat, loc, ephemeris, tEv) assert round(val.degrees, 5) == 129.84279 def test_calcAppMag_1(function): tle = ["NOAA 8", "1 13923U 83022A 20076.90417581 .00000005 00000-0 19448-4 0 9998", "2 13923 98.6122 63.2579 0016304 96.9736 263.3301 14.28696485924954"] sat = EarthSatellite(tle[1], tle[2], name=tle[0]) loc = wgs84.latlon(latitude_degrees=49, longitude_degrees=-11) ephemeris = function.app.ephemeris satRange = 483 phase = Angle(degrees=113) tEv = function.app.mount.obsSite.ts.now() with mock.patch.object(function, 'calcSatSunPhase', return_value=phase): val = function.calcAppMag(sat, loc, ephemeris, satRange, tEv) assert round(val, 4) == -2.0456 def test_setSatTableEntry(function): function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('test') suc = function.setSatTableEntry(0, 0, entry) assert suc def test_updateTableEntries_1(function): param = [1, 2, 3, 4] suc = function.updateTableEntries(0, param) assert suc def test_updateTableEntries_2(function): param = [1, 2, 3, 4] ts = function.app.mount.obsSite.ts.now() isUp = (True, [ts]) suc = function.updateTableEntries(0, param, isUp) assert suc def test_updateTableEntries_3(function): param = [1, 2, 3, 4] ts = function.app.mount.obsSite.ts.now() isUp = (False, [ts]) suc = function.updateTableEntries(0, param, isUp) assert suc def test_updateTableEntries_4(function): param = [1, 2, 3, 4] ts = function.app.mount.obsSite.ts.now() isUp = (False, [ts]) suc = function.updateTableEntries(0, param, isUp, True, 5) assert suc def test_updateTableEntries_5(function): param = [1, 2, 3, 4] ts = function.app.mount.obsSite.ts.now() isUp = (False, [ts]) suc = function.updateTableEntries(0, param, isUp, False, 5) assert suc def test_satCalcDynamicTable_1(function): function.satTableDynamicValid = False suc = function.satCalcDynamicTable() assert not suc def test_satCalcDynamicTable_2(function): function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(1) function.ui.mainTabWidget.setCurrentIndex(1) suc = function.satCalcDynamicTable() assert not suc def test_satCalcDynamicTable_3(function): function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(1) suc = function.satCalcDynamicTable() assert not suc def test_satCalcDynamicTable_4(function): function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) suc = function.satCalcDynamicTable() assert suc def test_satCalcDynamicTable_5(function): function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('test') function.ui.listSatelliteNames.setItem(0, 0, entry) with mock.patch.object(QRect, 'intersects', return_value=False): with mock.patch.object(function, 'calcAppMag', return_value=10): with mock.patch.object(function, 'findSunlit', return_value=True): suc = function.satCalcDynamicTable() assert suc def test_satCalcDynamicTable_6(function): function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('test') function.ui.listSatelliteNames.setItem(0, 0, entry) function.ui.listSatelliteNames.setRowHidden(0, True) with mock.patch.object(function, 'findSunlit', return_value=True): with mock.patch.object(function, 'calcAppMag', return_value=10): with mock.patch.object(QRect, 'intersects', return_value=True): suc = function.satCalcDynamicTable() assert suc def test_satCalcDynamicTable_7(function): tle = ["NOAA 8", "1 13923U 83022A 20076.90417581 .00000005 00000-0 19448-4 0 9998", "2 13923 98.6122 63.2579 0016304 96.9736 263.3301 14.28696485924954"] sat = EarthSatellite(tle[1], tle[2], name=tle[0]) function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(2) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('NOAA 8') function.ui.listSatelliteNames.setItem(0, 1, entry) function.ui.listSatelliteNames.setRowHidden(0, False) function.satellites = {'NOAA 8': sat} with mock.patch.object(function, 'updateTableEntries'): with mock.patch.object(function, 'findRangeRate'): with mock.patch.object(function, 'findSunlit', return_value=False): with mock.patch.object(QRect, 'intersects', return_value=True): suc = function.satCalcDynamicTable() assert suc def test_satCalcDynamicTable_8(function): tle = ["NOAA 8", "1 13923U 83022A 20076.90417581 .00000005 00000-0 19448-4 0 9998", "2 13923 98.6122 63.2579 0016304 96.9736 263.3301 14.28696485924954"] sat = EarthSatellite(tle[1], tle[2], name=tle[0]) function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(2) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('NOAA 8') function.ui.listSatelliteNames.setItem(0, 1, entry) function.ui.listSatelliteNames.setRowHidden(0, False) function.satellites = {'NOAA 8': sat} with mock.patch.object(function, 'updateTableEntries'): with mock.patch.object(function, 'findRangeRate'): with mock.patch.object(function, 'findSunlit', return_value=True): with mock.patch.object(function, 'calcAppMag', return_value=10): with mock.patch.object(QRect, 'intersects', return_value=True): suc = function.satCalcDynamicTable() assert suc def test_positionCursorInSatTable_1(function): satTab = function.ui.listSatelliteNames satTab.setRowCount(0) satTab.setColumnCount(2) satTab.insertRow(0) entry = QTableWidgetItem('NOAA 8') satTab.setItem(0, 1, entry) suc = function.positionCursorInSatTable(satTab, 'test') assert not suc def test_positionCursorInSatTable_2(function): satTab = function.ui.listSatelliteNames satTab.setRowCount(0) satTab.setColumnCount(2) satTab.insertRow(0) entry = QTableWidgetItem('NOAA 8') satTab.setItem(0, 1, entry) suc = function.positionCursorInSatTable(satTab, 'NOAA 8') assert suc def test_filterSatelliteNamesList_1(function): suc = function.filterSatelliteNamesList() assert suc def test_filterSatelliteNamesList_2(function): function.ui.satIsUp.setEnabled(True) function.ui.satIsUp.setChecked(True) function.ui.satIsSunlit.setEnabled(True) function.ui.satIsSunlit.setChecked(True) function.ui.satRemoveSO.setChecked(True) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('1234') function.ui.listSatelliteNames.setItem(0, 0, entry) entry = QTableWidgetItem('NOAA 8') function.ui.listSatelliteNames.setItem(0, 1, entry) entry = QTableWidgetItem('*') function.ui.listSatelliteNames.setItem(0, 8, entry) entry = QTableWidgetItem('1234') function.ui.listSatelliteNames.setItem(0, 7, entry) suc = function.filterSatelliteNamesList() assert suc def test_workerSatCalcTable_1(function): function.ui.listSatelliteNames.setRowCount(0) suc = function.workerSatCalcTable() assert suc assert function.satTableDynamicValid def test_workerSatCalcTable_2(function): class Test1: satnum = 12345 class Test: model = Test1() function.satellites = {'sat1': Test()} function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('sat1') function.ui.listSatelliteNames.setItem(0, 1, entry) function.satTableBaseValid = False function.satTableDynamicValid = False function.ui.satUpTimeWindow.setValue(0) with mock.patch.object(function, 'findRangeRate'): with mock.patch.object(function, 'findSunlit', return_value=False): with mock.patch.object(function, 'findSatUp'): with mock.patch.object(function, 'updateTableEntries'): suc = function.workerSatCalcTable() assert not suc def test_workerSatCalcTable_3(function): class Test1: satnum = 12345 class Test: model = Test1() function.satellites = {'sat1': Test()} function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('sat1') function.ui.listSatelliteNames.setItem(0, 1, entry) function.satTableBaseValid = True function.satTableDynamicValid = False function.ui.satUpTimeWindow.setValue(2) with mock.patch.object(function, 'findRangeRate'): with mock.patch.object(function, 'findSunlit', return_value=False): with mock.patch.object(function, 'findSatUp'): with mock.patch.object(function, 'updateTableEntries'): with mock.patch.object(function, 'calcAppMag', return_value=0): suc = function.workerSatCalcTable() assert suc assert function.satTableDynamicValid def test_workerSatCalcTable_4(function): class Test1: satnum = 12345 class Test: model = Test1() function.satellites = {'sat1': Test()} function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('sat1') function.ui.listSatelliteNames.setItem(0, 1, entry) function.satTableBaseValid = True function.satTableDynamicValid = False function.ui.satUpTimeWindow.setValue(2) with mock.patch.object(function, 'findRangeRate'): with mock.patch.object(function, 'findSunlit', return_value=True): with mock.patch.object(function, 'findSatUp'): with mock.patch.object(function, 'updateTableEntries'): with mock.patch.object(function, 'calcAppMag', return_value=0): suc = function.workerSatCalcTable() assert suc assert function.satTableDynamicValid def test_workerSatCalcTable_5(function): class Test1: satnum = 12345 class Test: model = Test1() function.satellites = {'sat1': Test()} function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('sat1') function.ui.listSatelliteNames.setItem(0, 1, entry) function.satTableBaseValid = True function.satTableDynamicValid = False function.ui.satUpTimeWindow.setValue(2) with mock.patch.object(function, 'findRangeRate', return_value=[np.nan]): with mock.patch.object(function, 'findSunlit', return_value=True): with mock.patch.object(function, 'findSatUp'): with mock.patch.object(function, 'updateTableEntries'): with mock.patch.object(function, 'calcAppMag', return_value=0): suc = function.workerSatCalcTable() assert suc assert function.satTableDynamicValid def test_satCalcTable_1(function): function.satTableBaseValid = False suc = function.satCalcTable() assert not suc def test_satCalcTable_2(function): function.satTableBaseValid = True function.satTableDynamicValid = True with mock.patch.object(function.threadPool, 'start'): suc = function.satCalcTable() assert suc assert not function.satTableDynamicValid def test_updateSatTable_1(function): function.ui.satCyclicUpdates.setChecked(False) suc = function.updateSatTable() assert not suc def test_updateSatTable_2(function): function.ui.satCyclicUpdates.setChecked(True) with mock.patch.object(function, 'satCalcTable'): suc = function.updateSatTable() assert suc def test_prepareSatTable_1(function): suc = function.prepareSatTable() assert suc def test_setupSatelliteNameList_1(function): class Test1: satnum = 12345 class Test: model = Test1() function.satSourceValid = False function.satellites = {'sat1': Test()} with mock.patch.object(function, 'prepareSatTable'): suc = function.setupSatelliteNameList() assert not suc def test_setupSatelliteNameList_2(function): class Test1: satnum = 12345 class Test: model = Test1() function.satSourceValid = True function.satellites = {'sat1': Test()} with mock.patch.object(function, 'prepareSatTable'): with mock.patch.object(function, 'filterSatelliteNamesList'): with mock.patch.object(function, 'satCalcTable'): suc = function.setupSatelliteNameList() assert suc assert function.satTableBaseValid def test_workerLoadDataFromSourceURLs_1(function): with mock.patch.object(function.app.mount.obsSite.loader, 'tle_file', return_value={}): suc = function.workerLoadDataFromSourceURLs() assert not suc def test_workerLoadDataFromSourceURLs_2(function): source = 'test' with mock.patch.object(function.app.mount.obsSite.loader, 'tle_file', return_value={}): with mock.patch.object(os.path, 'isfile', return_value=False): suc = function.workerLoadDataFromSourceURLs(source=source, isOnline=False) assert not suc def test_workerLoadDataFromSourceURLs_3(function): source = 'test' function.satSourceValid = False with mock.patch.object(function.app.mount.obsSite.loader, 'tle_file', return_value={}): with mock.patch.object(os.path, 'isfile', return_value=True): with mock.patch.object(function.app.mount.obsSite.loader, 'days_old', return_value=5): suc = function.workerLoadDataFromSourceURLs(source=source, isOnline=True) assert suc assert function.satSourceValid def test_loadDataFromSourceURLs_1(function): suc = function.loadDataFromSourceURLs() assert not suc def test_loadDataFromSourceURLs_2(function): function.ui.satelliteSource.addItem('test') suc = function.loadDataFromSourceURLs() assert not suc def test_loadDataFromSourceURLs_3(function): function.ui.satelliteSource.addItem('Active') suc = function.loadDataFromSourceURLs() assert suc def test_progSatellitesFiltered_1(function): class Satnum: satnum = 1 class Model: model = Satnum() function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=False): suc = function.progSatellitesFiltered() assert not suc def test_progSatellitesFiltered_2(function): class Satnum: satnum = 1 class Model: model = Satnum() function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=False): suc = function.progSatellitesFiltered() assert not suc def test_progSatellitesFiltered_3(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation = None function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): suc = function.progSatellitesFiltered() assert not suc def test_progSatellitesFiltered_3b(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation.installPath = '' function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): suc = function.progSatellitesFiltered() assert not suc def test_progSatellitesFiltered_4(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation.installPath = 'test' function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): with mock.patch.object(function.app.automation, 'uploadTLEData', return_value=False): suc = function.progSatellitesFiltered() assert not suc def test_progSatellitesFiltered_5(function): class Satnum: satnum = 1 class Model: model = Satnum() function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): with mock.patch.object(function.app.automation, 'uploadTLEData', return_value=True): suc = function.progSatellitesFiltered() assert suc def test_progSatellitesFull_1(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation = None function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=False): suc = function.progSatellitesFull() assert not suc def test_progSatellitesFull_2(function): class Satnum: satnum = 1 class Model: model = Satnum() function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=False): suc = function.progSatellitesFull() assert not suc def test_progSatellitesFull_3(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation = None function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): suc = function.progSatellitesFull() assert not suc def test_progSatellitesFull_3b(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation.installPath = '' function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): suc = function.progSatellitesFull() assert not suc def test_progSatellitesFull_4(function): class Satnum: satnum = 1 class Model: model = Satnum() function.app.automation.installPath = 'test' function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): with mock.patch.object(function.app.automation, 'uploadTLEData', return_value=False): suc = function.progSatellitesFull() assert not suc def test_progSatellitesFull_5(function): class Satnum: satnum = 1 class Model: model = Satnum() function.ui.satelliteSource.clear() function.ui.satelliteSource.addItem('Comet') function.ui.satelliteSource.setCurrentIndex(0) function.ui.filterSatellite.setText('test') function.satellites = {'test': Model(), '0815': Model(), 0: Model()} with mock.patch.object(function, 'messageDialog', return_value=True): with mock.patch.object(function.databaseProcessing, 'writeSatelliteTLE', return_value=True): with mock.patch.object(function.app.automation, 'uploadTLEData', return_value=True): suc = function.progSatellitesFull() assert suc
33.246615
83
0.595165
3,203
34,377
6.319076
0.089291
0.061265
0.052026
0.076038
0.820949
0.778903
0.758745
0.747579
0.728162
0.702421
0
0.041772
0.306397
34,377
1,033
84
33.2788
0.807079
0.009076
0
0.768187
0
0
0.063365
0.000708
0
0
0
0
0.097411
1
0.087546
false
0.003699
0.022195
0.003699
0.221948
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
50138262e9b7bc99fc5c0f8b04b6a07adb934f2d
239
py
Python
python/tests/compat.py
JX7P/libucl
d1cf4e9783fa96b9399f6585e2dc9a42e4d64746
[ "BSD-2-Clause" ]
1,301
2015-01-01T10:42:07.000Z
2022-03-21T08:00:14.000Z
python/tests/compat.py
JX7P/libucl
d1cf4e9783fa96b9399f6585e2dc9a42e4d64746
[ "BSD-2-Clause" ]
137
2015-01-04T18:15:11.000Z
2022-03-21T20:46:58.000Z
python/tests/compat.py
JX7P/libucl
d1cf4e9783fa96b9399f6585e2dc9a42e4d64746
[ "BSD-2-Clause" ]
161
2015-01-04T14:15:23.000Z
2022-03-20T04:11:01.000Z
try: import unittest2 as unittest except ImportError: import unittest # Python 2.7 - 3.1 if not hasattr(unittest.TestCase, 'assertRaisesRegex'): unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
26.555556
78
0.757322
26
239
6.961538
0.692308
0.265193
0.364641
0.453039
0.453039
0
0
0
0
0
0
0.025126
0.167364
239
8
79
29.875
0.884422
0.066946
0
0
0
0
0.076923
0
0
0
0
0
0.333333
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
7
ac9fa60e7041f8e00db33f0d5f49e90141c9bcef
12,355
py
Python
src/maintenance/azext_maintenance/tests/latest/example_steps.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
207
2017-11-29T06:59:41.000Z
2022-03-31T10:00:53.000Z
src/maintenance/azext_maintenance/tests/latest/example_steps.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
4,061
2017-10-27T23:19:56.000Z
2022-03-31T23:18:30.000Z
src/maintenance/azext_maintenance/tests/latest/example_steps.py
haroonf/azure-cli-extensions
61c044d34c224372f186934fa7c9313f1cd3a525
[ "MIT" ]
802
2017-10-11T17:36:26.000Z
2022-03-31T22:24:32.000Z
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from .. import try_manual # EXAMPLE: /ApplyUpdates/put/ApplyUpdates_CreateOrUpdate @try_manual def step_applyupdate_create(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance applyupdate create ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ApplyUpdates/put/ApplyUpdates_CreateOrUpdateParent @try_manual def step_applyupdate_create_or_update_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance applyupdate create-or-update-parent ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /ApplyUpdates/get/ApplyUpdates_Get @try_manual def step_applyupdate_show(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance applyupdate show ' '--name "{myApplyUpdate}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ApplyUpdates/get/ApplyUpdates_GetParent @try_manual def step_applyupdate_show_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance applyupdate show-parent ' '--name "{myApplyUpdate}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /ApplyUpdates/get/ApplyUpdates_List @try_manual def step_applyupdate_list(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance applyupdate list', checks=checks) # EXAMPLE: /MaintenanceConfigurations/put/MaintenanceConfigurations_CreateOrUpdateForResource @try_manual def step_configuration_create(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance configuration create ' '--location "eastus2euap" ' '--maintenance-scope "OSImage" ' '--maintenance-window-duration "05:00" ' '--maintenance-window-expiration-date-time "9999-12-31 00:00" ' '--maintenance-window-recur-every "Day" ' '--maintenance-window-start-date-time "2020-04-30 08:00" ' '--maintenance-window-time-zone "Pacific Standard Time" ' '--namespace "Microsoft.Maintenance" ' '--visibility "Custom" ' '--resource-group "{rg}" ' '--resource-name "{myMaintenanceConfiguration}"', checks=checks) # EXAMPLE: /MaintenanceConfigurations/get/MaintenanceConfigurations_GetForResource @try_manual def step_configuration_show(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance configuration show ' '--resource-group "{rg}" ' '--resource-name "{myMaintenanceConfiguration}"', checks=checks) # EXAMPLE: /MaintenanceConfigurations/get/MaintenanceConfigurations_GetForResource_GuestOSPatchLinux @try_manual def step_configuration_show2(test, checks=None): return step_configuration_show(test, checks) # EXAMPLE: /MaintenanceConfigurations/get/MaintenanceConfigurations_GetForResource_GuestOSPatchWindows @try_manual def step_configuration_show3(test, checks=None): return step_configuration_show(test, checks) # EXAMPLE: /MaintenanceConfigurations/get/MaintenanceConfigurations_List @try_manual def step_configuration_list(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance configuration list', checks=checks) # EXAMPLE: /MaintenanceConfigurations/patch/MaintenanceConfigurations_UpdateForResource @try_manual def step_configuration_update(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance configuration update ' '--location "eastus2euap" ' '--maintenance-scope "OSImage" ' '--maintenance-window-duration "05:00" ' '--maintenance-window-expiration-date-time "9999-12-31 00:00" ' '--maintenance-window-recur-every "Month Third Sunday" ' '--maintenance-window-start-date-time "2020-04-30 08:00" ' '--maintenance-window-time-zone "Pacific Standard Time" ' '--namespace "Microsoft.Maintenance" ' '--visibility "Custom" ' '--resource-group "{rg}" ' '--resource-name "{myMaintenanceConfiguration}"', checks=checks) # EXAMPLE: /ConfigurationAssignments/put/ConfigurationAssignments_CreateOrUpdate @try_manual def step_assignment_create(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment create ' '--maintenance-configuration-id "/subscriptions/{subscription_id}/resourcegroups/{rg}/providers/Microsoft.' 'Maintenance/maintenanceConfigurations/{myMaintenanceConfiguration}" ' '--name "{myConfigurationAssignment}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ConfigurationAssignments/put/ConfigurationAssignments_CreateOrUpdateParent @try_manual def step_assignment_create_or_update_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment create-or-update-parent ' '--maintenance-configuration-id "/subscriptions/{subscription_id}/resourcegroups/{rg}/providers/Microsoft.' 'Maintenance/maintenanceConfigurations/{myMaintenanceConfiguration2}" ' '--name "{myConfigurationAssignment2}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /ConfigurationAssignments/get/ConfigurationAssignments_Get @try_manual def step_assignment_show(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment show ' '--name "{myConfigurationAssignment}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ConfigurationAssignments/get/ConfigurationAssignments_GetParent @try_manual def step_assignment_show_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment show-parent ' '--name "{myConfigurationAssignment2}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /ConfigurationAssignments/get/ConfigurationAssignments_List @try_manual def step_assignment_list(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment list ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ConfigurationAssignments/get/ConfigurationAssignments_ListParent @try_manual def step_assignment_list_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment list-parent ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtestvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /ConfigurationAssignments/delete/ConfigurationAssignments_Delete @try_manual def step_assignment_delete(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment delete -y ' '--name "{myConfigurationAssignment}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /ConfigurationAssignments/delete/ConfigurationAssignments_DeleteParent @try_manual def step_assignment_delete_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance assignment delete-parent ' '--name "{myConfigurationAssignment}" ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdvm1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks) # EXAMPLE: /MaintenanceConfigurations/delete/MaintenanceConfigurations_DeleteForResource @try_manual def step_configuration_delete(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance configuration delete -y ' '--resource-group "{rg}" ' '--resource-name "example1"', checks=checks) # EXAMPLE: /PublicMaintenanceConfigurations/get/PublicMaintenanceConfigurations_GetForResource @try_manual def step_public_configuration_show(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance public-configuration show ' '--resource-name "{myMaintenanceConfiguration}"', checks=checks) # EXAMPLE: /PublicMaintenanceConfigurations/get/PublicMaintenanceConfigurations_List @try_manual def step_public_configuration_list(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance public-configuration list', checks=checks) # EXAMPLE: /Updates/get/Updates_List @try_manual def step_update_list(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance update list ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "smdtest1" ' '--resource-type "virtualMachineScaleSets"', checks=checks) # EXAMPLE: /Updates/get/Updates_ListParent @try_manual def step_update_list_parent(test, checks=None): if checks is None: checks = [] test.cmd('az maintenance update list-parent ' '--provider-name "Microsoft.Compute" ' '--resource-group "{rg}" ' '--resource-name "1" ' '--resource-parent-name "smdtest1" ' '--resource-parent-type "virtualMachineScaleSets" ' '--resource-type "virtualMachines"', checks=checks)
37.213855
120
0.632699
1,115
12,355
6.904933
0.124664
0.033771
0.037407
0.049877
0.911157
0.846344
0.737758
0.737758
0.737758
0.737758
0
0.009032
0.238284
12,355
331
121
37.326284
0.809053
0.175395
0
0.782258
0
0
0.469963
0.169884
0
0
0
0
0
1
0.096774
false
0
0.004032
0.008065
0.108871
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
ace894c1a9acaf1a77eb9f7f647647ec4d39d38e
171
py
Python
app/api/__init__.py
netai/apidesk
f87ace7d08777ed3f1e587e904800e78d6401b7f
[ "MIT" ]
null
null
null
app/api/__init__.py
netai/apidesk
f87ace7d08777ed3f1e587e904800e78d6401b7f
[ "MIT" ]
null
null
null
app/api/__init__.py
netai/apidesk
f87ace7d08777ed3f1e587e904800e78d6401b7f
[ "MIT" ]
null
null
null
from flask import Flask from flask import Blueprint from .routes import api_routes api_blueprint = Blueprint('api', __name__, url_prefix='/api') api_routes(api_blueprint)
28.5
61
0.812865
25
171
5.2
0.36
0.138462
0.230769
0.323077
0
0
0
0
0
0
0
0
0.105263
171
6
62
28.5
0.849673
0
0
0
0
0
0.040698
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0.6
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
0
0
1
0
1
1
0
7
4a06a619dc6b0a3492b294be5eba310a52281c13
5,124
py
Python
feeder/ntu_feeder.py
zjl863761131/CrosSCLR
792b70c76902a5e7ca5696f5a032f14bb04a255a
[ "BSD-2-Clause" ]
35
2021-04-20T03:30:20.000Z
2022-03-30T02:45:04.000Z
feeder/ntu_feeder.py
zjl863761131/CrosSCLR
792b70c76902a5e7ca5696f5a032f14bb04a255a
[ "BSD-2-Clause" ]
1
2022-03-25T12:32:47.000Z
2022-03-25T12:32:47.000Z
feeder/ntu_feeder.py
zjl863761131/CrosSCLR
792b70c76902a5e7ca5696f5a032f14bb04a255a
[ "BSD-2-Clause" ]
16
2021-04-22T14:38:05.000Z
2022-02-22T09:18:52.000Z
import numpy as np import pickle, torch from . import tools class Feeder_single(torch.utils.data.Dataset): """ Feeder for single inputs """ def __init__(self, data_path, label_path, shear_amplitude=0.5, temperal_padding_ratio=6, mmap=True): self.data_path = data_path self.label_path = label_path self.shear_amplitude = shear_amplitude self.temperal_padding_ratio = temperal_padding_ratio self.load_data(mmap) def load_data(self, mmap): # load label with open(self.label_path, 'rb') as f: self.sample_name, self.label = pickle.load(f) # load data if mmap: self.data = np.load(self.data_path, mmap_mode='r') else: self.data = np.load(self.data_path) def __len__(self): return len(self.label) def __getitem__(self, index): # get data data_numpy = np.array(self.data[index]) label = self.label[index] # processing data = self._aug(data_numpy) return data, label def _aug(self, data_numpy): if self.temperal_padding_ratio > 0: data_numpy = tools.temperal_crop(data_numpy, self.temperal_padding_ratio) if self.shear_amplitude > 0: data_numpy = tools.shear(data_numpy, self.shear_amplitude) return data_numpy class Feeder_dual(torch.utils.data.Dataset): """ Feeder for dual inputs """ def __init__(self, data_path, label_path, shear_amplitude=0.5, temperal_padding_ratio=6, mmap=True): self.data_path = data_path self.label_path = label_path self.shear_amplitude = shear_amplitude self.temperal_padding_ratio = temperal_padding_ratio self.load_data(mmap) def load_data(self, mmap): # load label with open(self.label_path, 'rb') as f: self.sample_name, self.label = pickle.load(f) # load data if mmap: self.data = np.load(self.data_path, mmap_mode='r') else: self.data = np.load(self.data_path) def __len__(self): return len(self.label) def __getitem__(self, index): # get data data_numpy = np.array(self.data[index]) label = self.label[index] # processing data1 = self._aug(data_numpy) data2 = self._aug(data_numpy) return [data1, data2], label def _aug(self, data_numpy): if self.temperal_padding_ratio > 0: data_numpy = tools.temperal_crop(data_numpy, self.temperal_padding_ratio) if self.shear_amplitude > 0: data_numpy = tools.shear(data_numpy, self.shear_amplitude) return data_numpy # class Feeder_semi(torch.utils.data.Dataset): # """ Feeder for semi-supervised learning """ # def __init__(self, data_path, label_path, shear_amplitude=0.5, temperal_padding_ratio=6, mmap=True, label_list=None): # self.data_path = data_path # self.label_path = label_path # self.shear_amplitude = shear_amplitude # self.temperal_padding_ratio = temperal_padding_ratio # self.label_list = label_list # self.load_data(mmap) # self.load_semi_data() # def load_data(self, mmap): # # load label # with open(self.label_path, 'rb') as f: # self.sample_name, self.label = pickle.load(f) # # load data # if mmap: # self.data = np.load(self.data_path, mmap_mode='r') # else: # self.data = np.load(self.data_path) # def load_semi_data(self): # data_length = len(self.label) # if not self.label_list: # self.label_list = list(range(data_length)) # else: # self.label_list = np.load(self.label_list).tolist() # self.label_list.sort() # self.unlabel_list = list(range(data_length)) # def __len__(self): # return len(self.unlabel_list) # def __getitem__(self, index): # # get data # data_numpy = np.array(self.data[index]) # label = self.label[index] # # processing # data = self._aug(data_numpy) # return data, label # def __getitem__(self, index): # label_index = self.label_list[index % len(self.label_list)] # unlabel_index = self.unlabel_list[index] # # get data # label_data_numpy = np.array(self.data[label_index]) # unlabel_data_numpy = np.array(self.data[unlabel_index]) # label = self.label[label_index] # # processing # data1 = self._aug(unlabel_data_numpy) # data2 = self._aug(unlabel_data_numpy) # return [data1, data2], label_data_numpy, label # def _aug(self, data_numpy): # if self.temperal_padding_ratio > 0: # data_numpy = tools.temperal_crop(data_numpy, self.temperal_padding_ratio) # if self.shear_amplitude > 0: # data_numpy = tools.shear(data_numpy, self.shear_amplitude) # return data_numpy
30.86747
123
0.610656
651
5,124
4.500768
0.099846
0.09215
0.102389
0.07372
0.845392
0.805119
0.716382
0.716382
0.716382
0.716382
0
0.006298
0.287276
5,124
166
124
30.86747
0.796002
0.456674
0
0.827586
0
0
0.002217
0
0
0
0
0
0
1
0.172414
false
0
0.051724
0.034483
0.362069
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
4a06d0821d5a4970caddf87d61fc7ebe786a6ee1
3,229
py
Python
models/addatt_RNN.py
caokyhieu/DELAFO
1c84e5f4ef9690e453973b57d1f0feb194a55a8c
[ "MIT" ]
17
2020-05-04T08:54:14.000Z
2022-03-28T08:43:09.000Z
models/addatt_RNN.py
caokyhieu/DELAFO
1c84e5f4ef9690e453973b57d1f0feb194a55a8c
[ "MIT" ]
2
2020-11-03T01:07:24.000Z
2021-08-06T16:56:18.000Z
models/addatt_RNN.py
caokyhieu/DELAFO
1c84e5f4ef9690e453973b57d1f0feb194a55a8c
[ "MIT" ]
10
2020-06-11T15:59:32.000Z
2022-03-22T14:00:04.000Z
from keras.layers import Input, Activation, Dense,Flatten, BatchNormalization, Add, Conv2D from keras.layers import MaxPooling2D,AveragePooling2D,Permute,Reshape,LSTM,Lambda,GRU,Bidirectional,BatchNormalization,Concatenate from keras import regularizers from keras.optimizers import Adam from models.attention_layer import * from keras.models import Model from utils import sharpe_ratio_loss,sharpe_ratio ############################### # additive attention RNN models ############################### def build_add_att_lstm_model(params): units = params['units'] activation = params['activation'] reg1 = params['l2'] reg2 = params['l2_1'] lr = params['l2_2'] input_shape = params['input_shape'] ts = input_shape[1] tickers = input_shape[0] input = Input(shape=input_shape) reshape_inp = Lambda(lambda x: K.permute_dimensions(x,pattern=(0,2,1,3))) (input) reshape_inp = Reshape((ts,-1)) (reshape_inp) batch_norm = BatchNormalization()(reshape_inp) recurrent_layer = LSTM(units = units, activation = activation, kernel_regularizer=regularizers.l2(reg1)) (batch_norm) batch_norm_2 = BatchNormalization()(recurrent_layer) ##ATTENTION LAYER contxt_layer = AdditiveAttentionLayer(name='Att',latent_dim=32,kernel_regularizer=regularizers.l2(0.01))([batch_norm,batch_norm_2]) merge = Concatenate()([batch_norm_2,contxt_layer]) out = Dense(units, kernel_regularizer =regularizers.l2(reg2),activation='tanh') (merge) batch_norm_3 = BatchNormalization()(out) out = Dense(tickers, kernel_regularizer =regularizers.l2(reg2)) (batch_norm_3) out = Activation('sigmoid')(out) model = Model([input], [out]) optimizer = Adam(lr = lr) model.compile(loss=sharpe_ratio_loss, optimizer=optimizer, metrics = [sharpe_ratio]) return model def build_add_att_gru_model(params): units = params['units'] activation = params['activation'] reg1 = params['l2'] reg2 = params['l2_1'] lr = params['l2_2'] input_shape = params['input_shape'] ts = input_shape[1] tickers = input_shape[0] input = Input(shape=input_shape) reshape_inp = Lambda(lambda x: K.permute_dimensions(x,pattern=(0,2,1,3))) (input) reshape_inp = Reshape((ts,-1)) (reshape_inp) batch_norm = BatchNormalization()(reshape_inp) recurrent_layer = GRU(units = units, activation = activation, kernel_regularizer=regularizers.l2(reg1)) (batch_norm) batch_norm_2 = BatchNormalization()(recurrent_layer) ##ATTENTION LAYER contxt_layer = AdditiveAttentionLayer(name='Att',latent_dim=32,kernel_regularizer=regularizers.l2(0.01))([batch_norm,batch_norm_2]) merge = Concatenate()([batch_norm_2,contxt_layer]) out = Dense(units, kernel_regularizer =regularizers.l2(reg2),activation='tanh') (merge) batch_norm_3 = BatchNormalization()(out) out = Dense(tickers, kernel_regularizer =regularizers.l2(reg2)) (batch_norm_3) out = Activation('sigmoid')(out) model = Model([input], [out]) optimizer = Adam(lr = lr) model.compile(loss=sharpe_ratio_loss, optimizer=optimizer, metrics = [sharpe_ratio]) return model
33.989474
135
0.69681
394
3,229
5.492386
0.187817
0.066543
0.107209
0.114603
0.808688
0.808688
0.808688
0.808688
0.808688
0.808688
0
0.024155
0.166615
3,229
94
136
34.351064
0.780007
0.018272
0
0.819672
0
0
0.032237
0
0
0
0
0
0
1
0.032787
false
0
0.114754
0
0.180328
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
c582c6ad967b20ffce6e762584e9e65b269a7884
3,903
py
Python
test/libzstd.py
MaxSac/build
482c25f3a26171073c7e6c59f0427f2259a63fec
[ "BSL-1.0" ]
11,356
2017-12-08T19:42:32.000Z
2022-03-31T16:55:25.000Z
test/libzstd.py
MaxSac/build
482c25f3a26171073c7e6c59f0427f2259a63fec
[ "BSL-1.0" ]
2,402
2017-12-08T22:31:01.000Z
2022-03-28T19:25:52.000Z
test/libzstd.py
MaxSac/build
482c25f3a26171073c7e6c59f0427f2259a63fec
[ "BSL-1.0" ]
1,343
2017-12-08T19:47:19.000Z
2022-03-26T11:31:36.000Z
#!/usr/bin/python # Copy-paste-modify from zlib.py # Copyright (C) 2013 Steven Watanabe # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import BoostBuild import MockToolset t = BoostBuild.Tester(arguments=['toolset=mock', '--ignore-site-config', '--user-config='], pass_toolset=0) MockToolset.create(t) # Generic definitions that aren't configuration specific common_stuff = ''' source_file('test.cpp', 'test.cpp') source_file('main.cpp', 'int main() {}') source_file('zstd.h.cpp', '#include <zstd.h>\\n') action('-c -x c++ $main.cpp -o $main.o') ''' t.write('test.cpp', 'test.cpp') # Default initialization - static library t.rm('bin') t.write("Jamroot.jam", """ path-constant here : . ; using zstd ; exe test : test.cpp /zstd//zstd : : <link>static <link>shared ; """) MockToolset.set_expected(t, common_stuff + ''' action('$main.o --static-lib=zstd -o $config.exe') action('-c -x c++ $zstd.h.cpp -o $zstd.h.o') action('-c -x c++ $test.cpp -o $test.o') action('$test.o --static-lib=zstd -o $test') ''') t.run_build_system() t.expect_addition('bin/mock/debug/test.exe') t.expect_addition('bin/mock/debug/link-static/test.exe') # Default initialization - shared library t.rm('bin') t.write("Jamroot.jam", """ path-constant here : . ; using zstd ; exe test : test.cpp /zstd//zstd : : <link>static <link>shared ; """) MockToolset.set_expected(t, common_stuff + ''' action('$main.o --shared-lib=zstd -o $config.exe') action('-c -x c++ $zstd.h.cpp -o $zstd.h.o') action('-c -x c++ $test.cpp -o $test.o') action('$test.o --shared-lib=zstd -o $test') ''') t.run_build_system() t.expect_addition('bin/mock/debug/test.exe') t.expect_addition('bin/mock/debug/link-static/test.exe') # Initialization in explicit location - static library t.rm('bin') t.write("Jamroot.jam", """ path-constant here : . ; using zstd : : <name>myzstd <include>$(here)/zstd <search>$(here)/zstd ; exe test : test.cpp /zstd//zstd : : <link>static <link>shared ; """) t.write('zstd/zstd.h', 'zstd') MockToolset.set_expected(t, common_stuff + ''' action('$main.o -L./zstd --static-lib=myzstd -o $config.exe') action('-c -x c++ $test.cpp -I./zstd -o $test.o') action('$test.o -L./zstd --static-lib=myzstd -o $test') ''') t.run_build_system() t.expect_addition('bin/mock/debug/test.exe') t.expect_addition('bin/mock/debug/link-static/test.exe') # Initialization in explicit location - shared library t.rm('bin') t.write("Jamroot.jam", """ path-constant here : . ; using zstd : : <name>myzstd <include>$(here)/zstd <search>$(here)/zstd ; exe test : test.cpp /zstd//zstd : : <link>static <link>shared ; """) MockToolset.set_expected(t, common_stuff + ''' action('$main.o -L./zstd --shared-lib=myzstd -o $config.exe') action('-c -x c++ $test.cpp -I./zstd -o $test.o') action('$test.o -L./zstd --shared-lib=myzstd -o $test') ''') t.run_build_system() t.expect_addition('bin/mock/debug/test.exe') t.expect_addition('bin/mock/debug/link-static/test.exe') # Initialization in explicit location - both static and shared libraries t.rm('bin') t.write("Jamroot.jam", """ path-constant here : . ; using zstd : : <name>myzstd <include>$(here)/zstd <search>$(here)/zstd ; exe test : test.cpp /zstd//zstd : <link>shared:<define>SHARED : <link>static <link>shared ; """) MockToolset.set_expected(t, common_stuff + ''' action('$main.o -L./zstd --static-lib=myzstd -o $config.exe') action('$main.o -L./zstd --shared-lib=myzstd -o $config.exe') action('-c -x c++ $test.cpp -I./zstd -o $test-static.o') action('-c -x c++ $test.cpp -I./zstd -DSHARED -o $test-shared.o') action('$test-static.o -L./zstd --static-lib=myzstd -o $test') action('$test-shared.o -L./zstd --shared-lib=myzstd -o $test') ''') t.run_build_system() t.expect_addition('bin/mock/debug/test.exe') t.expect_addition('bin/mock/debug/link-static/test.exe') t.cleanup()
32.798319
107
0.679734
629
3,903
4.155803
0.165342
0.040168
0.057383
0.06886
0.748661
0.73948
0.73948
0.739097
0.718822
0.718822
0
0.003145
0.103766
3,903
118
108
33.076271
0.74414
0.138611
0
0.719101
0
0.213483
0.719104
0.147761
0
0
0
0
0
1
0
false
0.011236
0.022472
0
0.022472
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
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
8
c590528ffbff8fdab0a110e2cea092d93415305b
12,030
py
Python
services/server/dashboard/2020-03-19-cases-and-deaths-per-million.py
adriangrepo/covid-19_virus
c13b8be5a4e0df43ce6fd743aa0b82cb66e4cc0e
[ "MIT" ]
null
null
null
services/server/dashboard/2020-03-19-cases-and-deaths-per-million.py
adriangrepo/covid-19_virus
c13b8be5a4e0df43ce6fd743aa0b82cb66e4cc0e
[ "MIT" ]
null
null
null
services/server/dashboard/2020-03-19-cases-and-deaths-per-million.py
adriangrepo/covid-19_virus
c13b8be5a4e0df43ce6fd743aa0b82cb66e4cc0e
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # # COVID-19 Deaths Per Capita # > Comparing death rates adjusting for population size. # # - comments: true # - author: Joao B. Duarte & Hamel Husain # - categories: [growth, compare, interactive] # - hide: false # - image: images/covid-permillion-trajectories.png # - permalink: /covid-compare-permillion/ # In[1]: #hide import numpy as np import pandas as pd import matplotlib.pyplot as plt import altair as alt get_ipython().run_line_magic('config', "InlineBackend.figure_format = 'retina'") chart_width = 550 chart_height= 400 # ## Deaths Per Million Of Inhabitants # Since reaching at least 1 death per million # # > Tip: Click (Shift+ for multiple) on countries in the legend to filter the visualization. # In[2]: #hide data = pd.read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Deaths.csv", error_bad_lines=False) data = data.drop(columns=["Lat", "Long"]) data = data.melt(id_vars= ["Province/State", "Country/Region"]) data = pd.DataFrame(data.groupby(['Country/Region', "variable"]).sum()) data.reset_index(inplace=True) data = data.rename(columns={"Country/Region": "location", "variable": "date", "value": "total_cases"}) data['date'] =pd.to_datetime(data.date) data = data.sort_values(by = "date") data.loc[data.location == "US","location"] = "United States" data.loc[data.location == "Korea, South","location"] = "South Korea" data_pwt = pd.read_stata("https://www.rug.nl/ggdc/docs/pwt91.dta") filter1 = data_pwt["year"] == 2017 data_pop = data_pwt[filter1] data_pop = data_pop[["country","pop"]] data_pop.loc[data_pop.country == "Republic of Korea","country"] = "South Korea" data_pop.loc[data_pop.country == "Iran (Islamic Republic of)","country"] = "Iran" # per habitant data_pc = data.copy() countries = ["China", "Italy", "Spain", "France", "United Kingdom", "Germany", "Portugal", "United States", "Singapore","South Korea", "Japan", "Brazil","Iran"] data_countries = [] data_countries_pc = [] # compute per habitant for i in countries: data_pc.loc[data_pc.location == i,"total_cases"] = data_pc.loc[data_pc.location == i,"total_cases"]/float(data_pop.loc[data_pop.country == i, "pop"]) # get each country time series filter1 = data_pc["total_cases"] > 1 for i in countries: filter_country = data_pc["location"]== i data_countries_pc.append(data_pc[filter_country & filter1]) # In[3]: #hide_input # Stack data to get it to Altair dataframe format data_countries_pc2 = data_countries_pc.copy() for i in range(0,len(countries)): data_countries_pc2[i] = data_countries_pc2[i].reset_index() data_countries_pc2[i]['n_days'] = data_countries_pc2[i].index data_countries_pc2[i]['log_cases'] = np.log(data_countries_pc2[i]["total_cases"]) data_plot = data_countries_pc2[0] for i in range(1, len(countries)): data_plot = pd.concat([data_plot, data_countries_pc2[i]], axis=0) data_plot["trend_2days"] = np.log(2)/2*data_plot["n_days"] data_plot["trend_4days"] = np.log(2)/4*data_plot["n_days"] data_plot["trend_12days"] = np.log(2)/12*data_plot["n_days"] data_plot["trend_2days_label"] = "Doubles every 2 days" data_plot["trend_4days_label"] = "Doubles evey 4 days" data_plot["trend_12days_label"] = "Doubles every 12 days" # Plot it using Altair source = data_plot scales = alt.selection_interval(bind='scales') selection = alt.selection_multi(fields=['location'], bind='legend') base = alt.Chart(source, title = "COVID-19 Deaths Per Million of Inhabitants").encode( x = alt.X('n_days:Q', title = "Days passed since reaching 1 death per million"), y = alt.Y("log_cases:Q",title = "Log of deaths per million"), color = alt.Color('location:N', legend=alt.Legend(title="Country", labelFontSize=15, titleFontSize=17), scale=alt.Scale(scheme='tableau20')), opacity = alt.condition(selection, alt.value(1), alt.value(0.1)) ) lines = base.mark_line().add_selection( scales ).add_selection( selection ).properties( width=chart_width, height=chart_height ) trend_2d = alt.Chart(source).encode( x = "n_days:Q", y = alt.Y("trend_2days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ).mark_line(color="grey", strokeDash=[3,3]) labels = pd.DataFrame([{'label': 'Doubles every 2 days', 'x_coord': 6, 'y_coord': 4}, {'label': 'Doubles every 4 days', 'x_coord': 16, 'y_coord': 3.5}, {'label': 'Doubles every 12 days', 'x_coord': 25, 'y_coord': 1.8}, ]) trend_label = (alt.Chart(labels) .mark_text(align='left', dx=-55, dy=-15, fontSize=12, color="grey") .encode(x='x_coord:Q', y='y_coord:Q', text='label:N') ) trend_4d = alt.Chart(source).mark_line(color="grey", strokeDash=[3,3]).encode( x = "n_days:Q", y = alt.Y("trend_4days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ) trend_12d = alt.Chart(source).mark_line(color="grey", strokeDash=[3,3]).encode( x = "n_days:Q", y = alt.Y("trend_12days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ) ( (trend_2d + trend_4d + trend_12d + trend_label + lines) .configure_title(fontSize=20) .configure_axis(labelFontSize=15,titleFontSize=18) ) # Last Available Total Deaths By Country: # In[4]: #hide_input label = 'Deaths' temp = pd.concat([x.copy() for x in data_countries_pc]).loc[lambda x: x.date >= '3/1/2020'] metric_name = f'{label} per Million' temp.columns = ['Country', 'date', metric_name] # temp.loc[:, 'month'] = temp.date.dt.strftime('%Y-%m') temp.loc[:, f'Log of {label} per Million'] = temp[f'{label} per Million'].apply(lambda x: np.log(x)) temp.groupby('Country').last() # In[5]: #hide # Get data and clean it data = pd.read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv", error_bad_lines=False) data = data.drop(columns=["Lat", "Long"]) data = data.melt(id_vars= ["Province/State", "Country/Region"]) data = pd.DataFrame(data.groupby(['Country/Region', "variable"]).sum()) data.reset_index(inplace=True) data = data.rename(columns={"Country/Region": "location", "variable": "date", "value": "total_cases"}) data['date'] =pd.to_datetime(data.date) data = data.sort_values(by = "date") data.loc[data.location == "US","location"] = "United States" data.loc[data.location == "Korea, South","location"] = "South Korea" # Population data (last year is 2017 which is what we use) data_pwt = pd.read_stata("https://www.rug.nl/ggdc/docs/pwt91.dta") filter1 = data_pwt["year"] == 2017 data_pop = data_pwt[filter1] data_pop = data_pop[["country","pop"]] data_pop.loc[data_pop.country == "Republic of Korea","country"] = "South Korea" data_pop.loc[data_pop.country == "Iran (Islamic Republic of)","country"] = "Iran" # per habitant data_pc = data.copy() # I can add more countries if needed countries = ["China", "Italy", "Spain", "France", "United Kingdom", "Germany", "Portugal", "United States", "Singapore","South Korea", "Japan", "Brazil","Iran"] data_countries = [] data_countries_pc = [] # compute per habitant for i in countries: data_pc.loc[data_pc.location == i,"total_cases"] = data_pc.loc[data_pc.location == i,"total_cases"]/float(data_pop.loc[data_pop.country == i, "pop"]) # get each country time series filter1 = data_pc["total_cases"] > 1 for i in countries: filter_country = data_pc["location"]== i data_countries_pc.append(data_pc[filter_country & filter1]) # ## Appendix # # > Warning: The following chart, "Cases Per Million of Habitants" is biased depending on how widely a country administers tests. Please read with caution. # ### Cases Per Million of Habitants # # In[6]: #hide_input # Stack data to get it to Altair dataframe format data_countries_pc2 = data_countries_pc.copy() for i in range(0,len(countries)): data_countries_pc2[i] = data_countries_pc2[i].reset_index() data_countries_pc2[i]['n_days'] = data_countries_pc2[i].index data_countries_pc2[i]['log_cases'] = np.log(data_countries_pc2[i]["total_cases"]) data_plot = data_countries_pc2[0] for i in range(1, len(countries)): data_plot = pd.concat([data_plot, data_countries_pc2[i]], axis=0) data_plot["trend_2days"] = np.log(2)/2*data_plot["n_days"] data_plot["trend_4days"] = np.log(2)/4*data_plot["n_days"] data_plot["trend_12days"] = np.log(2)/12*data_plot["n_days"] data_plot["trend_2days_label"] = "Doubles every 2 days" data_plot["trend_4days_label"] = "Doubles evey 4 days" data_plot["trend_12days_label"] = "Doubles every 12 days" # Plot it using Altair source = data_plot scales = alt.selection_interval(bind='scales') selection = alt.selection_multi(fields=['location'], bind='legend') base = alt.Chart(source, title = "COVID-19 Confirmed Cases Per Million of Inhabitants").encode( x = alt.X('n_days:Q', title = "Days passed since reaching 1 case per million"), y = alt.Y("log_cases:Q",title = "Log of confirmed cases per million"), color = alt.Color('location:N', legend=alt.Legend(title="Country", labelFontSize=15, titleFontSize=17), scale=alt.Scale(scheme='tableau20')), opacity = alt.condition(selection, alt.value(1), alt.value(0.1)) ).properties( width=chart_width, height=chart_height ) lines = base.mark_line().add_selection( scales ).add_selection( selection ) trend_2d = alt.Chart(source).encode( x = "n_days:Q", y = alt.Y("trend_2days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ).mark_line( strokeDash=[3,3], color="grey") labels = pd.DataFrame([{'label': 'Doubles every 2 days', 'x_coord': 10, 'y_coord': 6}, {'label': 'Doubles every 4 days', 'x_coord': 28, 'y_coord': 6}, {'label': 'Doubles every 12 days', 'x_coord': 45, 'y_coord': 3}, ]) trend_label = (alt.Chart(labels) .mark_text(align='left', dx=-55, dy=-15, fontSize=12, color="grey") .encode(x='x_coord:Q', y='y_coord:Q', text='label:N') ) trend_4d = alt.Chart(source).mark_line(color="grey", strokeDash=[3,3]).encode( x = "n_days:Q", y = alt.Y("trend_4days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ) trend_12d = alt.Chart(source).mark_line(color="grey", strokeDash=[3,3]).encode( x = "n_days:Q", y = alt.Y("trend_12days:Q", scale=alt.Scale(domain=(0, max(data_plot["log_cases"])))), ) ( (trend_2d + trend_4d + trend_12d + trend_label + lines) .configure_title(fontSize=20) .configure_axis(labelFontSize=15,titleFontSize=18) ) # Last Available Cases Per Million By Country: # In[7]: #hide_input label = 'Cases' temp = pd.concat([x.copy() for x in data_countries_pc]).loc[lambda x: x.date >= '3/1/2020'] metric_name = f'{label} per Million' temp.columns = ['Country', 'date', metric_name] # temp.loc[:, 'month'] = temp.date.dt.strftime('%Y-%m') temp.loc[:, f'Log of {label} per Million'] = temp[f'{label} per Million'].apply(lambda x: np.log(x)) temp.groupby('Country').last() # This analysis was conducted by [Joao B. Duarte](https://www.jbduarte.com). Assitance with creating visualizations were provided by [Hamel Husain](https://twitter.com/HamelHusain). Relevant sources are listed below: # # # 1. ["2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE"](https://systems.jhu.edu/research/public-health/ncov/) [GitHub repository](https://github.com/CSSEGISandData/COVID-19). # # 2. [Feenstra, Robert C., Robert Inklaar and Marcel P. Timmer (2015), "The Next Generation of the Penn World Table" American Economic Review, 105(10), 3150-3182](https://www.rug.nl/ggdc/productivity/pwt/related-research) # In[ ]:
35.910448
221
0.676725
1,791
12,030
4.379118
0.189838
0.032641
0.036721
0.030346
0.817927
0.804667
0.802882
0.774959
0.774959
0.774959
0
0.027849
0.155278
12,030
334
222
36.017964
0.743948
0.16808
0
0.797927
0
0.010363
0.266754
0.002717
0
0
0
0
0
1
0
false
0.010363
0.020725
0
0.020725
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
c5a90548b6e446ed6bcacd0a869781b03d1e7eac
89
py
Python
script.py
bernadinm/sha512
5c4918839d2d9715fff20bf8476a906fa4a8d798
[ "Apache-2.0" ]
2
2019-03-07T00:31:39.000Z
2019-03-22T15:55:37.000Z
script.py
bernadinm/sha512
5c4918839d2d9715fff20bf8476a906fa4a8d798
[ "Apache-2.0" ]
null
null
null
script.py
bernadinm/sha512
5c4918839d2d9715fff20bf8476a906fa4a8d798
[ "Apache-2.0" ]
null
null
null
from passlib.hash import sha512_crypt import sys print (sha512_crypt.hash(sys.argv[1]))
17.8
38
0.797753
15
89
4.6
0.666667
0.318841
0
0
0
0
0
0
0
0
0
0.0875
0.101124
89
4
39
22.25
0.775
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0.666667
0
0.666667
0.333333
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
c5b8a9c6dac6321ab367215edc2cc8d83138dd88
117
py
Python
scripts/learning/src/interfaces/__init__.py
wvat/NTRTsim
0443cbd542e12e23c04adf79ea0d8d003c428baa
[ "Apache-2.0" ]
148
2015-01-08T22:44:00.000Z
2022-03-19T18:42:48.000Z
scripts/learning/src/interfaces/__init__.py
wvat/NTRTsim
0443cbd542e12e23c04adf79ea0d8d003c428baa
[ "Apache-2.0" ]
107
2015-01-02T16:41:42.000Z
2021-06-14T22:09:19.000Z
scripts/learning/src/interfaces/__init__.py
wvat/NTRTsim
0443cbd542e12e23c04adf79ea0d8d003c428baa
[ "Apache-2.0" ]
86
2015-01-06T07:02:36.000Z
2022-02-28T17:36:14.000Z
from ntrt_job_master import NTRTJobMaster from ntrt_job import NTRTJob from ntrt_master_error import NTRTMasterError
29.25
45
0.897436
17
117
5.882353
0.529412
0.24
0.22
0
0
0
0
0
0
0
0
0
0.102564
117
3
46
39
0.952381
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
c5d1c71d4ed0b8e3b71d7182520d991acee5ed1a
122
py
Python
floris/tools/optimization/pyoptsparse/__init__.py
jialrs/floris-enhanced
66cdf1c9597aa3bb4f956cc9a0cb497312a690bf
[ "Apache-2.0" ]
null
null
null
floris/tools/optimization/pyoptsparse/__init__.py
jialrs/floris-enhanced
66cdf1c9597aa3bb4f956cc9a0cb497312a690bf
[ "Apache-2.0" ]
null
null
null
floris/tools/optimization/pyoptsparse/__init__.py
jialrs/floris-enhanced
66cdf1c9597aa3bb4f956cc9a0cb497312a690bf
[ "Apache-2.0" ]
null
null
null
from . import layout from . import optimization from . import power_density from . import power_density from . import yaw
20.333333
27
0.795082
17
122
5.588235
0.411765
0.526316
0.315789
0.463158
0.568421
0.568421
0
0
0
0
0
0
0.163934
122
5
28
24.4
0.931373
0
0
0.4
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
a86317bd6e6a950737edbaf388356c7146cbb65e
4,816
py
Python
tests/handling/indexing/test_index_population.py
pshchelo/kopf
a94648d18b3d0dc84e8d15caf1fcab7a84f7fdb8
[ "MIT" ]
null
null
null
tests/handling/indexing/test_index_population.py
pshchelo/kopf
a94648d18b3d0dc84e8d15caf1fcab7a84f7fdb8
[ "MIT" ]
null
null
null
tests/handling/indexing/test_index_population.py
pshchelo/kopf
a94648d18b3d0dc84e8d15caf1fcab7a84f7fdb8
[ "MIT" ]
null
null
null
import asyncio import logging import pytest from kopf._cogs.aiokits.aiotoggles import Toggle from kopf._cogs.structs.ephemera import Memo from kopf._core.actions.lifecycles import all_at_once from kopf._core.reactor.inventory import ResourceMemories from kopf._core.reactor.processing import process_resource_event EVENT_TYPES_WHEN_EXISTS = [None, 'ADDED', 'MODIFIED'] EVENT_TYPES_WHEN_GONE = ['DELETED'] EVENT_TYPES = EVENT_TYPES_WHEN_EXISTS + EVENT_TYPES_WHEN_GONE @pytest.mark.parametrize('event_type', EVENT_TYPES_WHEN_EXISTS) async def test_initially_stored( resource, settings, registry, indexers, index, caplog, event_type, handlers): caplog.set_level(logging.DEBUG) body = {'metadata': {'namespace': 'ns1', 'name': 'name1'}} handlers.index_mock.return_value = 123 await process_resource_event( lifecycle=all_at_once, registry=registry, settings=settings, resource=resource, indexers=indexers, memories=ResourceMemories(), memobase=Memo(), raw_event={'type': event_type, 'object': body}, event_queue=asyncio.Queue(), resource_indexed=Toggle(), # used! only to enable indexing. ) assert set(index) == {None} assert set(index[None]) == {123} @pytest.mark.usefixtures('indexed_123') @pytest.mark.parametrize('event_type', EVENT_TYPES_WHEN_EXISTS) async def test_overwritten( resource, settings, registry, indexers, index, caplog, event_type, handlers): caplog.set_level(logging.DEBUG) body = {'metadata': {'namespace': 'ns1', 'name': 'name1'}} handlers.index_mock.return_value = 456 await process_resource_event( lifecycle=all_at_once, registry=registry, settings=settings, resource=resource, indexers=indexers, memories=ResourceMemories(), memobase=Memo(), raw_event={'type': event_type, 'object': body}, event_queue=asyncio.Queue(), resource_indexed=Toggle(), # used! only to enable indexing. ) assert set(index) == {None} assert set(index[None]) == {456} @pytest.mark.usefixtures('indexed_123') @pytest.mark.parametrize('event_type', EVENT_TYPES_WHEN_EXISTS) async def test_preserved_on_logical_deletion( resource, settings, registry, indexers, index, caplog, event_type, handlers): caplog.set_level(logging.DEBUG) body = {'metadata': {'namespace': 'ns1', 'name': 'name1', 'deletionTimestamp': '...'}} handlers.index_mock.return_value = 456 await process_resource_event( lifecycle=all_at_once, registry=registry, settings=settings, resource=resource, indexers=indexers, memories=ResourceMemories(), memobase=Memo(), raw_event={'type': event_type, 'object': body}, event_queue=asyncio.Queue(), resource_indexed=Toggle(), # used! only to enable indexing. ) assert set(index) == {None} assert set(index[None]) == {456} @pytest.mark.usefixtures('indexed_123') @pytest.mark.parametrize('event_type', EVENT_TYPES_WHEN_GONE) async def test_removed_on_physical_deletion( resource, settings, registry, indexers, index, caplog, event_type, handlers): caplog.set_level(logging.DEBUG) body = {'metadata': {'namespace': 'ns1', 'name': 'name1'}} handlers.index_mock.return_value = 456 await process_resource_event( lifecycle=all_at_once, registry=registry, settings=settings, resource=resource, indexers=indexers, memories=ResourceMemories(), memobase=Memo(), raw_event={'type': event_type, 'object': body}, event_queue=asyncio.Queue(), resource_indexed=Toggle(), # used! only to enable indexing. ) assert set(index) == set() @pytest.mark.usefixtures('indexed_123') @pytest.mark.parametrize('event_type', EVENT_TYPES_WHEN_EXISTS) async def test_removed_on_filters_mismatch( resource, settings, registry, indexers, index, caplog, event_type, handlers, mocker): # Simulate the indexing handler is gone out of scope (this is only one of the ways to do it): mocker.patch.object(registry._indexing, 'get_handlers', return_value=[]) caplog.set_level(logging.DEBUG) body = {'metadata': {'namespace': 'ns1', 'name': 'name1'}} handlers.index_mock.return_value = 123 await process_resource_event( lifecycle=all_at_once, registry=registry, settings=settings, resource=resource, indexers=indexers, memories=ResourceMemories(), memobase=Memo(), raw_event={'type': event_type, 'object': body}, event_queue=asyncio.Queue(), resource_indexed=Toggle(), # used! only to enable indexing. ) assert set(index) == set()
36.484848
97
0.682309
552
4,816
5.728261
0.184783
0.056926
0.044276
0.037951
0.811195
0.801708
0.801708
0.801708
0.801708
0.782732
0
0.011917
0.198505
4,816
131
98
36.763359
0.807254
0.05108
0
0.765217
0
0
0.074732
0
0
0
0
0
0.069565
1
0
false
0
0.069565
0
0.069565
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
a86b6cb161b81ddc57b24ec2b7d236ef453a05d4
52,369
py
Python
LeetCode/contest-2018-11-4/three_equal_parts.py
Max-PJB/python-learning2
e8b05bef1574ee9abf8c90497e94ef20a7f4e3bd
[ "MIT" ]
null
null
null
LeetCode/contest-2018-11-4/three_equal_parts.py
Max-PJB/python-learning2
e8b05bef1574ee9abf8c90497e94ef20a7f4e3bd
[ "MIT" ]
null
null
null
LeetCode/contest-2018-11-4/three_equal_parts.py
Max-PJB/python-learning2
e8b05bef1574ee9abf8c90497e94ef20a7f4e3bd
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : pengj @ date : 2018/11/4 13:44 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : pengjianbiao@hotmail.com ------------------------------------------------- Description : 给定一个由 0 和 1 组成的数组 A,将数组分成 3 个非空的部分,使得所有这些部分表示相同的二进制值。 如果可以做到,请返回任何 [i, j],其中 i+1 < j,这样一来: A[0], A[1], ..., A[i] 组成第一部分; A[i+1], A[i+2], ..., A[j-1] 作为第二部分; A[j], A[j+1], ..., A[A.length - 1] 是第三部分。 这三个部分所表示的二进制值相等。 如果无法做到,就返回 [-1, -1]。 注意,在考虑每个部分所表示的二进制时,应当将其看作一个整体。例如,[1,1,0] 表示十进制中的 6,而不会是 3。此外,前导零也是被允许的,所以 [0,1,1] 和 [1,1] 表示相同的值。 示例 1: 输入:[1,0,1,0,1] 输出:[0,3] 示例 2: 输出:[1,1,0,1,1] 输出:[-1,-1] 提示: 3 <= A.length <= 30000 A[i] == 0 或 A[i] == 1 ------------------------------------------------- """ import time __author__ = 'Max_Pengjb' start = time.time() # 下面写上代码块 def three_equal_parts(A): step1 = del_front_of_0(A) n = len(step1[1]) if n == 0 and len(A) > 3: return [0, len(A) - 1] # print("step1:", step1) n1of3 = int(n / 3) # print(n1of3) # for i in range(1, n1of3 + 1): for i in range(n1of3, 0, -1): print(i, step1[1], step1[1][:i:], step1[1][-i::]) if step1[1][:i:] == step1[1][-i::]: x = stack_match(step1[1][:i:], step1[1][i:-i:]) if x: return [step1[0] + i - 1, step1[0] + i + x[0] + i] return False # 去除开头是 0 的数,没有意思,不对值构成影响 def del_front_of_0(ss): i = 0 while ss and i < len(ss) and ss[i] == 0: i += 1 return [i, ss[i::]] def stack_match(front_str, rest_str): # print("front_str", front_str, rest_str) step2 = del_front_of_0(rest_str) # print("step2:", step2, step2[1][:len(front_str):]) if front_str == step2[1][:len(front_str):]: step3 = del_front_of_0(step2[1][len(front_str)::]) # print("step3", step3, step3[1]) if not step3[1]: # print("front_str,step3[1]", front_str, step3[1]) return [step2[0]] return False # s_in2 = [1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,1,0,1,1,0,1,0,0,1,0,0,1,1,1,1,0,0,0,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,0,1,1,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,0,0,0,1,0,1,0,1,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,1,0,1,1,1,1,1,1,0,0,0,0,0,0,1,0,1,1,0,0,0,1,1,1,1,0,0,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,1,1,0,1,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,1,1,1,0,0,0,1,1,1,0,1,0,0,1,0,1,1,1,0,0,1,0,0,1,1,0,1,1,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,0,1,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,0,1,1,1,0,0,0,0,1,0,1,0,1,1,1,1,0,0,1,1,1,0,1,1,0,0,1,0,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,0,1,0,1,1,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0,1,1,1,1,0,1,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1,0,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1,1,1,0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,0,1,1,0,0,1,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,1,1,1,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,1,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,0,1,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,0,0,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1,1,1,0,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,1,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,0,0,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,1,1,0,0,1,0,0,1,0,0,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,1,1,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,1,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,1,0,0,0,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,1,1,1,0,1,1,1,1,1,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,0,1,0,1,0,0,1,0,1,1,0,0,1,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,0,1,1,0,1,1,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,0,1,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,1,0,0,0,1,0,0,1,1,1,0,0,0,1,0,1,0,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,0,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,1,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,0,1,1,1,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,0,0,1,1,1,0,1,1,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1,0,0,0,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,0,1,0,0,1,1,0,1,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,0,0,1,0,1,1,1,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1,0,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,1,1,1,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,0,1,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,0,0,0,0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,1,1,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,1,0,0,1,0,0,1,1,0,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,0,0,1,0,1,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,1,1,1,0,1,1,1,1,1,0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,1,1,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,1,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,1,1,1,0,0,0,1,0,0,1,1,0,0,0,1,1,1,1,0,0,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1,1,1,0,0,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,1,0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,0,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,0,0,1,1,1,1,1,1,0,0,1,0,0,1,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,1,1,0,1,0,1,1,0,1,0,0,0,1,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,0,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,0,1,0,1,0,0,1,1,1,0,0,0,1,0,0,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,1,0,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,0,1,0,1,0,1,1,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,1,0,1,1,0,1,0,0,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,0,0,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,0,1,0,1,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,1,1,1,0,0,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,0,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,1,0,0,0,0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,0,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,1,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,0,1,1,0,0,1,0,0,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,1,0,1,1,1,1,1,1,0,1,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,0,1,1,1,1,0,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0,0,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1,1,0,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,1,1,1,0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,0,0,0,1,0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,1,1,0,0,1,0,1,0,1,0,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,0,0,0,1,1,0,1,1,1,0,0,1,0,1,1,0,1,1,1,0,0,1,1,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0,1,1,1,0,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,1,0,1,0,0,1,0,0,1,0,1,0,1,1,1,0,1,0,0,0,0,1,0,1,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,1,1,1,0,0,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,0,1,0,0,0,1,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,0,1,1,1,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,1,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,1,0,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,1,0,0,1,0,1,0,1,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,1,1,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,0,1,1,0,1,0,0,1,1,1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,1,1,0,1,1,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,1,0,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,0,1,1,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,1,1,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,1,0,0,0,1,1,0,1,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,1,1,1,0,0,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,0,1,0,1,1,1,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,0,1,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,1,1,1,1,0,0,1,0,1,1,1,0,1,1,0,1,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,1,1,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,0,0,1,1,0,1,0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,1,1,0,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,1,0,1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,0,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,0,1,0,0,1,1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0,0,0,1,0,0,0,1,1,0,0,0,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,1,0,0,0,0,1,1,1,1,0,1,1,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,1,1,1,1,0,1,0,1,1,1,0,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,1,1,1,1,0,1,1,0,1,0,1,0,1,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,0,0,0,1,1,0,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,0,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,0,0,0,0,1,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1,1,1,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,1,0,1,1,1,0,1,0,1,0,1,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,0,1,1,0,1,1,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,1,1,1,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,0,0,1,0,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,0,1,1,1,0,1,1,1,0,0,1,1,1,0,1,0,1,1,0,1,0,1,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,1,0,1,0,0,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,0,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,1,1,1,1,1,1,0,0,1,0,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,1,0,0,1,0,1,1,1,1,1,0,1,0,1,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,1,1,1,0,1,1,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,0,0,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,0,1,0,1,1,0,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,1,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,1,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,1,0,0,1,1,0,0,1,1,0,0,0,1,1,1,0,0,1,0,1,1,1,0,0,1,0,1,0,1,0,0,1,1,1,0,1,0,1,1,1,0,0,0,0,1,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,0,0,1,1,1,0,0,1,1,0,1,1,1,0,0,0,1,1,1,0,0,1,1,1,0,1,0,1,1,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,1,0,1,1,0,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,0,1,0,0,1,1,0,0,0,1,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,1,1,1,0,1,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,1,1,0,1,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,0,1,0,1,1,0,1,0,0,0,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,0,1,0,1,0,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,0,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1,1,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,0,1,1,1,1,0,1,0,1,1,0,1,0,1,0,0,1,1,1,0,1,1,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,1,1,1,0,0,0,1,0,0,1,1,1,0,1,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0,0,1,1,1,1,1,0,1,0,0,1,0,1,0,0,1,1,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,1,1,1,0,1,0,0,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,0,0,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,0,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,0,0,1,1,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1,1,0,1,1,1,0,0,1,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,1,1,0,1,1,0,1,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,0,1,0,0,0,0,1,1,1,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,0,1,0,1,1,1,1,1,0,0,1,0,0,0,0,0,1,1,1,0,1,0,1,1,1,0,1,1,0,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,1,1,1,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,0,0,1,1,1,0,1,1,0,1,1,0,0,0,1,0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,0,1,1,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,1,1,1,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,1,1,0,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,0,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,0,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,0,0,1,1,1,0,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,0,1,0,1,0,0,0,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,1,0,1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,1,0,1,1,0,1,0,0,0,1,1,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,1,0,1,1,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1,0,0,1,0,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,0,1,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,0,1,1,0,0,0,1,0,0,1,1,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,1,0,1,0,0,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,1,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,1,0,0,1,0,0,1,1,0,1,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,1,1,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,1,1,1,1,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0,0,0,1,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,0,1,1,1,1,1,0,1,1,0,1,0,1,0,0,0,0,1,0,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,1,0,0,0,1,0,1,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,1,1,1,1,1,1,1,0,0,0,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1,0,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,0,0,0,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1,0,1,1,0,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,1,0,0,0,1,1,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,0,1,1,1,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0,0,0,1,1,1,0,1,0,1,1,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1,1,1,0,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,1,1,0,0,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,1,1,0,1,0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,0,1,0,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,1,1,1,1,0,0,1,0,0,0,1,1,1,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1,0,0,1,0,0,1,1,1,1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,1,1,1,1,0,1,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,1,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,0,1,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1,1,0,1,1,1,0,0,1,0,0,1,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,1,1,1,1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,0,0,1,0,1,0,1,0,0,0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0,1,0,0,0,0,1,0,0,1,1,1,1,1,1,0,1,1,0,0,1,0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,0,0,1,1,0,1,0,1,0,0,1,0,0,1,1,1,0,0,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,0,1,1,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,1,1,1,1,1,0,1,1,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,1,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,1,0,0,0,1,0,0,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,0,1,1,0,0,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,1,0,0,0,1,0,1,1,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,1,1,1,1,1,0,0,1,1,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,0,1,1,1,1,0,1,0,1,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,1,0,1,1,0,1,1,0,1,1,1,0,0,1,1,1,1,0,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0,1,0,0,1,1,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,1,0,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,0,1,0,0,0,1,1,1,0,1,1,1,1,0,1,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,1,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,1,0,1,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,1,1,1,1,0,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,1,0,1,1,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,1,0,0,1,0,1,1,1,0,0,1,1,0,1,1,0,0,0,1,0,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,1,1,0,1,1,0,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,1,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,1,1,0,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,0,1,0,0,1,1,0,1,1,1,1,1,1,0,0,0,1,0,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,1,1,0,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,1,1,1,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,1,1,0,1,0,1,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,0,0,1,1,1,0,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,0,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,1,0,1,1,1,0,0,1,1,1,1,0,1,1,0,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,1,0,1,1,1,1,1,0,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,0,1,0,0,1,0,1,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1,1,1,0,1,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,1,0,1,1,1,1,1,0,1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,1,0,1,1,0,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,0,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,1,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,1,0,0,0,0,1,0,1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,1,1,0,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,1,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,0,0,1,0,0,0,1,1,1,1,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,1,1,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1,1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,1,0,0,1,0,0,1,1,1,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,0,1,0,0,0,0,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,1,0,1,1,0,1,1,1,1,1,0,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,0,0,1,1,0,1,0,1,1,1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,1,1,0,0,1,0,0,0,1,1,1,0,1,1,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0,0,0,1,1,0,1,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,1,0,1,1,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,1,1,0,0,1,1,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,1,1,1,0,0,1,0,0,1,0,1,0,0,1,1,1,0,1,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,1,0,1,1,0,1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,1,1,1,1,0,0,1,0,1,1,0,1,1,0,1,1,0,0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,1,1,0,1,1,0,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,0,0,0,1,1,0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,0,1,0,0,0,1,1,1,0,1,0,0,1,1,1,0,0,1,0,1,1,0,1,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,1,0,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,1,0,0,0,0,1,0,1,0,1,1,0,1,0,0,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,0,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,1,1,1,1,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,0,0,1,1,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1,0,1,1,1,1,0,1,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0,0,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,1,0,0,0,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,0,0,1,0,0,0,1,1,0,1,0,0,0,1,1,1,0,1,1,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,0,1,1,0,0,0,1,1,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,1,1,1,1,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,0,0,1,1,1,0,1,1,0,0,1,1,0,0,1,0,0,0,1,1,1,1,1,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,1,0,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1,1,0,0,1,1,0,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,1,0,1,0,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,0,1,0,1,1,0,1,1,0,1,0,1,1,0,0,1,1,0,0,0,1,0,1,0,0,1,1,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,1,1,1,0,0,0,1,0,1,1,0,1,0,0,0,1,1,1,1,1,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,1,1,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,0,0,1,1,1,1,0,0,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,1,0,1,0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,0,1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,1,0,0,1,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,0,1,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1,1,0,0,1,1,1,1,1,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,1,1,0,1,0,1,0,0,0,1,1,1,1,1,1,0,0,1,1,0,1,0,0,1,0,0,1,1,0,1,0,1,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,1,1,1,1,1,0,0,1,0,0,1,0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,1,1,0,1,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,1,0,1,1,0,1,1,1,0,0,0,1,0,0,0,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,0,1,0,0,1,1,0,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,0,1,0,1,1,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,0,1,1,0,0,0,0,0,0,1,1,1,1,0,1,0,0,1,0,0,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,1,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,0,1,0,0,1,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1,0,1,0,0,1,1,1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,1,0,1,0,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,0,0,0,1,1,0,1,1,1,1,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0,1,0,1,0,1,1,0,1,1,0,1,0,1,0,1,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,1,1,0,1,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,0,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,1,0,0,1,1,0,1,0,1,1,1,0,1,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,1,1,1,0,0,1,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,1,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,1,0,0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0,0,1,0,1,1,0,1,1,0,1,1,1,0,1,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,1,0,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,1,0,0,0,0,1,0,0,0,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,1,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,0,0,1,1,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,1,1,1,0,0,1,0,0,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,1,1,1,1,0,1,1,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,1,0,0,1,1,0,0,1,0,1,1,1,1,1,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,0,0,0,1,1,1,1,1,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0,1,0,1,0,1,0,0,0,0,1,1,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0,0,1,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,1,1,1,0,0,1,1,0,0,0,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,1,1,0,1,0,1,1,0,0,0,1,0,0,0,0,1,1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,1,0,0,0,0,1,1,1,0,1,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,0,1,0,1,0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,1,1,0,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,1,1,0,1,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,0,1,0,1,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,0,1,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,0,0,1,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,0,1,1,1,0,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0,1,1,1,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,0,0,1,1,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,1,1,0,1,0,0,1,1,0,1,1,0,1,1,0,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,1,1,1,0,0,1,0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,1,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,0,0,1,1,1,0,0,1,0,0,1,0,1,0,0,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,0,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1,0,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,0,0,1,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,0,1,0,0,1,1,0,1,0,0,0,1,1,0,0,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,0,1,1,1,1,0,1,1,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,1,1,1,0,1,0,1,1,1,0,1,1,0,0,0,1,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,0,1,1,1,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,1,0,1,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,1,0,0,0,0,1,1,0,0,1,0,1,1,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,1,0,1,1,0,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,0,0,0,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,0,1,0,0,1,1,0,1,1,1,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,1,1,1,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,0,0,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,1,0,1,0,1,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,1,1,0,1,1,1,1,0,0,0,0,1,0,0,1,1,1,0,1,0,0,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,0,0,1,0,0,1,1,1,1,0,0,1,1,0,1,1,0,0,1,0,1,0,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,0,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,1,0,1,0,0,1,1,1,0,1,0,1,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,1,1,0,1,0,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,0,0,1,0,1,0,1,1,1,1,1,0,0,1,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,0,0,1,0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1,1,1,0,0,1,1,0,1,0,0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,0,1,1,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,1,0,0,1,1,1,0,0,1,1,0,1,0,0,0,1,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,0,1,0,1,0,1,0,0,1,0,0,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,0,1,1,0,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0,0,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1,0,1,1,0,0,0,1,0,0,1,1,1,0,1,1,0,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,0,1,1] s_in = [1,0,1,0,1,1] res = three_equal_parts(s_in) print(res) if res: print(s_in[0:res[0] + 1:], s_in[res[0] + 1:res[1]:], s_in[res[1]::]) # 上面中间写上代码块 end = time.time() print('Running time: %s Seconds' % (end - start))
523.69
50,009
0.499933
25,381
52,369
1.029904
0.004452
0.484392
0.364728
0.247284
0.96052
0.958187
0.95635
0.95635
0.95635
0.95635
0
0.485593
0.011247
52,369
99
50,010
528.979798
0.019235
0.977391
0
0.057143
0
0
0.02921
0
0
0
0
0
0
1
0.085714
false
0
0.028571
0
0.285714
0.114286
0
0
1
null
1
1
1
1
1
1
1
1
1
0
1
0
0
0
1
1
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
15
a889fd2af57298712860b0885fc5011bbbd1e4f5
4,566
py
Python
auctionDetailApi/mysql.py
wd18535470628/PythonCraw
9be3519da1219ad4ffc0d26cc97ceabcb0a7c06b
[ "Apache-2.0" ]
null
null
null
auctionDetailApi/mysql.py
wd18535470628/PythonCraw
9be3519da1219ad4ffc0d26cc97ceabcb0a7c06b
[ "Apache-2.0" ]
null
null
null
auctionDetailApi/mysql.py
wd18535470628/PythonCraw
9be3519da1219ad4ffc0d26cc97ceabcb0a7c06b
[ "Apache-2.0" ]
null
null
null
#coding=utf-8 import MySQLdb import time class Mysql: # 数据库初始化 def __init__(self): try: self.db = MySQLdb.connect('192.168.1.189', 'root', '123456', 'jd_crawler') self.cur = self.db.cursor() except MySQLdb.Error, e: print self.getCurrentTime(), "连接数据库错误,原因%d: %s" % (e.args[0], e.args[1]) def getCurrentTime(self): return time.strftime('[%Y-%m-%d %H:%M:%S]', time.localtime(time.time())) def insertTbData(self,cache_table,table, my_dict): try: self.db.set_character_set('utf8') sqlCount = 'select count(*) from '+cache_table+' where auctionId='+ my_dict['auction_id'] self.cur.execute(sqlCount) count_id = self.cur._rows[0][0] if count_id == 0: sqlAche = 'insert into ' + cache_table + ' ( auctionId) value (' + my_dict['auction_id'] + ')' sqlInfo = 'INSERT INTO ' + table +' (' + ', '.join(my_dict.keys()) + ') value ("'+ '"," '.join(my_dict.values()) +'")' print sqlInfo try: self.cur.execute(sqlAche) result = self.cur.execute(sqlInfo) insert_id = self.db.insert_id() self.db.commit() # 判断是否执行成功 if result: return insert_id else: return 0 except MySQLdb.Error, e: # 发生错误时回滚 self.db.rollback() # 主键唯一,无法插入 if "key 'PRIMARY'" in e.args[1]: print self.getCurrentTime(), "数据已存在,未插入数据" else: print self.getCurrentTime(), "插入数据失败,原因 %d: %s" % (e.args[0], e.args[1]) else: sqlUpdate = 'update %s set '%(table) for col in my_dict.keys(): sqlUpdate = sqlUpdate + col + '="' + my_dict[col] + '",' sqlUpdate = sqlUpdate[:-1] + 'where auction_id = ' + my_dict['auction_id'] print sqlUpdate result = self.cur.execute(sqlUpdate) insert_id = self.db.insert_id() self.db.commit() # 判断是否执行成功 if result: return insert_id else: return 0 except MySQLdb.Error, e: print self.getCurrentTime(), "数据库错误,原因%d: %s" % (e.args[0], e.args[1]) def insertJdData(self,cache_table,table, my_dict): try: self.db.set_character_set('utf8') sqlCount = 'select count(*) from '+cache_table+' where auction_id='+ my_dict['id'] self.cur.execute(sqlCount) count_id = self.cur._rows[0][0] if count_id == 0: sqlAche = 'insert into ' + cache_table + ' ( auction_id) value (' + my_dict['id'] + ')' sqlInfo = 'INSERT INTO ' + table +' (' + ', '.join(my_dict.keys()) + ') value ('+ ','.join(my_dict.values()) +')' print sqlInfo try: self.cur.execute(sqlAche) result = self.cur.execute(sqlInfo) insert_id = self.db.insert_id() self.db.commit() # 判断是否执行成功 if result: return insert_id else: return 0 except MySQLdb.Error, e: # 发生错误时回滚 self.db.rollback() # 主键唯一,无法插入 if "key 'PRIMARY'" in e.args[1]: print self.getCurrentTime(), "数据已存在,未插入数据" else: print self.getCurrentTime(), "插入数据失败,原因 %d: %s" % (e.args[0], e.args[1]) else: sqlUpdate = 'update %s set '%(table) for col in my_dict.keys(): sqlUpdate = sqlUpdate + col + '="' + my_dict[col] + '",' sqlUpdate = sqlUpdate[:-1] + ' where id = ' + my_dict['id'] print sqlUpdate result = self.cur.execute(sqlUpdate) insert_id = self.db.insert_id() self.db.commit() # 判断是否执行成功 if result: return insert_id else: return 0 except MySQLdb.Error, e: print self.getCurrentTime(), "数据库错误,原因%d: %s" % (e.args[0], e.args[1])
44.764706
135
0.452256
466
4,566
4.313305
0.190987
0.047761
0.055721
0.055721
0.844776
0.829851
0.829851
0.808955
0.808955
0.808955
0
0.016233
0.419842
4,566
102
136
44.764706
0.742544
0.01993
0
0.791209
0
0
0.110166
0
0.021978
0
0
0
0
0
null
null
0
0.021978
null
null
0.120879
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
a89308be7e26ed889006bb918d1f241d6f14a52b
4,295
py
Python
src/iterator.py
fstrub95/bpi_continuous
889fd08675ec4e448a0c9d80466a08faeedf3db0
[ "Apache-2.0" ]
null
null
null
src/iterator.py
fstrub95/bpi_continuous
889fd08675ec4e448a0c9d80466a08faeedf3db0
[ "Apache-2.0" ]
null
null
null
src/iterator.py
fstrub95/bpi_continuous
889fd08675ec4e448a0c9d80466a08faeedf3db0
[ "Apache-2.0" ]
null
null
null
import numpy as np try: from itertools import izip except ImportError: #python3.x izip = zip from collections import namedtuple MiniBatch = namedtuple('MiniBatch', ['state', 'next_state', 'action', 'reward']) class Dataset(object): def __init__(self, samples): self.samples = samples self.state_size = len(samples[0].state) self.action_size = len(samples[0].action) self.no_samples = len(self.samples) self.state=np.zeros((self.no_samples, self.state_size)) self.next_state=np.zeros((self.no_samples, self.state_size)) self.action=np.zeros((self.no_samples, self.action_size)) self.reward=np.zeros(self.no_samples) for i, sample in enumerate(self.samples): self.state[i] = sample.state self.next_state[i] = sample.next_state self.action[i] = sample.action self.reward[i] = sample.reward self.__shuffle__() self.epoch_completed = 0 self.index_epoch_completed = 0 def __shuffle__(self): # inplace permutation permute = np.arange(self.no_samples) np.random.shuffle(permute) # shuffle data self.state = self.state[permute] self.action = self.action[permute] self.next_state = self.next_state[permute] self.reward = self.reward[permute] def next_batch(self, size_batch, shuffle = True): # return a minibatch of size sizeBatch start = self.index_epoch_completed self.index_epoch_completed = self.index_epoch_completed + size_batch #when all the samples are used, restart and shuffle if self.index_epoch_completed > self.no_samples: self.epoch_completed +=1 #reset indices start = 0 self.index_epoch_completed = size_batch assert size_batch <= self.no_samples if shuffle: self.__shuffle__() end = self.index_epoch_completed return { "state":self.state[start:end], "next_state":self.next_state[start:end], "action":self.action[start:end], "reward":self.reward[start:end] } class DatasetPretrained(object): def __init__(self, samples): self.samples = samples self.state_size = len(samples[0].state) self.action_size = len(samples[0].action) self.no_samples = len(self.samples) self.state = np.zeros((self.no_samples, self.state_size)) self.next_state = np.zeros((self.no_samples, self.state_size)) self.action = np.zeros((self.no_samples, self.action_size)) self.reward = np.zeros(self.no_samples) for i, sample in enumerate(self.samples): self.state[i] = sample.state self.next_state[i] = sample.next_state self.action[i] = sample.action self.reward[i] = sample.reward self.__shuffle__() self.epoch_completed = 0 self.index_epoch_completed = 0 def __shuffle__(self): # inplace permutation permute = np.arange(self.no_samples) np.random.shuffle(permute) # shuffle data self.state = self.state[permute] self.action = self.action[permute] self.next_state = self.next_state[permute] self.reward = self.reward[permute] def next_batch(self, size_batch, shuffle=True): # return a minibatch of size sizeBatch start = self.index_epoch_completed self.index_epoch_completed = self.index_epoch_completed + size_batch # when all the samples are used, restart and shuffle if self.index_epoch_completed > self.no_samples: self.epoch_completed += 1 # reset indices start = 0 self.index_epoch_completed = size_batch assert size_batch <= self.no_samples if shuffle: self.__shuffle__() end = self.index_epoch_completed return { "state": self.state[start:end], "policy_pretrain_target": self.action[start:end], "next_state": self.next_state[start:end], "action": self.action[start:end], "reward": self.reward[start:end] }
31.123188
80
0.619092
524
4,295
4.851145
0.135496
0.099135
0.081825
0.126672
0.912667
0.912667
0.912667
0.912667
0.912667
0.912667
0
0.004211
0.281257
4,295
138
81
31.123188
0.819242
0.064494
0
0.869565
0
0
0.027944
0.005489
0
0
0
0
0.021739
1
0.065217
false
0
0.043478
0
0.152174
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
a8af26f7d06a3c253d71a4aa2d73edd41f699eb1
9,113
py
Python
appAlunos/views.py
ValerioMedeiros/SCEFA
9028b575f8813e309c01061f0c1f58776e225ae7
[ "MIT" ]
null
null
null
appAlunos/views.py
ValerioMedeiros/SCEFA
9028b575f8813e309c01061f0c1f58776e225ae7
[ "MIT" ]
4
2018-10-23T21:41:11.000Z
2019-02-16T16:34:39.000Z
appAlunos/views.py
ValerioMedeiros/SCEFA
9028b575f8813e309c01061f0c1f58776e225ae7
[ "MIT" ]
3
2019-01-20T01:34:41.000Z
2019-10-21T20:32:46.000Z
from django.contrib.auth.decorators import permission_required, login_required from django.contrib.auth.models import Group from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.shortcuts import render, redirect from appAlunos.forms import AlunoForm from appAlunos.models import * from appPonto.models import * @permission_required('appAlunos.add_aluno', login_url='erro_permissao') def aluno_new(request): if request.method == 'POST': form = AlunoForm(request.POST) if form.is_valid(): aluno = form.save() if request.FILES.get('foto'): aluno.foto = request.FILES['foto'] aluno.username = aluno.matricula aluno.first_name = aluno.nome if request.POST.get('senha'): aluno.set_password(request.POST['senha']) grupoAluno = Group.objects.get(name='Aluno') grupoAluno.user_set.add(aluno) aluno.save() return redirect('aluno_list') else: form = AlunoForm dados = {'form': form} return render(request, 'Aluno/aluno_form.html', dados) @permission_required('appAlunos.view_aluno', login_url='erro_permissao') def aluno_detail(request, pk): try: aluno = Aluno.objects.get(id=pk) return render(request, 'Aluno/exibirAluno.html', {'aluno': aluno}) except Aluno: mensagem = { 'mensagem': 'O Aluno não existe'} return render(request, 'utils/pagina_erro.html', mensagem) @permission_required('appAlunos.view_aluno', login_url='erro_permissao') def aluno_list(request): criterio = request.GET.get('criterio') if criterio: alunos = Aluno.objects.filter(nome__icontains=criterio).order_by('nome') else: alunos = Aluno.objects.all().order_by('nome') criterio = '' paginator = Paginator(alunos, 8) page = request.GET.get('page') try: alunos = paginator.page(page) except PageNotAnInteger: alunos = paginator.page(1) except EmptyPage: alunos = paginator.page(paginator.num_pages) dados = {'alunos': alunos, 'criterio': criterio, 'paginator': paginator, 'page_obj': alunos} return render(request, 'Aluno/alunos_list.html', dados) @permission_required('appAlunos.delete_aluno', login_url='erro_permissao') def aluno_delete(request, pk): try: aluno = Aluno.objects.get(id=pk) aluno.delete() return redirect('aluno_list') except Exception: mensagem ={'mensagem':'Não é possível excluir aluno, excluir o aluno selecionado exigiria excluir as frequências registradas'} return render(request,'utils/pagina_erro.html',mensagem) @permission_required('appAlunos.change_aluno', login_url='erro_permissao') def aluno_update(request,pk): try: aluno = Aluno.objects.get(id=pk) except Exception: mensagem = { 'mensagem': 'O Aluno não existe'} return render(request, 'utils/pagina_erro.html', mensagem) if request.method == "POST": form = AlunoForm(request.POST, instance=aluno) if form.is_valid(): aluno = form.save(commit=False) if request.FILES.get('foto'): aluno.foto = request.FILES['foto'] aluno.username = aluno.matricula aluno.first_name = aluno.nome if request.POST.get('senha'): aluno.set_password(request.POST['senha']) aluno.save() return redirect('aluno_list') else: form = AlunoForm(instance=aluno) dados = {'form': form, 'aluno': aluno} return render(request, 'Aluno/aluno_form.html', dados) @permission_required('appPonto.view_frequencia',login_url='erro_permissao') def aluno_frequencia(request): if request.method == 'POST': if "frequencia_id" in request.POST: id_frequencia = int(request.POST['frequencia_id']) frequencia = Frequencia.objects.get(pk=id_frequencia) frequencia.observacao = request.POST['observacao'] if request.FILES.get('arquivo'): frequencia.arquivo = request.FILES['arquivo'] frequencia.save() id_aluno = request.user.id try: aluno = Aluno.objects.get(id=id_aluno) except Aluno.DoesNotExist: return render(request, 'utils/permissao.html') data_inicial = request.GET.get('data_inicial') data_final = request.GET.get('data_final') if Frequencia.validarData(data_inicial) and Frequencia.validarData(data_final): data_inicial_formatada = datetime.datetime.strptime(data_inicial, "%d/%m/%Y").strftime("%Y-%m-%d") data_final_formatada = datetime.datetime.strptime(data_final, "%d/%m/%Y").strftime("%Y-%m-%d") frequencias = Frequencia.frequencias(data_inicial_formatada, data_final_formatada, aluno) dias_aulas = Frequencia.quantidadePresenca(frequencias) dias_nao_aulas = Frequencia.quantidadeFaltas(frequencias) horas_total = Frequencia.tempoTotal(frequencias) dias_abontados = Frequencia.dia_abonados(frequencias) dados = {'frequencias': frequencias, 'aluno': aluno, 'data_inicial': data_inicial, 'data_final': data_final, 'dias_aulas': dias_aulas, 'dias_nao_aulas': dias_nao_aulas, 'horas_total': horas_total,'dias_abontados':dias_abontados} return render(request, 'Frequencia/exibir_frequencia_aluno.html', dados) else: dados = {'data': 'Data inválida'} return render(request, 'Frequencia/busca_frequencia.html', dados) @permission_required('appPonto.view_frequencia',login_url='erro_permissao') def aluno_frequencias(request,pk): if request.method == 'POST': if "id_frequencia" in request.POST: id_frequencia = int(request.POST['id_frequencia']) frequencia = Frequencia.objects.get(pk=id_frequencia) frequencia.inconsistencia = False frequencia.save() if "frequencia_id" in request.POST: id_frequencia = int(request.POST['frequencia_id']) frequencia = Frequencia.objects.get(pk=id_frequencia) frequencia.observacao = request.POST['observacao'] if request.FILES.get('arquivo'): frequencia.arquivo = request.FILES['arquivo'] frequencia.save() try: aluno = Aluno.objects.get(id=pk) except Exception: mensagem = { 'mensagem': 'Aluno não existe'} return render(request, 'utils/pagina_erro.html', mensagem) data_inicial = request.GET.get('data_inicial') data_final = request.GET.get('data_final') if Frequencia.validarData(data_inicial) and Frequencia.validarData(data_final): data_inicial_formatada = datetime.datetime.strptime(data_inicial, "%d/%m/%Y").strftime("%Y-%m-%d") data_final_formatada = datetime.datetime.strptime(data_final, "%d/%m/%Y").strftime("%Y-%m-%d") frequencias = Frequencia.frequencias(data_inicial_formatada, data_final_formatada, aluno) dias_aulas = Frequencia.quantidadePresenca(frequencias) dias_nao_aulas = Frequencia.quantidadeFaltas(frequencias) horas_total = Frequencia.tempoTotal(frequencias) dias_abontados = Frequencia.dia_abonados(frequencias) dados = {'frequencias': frequencias, 'aluno': aluno, 'data_inicial': data_inicial, 'data_final': data_final, 'dias_aulas': dias_aulas, 'dias_nao_aulas': dias_nao_aulas, 'horas_total': horas_total,'dias_abontados':dias_abontados} return render(request, 'Frequencia/exibir_frequencia_aluno_admin.html', dados) else: return render(request, 'utils/permissao.html') @permission_required('appAlunos.view_aluno', login_url='erro_permissao') def alunos(request): criterio = request.GET.get('criterio') if criterio: alunos = Aluno.objects.filter(nome__icontains=criterio).order_by('nome') else: alunos = Aluno.objects.all().order_by('nome') criterio ="" paginator = Paginator(alunos, 8) page = request.GET.get('page') try: alunos = paginator.page(page) except PageNotAnInteger: alunos=paginator.page(1) except EmptyPage: alunos = paginator.page(paginator.num_pages) dados={'alunos':alunos,'criterio':criterio,'paginator':paginator,'page_obj':alunos} return render(request, 'Frequencia/alunos.html', dados) @permission_required('appPonto.view_frequencia', login_url='erro_permissao') def busca_frequencia_aluno(request, pk): try: aluno = Aluno.objects.get(id=pk) return render(request, 'Frequencia/busca_frequencia_aluno.html', {'aluno': aluno}) except Aluno.DoesNotExist: mensagem = { 'mensagem': 'O Aluno não existe'} return render(request, 'utils/pagina_erro.html', mensagem) @login_required(login_url='login') def perfil_aluno(request): try: id_aluno = request.user.id aluno = Aluno.objects.get(id=id_aluno) return render(request, 'Perfil/perfil_aluno.html', {'aluno': aluno}) except Aluno.DoesNotExist: return render(request, 'utils/permissao.html', )
46.258883
134
0.677274
1,049
9,113
5.714967
0.126787
0.03603
0.057048
0.031526
0.844204
0.818349
0.800167
0.756297
0.726439
0.702585
0
0.000549
0.201141
9,113
196
135
46.494898
0.82294
0
0
0.709677
0
0
0.179414
0.056183
0
0
0
0
0
1
0.053763
false
0.010753
0.037634
0
0.204301
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
7698551989a9816ef4d61dec6da1497bdad7d3cb
13,445
py
Python
bin/tests/sensors_test.py
shutingrz/sensorUI
dc08c5fdf67b7b41833c29dc94f7ecb8b5fded8c
[ "MIT" ]
null
null
null
bin/tests/sensors_test.py
shutingrz/sensorUI
dc08c5fdf67b7b41833c29dc94f7ecb8b5fded8c
[ "MIT" ]
null
null
null
bin/tests/sensors_test.py
shutingrz/sensorUI
dc08c5fdf67b7b41833c29dc94f7ecb8b5fded8c
[ "MIT" ]
null
null
null
import unittest import json import tempfile import time import app as sensors_app from app import db # データベースの準備 tempDB = tempfile.mkstemp() tempDBPath = tempDB[1] dburl = "sqlite:///" + tempDBPath app = sensors_app.create_app(dburl) db.init_db(app) with app.app_context(): db.create_all() class TestUserControl(unittest.TestCase): def setUp(self): self.app = app.test_client() def test_health(self): rv = self.app.get("/api/") self.assertIn(b"Sensors", rv.data) def test_user_isexist(self): testuser = {"name": "test_user_isexist", "password": "testtest"} rv = self.app.get("/api/user/%s/isexist" % testuser["name"]) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") def test_user_register(self): testuser = {"name": "test_user_register", "password": "testtest"} # register rv = self.app.get("/api/register/user", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # isexist rv = self.app.get("/api/user/%s/isexist" % testuser["name"]) json_data = rv.get_json() self.assertTrue(json_data["response"]) def test_admin_user_delete(self): testuser = {"name": "test_admin_user_delete", "password": "testtest"} # register rv = self.app.get("/api/register/user", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # isexist rv = self.app.get("/api/user/%s/isexist" % testuser["name"]) json_data = rv.get_json() self.assertTrue(json_data["response"]) # delete rv = self.app.get("/api/admin/user/delete/%s" % testuser["name"]) json_data = rv.get_json() # isexist rv = self.app.get("/api/user/%s/isexist" % testuser["name"]) json_data = rv.get_json() self.assertFalse(json_data["response"]) def test_user_login(self): testuser = {"name": "test_user_login", "password": "testtest"} # register rv = self.app.get("/api/register/user", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # login rv = self.app.get("/api/login", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") def test_auth_test(self): testuser = {"name": "test_auth_test", "password": "testtest"} # access login required page without session rv = self.app.get("/api/devices") self.assertEqual(rv.status_code, 401) # register rv = self.app.get("/api/register/user", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # login rv = self.app.get("/api/login", query_string=dict( username=testuser["name"], password=testuser["password"] )) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") session = rv.headers["Set-Cookie"] self.assertIn("session", session) # access login required page with session rv = self.app.get("/api/devices", headers={"Cookie": session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") class TestAccountControl(unittest.TestCase): testuser = {"name": "test_account_control", "password": "testtest"} def setUp(self): pass @classmethod def setUpClass(cls): cls.app = app.test_client() # register rv = cls.app.get("/api/register/user", query_string=dict( username=cls.testuser["name"], password=cls.testuser["password"] )) json_data = rv.get_json() assert json_data["header"]["status"] == "success" # login rv = cls.app.get("/api/login", query_string=dict( username=cls.testuser["name"], password=cls.testuser["password"] )) json_data = rv.get_json() assert json_data["header"]["status"] == "success" cls.session = rv.headers["Set-Cookie"] def test_device_register(self): testdevice = {"device_name": "testdev", "sensor_type": "1"} rv = self.app.get("/api/register-device", headers={"Cookie": self.session}, query_string=dict( device_name=testdevice["device_name"], sensor_type=testdevice["sensor_type"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # get device list rv = self.app.get("/api/devices", headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") def test_temperature_view(self): testdevice = {"device_name": "testdev2", "sensor_type": "1"} # device register rv = self.app.get("/api/register-device", headers={"Cookie": self.session}, query_string=dict( device_name=testdevice["device_name"], sensor_type=testdevice["sensor_type"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") device_id = json_data["response"]["device_id"] self.assertIsNotNone(device_id) # device view rv = self.app.get("/api/device/temperature/%s" % device_id, headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") def test_temperature_record(self): from datetime import datetime testdevice = {"device_name": "testdev3", "sensor_type": "1"} # create testdata test_records = [] now = datetime.now() basetime = int(now.timestamp()) for i in range(0, 101): # prepare 101 records record = { "time": basetime - i*60, "value": str(20) } test_records.append(record) # device register rv = self.app.get("/api/register-device", headers={"Cookie": self.session}, query_string=dict( device_name=testdevice["device_name"], sensor_type=testdevice["sensor_type"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") api_key = json_data["response"]["api_key"] device_id = json_data["response"]["device_id"] self.assertIsNotNone(api_key) self.assertIsNotNone(device_id) # temperature record for record in test_records: rv = self.app.get("/api/record/temperature", query_string=dict( api_key=api_key, time=record["time"], value=record["value"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # device view rv = self.app.get("/api/device/temperature/%s" % device_id, headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # max 100 records check res_records = json_data["response"] self.assertLess(len(res_records), 101) def test_temperature_record_delete(self): from datetime import datetime testdevice = {"device_name": "testdev4", "sensor_type": "1"} # create testdata test_records = [] now = datetime.now() basetime = int(now.timestamp()) for i in range(0, 10): # prepare 10 records record = { "time": basetime - i*60, "value": str(20) } test_records.append(record) # device register rv = self.app.get("/api/register-device", headers={"Cookie": self.session}, query_string=dict( device_name=testdevice["device_name"], sensor_type=testdevice["sensor_type"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") api_key = json_data["response"]["api_key"] device_id = json_data["response"]["device_id"] self.assertIsNotNone(api_key) self.assertIsNotNone(device_id) # temperature record for record in test_records: rv = self.app.get("/api/record/temperature", query_string=dict( api_key=api_key, time=record["time"], value=record["value"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # device view rv = self.app.get("/api/device/temperature/%s" % device_id, headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # record exist check res_records = json_data["response"] self.assertGreater(len(res_records), 0) # record delete rv = self.app.get("/api/delete-record/temperature/all", query_string=dict( device_id = device_id ), headers={"Cookie": self.session} ) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # record exist check # device view rv = self.app.get("/api/device/temperature/%s" % device_id, headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # record exist check res_records = json_data["response"] self.assertEqual(len(res_records), 0) def test_device_delete(self): testdevice = {"device_name": "testdev5", "sensor_type": "1"} rv = self.app.get("/api/register-device", headers={"Cookie": self.session}, query_string=dict( device_name=testdevice["device_name"], sensor_type=testdevice["sensor_type"] )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") device_id = json_data["response"]["device_id"] # get device list rv = self.app.get("/api/devices", headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") devices = json_data["response"] isExist = False for device in devices: if device_id in device["device_id"]: isExist = True self.assertTrue(isExist) # delete device rv = self.app.get("/api/delete-device", headers={"Cookie": self.session}, query_string=dict( device_id = device_id )) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") # get device list rv = self.app.get("/api/devices", headers={"Cookie": self.session}) self.assertEqual(rv.status_code, 200) json_data = rv.get_json() self.assertEqual(json_data["header"]["status"], "success") devices = json_data["response"] isExist = False for device in devices: if device_id in device["device_id"]: isExist = True self.assertFalse(isExist) if __name__ == '__main__': unittest.main()
31.413551
78
0.561696
1,459
13,445
4.996573
0.087731
0.076818
0.039506
0.049383
0.835802
0.808093
0.798628
0.779424
0.758985
0.746502
0
0.009801
0.301822
13,445
427
79
31.487119
0.766805
0.04061
0
0.743682
0
0
0.159397
0.017961
0
0
0
0
0.212996
1
0.050542
false
0.054152
0.028881
0
0.090253
0
0
0
0
null
0
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
8
4f268bd275e8e908e8a8a2bf6b730ceda9627f62
3,270
py
Python
tests/test_find_element_by_image.py
cle-b/niobium
b18e555e539cee5080ae00dbb1706f268d5eb4de
[ "Apache-2.0" ]
1
2020-09-18T13:36:40.000Z
2020-09-18T13:36:40.000Z
tests/test_find_element_by_image.py
cle-b/niobium
b18e555e539cee5080ae00dbb1706f268d5eb4de
[ "Apache-2.0" ]
1
2019-07-30T21:09:33.000Z
2019-07-30T21:09:33.000Z
tests/test_find_element_by_image.py
cle-b/niobium
b18e555e539cee5080ae00dbb1706f268d5eb4de
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- from urllib.parse import urljoin import pytest from selenium.common.exceptions import NoSuchElementException def test_find_element_by_image_no_element(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) with pytest.raises(NoSuchElementException): selenium.find_element_by_image("tests/html/browser0.png") def test_find_element_by_image_one_element(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) selenium.find_element_by_image("tests/html/browser_edge.png") def test_find_element_by_image_three_elements(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) selenium.find_element_by_image("tests/html/browser_firefox.png") def test_find_element_by_image_one_element_click(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) element = selenium.find_element_by_image("tests/html/browser_edge.png") element.click() assert ( selenium.find_element_by_id("message").text == "edge1" ), "click on element failed" def test_find_element_by_image_one_element_click_at(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) element = selenium.find_element_by_image("tests/html/browser_edge.png") element.click_at(-100, 200) assert ( selenium.find_element_by_id("message").text == "firefox2" ), "click on element failed" def test_find_element_by_image_one_element_move_to(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) element = selenium.find_element_by_image("tests/html/browser_edge.png") element.move_to() assert ( selenium.find_element_by_id("message").text == "overedge1" ), "click on element failed" def test_find_element_by_image_one_element_move_at(selenium, website): selenium.get(urljoin(website, "/browsers.htm")) element = selenium.find_element_by_image("tests/html/browser_edge.png") element.move_at(200, 200) assert ( selenium.find_element_by_id("message").text == "overchrome2" ), "click on element failed" def test_find_element_by_image_one_element_need_wait(selenium, website): selenium.get(urljoin(website, "/browsers_delay.htm")) with pytest.raises(NoSuchElementException): selenium.find_element_by_image("tests/html/browser_edge.png") def test_find_element_by_image_one_element_with_wait(selenium, website): selenium.implicitly_wait(6) selenium.get(urljoin(website, "/browsers_delay.htm")) selenium.find_element_by_image("tests/html/browser_edge.png") def test_find_element_by_image_click_need_scroll(selenium, website): selenium.get(urljoin(website, "/browsers_scroll.htm")) with pytest.raises(NoSuchElementException): selenium.find_element_by_image("tests/html/browser_edge.png") def test_find_element_by_image_click_with_scroll(selenium, website): selenium.get(urljoin(website, "/browsers_scroll.htm")) img_browsers = selenium.find_element_by_id("browsers") selenium.execute_script("arguments[0].scrollIntoView();", img_browsers) selenium.find_element_by_image("tests/html/browser_edge.png").click() assert ( selenium.find_element_by_id("message").text == "edge1" ), "click on element failed"
38.023256
75
0.760245
435
3,270
5.367816
0.147126
0.131906
0.155889
0.169593
0.874518
0.873662
0.84454
0.805567
0.788437
0.686938
0
0.007317
0.122324
3,270
85
76
38.470588
0.806272
0.006422
0
0.557377
0
0
0.212812
0.1004
0
0
0
0
0.081967
1
0.180328
false
0
0.04918
0
0.229508
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
4f286d1963050319e604b9b384ce213f3efd56e5
976
py
Python
databases/seeds/blog_table_seeder.py
raymondmorris/masonite-blog-backend
d5875d3f108dda2cf423de5a555c5580e9f87d0e
[ "MIT" ]
null
null
null
databases/seeds/blog_table_seeder.py
raymondmorris/masonite-blog-backend
d5875d3f108dda2cf423de5a555c5580e9f87d0e
[ "MIT" ]
null
null
null
databases/seeds/blog_table_seeder.py
raymondmorris/masonite-blog-backend
d5875d3f108dda2cf423de5a555c5580e9f87d0e
[ "MIT" ]
null
null
null
"""BlogTableSeeder Seeder.""" from masoniteorm.seeds import Seeder from app.Blog import Blog class BlogTableSeeder(Seeder): def run(self): Blog.create({"title": "Post1", "body": "Lorem ipsum dolor sit amet. In ipsa repellat qui totam tempora et quae consequatur aut sint quas ex quibusdam fuga ut placeat distinctio At voluptas dolore."}) Blog.create({"title": "Post2", "body": "Lorem ipsum dolor sit amet. In ipsa repellat qui totam tempora et quae consequatur aut sint quas ex quibusdam fuga ut placeat distinctio At voluptas dolore."}) Blog.create({"title": "Post3", "body": "Lorem ipsum dolor sit amet. In ipsa repellat qui totam tempora et quae consequatur aut sint quas ex quibusdam fuga ut placeat distinctio At voluptas dolore."}) Blog.create({"title": "Post4", "body": "Lorem ipsum dolor sit amet. In ipsa repellat qui totam tempora et quae consequatur aut sint quas ex quibusdam fuga ut placeat distinctio At voluptas dolore."})
88.727273
207
0.739754
142
976
5.084507
0.316901
0.055402
0.083102
0.105263
0.799169
0.799169
0.799169
0.799169
0.799169
0.799169
0
0.004944
0.171107
976
11
208
88.727273
0.887515
0.023566
0
0
0
0.5
0.7173
0
0
0
0
0
0
1
0.125
false
0
0.25
0
0.5
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
4f698f4aca6730dab773bf1c7385ba96739b407e
45,204
py
Python
lib/python2.7/site-packages/tensorflow/python/ops/gen_lookup_ops.py
wangyum/anaconda
6e5a0dbead3327661d73a61e85414cf92aa52be6
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
lib/python2.7/site-packages/tensorflow/python/ops/gen_lookup_ops.py
wangyum/anaconda
6e5a0dbead3327661d73a61e85414cf92aa52be6
[ "Apache-2.0", "BSD-3-Clause" ]
10
2020-01-28T22:23:57.000Z
2022-02-09T23:39:43.000Z
udacity-car/lib/python2.7/site-packages/tensorflow/python/ops/gen_lookup_ops.py
808brick/CarND-Capstone
f9e536b4a9d96322d7e971073602c8969dbd9369
[ "MIT" ]
1
2020-06-18T15:56:53.000Z
2020-06-18T15:56:53.000Z
"""Python wrappers around TensorFlow ops. This file is MACHINE GENERATED! Do not edit. """ import collections as _collections from tensorflow.core.framework import op_def_pb2 as _op_def_pb2 # Needed to trigger the call to _set_call_cpp_shape_fn. from tensorflow.python.framework import common_shapes as _common_shapes from tensorflow.python.framework import op_def_registry as _op_def_registry from tensorflow.python.framework import ops as _ops from tensorflow.python.framework import op_def_library as _op_def_library def _hash_table(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, name=None): r"""Creates a non-initialized hash table. This op creates a hash table, specifying the type of its keys and values. Before using the table you will have to initialize it. After initialization the table will be immutable. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. If true and shared_name is empty, the table is shared using the node name. name: A name for the operation (optional). Returns: A `Tensor` of type mutable `string`. Handle to a table. """ result = _op_def_lib.apply_op("HashTable", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, name=name) return result def _hash_table_v2(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, name=None): r"""Creates a non-initialized hash table. This op creates a hash table, specifying the type of its keys and values. Before using the table you will have to initialize it. After initialization the table will be immutable. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. If true and shared_name is empty, the table is shared using the node name. name: A name for the operation (optional). Returns: A `Tensor` of type `resource`. Handle to a table. """ result = _op_def_lib.apply_op("HashTableV2", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, name=name) return result def _initialize_table(table_handle, keys, values, name=None): r"""Table initializer that takes two tensors for keys and values respectively. Args: table_handle: A `Tensor` of type mutable `string`. Handle to a table which will be initialized. keys: A `Tensor`. Keys of type Tkey. values: A `Tensor`. Values of type Tval. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("InitializeTable", table_handle=table_handle, keys=keys, values=values, name=name) return result def _initialize_table_from_text_file(table_handle, filename, key_index, value_index, vocab_size=None, delimiter=None, name=None): r"""Initializes a table from a text file. It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on `delimiter` or the line number (starting from zero). Where to extract the key and value from a line is specified by `key_index` and `value_index`. - A value of -1 means use the line number(starting from zero), expects `int64`. - A value of -2 means use the whole line content, expects `string`. - A value >= 0 means use the index (starting at zero) of the split line based on `delimiter`. Args: table_handle: A `Tensor` of type mutable `string`. Handle to a table which will be initialized. filename: A `Tensor` of type `string`. Filename of a vocabulary text file. key_index: An `int` that is `>= -2`. Column index in a line to get the table `key` values from. value_index: An `int` that is `>= -2`. Column index that represents information of a line to get the table `value` values from. vocab_size: An optional `int` that is `>= -1`. Defaults to `-1`. Number of elements of the file, use -1 if unknown. delimiter: An optional `string`. Defaults to `"\t"`. Delimiter to separate fields in a line. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("InitializeTableFromTextFile", table_handle=table_handle, filename=filename, key_index=key_index, value_index=value_index, vocab_size=vocab_size, delimiter=delimiter, name=name) return result def _initialize_table_from_text_file_v2(table_handle, filename, key_index, value_index, vocab_size=None, delimiter=None, name=None): r"""Initializes a table from a text file. It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on `delimiter` or the line number (starting from zero). Where to extract the key and value from a line is specified by `key_index` and `value_index`. - A value of -1 means use the line number(starting from zero), expects `int64`. - A value of -2 means use the whole line content, expects `string`. - A value >= 0 means use the index (starting at zero) of the split line based on `delimiter`. Args: table_handle: A `Tensor` of type `resource`. Handle to a table which will be initialized. filename: A `Tensor` of type `string`. Filename of a vocabulary text file. key_index: An `int` that is `>= -2`. Column index in a line to get the table `key` values from. value_index: An `int` that is `>= -2`. Column index that represents information of a line to get the table `value` values from. vocab_size: An optional `int` that is `>= -1`. Defaults to `-1`. Number of elements of the file, use -1 if unknown. delimiter: An optional `string`. Defaults to `"\t"`. Delimiter to separate fields in a line. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("InitializeTableFromTextFileV2", table_handle=table_handle, filename=filename, key_index=key_index, value_index=value_index, vocab_size=vocab_size, delimiter=delimiter, name=name) return result def _initialize_table_v2(table_handle, keys, values, name=None): r"""Table initializer that takes two tensors for keys and values respectively. Args: table_handle: A `Tensor` of type `resource`. Handle to a table which will be initialized. keys: A `Tensor`. Keys of type Tkey. values: A `Tensor`. Values of type Tval. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("InitializeTableV2", table_handle=table_handle, keys=keys, values=values, name=name) return result __lookup_table_export_outputs = ["keys", "values"] _LookupTableExportOutput = _collections.namedtuple( "LookupTableExport", __lookup_table_export_outputs) def _lookup_table_export(table_handle, Tkeys, Tvalues, name=None): r"""Outputs all keys and values in the table. Args: table_handle: A `Tensor` of type mutable `string`. Handle to the table. Tkeys: A `tf.DType`. Tvalues: A `tf.DType`. name: A name for the operation (optional). Returns: A tuple of `Tensor` objects (keys, values). keys: A `Tensor` of type `Tkeys`. Vector of all keys present in the table. values: A `Tensor` of type `Tvalues`. Tensor of all values in the table. Indexed in parallel with `keys`. """ result = _op_def_lib.apply_op("LookupTableExport", table_handle=table_handle, Tkeys=Tkeys, Tvalues=Tvalues, name=name) return _LookupTableExportOutput._make(result) __lookup_table_export_v2_outputs = ["keys", "values"] _LookupTableExportV2Output = _collections.namedtuple( "LookupTableExportV2", __lookup_table_export_v2_outputs) def _lookup_table_export_v2(table_handle, Tkeys, Tvalues, name=None): r"""Outputs all keys and values in the table. Args: table_handle: A `Tensor` of type `resource`. Handle to the table. Tkeys: A `tf.DType`. Tvalues: A `tf.DType`. name: A name for the operation (optional). Returns: A tuple of `Tensor` objects (keys, values). keys: A `Tensor` of type `Tkeys`. Vector of all keys present in the table. values: A `Tensor` of type `Tvalues`. Tensor of all values in the table. Indexed in parallel with `keys`. """ result = _op_def_lib.apply_op("LookupTableExportV2", table_handle=table_handle, Tkeys=Tkeys, Tvalues=Tvalues, name=name) return _LookupTableExportV2Output._make(result) def _lookup_table_find(table_handle, keys, default_value, name=None): r"""Looks up keys in a table, outputs the corresponding values. The tensor `keys` must of the same type as the keys of the table. The output `values` is of the type of the table values. The scalar `default_value` is the value output for keys not present in the table. It must also be of the same type as the table values. Args: table_handle: A `Tensor` of type mutable `string`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. default_value: A `Tensor`. name: A name for the operation (optional). Returns: A `Tensor`. Has the same type as `default_value`. Same shape as `keys`. Values found in the table, or `default_values` for missing keys. """ result = _op_def_lib.apply_op("LookupTableFind", table_handle=table_handle, keys=keys, default_value=default_value, name=name) return result def _lookup_table_find_v2(table_handle, keys, default_value, name=None): r"""Looks up keys in a table, outputs the corresponding values. The tensor `keys` must of the same type as the keys of the table. The output `values` is of the type of the table values. The scalar `default_value` is the value output for keys not present in the table. It must also be of the same type as the table values. Args: table_handle: A `Tensor` of type `resource`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. default_value: A `Tensor`. name: A name for the operation (optional). Returns: A `Tensor`. Has the same type as `default_value`. Same shape as `keys`. Values found in the table, or `default_values` for missing keys. """ result = _op_def_lib.apply_op("LookupTableFindV2", table_handle=table_handle, keys=keys, default_value=default_value, name=name) return result def _lookup_table_import(table_handle, keys, values, name=None): r"""Replaces the contents of the table with the specified keys and values. The tensor `keys` must be of the same type as the keys of the table. The tensor `values` must be of the type of the table values. Args: table_handle: A `Tensor` of type mutable `string`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. values: A `Tensor`. Values to associate with keys. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("LookupTableImport", table_handle=table_handle, keys=keys, values=values, name=name) return result def _lookup_table_import_v2(table_handle, keys, values, name=None): r"""Replaces the contents of the table with the specified keys and values. The tensor `keys` must be of the same type as the keys of the table. The tensor `values` must be of the type of the table values. Args: table_handle: A `Tensor` of type `resource`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. values: A `Tensor`. Values to associate with keys. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("LookupTableImportV2", table_handle=table_handle, keys=keys, values=values, name=name) return result def _lookup_table_insert(table_handle, keys, values, name=None): r"""Updates the table to associates keys with values. The tensor `keys` must be of the same type as the keys of the table. The tensor `values` must be of the type of the table values. Args: table_handle: A `Tensor` of type mutable `string`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. values: A `Tensor`. Values to associate with keys. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("LookupTableInsert", table_handle=table_handle, keys=keys, values=values, name=name) return result def _lookup_table_insert_v2(table_handle, keys, values, name=None): r"""Updates the table to associates keys with values. The tensor `keys` must be of the same type as the keys of the table. The tensor `values` must be of the type of the table values. Args: table_handle: A `Tensor` of type `resource`. Handle to the table. keys: A `Tensor`. Any shape. Keys to look up. values: A `Tensor`. Values to associate with keys. name: A name for the operation (optional). Returns: The created Operation. """ result = _op_def_lib.apply_op("LookupTableInsertV2", table_handle=table_handle, keys=keys, values=values, name=name) return result def _lookup_table_size(table_handle, name=None): r"""Computes the number of elements in the given table. Args: table_handle: A `Tensor` of type mutable `string`. Handle to the table. name: A name for the operation (optional). Returns: A `Tensor` of type `int64`. Scalar that contains number of elements in the table. """ result = _op_def_lib.apply_op("LookupTableSize", table_handle=table_handle, name=name) return result def _lookup_table_size_v2(table_handle, name=None): r"""Computes the number of elements in the given table. Args: table_handle: A `Tensor` of type `resource`. Handle to the table. name: A name for the operation (optional). Returns: A `Tensor` of type `int64`. Scalar that contains number of elements in the table. """ result = _op_def_lib.apply_op("LookupTableSizeV2", table_handle=table_handle, name=name) return result def _mutable_dense_hash_table(empty_key, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, value_shape=None, initial_num_buckets=None, max_load_factor=None, name=None): r"""Creates an empty hash table that uses tensors as the backing store. It uses "open addressing" with quadratic reprobing to resolve collisions. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: empty_key: A `Tensor`. The key used to represent empty key buckets internally. Must not be used in insert or lookup operations. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. value_shape: An optional `tf.TensorShape` or list of `ints`. Defaults to `[]`. The shape of each value. initial_num_buckets: An optional `int`. Defaults to `131072`. The initial number of hash table buckets. Must be a power to 2. max_load_factor: An optional `float`. Defaults to `0.8`. The maximum ratio between number of entries and number of buckets before growing the table. Must be between 0 and 1. name: A name for the operation (optional). Returns: A `Tensor` of type mutable `string`. Handle to a table. """ result = _op_def_lib.apply_op("MutableDenseHashTable", empty_key=empty_key, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, value_shape=value_shape, initial_num_buckets=initial_num_buckets, max_load_factor=max_load_factor, name=name) return result def _mutable_dense_hash_table_v2(empty_key, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, value_shape=None, initial_num_buckets=None, max_load_factor=None, name=None): r"""Creates an empty hash table that uses tensors as the backing store. It uses "open addressing" with quadratic reprobing to resolve collisions. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: empty_key: A `Tensor`. The key used to represent empty key buckets internally. Must not be used in insert or lookup operations. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. value_shape: An optional `tf.TensorShape` or list of `ints`. Defaults to `[]`. The shape of each value. initial_num_buckets: An optional `int`. Defaults to `131072`. The initial number of hash table buckets. Must be a power to 2. max_load_factor: An optional `float`. Defaults to `0.8`. The maximum ratio between number of entries and number of buckets before growing the table. Must be between 0 and 1. name: A name for the operation (optional). Returns: A `Tensor` of type `resource`. Handle to a table. """ result = _op_def_lib.apply_op("MutableDenseHashTableV2", empty_key=empty_key, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, value_shape=value_shape, initial_num_buckets=initial_num_buckets, max_load_factor=max_load_factor, name=name) return result def _mutable_hash_table(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, name=None): r"""Creates an empty hash table. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. If true and shared_name is empty, the table is shared using the node name. name: A name for the operation (optional). Returns: A `Tensor` of type mutable `string`. Handle to a table. """ result = _op_def_lib.apply_op("MutableHashTable", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, name=name) return result def _mutable_hash_table_of_tensors(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, value_shape=None, name=None): r"""Creates an empty hash table. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a vector. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. value_shape: An optional `tf.TensorShape` or list of `ints`. Defaults to `[]`. name: A name for the operation (optional). Returns: A `Tensor` of type mutable `string`. Handle to a table. """ result = _op_def_lib.apply_op("MutableHashTableOfTensors", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, value_shape=value_shape, name=name) return result def _mutable_hash_table_of_tensors_v2(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, value_shape=None, name=None): r"""Creates an empty hash table. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a vector. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. value_shape: An optional `tf.TensorShape` or list of `ints`. Defaults to `[]`. name: A name for the operation (optional). Returns: A `Tensor` of type `resource`. Handle to a table. """ result = _op_def_lib.apply_op("MutableHashTableOfTensorsV2", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, value_shape=value_shape, name=name) return result def _mutable_hash_table_v2(key_dtype, value_dtype, container=None, shared_name=None, use_node_name_sharing=None, name=None): r"""Creates an empty hash table. This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation. Args: key_dtype: A `tf.DType`. Type of the table keys. value_dtype: A `tf.DType`. Type of the table values. container: An optional `string`. Defaults to `""`. If non-empty, this table is placed in the given container. Otherwise, a default container is used. shared_name: An optional `string`. Defaults to `""`. If non-empty, this table is shared under the given name across multiple sessions. use_node_name_sharing: An optional `bool`. Defaults to `False`. If true and shared_name is empty, the table is shared using the node name. name: A name for the operation (optional). Returns: A `Tensor` of type `resource`. Handle to a table. """ result = _op_def_lib.apply_op("MutableHashTableV2", key_dtype=key_dtype, value_dtype=value_dtype, container=container, shared_name=shared_name, use_node_name_sharing=use_node_name_sharing, name=name) return result def _InitOpDefLibrary(op_list_proto_bytes): op_list = _op_def_pb2.OpList() op_list.ParseFromString(op_list_proto_bytes) _op_def_registry.register_op_list(op_list) op_def_lib = _op_def_library.OpDefLibrary() op_def_lib.add_op_list(op_list) return op_def_lib # op { # name: "HashTable" # output_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # is_stateful: true # } # op { # name: "HashTableV2" # output_arg { # name: "table_handle" # type: DT_RESOURCE # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # is_stateful: true # } # op { # name: "InitializeTable" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # input_arg { # name: "keys" # type_attr: "Tkey" # } # input_arg { # name: "values" # type_attr: "Tval" # } # attr { # name: "Tkey" # type: "type" # } # attr { # name: "Tval" # type: "type" # } # } # op { # name: "InitializeTableFromTextFile" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # input_arg { # name: "filename" # type: DT_STRING # } # attr { # name: "key_index" # type: "int" # has_minimum: true # minimum: -2 # } # attr { # name: "value_index" # type: "int" # has_minimum: true # minimum: -2 # } # attr { # name: "vocab_size" # type: "int" # default_value { # i: -1 # } # has_minimum: true # minimum: -1 # } # attr { # name: "delimiter" # type: "string" # default_value { # s: "\t" # } # } # } # op { # name: "InitializeTableFromTextFileV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # input_arg { # name: "filename" # type: DT_STRING # } # attr { # name: "key_index" # type: "int" # has_minimum: true # minimum: -2 # } # attr { # name: "value_index" # type: "int" # has_minimum: true # minimum: -2 # } # attr { # name: "vocab_size" # type: "int" # default_value { # i: -1 # } # has_minimum: true # minimum: -1 # } # attr { # name: "delimiter" # type: "string" # default_value { # s: "\t" # } # } # is_stateful: true # } # op { # name: "InitializeTableV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # input_arg { # name: "keys" # type_attr: "Tkey" # } # input_arg { # name: "values" # type_attr: "Tval" # } # attr { # name: "Tkey" # type: "type" # } # attr { # name: "Tval" # type: "type" # } # is_stateful: true # } # op { # name: "LookupTableExport" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # output_arg { # name: "keys" # type_attr: "Tkeys" # } # output_arg { # name: "values" # type_attr: "Tvalues" # } # attr { # name: "Tkeys" # type: "type" # } # attr { # name: "Tvalues" # type: "type" # } # } # op { # name: "LookupTableExportV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # output_arg { # name: "keys" # type_attr: "Tkeys" # } # output_arg { # name: "values" # type_attr: "Tvalues" # } # attr { # name: "Tkeys" # type: "type" # } # attr { # name: "Tvalues" # type: "type" # } # is_stateful: true # } # op { # name: "LookupTableFind" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "default_value" # type_attr: "Tout" # } # output_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # } # op { # name: "LookupTableFindV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "default_value" # type_attr: "Tout" # } # output_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # is_stateful: true # } # op { # name: "LookupTableImport" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # } # op { # name: "LookupTableImportV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # is_stateful: true # } # op { # name: "LookupTableInsert" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # } # op { # name: "LookupTableInsertV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # input_arg { # name: "keys" # type_attr: "Tin" # } # input_arg { # name: "values" # type_attr: "Tout" # } # attr { # name: "Tin" # type: "type" # } # attr { # name: "Tout" # type: "type" # } # is_stateful: true # } # op { # name: "LookupTableSize" # input_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # output_arg { # name: "size" # type: DT_INT64 # } # } # op { # name: "LookupTableSizeV2" # input_arg { # name: "table_handle" # type: DT_RESOURCE # } # output_arg { # name: "size" # type: DT_INT64 # } # is_stateful: true # } # op { # name: "MutableDenseHashTable" # input_arg { # name: "empty_key" # type_attr: "key_dtype" # } # output_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # attr { # name: "value_shape" # type: "shape" # default_value { # shape { # } # } # } # attr { # name: "initial_num_buckets" # type: "int" # default_value { # i: 131072 # } # } # attr { # name: "max_load_factor" # type: "float" # default_value { # f: 0.8 # } # } # is_stateful: true # } # op { # name: "MutableDenseHashTableV2" # input_arg { # name: "empty_key" # type_attr: "key_dtype" # } # output_arg { # name: "table_handle" # type: DT_RESOURCE # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # attr { # name: "value_shape" # type: "shape" # default_value { # shape { # } # } # } # attr { # name: "initial_num_buckets" # type: "int" # default_value { # i: 131072 # } # } # attr { # name: "max_load_factor" # type: "float" # default_value { # f: 0.8 # } # } # is_stateful: true # } # op { # name: "MutableHashTable" # output_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # is_stateful: true # } # op { # name: "MutableHashTableOfTensors" # output_arg { # name: "table_handle" # type: DT_STRING # is_ref: true # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # attr { # name: "value_shape" # type: "shape" # default_value { # shape { # } # } # } # is_stateful: true # } # op { # name: "MutableHashTableOfTensorsV2" # output_arg { # name: "table_handle" # type: DT_RESOURCE # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # attr { # name: "value_shape" # type: "shape" # default_value { # shape { # } # } # } # is_stateful: true # } # op { # name: "MutableHashTableV2" # output_arg { # name: "table_handle" # type: DT_RESOURCE # } # attr { # name: "container" # type: "string" # default_value { # s: "" # } # } # attr { # name: "shared_name" # type: "string" # default_value { # s: "" # } # } # attr { # name: "use_node_name_sharing" # type: "bool" # default_value { # b: false # } # } # attr { # name: "key_dtype" # type: "type" # } # attr { # name: "value_dtype" # type: "type" # } # is_stateful: true # } _op_def_lib = _InitOpDefLibrary(b"\n\242\001\n\tHashTable\032\023\n\014table_handle\030\007\200\001\001\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\210\001\001\n\241\001\n\013HashTableV2\032\020\n\014table_handle\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\210\001\001\n`\n\017InitializeTable\022\023\n\014table_handle\030\007\200\001\001\022\014\n\004keys\"\004Tkey\022\016\n\006values\"\004Tval\"\014\n\004Tkey\022\004type\"\014\n\004Tval\022\004type\n\307\001\n\033InitializeTableFromTextFile\022\023\n\014table_handle\030\007\200\001\001\022\014\n\010filename\030\007\"\035\n\tkey_index\022\003int(\0010\376\377\377\377\377\377\377\377\377\001\"\037\n\013value_index\022\003int(\0010\376\377\377\377\377\377\377\377\377\001\"+\n\nvocab_size\022\003int\032\013\030\377\377\377\377\377\377\377\377\377\001(\0010\377\377\377\377\377\377\377\377\377\001\"\030\n\tdelimiter\022\006string\032\003\022\001\t\n\311\001\n\035InitializeTableFromTextFileV2\022\020\n\014table_handle\030\024\022\014\n\010filename\030\007\"\035\n\tkey_index\022\003int(\0010\376\377\377\377\377\377\377\377\377\001\"\037\n\013value_index\022\003int(\0010\376\377\377\377\377\377\377\377\377\001\"+\n\nvocab_size\022\003int\032\013\030\377\377\377\377\377\377\377\377\377\001(\0010\377\377\377\377\377\377\377\377\377\001\"\030\n\tdelimiter\022\006string\032\003\022\001\t\210\001\001\nb\n\021InitializeTableV2\022\020\n\014table_handle\030\024\022\014\n\004keys\"\004Tkey\022\016\n\006values\"\004Tval\"\014\n\004Tkey\022\004type\"\014\n\004Tval\022\004type\210\001\001\nj\n\021LookupTableExport\022\023\n\014table_handle\030\007\200\001\001\032\r\n\004keys\"\005Tkeys\032\021\n\006values\"\007Tvalues\"\r\n\005Tkeys\022\004type\"\017\n\007Tvalues\022\004type\nl\n\023LookupTableExportV2\022\020\n\014table_handle\030\024\032\r\n\004keys\"\005Tkeys\032\021\n\006values\"\007Tvalues\"\r\n\005Tkeys\022\004type\"\017\n\007Tvalues\022\004type\210\001\001\nu\n\017LookupTableFind\022\023\n\014table_handle\030\007\200\001\001\022\013\n\004keys\"\003Tin\022\025\n\rdefault_value\"\004Tout\032\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\nw\n\021LookupTableFindV2\022\020\n\014table_handle\030\024\022\013\n\004keys\"\003Tin\022\025\n\rdefault_value\"\004Tout\032\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\210\001\001\n`\n\021LookupTableImport\022\023\n\014table_handle\030\007\200\001\001\022\013\n\004keys\"\003Tin\022\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\nb\n\023LookupTableImportV2\022\020\n\014table_handle\030\024\022\013\n\004keys\"\003Tin\022\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\210\001\001\n`\n\021LookupTableInsert\022\023\n\014table_handle\030\007\200\001\001\022\013\n\004keys\"\003Tin\022\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\nb\n\023LookupTableInsertV2\022\020\n\014table_handle\030\024\022\013\n\004keys\"\003Tin\022\016\n\006values\"\004Tout\"\013\n\003Tin\022\004type\"\014\n\004Tout\022\004type\210\001\001\n0\n\017LookupTableSize\022\023\n\014table_handle\030\007\200\001\001\032\010\n\004size\030\t\n2\n\021LookupTableSizeV2\022\020\n\014table_handle\030\024\032\010\n\004size\030\t\210\001\001\n\243\002\n\025MutableDenseHashTable\022\026\n\tempty_key\"\tkey_dtype\032\023\n\014table_handle\030\007\200\001\001\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\"\030\n\013value_shape\022\005shape\032\002:\000\" \n\023initial_num_buckets\022\003int\032\004\030\200\200\010\"\037\n\017max_load_factor\022\005float\032\005%\315\314L?\210\001\001\n\242\002\n\027MutableDenseHashTableV2\022\026\n\tempty_key\"\tkey_dtype\032\020\n\014table_handle\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\"\030\n\013value_shape\022\005shape\032\002:\000\" \n\023initial_num_buckets\022\003int\032\004\030\200\200\010\"\037\n\017max_load_factor\022\005float\032\005%\315\314L?\210\001\001\n\251\001\n\020MutableHashTable\032\023\n\014table_handle\030\007\200\001\001\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\210\001\001\n\314\001\n\031MutableHashTableOfTensors\032\023\n\014table_handle\030\007\200\001\001\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\"\030\n\013value_shape\022\005shape\032\002:\000\210\001\001\n\313\001\n\033MutableHashTableOfTensorsV2\032\020\n\014table_handle\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\"\030\n\013value_shape\022\005shape\032\002:\000\210\001\001\n\250\001\n\022MutableHashTableV2\032\020\n\014table_handle\030\024\"\027\n\tcontainer\022\006string\032\002\022\000\"\031\n\013shared_name\022\006string\032\002\022\000\"!\n\025use_node_name_sharing\022\004bool\032\002(\000\"\021\n\tkey_dtype\022\004type\"\023\n\013value_dtype\022\004type\210\001\001")
32.127932
6,044
0.627201
6,087
45,204
4.500411
0.061442
0.031321
0.017084
0.019274
0.921698
0.911075
0.90998
0.903921
0.898664
0.894101
0
0.077422
0.256238
45,204
1,406
6,045
32.150782
0.737367
0.590036
0
0.523077
1
0.087179
0.222438
0.198776
0
0
0
0
0
1
0.117949
false
0
0.05641
0
0.292308
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
8
96f79c1b4ead43e94a3545f6aa3ea02cf1121668
93
py
Python
tests/test_jinja2_webpack.py
JDeuce/python-jinja-webpack
109d2595ef2ff5b23a9799532934f8ad94562081
[ "BSD-2-Clause" ]
6
2019-04-15T05:07:31.000Z
2021-05-06T08:18:20.000Z
tests/test_jinja2_webpack.py
JDeuce/python-jinja-webpack
109d2595ef2ff5b23a9799532934f8ad94562081
[ "BSD-2-Clause" ]
4
2018-09-10T19:56:17.000Z
2021-05-19T20:04:18.000Z
tests/test_jinja2_webpack.py
JDeuce/python-jinja-webpack
109d2595ef2ff5b23a9799532934f8ad94562081
[ "BSD-2-Clause" ]
2
2019-07-15T21:04:38.000Z
2019-07-18T20:13:57.000Z
import jinja2_webpack def test_main(): assert jinja2_webpack # use your library here
13.285714
50
0.752688
13
93
5.153846
0.846154
0.38806
0
0
0
0
0
0
0
0
0
0.027027
0.204301
93
6
51
15.5
0.878378
0.225806
0
0
0
0
0
0
0
0
0
0
0.333333
1
0.333333
true
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
0
0
0
null
0
0
0
0
0
1
1
0
1
0
1
0
0
7
4fd3f49d16c0eb22e859ea2288a0405b7bcf3302
7,926
py
Python
core/PDF_Functions.py
School-Simplified/CommunityServiceBot
dd5747c599ec3be86879bbcda5777a5db2777ab9
[ "MIT" ]
null
null
null
core/PDF_Functions.py
School-Simplified/CommunityServiceBot
dd5747c599ec3be86879bbcda5777a5db2777ab9
[ "MIT" ]
null
null
null
core/PDF_Functions.py
School-Simplified/CommunityServiceBot
dd5747c599ec3be86879bbcda5777a5db2777ab9
[ "MIT" ]
null
null
null
from PyPDF2 import PdfFileWriter, PdfFileReader import io from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter from shutil import copyfile import discord from core.common import * import textwrap import re from core.common import * config, _ = load_config() async def self2(StudentName, StudnetID, SchoolName, SchoolPhone,StudentAddress,StudentCity,StudentState, StudentEmail, stuffdone, ctx, DiscID, supervisor): copyfile("PDFbase.pdf", fr"PDF/rec-{DiscID}.pdf") open(fr"PDF/rec-{DiscID}.pdf") packet = io.BytesIO() can = canvas.Canvas(packet, pagesize=letter) can.setFont("Times-Roman", 10) #Top: can.drawString(146, 647, StudentName) can.drawString(380, 647, StudnetID) can.drawString(115, 627, SchoolName) can.drawString(353, 627, SchoolPhone) can.drawString(157, 605, StudentAddress) can.drawString(345, 605, StudentCity) can.drawString(455, 605, StudentState) can.drawString(110, 585, StudentEmail) #Bottom: can.drawString(185, 185, config['OrgName']) can.drawString(370, 185, config['OrgCity']) can.drawString(462, 185, config['OrgState']) AdultName, Email, PhoneNumber = getValues(supervisor) can.drawString(130, 165, PhoneNumber) can.drawString(325, 165, Email) #can.drawString(247, 105, "Signature") can.drawString(145, 145, AdultName) yVal = 505 content = textwrap.fill(stuffdone, 110) for x in content.splitlines(): lineContent = '\n'.join(line.strip() for line in re.findall(r'.{1,40}(?:\s+|$)', x)) try: lineContent = lineContent.replace("\u00A0","\u0020") except: print("Error Code 1") finally: print(lineContent) can.drawString(75, yVal, lineContent) yVal = yVal - 20 packet.seek(0) new_pdf = PdfFileReader(packet) existing_pdf = PdfFileReader(open("PDFbase.pdf", "rb")) output = PdfFileWriter() page = existing_pdf.getPage(0) page.mergePage(new_pdf.getPage(0)) output.addPage(page) outputStream = open(fr"PDF/rec-{DiscID}.pdf", "wb") output.write(outputStream) outputStream.close() await ctx.send(file=discord.File(fr"PDF/rec-{DiscID}.pdf")) async def doBottom(Date, AdultName ,userID, DiscID, self): copyfile(fr"PDF/rec-{DiscID}.pdf", fr"PDF/rec2-{DiscID}.pdf") open(fr"PDF/rec2-{DiscID}.pdf") user = await self.bot.fetch_user(userID) Requster = await self.bot.fetch_user(DiscID) packet = io.BytesIO() can = canvas.Canvas(packet, pagesize=letter) can.setFont("Times-Roman", 10) can.drawString(245, 102, AdultName) can.drawString(440, 102, Date) can.drawString(180, 83, AdultName) can.drawString(380, 83, Date) can.save() packet.seek(0) new_pdf = PdfFileReader(packet) existing_pdf = PdfFileReader(open(fr"PDF/rec-{DiscID}.pdf", "rb")) output = PdfFileWriter() page = existing_pdf.getPage(0) page.mergePage(new_pdf.getPage(0)) output.addPage(page) outputStream = open(fr"PDF/rec2-{DiscID}.pdf", "wb") output.write(outputStream) outputStream.close() await user.send("**YOU HAVE APPROVED THEIR REQUEST!**\nHere is your copy of their PDF!") await user.send(file=discord.File(fr'PDF/rec2-{DiscID}.pdf')) embed = discord.Embed(title = "Authorization Approved", description = "Dear User, your community service request has been approved by your supervisor and below attached is your signed Community Service PDF.", color = 0x34eb71) await Requster.send(embed = embed) await Requster.send(file=discord.File(fr'PDF/rec2-{DiscID}.pdf')) async def DMPDF(StudentName, StudnetID, SchoolName, SchoolPhone,StudentAddress,StudentCity,StudentState, StudentEmail, stuffdone, self, DiscID, supervisor): copyfile("PDFbase.pdf", rf"PDF/rec-{DiscID}.pdf") open(rf"PDF/rec-{DiscID}.pdf") packet = io.BytesIO() can = canvas.Canvas(packet, pagesize=letter) can.setFont("Times-Roman", 10) #Top: can.drawString(146, 647, StudentName) can.drawString(380, 647, StudnetID) can.drawString(115, 627, SchoolName) can.drawString(353, 627, SchoolPhone) can.drawString(157, 605, StudentAddress) can.drawString(345, 605, StudentCity) can.drawString(455, 605, StudentState) can.drawString(110, 585, StudentEmail) #Bottom: can.drawString(185, 185, config['OrgName']) can.drawString(370, 185, config['OrgCity']) can.drawString(462, 185, config['OrgState']) AdultName, Email, PhoneNumber = getValues(supervisor) can.drawString(130, 165, PhoneNumber) can.drawString(325, 165, Email) #can.drawString(247, 105, "Signature") can.drawString(145, 145, AdultName) yVal = 505 content = textwrap.fill(stuffdone, 110) for x in content.splitlines(): lineContent = '\n'.join(line.strip() for line in re.findall(r'.{1,40}(?:\s+|$)', x)) try: lineContent = lineContent.replace("\u00A0","\u0020") except: print("Error Code 1") finally: print(lineContent) can.drawString(75, yVal, lineContent) yVal = yVal - 20 can.save() packet.seek(0) new_pdf = PdfFileReader(packet) existing_pdf = PdfFileReader(open("PDFbase.pdf", "rb")) output = PdfFileWriter() page = existing_pdf.getPage(0) page.mergePage(new_pdf.getPage(0)) output.addPage(page) outputStream = open(rf"PDF/rec-{DiscID}.pdf", "wb") output.write(outputStream) outputStream.close() user = await self.bot.fetch_user(450476337954553858) await user.send(f"New Response from {StudentName}:") await user.send(file=discord.File(rf"PDF/rec-{DiscID}.pdf")) guild = self.bot.get_guild(805593783684562965) channel = guild.get_channel(813109417267429386) await channel.send(f"PDF for {StudentName}:") await channel.send(file=discord.File(rf"PDF/rec-{DiscID}.pdf")) async def givePDF(StudentName, StudnetID, SchoolName, SchoolPhone,StudentAddress,StudentCity,StudentState, StudentEmail, stuffdone, self, DiscID, supervisor): copyfile("PDFbase.pdf", fr"PDF/rec-{DiscID}.pdf") open(fr"PDF/rec-{DiscID}.pdf") packet = io.BytesIO() can = canvas.Canvas(packet, pagesize=letter) can.setFont("Times-Roman", 10) #Top: can.drawString(146, 647, StudentName) can.drawString(380, 647, StudnetID) can.drawString(115, 627, SchoolName) can.drawString(353, 627, SchoolPhone) can.drawString(157, 605, StudentAddress) can.drawString(345, 605, StudentCity) can.drawString(455, 605, StudentState) can.drawString(110, 585, StudentEmail) #Bottom: can.drawString(185, 185, config['OrgName']) can.drawString(370, 185, config['OrgCity']) can.drawString(462, 185, config['OrgState']) AdultName, Email, PhoneNumber = getValues(supervisor) can.drawString(130, 165, PhoneNumber) can.drawString(325, 165, Email) #can.drawString(247, 105, "Signature") can.drawString(145, 145, AdultName) yVal = 505 content = textwrap.fill(stuffdone, 110) for x in content.splitlines(): lineContent = '\n'.join(line.strip() for line in re.findall(r'.{1,40}(?:\s+|$)', x)) try: lineContent = lineContent.replace("\u00A0","\u0020") except: print("Error Code 1") finally: print(lineContent) can.drawString(75, yVal, lineContent) yVal = yVal - 20 can.save() packet.seek(0) new_pdf = PdfFileReader(packet) existing_pdf = PdfFileReader(open("PDFbase.pdf", "rb")) output = PdfFileWriter() page = existing_pdf.getPage(0) page.mergePage(new_pdf.getPage(0)) output.addPage(page) outputStream = open(rf"PDF/rec-{DiscID}.pdf", "wb") output.write(outputStream) outputStream.close()
32.089069
230
0.665657
962
7,926
5.460499
0.186071
0.128688
0.031982
0.039977
0.82886
0.814963
0.783362
0.783362
0.783362
0.725109
0
0.06922
0.19619
7,926
246
231
32.219512
0.755297
0.018168
0
0.780899
0
0.005618
0.126463
0.013508
0
0
0.001029
0
0
1
0
false
0
0.05618
0
0.05618
0.033708
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
4fe6864e6608a25f9a355a998c4152770784d495
2,202
py
Python
sango/process.py
short-greg/sango
68bcdbe8f4784fef6f7fc382ec2c4e81911c2a8a
[ "MIT" ]
null
null
null
sango/process.py
short-greg/sango
68bcdbe8f4784fef6f7fc382ec2c4e81911c2a8a
[ "MIT" ]
null
null
null
sango/process.py
short-greg/sango
68bcdbe8f4784fef6f7fc382ec2c4e81911c2a8a
[ "MIT" ]
1
2022-01-27T15:39:10.000Z
2022-01-27T15:39:10.000Z
import typing from ._std import Filter, Task class IntersectFilter(Filter): def __init__(self, filters: typing.List[Filter]): """initializer Args: filters (typing.List[Filter]): Filters to intersect """ self._filters = filters def check(self, node) -> bool: """Check if the node passes the filter Args: node: Node to filter Returns: bool """ for filter in self._filters: if not filter.check(node): return False return True class UnionFilter(Filter): def __init__(self, filters: typing.List[Filter]): """initializer Args: filters (typing.List[Filter]): Filters to intersect """ self._filters = filters def check(self, node) -> bool: """Check if the node passes the filter Args: node: Node to filter Returns: bool """ for filter in self._filters: if filter.check(node): return True return False class StatusFilter(Filter): """Filter based on the status of a node """ def __init__(self, statuses: typing.Iterable): """initializer Args: statuses (typing.Iterable): Statuses to filter out """ self._statuses = set(statuses) def check(self, node) -> bool: """Filter based Args: node Returns: bool """ if isinstance(node, Task): return node.status in self._statuses return False class StatusExcluder(Filter): """Filter out based on the status of a node """ def __init__(self, statuses: typing.Iterable): """initializer Args: statuses (typing.Iterable): Statuses to filter out """ self._statuses = set(statuses) def check(self, node) -> bool: """Filter based Args: node Returns: bool """ if isinstance(node, Task): return node.status not in self._statuses return False
20.388889
63
0.529064
224
2,202
5.089286
0.191964
0.057895
0.038596
0.080702
0.814035
0.770175
0.770175
0.770175
0.770175
0.770175
0
0
0.381926
2,202
107
64
20.579439
0.837619
0.298365
0
0.6875
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.0625
0
0.6875
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
8b036741ba5bbe5723410dc768e40bcf2e359cfa
43,137
py
Python
tb_rest_client/api/api_ce/ota_package_controller_api.py
samson0v/python_tb_rest_client
08ff7898740f7cec2170e85d5c3c89e222e967f7
[ "Apache-2.0" ]
30
2020-06-19T06:42:50.000Z
2021-08-23T21:16:36.000Z
tb_rest_client/api/api_ce/ota_package_controller_api.py
samson0v/python_tb_rest_client
08ff7898740f7cec2170e85d5c3c89e222e967f7
[ "Apache-2.0" ]
25
2021-08-30T01:17:27.000Z
2022-03-16T14:10:14.000Z
tb_rest_client/api/api_ce/ota_package_controller_api.py
samson0v/python_tb_rest_client
08ff7898740f7cec2170e85d5c3c89e222e967f7
[ "Apache-2.0" ]
23
2020-07-06T13:41:54.000Z
2021-08-23T21:04:50.000Z
# coding: utf-8 """ ThingsBoard REST API ThingsBoard open-source IoT platform REST API documentation. # noqa: E501 OpenAPI spec version: 3.3.3-SNAPSHOT Contact: info@thingsboard.io 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 tb_rest_client.api_client import ApiClient class OtaPackageControllerApi(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 delete_ota_package_using_delete(self, ota_package_id, **kwargs): # noqa: E501 """Delete OTA Package (deleteOtaPackage) # noqa: E501 Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_ota_package_using_delete(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 else: (data) = self.delete_ota_package_using_delete_with_http_info(ota_package_id, **kwargs) # noqa: E501 return data def delete_ota_package_using_delete_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 """Delete OTA Package (deleteOtaPackage) # noqa: E501 Deletes the OTA Package. Referencing non-existing OTA Package Id will cause an error. Can't delete the OTA Package if it is referenced by existing devices or device profile. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_ota_package_using_delete_with_http_info(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['ota_package_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method delete_ota_package_using_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'ota_package_id' is set if ('ota_package_id' not in params or params['ota_package_id'] is None): raise ValueError("Missing the required parameter `ota_package_id` when calling `delete_ota_package_using_delete`") # noqa: E501 collection_formats = {} path_params = {} if 'ota_package_id' in params: path_params['otaPackageId'] = params['ota_package_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage/{otaPackageId}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def download_ota_package_using_get(self, ota_package_id, **kwargs): # noqa: E501 """Download OTA Package (downloadOtaPackage) # noqa: E501 Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.download_ota_package_using_get(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: Resource If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 else: (data) = self.download_ota_package_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 return data def download_ota_package_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 """Download OTA Package (downloadOtaPackage) # noqa: E501 Download OTA Package based on the provided OTA Package Id. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.download_ota_package_using_get_with_http_info(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: Resource If the method is called asynchronously, returns the request thread. """ all_params = ['ota_package_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method download_ota_package_using_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'ota_package_id' is set if ('ota_package_id' not in params or params['ota_package_id'] is None): raise ValueError("Missing the required parameter `ota_package_id` when calling `download_ota_package_using_get`") # noqa: E501 collection_formats = {} path_params = {} if 'ota_package_id' in params: path_params['otaPackageId'] = params['ota_package_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage/{otaPackageId}/download', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Resource', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_ota_package_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 """Get OTA Package (getOtaPackageById) # noqa: E501 Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_package_by_id_using_get(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: OtaPackage If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 else: (data) = self.get_ota_package_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 return data def get_ota_package_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 """Get OTA Package (getOtaPackageById) # noqa: E501 Fetch the OTA Package object based on the provided OTA Package Id. The server checks that the OTA Package is owned by the same tenant. OTA Package is a heavyweight object that includes main information about the OTA Package and also data. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_package_by_id_using_get_with_http_info(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: OtaPackage If the method is called asynchronously, returns the request thread. """ all_params = ['ota_package_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_ota_package_by_id_using_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'ota_package_id' is set if ('ota_package_id' not in params or params['ota_package_id'] is None): raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_by_id_using_get`") # noqa: E501 collection_formats = {} path_params = {} if 'ota_package_id' in params: path_params['otaPackageId'] = params['ota_package_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage/{otaPackageId}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='OtaPackage', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_ota_package_info_by_id_using_get(self, ota_package_id, **kwargs): # noqa: E501 """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_package_info_by_id_using_get(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 else: (data) = self.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, **kwargs) # noqa: E501 return data def get_ota_package_info_by_id_using_get_with_http_info(self, ota_package_id, **kwargs): # noqa: E501 """Get OTA Package Info (getOtaPackageInfoById) # noqa: E501 Fetch the OTA Package Info object based on the provided OTA Package Id. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_package_info_by_id_using_get_with_http_info(ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ all_params = ['ota_package_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_ota_package_info_by_id_using_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'ota_package_id' is set if ('ota_package_id' not in params or params['ota_package_id'] is None): raise ValueError("Missing the required parameter `ota_package_id` when calling `get_ota_package_info_by_id_using_get`") # noqa: E501 collection_formats = {} path_params = {} if 'ota_package_id' in params: path_params['otaPackageId'] = params['ota_package_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage/info/{otaPackageId}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='OtaPackageInfo', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_ota_packages_using_get(self, page_size, page, **kwargs): # noqa: E501 """Get OTA Package Infos (getOtaPackages) # noqa: E501 Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_packages_using_get(page_size, page, async_req=True) >>> result = thread.get() :param async_req bool :param int page_size: Maximum amount of entities in a one page (required) :param int page: Sequence number of page starting from 0 (required) :param str text_search: The case insensitive 'startsWith' filter based on the ota package title. :param str sort_property: Property of entity to sort by :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) :return: PageDataOtaPackageInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 else: (data) = self.get_ota_packages_using_get_with_http_info(page_size, page, **kwargs) # noqa: E501 return data def get_ota_packages_using_get_with_http_info(self, page_size, page, **kwargs): # noqa: E501 """Get OTA Package Infos (getOtaPackages) # noqa: E501 Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_packages_using_get_with_http_info(page_size, page, async_req=True) >>> result = thread.get() :param async_req bool :param int page_size: Maximum amount of entities in a one page (required) :param int page: Sequence number of page starting from 0 (required) :param str text_search: The case insensitive 'startsWith' filter based on the ota package title. :param str sort_property: Property of entity to sort by :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) :return: PageDataOtaPackageInfo If the method is called asynchronously, returns the request thread. """ all_params = ['page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_ota_packages_using_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'page_size' is set if ('page_size' not in params or params['page_size'] is None): raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get`") # noqa: E501 # verify the required parameter 'page' is set if ('page' not in params or params['page'] is None): raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'page_size' in params: query_params.append(('pageSize', params['page_size'])) # noqa: E501 if 'page' in params: query_params.append(('page', params['page'])) # noqa: E501 if 'text_search' in params: query_params.append(('textSearch', params['text_search'])) # noqa: E501 if 'sort_property' in params: query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 if 'sort_order' in params: query_params.append(('sortOrder', params['sort_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackages{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='PageDataOtaPackageInfo', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def get_ota_packages_using_get1(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 """Get OTA Package Infos (getOtaPackages) # noqa: E501 Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_packages_using_get1(device_profile_id, type, page_size, page, async_req=True) >>> result = thread.get() :param async_req bool :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :param str type: OTA Package type. (required) :param int page_size: Maximum amount of entities in a one page (required) :param int page: Sequence number of page starting from 0 (required) :param str text_search: The case insensitive 'startsWith' filter based on the ota package title. :param str sort_property: Property of entity to sort by :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) :return: PageDataOtaPackageInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 else: (data) = self.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, **kwargs) # noqa: E501 return data def get_ota_packages_using_get1_with_http_info(self, device_profile_id, type, page_size, page, **kwargs): # noqa: E501 """Get OTA Package Infos (getOtaPackages) # noqa: E501 Returns a page of OTA Package Info objects owned by tenant. You can specify parameters to filter the results. The result is wrapped with PageData object that allows you to iterate over result set using pagination. See the 'Model' tab of the Response Class for more details. OTA Package Info is a lightweight object that includes main information about the OTA Package excluding the heavyweight data. Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_ota_packages_using_get1_with_http_info(device_profile_id, type, page_size, page, async_req=True) >>> result = thread.get() :param async_req bool :param str device_profile_id: A string value representing the device profile id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :param str type: OTA Package type. (required) :param int page_size: Maximum amount of entities in a one page (required) :param int page: Sequence number of page starting from 0 (required) :param str text_search: The case insensitive 'startsWith' filter based on the ota package title. :param str sort_property: Property of entity to sort by :param str sort_order: Sort order. ASC (ASCENDING) or DESC (DESCENDING) :return: PageDataOtaPackageInfo If the method is called asynchronously, returns the request thread. """ all_params = ['device_profile_id', 'type', 'page_size', 'page', 'text_search', 'sort_property', 'sort_order'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_ota_packages_using_get1" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'device_profile_id' is set if ('device_profile_id' not in params or params['device_profile_id'] is None): raise ValueError("Missing the required parameter `device_profile_id` when calling `get_ota_packages_using_get1`") # noqa: E501 # verify the required parameter 'type' is set if ('type' not in params or params['type'] is None): raise ValueError("Missing the required parameter `type` when calling `get_ota_packages_using_get1`") # noqa: E501 # verify the required parameter 'page_size' is set if ('page_size' not in params or params['page_size'] is None): raise ValueError("Missing the required parameter `page_size` when calling `get_ota_packages_using_get1`") # noqa: E501 # verify the required parameter 'page' is set if ('page' not in params or params['page'] is None): raise ValueError("Missing the required parameter `page` when calling `get_ota_packages_using_get1`") # noqa: E501 collection_formats = {} path_params = {} if 'device_profile_id' in params: path_params['deviceProfileId'] = params['device_profile_id'] # noqa: E501 if 'type' in params: path_params['type'] = params['type'] # noqa: E501 query_params = [] if 'page_size' in params: query_params.append(('pageSize', params['page_size'])) # noqa: E501 if 'page' in params: query_params.append(('page', params['page'])) # noqa: E501 if 'text_search' in params: query_params.append(('textSearch', params['text_search'])) # noqa: E501 if 'sort_property' in params: query_params.append(('sortProperty', params['sort_property'])) # noqa: E501 if 'sort_order' in params: query_params.append(('sortOrder', params['sort_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 = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackages/{deviceProfileId}/{type}{?page,pageSize,sortOrder,sortProperty,textSearch}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='PageDataOtaPackageInfo', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def save_ota_package_data_using_post(self, checksum_algorithm, ota_package_id, **kwargs): # noqa: E501 """Save OTA Package data (saveOtaPackageData) # noqa: E501 Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.save_ota_package_data_using_post(checksum_algorithm, ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str checksum_algorithm: OTA Package checksum algorithm. (required) :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :param Object body: :param str checksum: OTA Package checksum. For example, '0xd87f7e0c' :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.save_ota_package_data_using_post_with_http_info(checksum_algorithm, ota_package_id, **kwargs) # noqa: E501 else: (data) = self.save_ota_package_data_using_post_with_http_info(checksum_algorithm, ota_package_id, **kwargs) # noqa: E501 return data def save_ota_package_data_using_post_with_http_info(self, checksum_algorithm, ota_package_id, **kwargs): # noqa: E501 """Save OTA Package data (saveOtaPackageData) # noqa: E501 Update the OTA Package. Adds the date to the existing OTA Package Info Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.save_ota_package_data_using_post_with_http_info(checksum_algorithm, ota_package_id, async_req=True) >>> result = thread.get() :param async_req bool :param str checksum_algorithm: OTA Package checksum algorithm. (required) :param str ota_package_id: A string value representing the ota package id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' (required) :param Object body: :param str checksum: OTA Package checksum. For example, '0xd87f7e0c' :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ all_params = ['checksum_algorithm', 'ota_package_id', 'body', 'checksum'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method save_ota_package_data_using_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'checksum_algorithm' is set if ('checksum_algorithm' not in params or params['checksum_algorithm'] is None): raise ValueError("Missing the required parameter `checksum_algorithm` when calling `save_ota_package_data_using_post`") # noqa: E501 # verify the required parameter 'ota_package_id' is set if ('ota_package_id' not in params or params['ota_package_id'] is None): raise ValueError("Missing the required parameter `ota_package_id` when calling `save_ota_package_data_using_post`") # noqa: E501 collection_formats = {} path_params = {} if 'ota_package_id' in params: path_params['otaPackageId'] = params['ota_package_id'] # noqa: E501 query_params = [] if 'checksum' in params: query_params.append(('checksum', params['checksum'])) # noqa: E501 if 'checksum_algorithm' in params: query_params.append(('checksumAlgorithm', params['checksum_algorithm'])) # 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', 'application/octet-stream']) # noqa: E501 # Authentication setting auth_settings = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage/{otaPackageId}{?checksum,checksumAlgorithm}', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='OtaPackageInfo', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def save_ota_package_info_using_post(self, **kwargs): # noqa: E501 """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.save_ota_package_info_using_post(async_req=True) >>> result = thread.get() :param async_req bool :param SaveOtaPackageInfoRequest body: :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 else: (data) = self.save_ota_package_info_using_post_with_http_info(**kwargs) # noqa: E501 return data def save_ota_package_info_using_post_with_http_info(self, **kwargs): # noqa: E501 """Create Or Update OTA Package Info (saveOtaPackageInfo) # noqa: E501 Create or update the OTA Package Info. When creating OTA Package Info, platform generates OTA Package id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created OTA Package id will be present in the response. Specify existing OTA Package id to update the OTA Package Info. Referencing non-existing OTA Package Id will cause 'Not Found' error. OTA Package combination of the title with the version is unique in the scope of tenant. Available for users with 'TENANT_ADMIN' authority. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.save_ota_package_info_using_post_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool :param SaveOtaPackageInfoRequest body: :return: OtaPackageInfo If the method is called asynchronously, returns the request thread. """ all_params = ['body'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in six.iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method save_ota_package_info_using_post" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'body' in params: body_params = params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['X-Authorization'] # noqa: E501 return self.api_client.call_api( '/api/otaPackage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='OtaPackageInfo', # noqa: E501 auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
49.582759
590
0.655794
5,376
43,137
5.013021
0.055804
0.081262
0.044972
0.021373
0.966568
0.956364
0.951132
0.945566
0.937885
0.927941
0
0.021511
0.26286
43,137
869
591
49.639816
0.826027
0.425806
0
0.788009
0
0
0.221285
0.068488
0
0
0
0
0
1
0.036403
false
0
0.008565
0
0.098501
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
8c7adc7ad4638efddd368012be4b46e5c290c7ca
849,812
py
Python
TweakApi/apis/customer_api.py
tweak-com-public/tweak-api-client-python
019f86da11fdb12683d516f8f37db5d717380bcc
[ "Apache-2.0" ]
null
null
null
TweakApi/apis/customer_api.py
tweak-com-public/tweak-api-client-python
019f86da11fdb12683d516f8f37db5d717380bcc
[ "Apache-2.0" ]
null
null
null
TweakApi/apis/customer_api.py
tweak-com-public/tweak-api-client-python
019f86da11fdb12683d516f8f37db5d717380bcc
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 """ tweak-api Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak. OpenAPI spec version: 1.0.8-beta.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from __future__ import absolute_import import sys import os import re # python 2 and python 3 compatibility library from six import iteritems from ..configuration import Configuration from ..api_client import ApiClient class CustomerApi(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): config = Configuration() if api_client: self.api_client = api_client else: if not config.api_client: config.api_client = ApiClient() self.api_client = config.api_client def customers_change_password_post(self, old_password, new_password, **kwargs): """ Change a user's password. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_password_post(old_password, new_password, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str old_password: (required) :param str new_password: (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_change_password_post_with_http_info(old_password, new_password, **kwargs) else: (data) = self.customers_change_password_post_with_http_info(old_password, new_password, **kwargs) return data def customers_change_password_post_with_http_info(self, old_password, new_password, **kwargs): """ Change a user's password. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_password_post_with_http_info(old_password, new_password, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str old_password: (required) :param str new_password: (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['old_password', 'new_password'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_change_password_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'old_password' is set if ('old_password' not in params) or (params['old_password'] is None): raise ValueError("Missing the required parameter `old_password` when calling `customers_change_password_post`") # verify the required parameter 'new_password' is set if ('new_password' not in params) or (params['new_password'] is None): raise ValueError("Missing the required parameter `new_password` when calling `customers_change_password_post`") collection_formats = {} resource_path = '/Customers/change-password'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} if 'old_password' in params: form_params.append(('oldPassword', params['old_password'])) if 'new_password' in params: form_params.append(('newPassword', params['new_password'])) body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_change_stream_get(self, **kwargs): """ Create a change stream. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_stream_get(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str options: :return: file If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_change_stream_get_with_http_info(**kwargs) else: (data) = self.customers_change_stream_get_with_http_info(**kwargs) return data def customers_change_stream_get_with_http_info(self, **kwargs): """ Create a change stream. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_stream_get_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str options: :return: file If the method is called asynchronously, returns the request thread. """ all_params = ['options'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_change_stream_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/change-stream'.replace('{format}', 'json') path_params = {} query_params = {} if 'options' in params: query_params['options'] = params['options'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='file', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_change_stream_post(self, **kwargs): """ Create a change stream. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_stream_post(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str options: :return: file If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_change_stream_post_with_http_info(**kwargs) else: (data) = self.customers_change_stream_post_with_http_info(**kwargs) return data def customers_change_stream_post_with_http_info(self, **kwargs): """ Create a change stream. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_change_stream_post_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str options: :return: file If the method is called asynchronously, returns the request thread. """ all_params = ['options'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_change_stream_post" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/change-stream'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} if 'options' in params: form_params.append(('options', params['options'])) body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='file', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_confirm_get(self, uid, token, **kwargs): """ Confirm a user registration with identity verification token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_confirm_get(uid, token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str uid: (required) :param str token: (required) :param str redirect: :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_confirm_get_with_http_info(uid, token, **kwargs) else: (data) = self.customers_confirm_get_with_http_info(uid, token, **kwargs) return data def customers_confirm_get_with_http_info(self, uid, token, **kwargs): """ Confirm a user registration with identity verification token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_confirm_get_with_http_info(uid, token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str uid: (required) :param str token: (required) :param str redirect: :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['uid', 'token', 'redirect'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_confirm_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'uid' is set if ('uid' not in params) or (params['uid'] is None): raise ValueError("Missing the required parameter `uid` when calling `customers_confirm_get`") # verify the required parameter 'token' is set if ('token' not in params) or (params['token'] is None): raise ValueError("Missing the required parameter `token` when calling `customers_confirm_get`") collection_formats = {} resource_path = '/Customers/confirm'.replace('{format}', 'json') path_params = {} query_params = {} if 'uid' in params: query_params['uid'] = params['uid'] if 'token' in params: query_params['token'] = params['token'] if 'redirect' in params: query_params['redirect'] = params['redirect'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_count_get(self, **kwargs): """ Count instances of the model matched by where from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_count_get(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_count_get_with_http_info(**kwargs) else: (data) = self.customers_count_get_with_http_info(**kwargs) return data def customers_count_get_with_http_info(self, **kwargs): """ Count instances of the model matched by where from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_count_get_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_count_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/count'.replace('{format}', 'json') path_params = {} query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_email_email_exists_get(self, email, **kwargs): """ Define whether customer exists or not This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_email_email_exists_get(email, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str email: Customer email (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_email_email_exists_get_with_http_info(email, **kwargs) else: (data) = self.customers_email_email_exists_get_with_http_info(email, **kwargs) return data def customers_email_email_exists_get_with_http_info(self, email, **kwargs): """ Define whether customer exists or not This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_email_email_exists_get_with_http_info(email, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str email: Customer email (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ all_params = ['email'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_email_email_exists_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'email' is set if ('email' not in params) or (params['email'] is None): raise ValueError("Missing the required parameter `email` when calling `customers_email_email_exists_get`") collection_formats = {} resource_path = '/Customers/email/{email}/exists'.replace('{format}', 'json') path_params = {} if 'email' in params: path_params['email'] = params['email'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2002', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_find_one_get(self, **kwargs): """ Find first instance of the model matched by filter from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_find_one_get(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str filter: Filter defining fields, where, include, order, offset, and limit - must be a JSON-encoded string ({\"something\":\"value\"}) :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_find_one_get_with_http_info(**kwargs) else: (data) = self.customers_find_one_get_with_http_info(**kwargs) return data def customers_find_one_get_with_http_info(self, **kwargs): """ Find first instance of the model matched by filter from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_find_one_get_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str filter: Filter defining fields, where, include, order, offset, and limit - must be a JSON-encoded string ({\"something\":\"value\"}) :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_find_one_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/findOne'.replace('{format}', 'json') path_params = {} query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_get(self, **kwargs): """ Find all instances of the model matched by filter from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_get(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str filter: Filter defining fields, where, include, order, offset, and limit - must be a JSON-encoded string ({\"something\":\"value\"}) :return: list[Customer] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_get_with_http_info(**kwargs) else: (data) = self.customers_get_with_http_info(**kwargs) return data def customers_get_with_http_info(self, **kwargs): """ Find all instances of the model matched by filter from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_get_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str filter: Filter defining fields, where, include, order, offset, and limit - must be a JSON-encoded string ({\"something\":\"value\"}) :return: list[Customer] If the method is called asynchronously, returns the request thread. """ all_params = ['filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers'.replace('{format}', 'json') path_params = {} query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Customer]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_count_get(self, id, **kwargs): """ Counts accessTokens of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_count_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_count_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_access_tokens_count_get_with_http_info(id, **kwargs) return data def customers_id_access_tokens_count_get_with_http_info(self, id, **kwargs): """ Counts accessTokens of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_count_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_count_get`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_delete(self, id, **kwargs): """ Deletes all accessTokens of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_delete(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_delete_with_http_info(id, **kwargs) else: (data) = self.customers_id_access_tokens_delete_with_http_info(id, **kwargs) return data def customers_id_access_tokens_delete_with_http_info(self, id, **kwargs): """ Deletes all accessTokens of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_delete_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_delete`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_fk_delete(self, id, fk, **kwargs): """ Delete a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_delete(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_fk_delete_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_access_tokens_fk_delete_with_http_info(id, fk, **kwargs) return data def customers_id_access_tokens_fk_delete_with_http_info(self, id, fk, **kwargs): """ Delete a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_delete_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_access_tokens_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_fk_get(self, id, fk, **kwargs): """ Find a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_get(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_fk_get_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_access_tokens_fk_get_with_http_info(id, fk, **kwargs) return data def customers_id_access_tokens_fk_get_with_http_info(self, id, fk, **kwargs): """ Find a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_get_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_access_tokens_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_fk_put(self, id, fk, **kwargs): """ Update a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_put(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :param TeamMemberAccessToken data: :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_fk_put_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_access_tokens_fk_put_with_http_info(id, fk, **kwargs) return data def customers_id_access_tokens_fk_put_with_http_info(self, id, fk, **kwargs): """ Update a related item by id for accessTokens. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_fk_put_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for accessTokens (required) :param TeamMemberAccessToken data: :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_access_tokens_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_get(self, id, **kwargs): """ Queries accessTokens of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[TeamMemberAccessToken] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_access_tokens_get_with_http_info(id, **kwargs) return data def customers_id_access_tokens_get_with_http_info(self, id, **kwargs): """ Queries accessTokens of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[TeamMemberAccessToken] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_get`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[TeamMemberAccessToken]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_access_tokens_post(self, id, **kwargs): """ Creates a new instance in accessTokens of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param TeamMemberAccessToken data: :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_access_tokens_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_access_tokens_post_with_http_info(id, **kwargs) return data def customers_id_access_tokens_post_with_http_info(self, id, **kwargs): """ Creates a new instance in accessTokens of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_access_tokens_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param TeamMemberAccessToken data: :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_access_tokens_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_access_tokens_post`") collection_formats = {} resource_path = '/Customers/{id}/accessTokens'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_active_get(self, id, **kwargs): """ Define whether customer is active or not This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_active_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id or email (required) :return: InlineResponse2003 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_active_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_active_get_with_http_info(id, **kwargs) return data def customers_id_active_get_with_http_info(self, id, **kwargs): """ Define whether customer is active or not This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_active_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id or email (required) :return: InlineResponse2003 If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_active_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_active_get`") collection_formats = {} resource_path = '/Customers/{id}/active'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2003', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_delete(self, id, **kwargs): """ Delete a model instance by {{id}} from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_delete(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: object If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_delete_with_http_info(id, **kwargs) else: (data) = self.customers_id_delete_with_http_info(id, **kwargs) return data def customers_id_delete_with_http_info(self, id, **kwargs): """ Delete a model instance by {{id}} from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_delete_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: object If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_delete`") collection_formats = {} resource_path = '/Customers/{id}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_exists_get(self, id, **kwargs): """ Check whether a model instance exists in the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_exists_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_exists_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_exists_get_with_http_info(id, **kwargs) return data def customers_id_exists_get_with_http_info(self, id, **kwargs): """ Check whether a model instance exists in the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_exists_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_exists_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_exists_get`") collection_formats = {} resource_path = '/Customers/{id}/exists'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2002', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_get(self, id, **kwargs): """ Find a model instance by {{id}} from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param str filter: Filter defining fields and include - must be a JSON-encoded string ({\"something\":\"value\"}) :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_get_with_http_info(id, **kwargs) return data def customers_id_get_with_http_info(self, id, **kwargs): """ Find a model instance by {{id}} from the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param str filter: Filter defining fields and include - must be a JSON-encoded string ({\"something\":\"value\"}) :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_get`") collection_formats = {} resource_path = '/Customers/{id}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_head(self, id, **kwargs): """ Check whether a model instance exists in the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_head(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_head_with_http_info(id, **kwargs) else: (data) = self.customers_id_head_with_http_info(id, **kwargs) return data def customers_id_head_with_http_info(self, id, **kwargs): """ Check whether a model instance exists in the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_head_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :return: InlineResponse2002 If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_head" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_head`") collection_formats = {} resource_path = '/Customers/{id}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'HEAD', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2002', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_count_get(self, id, **kwargs): """ Counts invitationTickets of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_count_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_count_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_invitation_tickets_count_get_with_http_info(id, **kwargs) return data def customers_id_invitation_tickets_count_get_with_http_info(self, id, **kwargs): """ Counts invitationTickets of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_count_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_count_get`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_delete(self, id, **kwargs): """ Deletes all invitationTickets of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_delete(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_delete_with_http_info(id, **kwargs) else: (data) = self.customers_id_invitation_tickets_delete_with_http_info(id, **kwargs) return data def customers_id_invitation_tickets_delete_with_http_info(self, id, **kwargs): """ Deletes all invitationTickets of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_delete_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_delete`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_fk_delete(self, id, fk, **kwargs): """ Delete a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_delete(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_fk_delete_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_invitation_tickets_fk_delete_with_http_info(id, fk, **kwargs) return data def customers_id_invitation_tickets_fk_delete_with_http_info(self, id, fk, **kwargs): """ Delete a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_delete_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_invitation_tickets_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_fk_get(self, id, fk, **kwargs): """ Find a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_get(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_fk_get_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_invitation_tickets_fk_get_with_http_info(id, fk, **kwargs) return data def customers_id_invitation_tickets_fk_get_with_http_info(self, id, fk, **kwargs): """ Find a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_get_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_invitation_tickets_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InvitationTicket', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_fk_put(self, id, fk, **kwargs): """ Update a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_put(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :param InvitationTicket data: :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_fk_put_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_invitation_tickets_fk_put_with_http_info(id, fk, **kwargs) return data def customers_id_invitation_tickets_fk_put_with_http_info(self, id, fk, **kwargs): """ Update a related item by id for invitationTickets. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_fk_put_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for invitationTickets (required) :param InvitationTicket data: :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_invitation_tickets_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InvitationTicket', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_get(self, id, **kwargs): """ Queries invitationTickets of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[InvitationTicket] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_invitation_tickets_get_with_http_info(id, **kwargs) return data def customers_id_invitation_tickets_get_with_http_info(self, id, **kwargs): """ Queries invitationTickets of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[InvitationTicket] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_get`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[InvitationTicket]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_invitation_tickets_post(self, id, **kwargs): """ Creates a new instance in invitationTickets of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param InvitationTicket data: :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_invitation_tickets_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_invitation_tickets_post_with_http_info(id, **kwargs) return data def customers_id_invitation_tickets_post_with_http_info(self, id, **kwargs): """ Creates a new instance in invitationTickets of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_invitation_tickets_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param InvitationTicket data: :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_invitation_tickets_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_invitation_tickets_post`") collection_formats = {} resource_path = '/Customers/{id}/invitationTickets'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InvitationTicket', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_patch(self, id, **kwargs): """ Patch attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_patch(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Customer data: An object of model property name/value pairs :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_patch_with_http_info(id, **kwargs) else: (data) = self.customers_id_patch_with_http_info(id, **kwargs) return data def customers_id_patch_with_http_info(self, id, **kwargs): """ Patch attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_patch_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Customer data: An object of model property name/value pairs :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_patch" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_patch`") collection_formats = {} resource_path = '/Customers/{id}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_permission_delete(self, id, **kwargs): """ Deletes permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_delete(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_permission_delete_with_http_info(id, **kwargs) else: (data) = self.customers_id_permission_delete_with_http_info(id, **kwargs) return data def customers_id_permission_delete_with_http_info(self, id, **kwargs): """ Deletes permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_delete_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_permission_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_permission_delete`") collection_formats = {} resource_path = '/Customers/{id}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_permission_get(self, id, **kwargs): """ Fetches hasOne relation permission. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param bool refresh: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_permission_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_permission_get_with_http_info(id, **kwargs) return data def customers_id_permission_get_with_http_info(self, id, **kwargs): """ Fetches hasOne relation permission. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param bool refresh: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'refresh'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_permission_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_permission_get`") collection_formats = {} resource_path = '/Customers/{id}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'refresh' in params: query_params['refresh'] = params['refresh'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CustomerPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_permission_post(self, id, **kwargs): """ Creates a new instance in permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param CustomerPermissionSet data: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_permission_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_permission_post_with_http_info(id, **kwargs) return data def customers_id_permission_post_with_http_info(self, id, **kwargs): """ Creates a new instance in permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param CustomerPermissionSet data: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_permission_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_permission_post`") collection_formats = {} resource_path = '/Customers/{id}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CustomerPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_permission_put(self, id, **kwargs): """ Update permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_put(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param CustomerPermissionSet data: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_permission_put_with_http_info(id, **kwargs) else: (data) = self.customers_id_permission_put_with_http_info(id, **kwargs) return data def customers_id_permission_put_with_http_info(self, id, **kwargs): """ Update permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_permission_put_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param CustomerPermissionSet data: :return: CustomerPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_permission_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_permission_put`") collection_formats = {} resource_path = '/Customers/{id}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CustomerPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_profile_picture_put(self, id, id2, data, **kwargs): """ Change profile picture This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_profile_picture_put(id, id2, data, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param Customer data: Profile picture (required) :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_profile_picture_put_with_http_info(id, id2, data, **kwargs) else: (data) = self.customers_id_profile_picture_put_with_http_info(id, id2, data, **kwargs) return data def customers_id_profile_picture_put_with_http_info(self, id, id2, data, **kwargs): """ Change profile picture This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_profile_picture_put_with_http_info(id, id2, data, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param Customer data: Profile picture (required) :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'id2', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_profile_picture_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_profile_picture_put`") # verify the required parameter 'id2' is set if ('id2' not in params) or (params['id2'] is None): raise ValueError("Missing the required parameter `id2` when calling `customers_id_profile_picture_put`") # verify the required parameter 'data' is set if ('data' not in params) or (params['data'] is None): raise ValueError("Missing the required parameter `data` when calling `customers_id_profile_picture_put`") collection_formats = {} resource_path = '/Customers/{id}/profilePicture'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'id2' in params: path_params['id'] = params['id2'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_put(self, id, **kwargs): """ Replace attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_put(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_put_with_http_info(id, **kwargs) else: (data) = self.customers_id_put_with_http_info(id, **kwargs) return data def customers_id_put_with_http_info(self, id, **kwargs): """ Replace attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_put_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_put`") collection_formats = {} resource_path = '/Customers/{id}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_register_team_post(self, id, **kwargs): """ Register team and assign it to the customer This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_register_team_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Team data: Model instance data :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_register_team_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_register_team_post_with_http_info(id, **kwargs) return data def customers_id_register_team_post_with_http_info(self, id, **kwargs): """ Register team and assign it to the customer This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_register_team_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Team data: Model instance data :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_register_team_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_register_team_post`") collection_formats = {} resource_path = '/Customers/{id}/register/team'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_replace_post(self, id, **kwargs): """ Replace attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_replace_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_replace_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_replace_post_with_http_info(id, **kwargs) return data def customers_id_replace_post_with_http_info(self, id, **kwargs): """ Replace attributes for a model instance and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_replace_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Model id (required) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_replace_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_replace_post`") collection_formats = {} resource_path = '/Customers/{id}/replace'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_count_get(self, id, **kwargs): """ Counts teams of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_count_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_count_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_teams_count_get_with_http_info(id, **kwargs) return data def customers_id_teams_count_get_with_http_info(self, id, **kwargs): """ Counts teams of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_count_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_delete(self, id, **kwargs): """ Deletes all teams of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_delete(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_delete_with_http_info(id, **kwargs) else: (data) = self.customers_id_teams_delete_with_http_info(id, **kwargs) return data def customers_id_teams_delete_with_http_info(self, id, **kwargs): """ Deletes all teams of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_delete_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_fk_delete(self, id, fk, **kwargs): """ Delete a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_delete(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_fk_delete_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_fk_delete_with_http_info(id, fk, **kwargs) return data def customers_id_teams_fk_delete_with_http_info(self, id, fk, **kwargs): """ Delete a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_delete_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_fk_get(self, id, fk, **kwargs): """ Find a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_get(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: Team If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_fk_get_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_fk_get_with_http_info(id, fk, **kwargs) return data def customers_id_teams_fk_get_with_http_info(self, id, fk, **kwargs): """ Find a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_get_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: Team If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Team', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_fk_put(self, id, fk, **kwargs): """ Update a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_put(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :param Team data: :return: Team If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_fk_put_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_fk_put_with_http_info(id, fk, **kwargs) return data def customers_id_teams_fk_put_with_http_info(self, id, fk, **kwargs): """ Update a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_fk_put_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :param Team data: :return: Team If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Team', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_get(self, id, **kwargs): """ Queries teams of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_get(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[Team] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_get_with_http_info(id, **kwargs) else: (data) = self.customers_id_teams_get_with_http_info(id, **kwargs) return data def customers_id_teams_get_with_http_info(self, id, **kwargs): """ Queries teams of Customer. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_get_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str filter: :return: list[Team] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_get`") collection_formats = {} resource_path = '/Customers/{id}/teams'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Team]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_brand_delete(self, id, nk, **kwargs): """ Deletes brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_brand_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_brand_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_brand_delete_with_http_info(self, id, nk, **kwargs): """ Deletes brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_brand_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_brand_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_brand_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/brand'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_brand_get(self, id, nk, **kwargs): """ Fetches hasOne relation brand. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_brand_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_brand_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_brand_get_with_http_info(self, id, nk, **kwargs): """ Fetches hasOne relation brand. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'refresh'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_brand_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_brand_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_brand_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/brand'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'refresh' in params: query_params['refresh'] = params['refresh'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBrand', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_brand_post(self, id, nk, **kwargs): """ Creates a new instance in brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBrand data: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_brand_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_brand_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_brand_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBrand data: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_brand_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_brand_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_brand_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/brand'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBrand', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_brand_put(self, id, nk, **kwargs): """ Update brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_put(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBrand data: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_brand_put_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_brand_put_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_brand_put_with_http_info(self, id, nk, **kwargs): """ Update brand of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_brand_put_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBrand data: :return: TeamBrand If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_brand_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_brand_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_brand_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/brand'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBrand', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_count_get(self, id, nk, **kwargs): """ Counts builderConfigs of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_builder_configs_count_get_with_http_info(self, id, nk, **kwargs): """ Counts builderConfigs of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_delete(self, id, nk, **kwargs): """ Deletes all builderConfigs of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_builder_configs_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all builderConfigs of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_builder_configs_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_builder_configs_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_builder_configs_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_builder_configs_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBuilderConfig', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :param TeamBuilderConfig data: :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_builder_configs_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for builderConfigs. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for builderConfigs (required) :param TeamBuilderConfig data: :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_builder_configs_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBuilderConfig', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_get(self, id, nk, **kwargs): """ Queries builderConfigs of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamBuilderConfig] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_builder_configs_get_with_http_info(self, id, nk, **kwargs): """ Queries builderConfigs of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamBuilderConfig] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[TeamBuilderConfig]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_builder_configs_post(self, id, nk, **kwargs): """ Creates a new instance in builderConfigs of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBuilderConfig data: :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_builder_configs_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_builder_configs_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_builder_configs_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in builderConfigs of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_builder_configs_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamBuilderConfig data: :return: TeamBuilderConfig If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_builder_configs_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_builder_configs_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_builder_configs_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/builderConfigs'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamBuilderConfig', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_count_get(self, id, nk, **kwargs): """ Counts dataSourceSoaps of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_count_get_with_http_info(self, id, nk, **kwargs): """ Counts dataSourceSoaps of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_data_source_soaps_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_data_source_soaps_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DataSourceSoap', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :param DataSourceSoap data: :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for dataSourceSoaps. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dataSourceSoaps (required) :param DataSourceSoap data: :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_data_source_soaps_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DataSourceSoap', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_get(self, id, nk, **kwargs): """ Queries dataSourceSoaps of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[DataSourceSoap] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_get_with_http_info(self, id, nk, **kwargs): """ Queries dataSourceSoaps of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[DataSourceSoap] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[DataSourceSoap]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_data_source_soaps_post(self, id, nk, **kwargs): """ Creates a new instance in dataSourceSoaps of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param DataSourceSoap data: :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_data_source_soaps_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_data_source_soaps_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_data_source_soaps_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in dataSourceSoaps of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_data_source_soaps_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param DataSourceSoap data: :return: DataSourceSoap If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_data_source_soaps_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_data_source_soaps_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_data_source_soaps_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dataSourceSoaps'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DataSourceSoap', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_count_get(self, id, nk, **kwargs): """ Counts dynamicDatas of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_count_get_with_http_info(self, id, nk, **kwargs): """ Counts dynamicDatas of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_dynamic_datas_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :return: DynamicData If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :return: DynamicData If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_dynamic_datas_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DynamicData', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :param DynamicData data: :return: DynamicData If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for dynamicDatas. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for dynamicDatas (required) :param DynamicData data: :return: DynamicData If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_dynamic_datas_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DynamicData', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_get(self, id, nk, **kwargs): """ Queries dynamicDatas of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[DynamicData] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_get_with_http_info(self, id, nk, **kwargs): """ Queries dynamicDatas of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[DynamicData] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[DynamicData]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_dynamic_datas_post(self, id, nk, **kwargs): """ Creates a new instance in dynamicDatas of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param DynamicData data: :return: DynamicData If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_dynamic_datas_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_dynamic_datas_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_dynamic_datas_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in dynamicDatas of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_dynamic_datas_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param DynamicData data: :return: DynamicData If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_dynamic_datas_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_dynamic_datas_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_dynamic_datas_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/dynamicDatas'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DynamicData', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_count_get(self, id, nk, **kwargs): """ Counts imageFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_image_folders_count_get_with_http_info(self, id, nk, **kwargs): """ Counts imageFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_delete(self, id, nk, **kwargs): """ Deletes all imageFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_image_folders_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all imageFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_image_folders_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_image_folders_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :return: ImageFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_image_folders_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :return: ImageFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_image_folders_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ImageFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :param ImageFolder data: :return: ImageFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_image_folders_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for imageFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for imageFolders (required) :param ImageFolder data: :return: ImageFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_image_folders_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ImageFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_get(self, id, nk, **kwargs): """ Queries imageFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ImageFolder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_image_folders_get_with_http_info(self, id, nk, **kwargs): """ Queries imageFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ImageFolder] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[ImageFolder]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_image_folders_post(self, id, nk, **kwargs): """ Creates a new instance in imageFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ImageFolder data: :return: ImageFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_image_folders_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_image_folders_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_image_folders_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in imageFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_image_folders_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ImageFolder data: :return: ImageFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_image_folders_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_image_folders_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_image_folders_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/imageFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ImageFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_count_get(self, id, nk, **kwargs): """ Counts images of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_images_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_images_count_get_with_http_info(self, id, nk, **kwargs): """ Counts images of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_delete(self, id, nk, **kwargs): """ Deletes all images of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_images_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_images_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all images of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_images_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_images_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_images_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :return: Image If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_images_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_images_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :return: Image If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_images_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Image', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :param Image data: :return: Image If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_images_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_images_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for images. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for images (required) :param Image data: :return: Image If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_images_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Image', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_get(self, id, nk, **kwargs): """ Queries images of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Image] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_images_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_images_get_with_http_info(self, id, nk, **kwargs): """ Queries images of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Image] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Image]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_images_post(self, id, nk, **kwargs): """ Creates a new instance in images of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Image data: :return: Image If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_images_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_images_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_images_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in images of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_images_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Image data: :return: Image If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_images_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_images_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_images_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/images'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Image', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_count_get(self, id, nk, **kwargs): """ Counts members of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_members_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_members_count_get_with_http_info(self, id, nk, **kwargs): """ Counts members of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_delete(self, id, nk, **kwargs): """ Deletes all members of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_members_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_members_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all members of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :param Customer data: :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :param Customer data: :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_get(self, id, nk, **kwargs): """ Queries members of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Customer] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_members_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_members_get_with_http_info(self, id, nk, **kwargs): """ Queries members of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Customer] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Customer]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_post(self, id, nk, **kwargs): """ Creates a new instance in members of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Customer data: :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_members_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_members_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in members of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Customer data: :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_rel_fk_delete(self, id, nk, fk, **kwargs): """ Remove the members relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_rel_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_rel_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_rel_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Remove the members relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_rel_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_rel_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_rel_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_rel_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_rel_fk_head(self, id, nk, fk, **kwargs): """ Check the existence of members relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_head(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: bool If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_rel_fk_head_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_rel_fk_head_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_rel_fk_head_with_http_info(self, id, nk, fk, **kwargs): """ Check the existence of members relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_head_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :return: bool If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_rel_fk_head" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_rel_fk_head`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_rel_fk_head`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_rel_fk_head`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'HEAD', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='bool', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_members_rel_fk_put(self, id, nk, fk, **kwargs): """ Add a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_members_rel_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_members_rel_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_members_rel_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Add a related item by id for members. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_members_rel_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for members (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_members_rel_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_members_rel_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_members_rel_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_members_rel_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/members/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_permission_delete(self, id, nk, **kwargs): """ Deletes permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_permission_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_permission_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_permission_delete_with_http_info(self, id, nk, **kwargs): """ Deletes permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_permission_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_permission_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_permission_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_permission_get(self, id, nk, **kwargs): """ Fetches hasOne relation permission. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_permission_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_permission_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_permission_get_with_http_info(self, id, nk, **kwargs): """ Fetches hasOne relation permission. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'refresh'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_permission_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_permission_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_permission_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'refresh' in params: query_params['refresh'] = params['refresh'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_permission_post(self, id, nk, **kwargs): """ Creates a new instance in permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamPermissionSet data: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_permission_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_permission_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_permission_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamPermissionSet data: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_permission_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_permission_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_permission_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_permission_put(self, id, nk, **kwargs): """ Update permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_put(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamPermissionSet data: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_permission_put_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_permission_put_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_permission_put_with_http_info(self, id, nk, **kwargs): """ Update permission of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_permission_put_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamPermissionSet data: :return: TeamPermissionSet If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_permission_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_permission_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_permission_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/permission'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamPermissionSet', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_count_get(self, id, nk, **kwargs): """ Counts portals of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_portals_count_get_with_http_info(self, id, nk, **kwargs): """ Counts portals of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_delete(self, id, nk, **kwargs): """ Deletes all portals of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_portals_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all portals of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_portals_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_portals_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :return: Portal If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_portals_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :return: Portal If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_portals_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Portal', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :param Portal data: :return: Portal If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_portals_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for portals. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for portals (required) :param Portal data: :return: Portal If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_portals_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Portal', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_get(self, id, nk, **kwargs): """ Queries portals of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Portal] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_portals_get_with_http_info(self, id, nk, **kwargs): """ Queries portals of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Portal] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Portal]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_portals_post(self, id, nk, **kwargs): """ Creates a new instance in portals of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Portal data: :return: Portal If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_portals_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_portals_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_portals_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in portals of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_portals_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Portal data: :return: Portal If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_portals_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_portals_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_portals_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/portals'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Portal', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_count_get(self, id, nk, **kwargs): """ Counts productMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_materials_count_get_with_http_info(self, id, nk, **kwargs): """ Counts productMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_delete(self, id, nk, **kwargs): """ Deletes all productMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_materials_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all productMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_materials_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_materials_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_materials_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_materials_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :param ProductMaterial data: :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_materials_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for productMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productMaterials (required) :param ProductMaterial data: :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_materials_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_get(self, id, nk, **kwargs): """ Queries productMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductMaterial] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_materials_get_with_http_info(self, id, nk, **kwargs): """ Queries productMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductMaterial] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[ProductMaterial]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_materials_post(self, id, nk, **kwargs): """ Creates a new instance in productMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ProductMaterial data: :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_materials_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_materials_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_materials_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in productMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_materials_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ProductMaterial data: :return: ProductMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_materials_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_materials_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_materials_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_count_get(self, id, nk, **kwargs): """ Counts productPdfColorProfiles of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_count_get_with_http_info(self, id, nk, **kwargs): """ Counts productPdfColorProfiles of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_delete(self, id, nk, **kwargs): """ Deletes all productPdfColorProfiles of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all productPdfColorProfiles of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :return: ProductPdfColorProfile If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :return: ProductPdfColorProfile If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductPdfColorProfile', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :param ProductPdfColorProfile data: :return: ProductPdfColorProfile If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for productPdfColorProfiles. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productPdfColorProfiles (required) :param ProductPdfColorProfile data: :return: ProductPdfColorProfile If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_pdf_color_profiles_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductPdfColorProfile', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_pdf_color_profiles_get(self, id, nk, **kwargs): """ Queries productPdfColorProfiles of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductPdfColorProfile] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_pdf_color_profiles_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_pdf_color_profiles_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_pdf_color_profiles_get_with_http_info(self, id, nk, **kwargs): """ Queries productPdfColorProfiles of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_pdf_color_profiles_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductPdfColorProfile] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_pdf_color_profiles_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_pdf_color_profiles_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_pdf_color_profiles_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productPdfColorProfiles'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[ProductPdfColorProfile]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_count_get(self, id, nk, **kwargs): """ Counts productSizeMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_size_materials_count_get_with_http_info(self, id, nk, **kwargs): """ Counts productSizeMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_delete(self, id, nk, **kwargs): """ Deletes all productSizeMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_size_materials_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all productSizeMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_size_materials_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_size_materials_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_size_materials_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_size_materials_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductSizeMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :param ProductSizeMaterial data: :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_product_size_materials_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for productSizeMaterials. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for productSizeMaterials (required) :param ProductSizeMaterial data: :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_product_size_materials_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductSizeMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_get(self, id, nk, **kwargs): """ Queries productSizeMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductSizeMaterial] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_size_materials_get_with_http_info(self, id, nk, **kwargs): """ Queries productSizeMaterials of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[ProductSizeMaterial] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[ProductSizeMaterial]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_product_size_materials_post(self, id, nk, **kwargs): """ Creates a new instance in productSizeMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ProductSizeMaterial data: :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_product_size_materials_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_product_size_materials_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_product_size_materials_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in productSizeMaterials of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_product_size_materials_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param ProductSizeMaterial data: :return: ProductSizeMaterial If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_product_size_materials_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_product_size_materials_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_product_size_materials_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/productSizeMaterials'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ProductSizeMaterial', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_data_get(self, id, nk, **kwargs): """ Fetches belongsTo relation teamData. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_data_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: DynamicData If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_data_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_team_data_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_team_data_get_with_http_info(self, id, nk, **kwargs): """ Fetches belongsTo relation teamData. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_data_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param bool refresh: :return: DynamicData If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'refresh'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_data_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_data_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_data_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamData'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'refresh' in params: query_params['refresh'] = params['refresh'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='DynamicData', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_count_get(self, id, nk, **kwargs): """ Counts teamMembers of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_team_members_count_get_with_http_info(self, id, nk, **kwargs): """ Counts teamMembers of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_delete(self, id, nk, **kwargs): """ Deletes all teamMembers of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_team_members_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all teamMembers of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_team_members_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_team_members_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_team_members_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_team_members_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_team_members_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for teamMembers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for teamMembers (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_team_members_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_get(self, id, nk, **kwargs): """ Queries teamMembers of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamMember] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_team_members_get_with_http_info(self, id, nk, **kwargs): """ Queries teamMembers of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamMember] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[TeamMember]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_team_members_post(self, id, nk, **kwargs): """ Creates a new instance in teamMembers of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_team_members_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_team_members_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_team_members_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in teamMembers of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_team_members_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_team_members_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_team_members_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_team_members_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/teamMembers'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_count_get(self, id, nk, **kwargs): """ Counts templateFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_template_folders_count_get_with_http_info(self, id, nk, **kwargs): """ Counts templateFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_delete(self, id, nk, **kwargs): """ Deletes all templateFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_template_folders_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all templateFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_template_folders_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_template_folders_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_template_folders_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_template_folders_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamTemplateFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :param TeamTemplateFolder data: :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_template_folders_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for templateFolders. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templateFolders (required) :param TeamTemplateFolder data: :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_template_folders_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamTemplateFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_get(self, id, nk, **kwargs): """ Queries templateFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamTemplateFolder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_template_folders_get_with_http_info(self, id, nk, **kwargs): """ Queries templateFolders of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[TeamTemplateFolder] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[TeamTemplateFolder]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_template_folders_post(self, id, nk, **kwargs): """ Creates a new instance in templateFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamTemplateFolder data: :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_template_folders_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_template_folders_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_template_folders_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in templateFolders of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_template_folders_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param TeamTemplateFolder data: :return: TeamTemplateFolder If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_template_folders_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_template_folders_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_template_folders_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templateFolders'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamTemplateFolder', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_count_get(self, id, nk, **kwargs): """ Counts templates of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_templates_count_get_with_http_info(self, id, nk, **kwargs): """ Counts templates of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_delete(self, id, nk, **kwargs): """ Deletes all templates of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_templates_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all templates of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_templates_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_templates_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :return: Template If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_templates_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :return: Template If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_templates_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Template', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :param Template data: :return: Template If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_templates_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for templates. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for templates (required) :param Template data: :return: Template If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_templates_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Template', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_get(self, id, nk, **kwargs): """ Queries templates of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Template] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_templates_get_with_http_info(self, id, nk, **kwargs): """ Queries templates of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Template] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Template]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_templates_post(self, id, nk, **kwargs): """ Creates a new instance in templates of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Template data: :return: Template If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_templates_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_templates_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_templates_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in templates of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_templates_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Template data: :return: Template If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_templates_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_templates_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_templates_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/templates'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Template', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_count_get(self, id, nk, **kwargs): """ Counts workflows of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_count_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_count_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_count_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_workflows_count_get_with_http_info(self, id, nk, **kwargs): """ Counts workflows of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_count_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str where: Criteria to match model instances :return: InlineResponse2001 If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'where'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_count_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_count_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_count_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows/count'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'where' in params: query_params['where'] = params['where'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InlineResponse2001', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_delete(self, id, nk, **kwargs): """ Deletes all workflows of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_delete(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_delete_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_delete_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_workflows_delete_with_http_info(self, id, nk, **kwargs): """ Deletes all workflows of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_delete_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_fk_delete(self, id, nk, fk, **kwargs): """ Delete a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_delete(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_fk_delete_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_fk_delete_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_workflows_fk_delete_with_http_info(self, id, nk, fk, **kwargs): """ Delete a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_delete_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_fk_delete`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_workflows_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_fk_get(self, id, nk, fk, **kwargs): """ Find a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_get(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :return: Workflow If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_fk_get_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_fk_get_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_workflows_fk_get_with_http_info(self, id, nk, fk, **kwargs): """ Find a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_get_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :return: Workflow If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_fk_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_fk_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_fk_get`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_workflows_fk_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Workflow', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_fk_put(self, id, nk, fk, **kwargs): """ Update a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_put(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :param Workflow data: :return: Workflow If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_fk_put_with_http_info(id, nk, fk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_fk_put_with_http_info(id, nk, fk, **kwargs) return data def customers_id_teams_nk_workflows_fk_put_with_http_info(self, id, nk, fk, **kwargs): """ Update a related item by id for workflows. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_fk_put_with_http_info(id, nk, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str fk: Foreign key for workflows (required) :param Workflow data: :return: Workflow If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_fk_put`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_nk_workflows_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Workflow', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_get(self, id, nk, **kwargs): """ Queries workflows of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_get(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Workflow] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_get_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_get_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_workflows_get_with_http_info(self, id, nk, **kwargs): """ Queries workflows of Team. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_get_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param str filter: :return: list[Workflow] If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'filter'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_get`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_get`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} if 'filter' in params: query_params['filter'] = params['filter'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Workflow]', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_nk_workflows_post(self, id, nk, **kwargs): """ Creates a new instance in workflows of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_post(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Workflow data: :return: Workflow If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_nk_workflows_post_with_http_info(id, nk, **kwargs) else: (data) = self.customers_id_teams_nk_workflows_post_with_http_info(id, nk, **kwargs) return data def customers_id_teams_nk_workflows_post_with_http_info(self, id, nk, **kwargs): """ Creates a new instance in workflows of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_nk_workflows_post_with_http_info(id, nk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str nk: Foreign key for teams. (required) :param Workflow data: :return: Workflow If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'nk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_nk_workflows_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_nk_workflows_post`") # verify the required parameter 'nk' is set if ('nk' not in params) or (params['nk'] is None): raise ValueError("Missing the required parameter `nk` when calling `customers_id_teams_nk_workflows_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{nk}/workflows'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'nk' in params: path_params['nk'] = params['nk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Workflow', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_post(self, id, **kwargs): """ Creates a new instance in teams of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Team data: :return: Team If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_teams_post_with_http_info(id, **kwargs) return data def customers_id_teams_post_with_http_info(self, id, **kwargs): """ Creates a new instance in teams of this model. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param Team data: :return: Team If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_post`") collection_formats = {} resource_path = '/Customers/{id}/teams'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Team', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_rel_fk_delete(self, id, fk, **kwargs): """ Remove the teams relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_delete(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_rel_fk_delete_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_rel_fk_delete_with_http_info(id, fk, **kwargs) return data def customers_id_teams_rel_fk_delete_with_http_info(self, id, fk, **kwargs): """ Remove the teams relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_delete_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_rel_fk_delete" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_rel_fk_delete`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_rel_fk_delete`") collection_formats = {} resource_path = '/Customers/{id}/teams/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_rel_fk_head(self, id, fk, **kwargs): """ Check the existence of teams relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_head(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: bool If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_rel_fk_head_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_rel_fk_head_with_http_info(id, fk, **kwargs) return data def customers_id_teams_rel_fk_head_with_http_info(self, id, fk, **kwargs): """ Check the existence of teams relation to an item by id. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_head_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :return: bool If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_rel_fk_head" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_rel_fk_head`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_rel_fk_head`") collection_formats = {} resource_path = '/Customers/{id}/teams/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'HEAD', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='bool', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_rel_fk_put(self, id, fk, **kwargs): """ Add a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_put(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_rel_fk_put_with_http_info(id, fk, **kwargs) else: (data) = self.customers_id_teams_rel_fk_put_with_http_info(id, fk, **kwargs) return data def customers_id_teams_rel_fk_put_with_http_info(self, id, fk, **kwargs): """ Add a related item by id for teams. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_rel_fk_put_with_http_info(id, fk, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str fk: Foreign key for teams (required) :param TeamMember data: :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'fk', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_rel_fk_put" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_rel_fk_put`") # verify the required parameter 'fk' is set if ('fk' not in params) or (params['fk'] is None): raise ValueError("Missing the required parameter `fk` when calling `customers_id_teams_rel_fk_put`") collection_formats = {} resource_path = '/Customers/{id}/teams/rel/{fk}'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'fk' in params: path_params['fk'] = params['fk'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_team_id_change_post(self, id, id2, team_id, **kwargs): """ Move authentication to a Team This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_team_id_change_post(id, id2, team_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param str team_id: Team id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_team_id_change_post_with_http_info(id, id2, team_id, **kwargs) else: (data) = self.customers_id_teams_team_id_change_post_with_http_info(id, id2, team_id, **kwargs) return data def customers_id_teams_team_id_change_post_with_http_info(self, id, id2, team_id, **kwargs): """ Move authentication to a Team This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_team_id_change_post_with_http_info(id, id2, team_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param str team_id: Team id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'id2', 'team_id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_team_id_change_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_team_id_change_post`") # verify the required parameter 'id2' is set if ('id2' not in params) or (params['id2'] is None): raise ValueError("Missing the required parameter `id2` when calling `customers_id_teams_team_id_change_post`") # verify the required parameter 'team_id' is set if ('team_id' not in params) or (params['team_id'] is None): raise ValueError("Missing the required parameter `team_id` when calling `customers_id_teams_team_id_change_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{teamId}/change'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'id2' in params: path_params['id'] = params['id2'] if 'team_id' in params: path_params['teamId'] = params['team_id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_teams_team_id_portals_portal_id_change_post(self, id, id2, team_id, portal_id, **kwargs): """ Move authentication to a Portal This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_team_id_portals_portal_id_change_post(id, id2, team_id, portal_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param str team_id: Team id (required) :param str portal_id: Portal id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_teams_team_id_portals_portal_id_change_post_with_http_info(id, id2, team_id, portal_id, **kwargs) else: (data) = self.customers_id_teams_team_id_portals_portal_id_change_post_with_http_info(id, id2, team_id, portal_id, **kwargs) return data def customers_id_teams_team_id_portals_portal_id_change_post_with_http_info(self, id, id2, team_id, portal_id, **kwargs): """ Move authentication to a Portal This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_teams_team_id_portals_portal_id_change_post_with_http_info(id, id2, team_id, portal_id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :param str team_id: Team id (required) :param str portal_id: Portal id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'id2', 'team_id', 'portal_id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_teams_team_id_portals_portal_id_change_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_teams_team_id_portals_portal_id_change_post`") # verify the required parameter 'id2' is set if ('id2' not in params) or (params['id2'] is None): raise ValueError("Missing the required parameter `id2` when calling `customers_id_teams_team_id_portals_portal_id_change_post`") # verify the required parameter 'team_id' is set if ('team_id' not in params) or (params['team_id'] is None): raise ValueError("Missing the required parameter `team_id` when calling `customers_id_teams_team_id_portals_portal_id_change_post`") # verify the required parameter 'portal_id' is set if ('portal_id' not in params) or (params['portal_id'] is None): raise ValueError("Missing the required parameter `portal_id` when calling `customers_id_teams_team_id_portals_portal_id_change_post`") collection_formats = {} resource_path = '/Customers/{id}/teams/{teamId}/portals/{portalId}/change'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'id2' in params: path_params['id'] = params['id2'] if 'team_id' in params: path_params['teamId'] = params['team_id'] if 'portal_id' in params: path_params['portalId'] = params['portal_id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_token_get(self, id, id2, **kwargs): """ Get token info This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_token_get(id, id2, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_token_get_with_http_info(id, id2, **kwargs) else: (data) = self.customers_id_token_get_with_http_info(id, id2, **kwargs) return data def customers_id_token_get_with_http_info(self, id, id2, **kwargs): """ Get token info This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_token_get_with_http_info(id, id2, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :param str id2: Customer id (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['id', 'id2'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_token_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_token_get`") # verify the required parameter 'id2' is set if ('id2' not in params) or (params['id2'] is None): raise ValueError("Missing the required parameter `id2` when calling `customers_id_token_get`") collection_formats = {} resource_path = '/Customers/{id}/token'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] if 'id2' in params: path_params['id'] = params['id2'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_id_verify_post(self, id, **kwargs): """ Trigger user's identity verification with configured verifyOptions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_verify_post(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_id_verify_post_with_http_info(id, **kwargs) else: (data) = self.customers_id_verify_post_with_http_info(id, **kwargs) return data def customers_id_verify_post_with_http_info(self, id, **kwargs): """ Trigger user's identity verification with configured verifyOptions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_id_verify_post_with_http_info(id, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str id: Customer id (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['id'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_id_verify_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): raise ValueError("Missing the required parameter `id` when calling `customers_id_verify_post`") collection_formats = {} resource_path = '/Customers/{id}/verify'.replace('{format}', 'json') path_params = {} if 'id' in params: path_params['id'] = params['id'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_invitation_tickets_token_accept_post(self, token, **kwargs): """ Accept invitation with token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_invitation_tickets_token_accept_post(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Token describing invitation ticket (required) :param Customer data: Customer data in case new customer :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_invitation_tickets_token_accept_post_with_http_info(token, **kwargs) else: (data) = self.customers_invitation_tickets_token_accept_post_with_http_info(token, **kwargs) return data def customers_invitation_tickets_token_accept_post_with_http_info(self, token, **kwargs): """ Accept invitation with token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_invitation_tickets_token_accept_post_with_http_info(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Token describing invitation ticket (required) :param Customer data: Customer data in case new customer :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ all_params = ['token', 'data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_invitation_tickets_token_accept_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'token' is set if ('token' not in params) or (params['token'] is None): raise ValueError("Missing the required parameter `token` when calling `customers_invitation_tickets_token_accept_post`") collection_formats = {} resource_path = '/Customers/invitationTickets/{token}/accept'.replace('{format}', 'json') path_params = {} if 'token' in params: path_params['token'] = params['token'] query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InvitationTicket', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_invitation_tickets_token_get(self, token, **kwargs): """ Get invitation details with token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_invitation_tickets_token_get(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Token describing invitation ticket (required) :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_invitation_tickets_token_get_with_http_info(token, **kwargs) else: (data) = self.customers_invitation_tickets_token_get_with_http_info(token, **kwargs) return data def customers_invitation_tickets_token_get_with_http_info(self, token, **kwargs): """ Get invitation details with token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_invitation_tickets_token_get_with_http_info(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Token describing invitation ticket (required) :return: InvitationTicket If the method is called asynchronously, returns the request thread. """ all_params = ['token'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_invitation_tickets_token_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'token' is set if ('token' not in params) or (params['token'] is None): raise ValueError("Missing the required parameter `token` when calling `customers_invitation_tickets_token_get`") collection_formats = {} resource_path = '/Customers/invitationTickets/{token}'.replace('{format}', 'json') path_params = {} if 'token' in params: path_params['token'] = params['token'] 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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='InvitationTicket', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_login_post(self, credentials, **kwargs): """ Login a user with username/email and password. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_login_post(credentials, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param object credentials: (required) :param str include: Related objects to include in the response. See the description of return value for more details. :return: object If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_login_post_with_http_info(credentials, **kwargs) else: (data) = self.customers_login_post_with_http_info(credentials, **kwargs) return data def customers_login_post_with_http_info(self, credentials, **kwargs): """ Login a user with username/email and password. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_login_post_with_http_info(credentials, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param object credentials: (required) :param str include: Related objects to include in the response. See the description of return value for more details. :return: object If the method is called asynchronously, returns the request thread. """ all_params = ['credentials', 'include'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_login_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'credentials' is set if ('credentials' not in params) or (params['credentials'] is None): raise ValueError("Missing the required parameter `credentials` when calling `customers_login_post`") collection_formats = {} resource_path = '/Customers/login'.replace('{format}', 'json') path_params = {} query_params = {} if 'include' in params: query_params['include'] = params['include'] header_params = {} form_params = [] local_var_files = {} body_params = None if 'credentials' in params: body_params = params['credentials'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='object', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_logout_post(self, **kwargs): """ Logout a user with access token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_logout_post(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_logout_post_with_http_info(**kwargs) else: (data) = self.customers_logout_post_with_http_info(**kwargs) return data def customers_logout_post_with_http_info(self, **kwargs): """ Logout a user with access token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_logout_post_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: None If the method is called asynchronously, returns the request thread. """ all_params = [] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_logout_post" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/logout'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_me_token_get(self, **kwargs): """ Get token info This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_me_token_get(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_me_token_get_with_http_info(**kwargs) else: (data) = self.customers_me_token_get_with_http_info(**kwargs) return data def customers_me_token_get_with_http_info(self, **kwargs): """ Get token info This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_me_token_get_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = [] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_me_token_get" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/me/token'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_me_token_refresh_get(self, refresh_token, **kwargs): """ Refresh current access token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_me_token_refresh_get(refresh_token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str refresh_token: AccessToken refreshToken (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_me_token_refresh_get_with_http_info(refresh_token, **kwargs) else: (data) = self.customers_me_token_refresh_get_with_http_info(refresh_token, **kwargs) return data def customers_me_token_refresh_get_with_http_info(self, refresh_token, **kwargs): """ Refresh current access token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_me_token_refresh_get_with_http_info(refresh_token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str refresh_token: AccessToken refreshToken (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['refresh_token'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_me_token_refresh_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'refresh_token' is set if ('refresh_token' not in params) or (params['refresh_token'] is None): raise ValueError("Missing the required parameter `refresh_token` when calling `customers_me_token_refresh_get`") collection_formats = {} resource_path = '/Customers/me/token/refresh'.replace('{format}', 'json') path_params = {} query_params = {} if 'refresh_token' in params: query_params['refreshToken'] = params['refresh_token'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_post(self, **kwargs): """ Create a new instance of the model and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_post(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_post_with_http_info(**kwargs) else: (data) = self.customers_post_with_http_info(**kwargs) return data def customers_post_with_http_info(self, **kwargs): """ Create a new instance of the model and persist it into the data source. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_post_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param Customer data: Model instance data :return: Customer If the method is called asynchronously, returns the request thread. """ all_params = ['data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_post" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Customer', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_register_post(self, **kwargs): """ Create customer and assign it to a team This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_register_post(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param Customer data: Model instance data :return: TeamMember If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_register_post_with_http_info(**kwargs) else: (data) = self.customers_register_post_with_http_info(**kwargs) return data def customers_register_post_with_http_info(self, **kwargs): """ Create customer and assign it to a team This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_register_post_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param Customer data: Model instance data :return: TeamMember If the method is called asynchronously, returns the request thread. """ all_params = ['data'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_register_post" % key ) params[key] = val del params['kwargs'] collection_formats = {} resource_path = '/Customers/register'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'data' in params: body_params = params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMember', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_reset_password_post(self, new_password, **kwargs): """ Reset user's password via a password-reset token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_password_post(new_password, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str new_password: (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_reset_password_post_with_http_info(new_password, **kwargs) else: (data) = self.customers_reset_password_post_with_http_info(new_password, **kwargs) return data def customers_reset_password_post_with_http_info(self, new_password, **kwargs): """ Reset user's password via a password-reset token. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_password_post_with_http_info(new_password, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str new_password: (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['new_password'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_reset_password_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'new_password' is set if ('new_password' not in params) or (params['new_password'] is None): raise ValueError("Missing the required parameter `new_password` when calling `customers_reset_password_post`") collection_formats = {} resource_path = '/Customers/reset-password'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} if 'new_password' in params: form_params.append(('newPassword', params['new_password'])) body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_reset_password_token_get(self, token, **kwargs): """ Get token info for reset password token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_password_token_get(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Reset password access token (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_reset_password_token_get_with_http_info(token, **kwargs) else: (data) = self.customers_reset_password_token_get_with_http_info(token, **kwargs) return data def customers_reset_password_token_get_with_http_info(self, token, **kwargs): """ Get token info for reset password token This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_password_token_get_with_http_info(token, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str token: Reset password access token (required) :return: TeamMemberAccessToken If the method is called asynchronously, returns the request thread. """ all_params = ['token'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_reset_password_token_get" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'token' is set if ('token' not in params) or (params['token'] is None): raise ValueError("Missing the required parameter `token` when calling `customers_reset_password_token_get`") collection_formats = {} resource_path = '/Customers/reset-password/token'.replace('{format}', 'json') path_params = {} query_params = {} if 'token' in params: query_params['token'] = params['token'] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TeamMemberAccessToken', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats) def customers_reset_post(self, options, **kwargs): """ Reset password for a user with email. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_post(options, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param object options: (required) :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.customers_reset_post_with_http_info(options, **kwargs) else: (data) = self.customers_reset_post_with_http_info(options, **kwargs) return data def customers_reset_post_with_http_info(self, options, **kwargs): """ Reset password for a user with email. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.customers_reset_post_with_http_info(options, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param object options: (required) :return: None If the method is called asynchronously, returns the request thread. """ all_params = ['options'] all_params.append('callback') all_params.append('_return_http_data_only') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method customers_reset_post" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'options' is set if ('options' not in params) or (params['options'] is None): raise ValueError("Missing the required parameter `options` when calling `customers_reset_post`") collection_formats = {} resource_path = '/Customers/reset'.replace('{format}', 'json') path_params = {} query_params = {} header_params = {} form_params = [] local_var_files = {} body_params = None if 'options' in params: body_params = params['options'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']) # Authentication setting auth_settings = ['access_token'] return self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), collection_formats=collection_formats)
43.07644
165
0.572873
90,371
849,812
5.151708
0.00405
0.057736
0.042409
0.043109
0.995736
0.9944
0.993144
0.989952
0.987714
0.984037
0
0.000597
0.340165
849,812
19,727
166
43.078623
0.829677
0.304449
0
0.845632
0
0
0.204632
0.085932
0
0
0
0
0
1
0.035729
false
0.003499
0.000742
0
0.090013
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
8c9d03f45721c11abfc26e5a07b04a7c61812a80
198
py
Python
analyze_log.py
clinfo/DeepKF
ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1
[ "MIT" ]
5
2019-12-19T13:33:36.000Z
2021-06-01T06:08:16.000Z
analyze_log.py
clinfo/DeepKF
ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1
[ "MIT" ]
24
2020-03-03T19:40:55.000Z
2021-05-26T15:27:38.000Z
analyze_log.py
clinfo/DeepKF
ee4f1be28e5f3bfa46bb47dbdc4d5f678eed36c1
[ "MIT" ]
1
2019-12-19T13:35:07.000Z
2019-12-19T13:35:07.000Z
import re # step 690, training cost 38680.1, validation cost 668.839 (model_2d/model/model.00690.ckpt) [error=0.0893403,alpha=0.997261] # training:[33027,4250.21,0] validation:[565.033,85.7933,0]
39.6
125
0.747475
35
198
4.2
0.771429
0
0
0
0
0
0
0
0
0
0
0.338889
0.090909
198
4
126
49.5
0.477778
0.919192
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
7
50952a69e93ba0cc4b26663f0ece18a27c14087f
3,241
py
Python
src/db-up/azext_db_up/_help.py
Mannan2812/azure-cli-extensions
e2b34efe23795f6db9c59100534a40f0813c3d95
[ "MIT" ]
207
2017-11-29T06:59:41.000Z
2022-03-31T10:00:53.000Z
src/db-up/azext_db_up/_help.py
Mannan2812/azure-cli-extensions
e2b34efe23795f6db9c59100534a40f0813c3d95
[ "MIT" ]
4,061
2017-10-27T23:19:56.000Z
2022-03-31T23:18:30.000Z
src/db-up/azext_db_up/_help.py
Mannan2812/azure-cli-extensions
e2b34efe23795f6db9c59100534a40f0813c3d95
[ "MIT" ]
802
2017-10-11T17:36:26.000Z
2022-03-31T22:24:32.000Z
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from knack.help_files import helps helps['mysql up'] = """ type: command short-summary: Set up an Azure Database for MySQL server and configurations. examples: - name: Ensure that a Azure Database for MySQL server is up and running and configured for immediate use. text: az mysql up - name: To override default names, provide parameters indicating desired values/existing resources. text: az mysql up -g MyResourceGroup -s MyServer -d MyDatabase -u MyUsername -p MyPassword """ helps['postgres up'] = """ type: command short-summary: Set up an Azure Database for PostgreSQL server and configurations. examples: - name: Ensure that a Azure Database for PostgreSQL server is up and running and configured for immediate use. text: az postgres up - name: To override default names, provide parameters indicating desired values/existing resources. text: az postgres up -g MyResourceGroup -s MyServer -d MyDatabase -u MyUsername -p MyPassword """ helps['sql up'] = """ type: command short-summary: Set up an Azure Database for SQL server and configurations. examples: - name: Ensure that a Azure Database for SQL server is up and running and configured for immediate use. text: az sql up - name: To override default names, provide parameters indicating desired values/existing resources. text: az sql up -g MyResourceGroup -s MyServer -d MyDatabase -u MyUsername -p MyPassword """ helps['mysql down'] = """ type: command short-summary: Delete the MySQL server and its cached information. examples: - name: Delete the server and the cached data, aside from the resource group. text: az mysql down - name: Delete the resource group and the full cache. text: az mysql down --delete-group """ helps['postgres down'] = """ type: command short-summary: Delete the PostgreSQL server and its cached information. examples: - name: Delete the server and the cached data, aside from the resource group. text: az postgres down - name: Delete the resource group and the full cache. text: az postgres down --delete-group """ helps['sql down'] = """ type: command short-summary: Delete the SQL server and its cached information. examples: - name: Delete the server and the cached data, aside from the resource group. text: az sql down - name: Delete the resource group and the full cache. text: az sql down --delete-group """ helps['mysql show-connection-string'] = """ type: command short-summary: Show the connection strings for a MySQL server database. """ helps['postgres show-connection-string'] = """ type: command short-summary: Show the connection strings for a PostgreSQL server database. """
41.551282
118
0.648257
406
3,241
5.172414
0.216749
0.034286
0.060952
0.087619
0.813333
0.79619
0.79619
0.744762
0.744762
0.744762
0
0
0.226165
3,241
77
119
42.090909
0.837321
0.103672
0
0.492063
0
0.047619
0.93069
0.015172
0
0
0
0
0
1
0
true
0.047619
0.015873
0
0.015873
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
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
8
50f781b025802dae338731ba0d9e8e2ff7700d6d
6,117
py
Python
sap2012/SAP_tables/heating_requirement_table_9c.py
building-energy/sap2012
4cb3a362be4662b0e96c56a3765771f0cba91422
[ "MIT" ]
7
2021-04-17T21:55:37.000Z
2021-08-19T13:06:16.000Z
sap2012/SAP_tables/heating_requirement_table_9c.py
building-energy/sap2012
4cb3a362be4662b0e96c56a3765771f0cba91422
[ "MIT" ]
null
null
null
sap2012/SAP_tables/heating_requirement_table_9c.py
building-energy/sap2012
4cb3a362be4662b0e96c56a3765771f0cba91422
[ "MIT" ]
2
2021-03-21T16:14:50.000Z
2021-04-20T08:54:41.000Z
# -*- coding: utf-8 -*- def heating_requirement_table_9c ( temperature_reduction_when_heating_is_off_1_weekday_living_room, temperature_reduction_when_heating_is_off_2_weekday_living_room, temperature_reduction_when_heating_is_off_1_weekend_living_room, temperature_reduction_when_heating_is_off_2_weekend_living_room, temperature_reduction_when_heating_is_off_1_weekday_rest_of_dwelling, temperature_reduction_when_heating_is_off_2_weekday_rest_of_dwelling, temperature_reduction_when_heating_is_off_1_weekend_rest_of_dwelling, temperature_reduction_when_heating_is_off_2_weekend_rest_of_dwelling, temperature_during_heating_living_room, temperature_during_heating_rest_of_dwelling, temperature_adjustment_table_4e ): """Calculates the heating requirement as given in Table 9c. :param temperature_reduction_when_heating_is_off_1_weekday_living_room: :type temperature_reduction_when_heating_is_off_1_weekday_living_room: list(float) :param temperature_reduction_when_heating_is_off_2_weekday_living_room: :type temperature_reduction_when_heating_is_off_2_weekday_living_room: list(float) :param temperature_reduction_when_heating_is_off_1_weekend_living_room: :type temperature_reduction_when_heating_is_off_1_weekend_living_room: list(float) :param temperature_reduction_when_heating_is_off_2_weekend_living_room: :type temperature_reduction_when_heating_is_off_2_weekend_living_room: list(float) :param temperature_reduction_when_heating_is_off_1_weekday_rest_of_dwelling: :type temperature_reduction_when_heating_is_off_1_weekday_rest_of_dwelling: list(float) :param temperature_reduction_when_heating_is_off_2_weekday_rest_of_dwelling: :type temperature_reduction_when_heating_is_off_2_weekday_rest_of_dwelling: list(float) :param temperature_reduction_when_heating_is_off_1_weekend_rest_of_dwelling: :type temperature_reduction_when_heating_is_off_1_weekend_rest_of_dwelling: list(float) :param temperature_reduction_when_heating_is_off_2_weekend_rest_of_dwelling: :type temperature_reduction_when_heating_is_off_2_weekend_rest_of_dwelling: list(float) :param temperature_during_heating_living_room: :type temperature_during_heating_living_room: float :param temperature_during_heating_rest_of_dwelling: :type temperature_during_heating_rest_of_dwelling: list(float) :param temperature_adjustment_table_4e: :type temperature_adjustment_table_4e: float :returns: A dictionary with keys ( T_weekday_living_room, T_weekend_living_room, mean_internal_temperature_living_room_T1_Table_9c, T_weekday_rest_of_dwelling, T_weekend_rest_of_dwelling, mean_internal_temperature_rest_of_dwelling_T2_table_9c ) - **T_weekday_living_room** (`list` (`float`)) - - **T_weekend_living_room** (`list` (`float`)) - - **mean_internal_temperature_living_room_T1_Table_9c** (`list` (`float`)) - - **T_weekday_rest_of_dwelling** (`list` (`float`)) - - **T_weekend_rest_of_dwelling** (`list` (`float`)) - - **mean_internal_temperature_rest_of_dwelling_T2_table_9c** (`list` (`float`)) - :rtype: dict """ T_weekday_living_room = [] for i in range(12): T_weekday_living_room.append(temperature_during_heating_living_room - (temperature_reduction_when_heating_is_off_1_weekday_living_room[i] + temperature_reduction_when_heating_is_off_2_weekday_living_room[i])) T_weekend_living_room = [] for i in range(12): T_weekend_living_room.append(temperature_during_heating_living_room - (temperature_reduction_when_heating_is_off_1_weekend_living_room[i] + temperature_reduction_when_heating_is_off_2_weekend_living_room[i])) mean_internal_temperature_living_room_T1_Table_9c = [] for i in range(12): mean_internal_temperature_living_room_T1_Table_9c.append((5 * T_weekday_living_room[i] + 2 * T_weekend_living_room[i] ) / 7) T_weekday_rest_of_dwelling = [] for i in range(12): T_weekday_rest_of_dwelling.append(temperature_during_heating_rest_of_dwelling[i] - (temperature_reduction_when_heating_is_off_1_weekday_rest_of_dwelling[i] + temperature_reduction_when_heating_is_off_2_weekday_rest_of_dwelling[i])) T_weekend_rest_of_dwelling = [] for i in range(12): T_weekend_rest_of_dwelling.append(temperature_during_heating_rest_of_dwelling[i] - (temperature_reduction_when_heating_is_off_1_weekend_rest_of_dwelling[i] + temperature_reduction_when_heating_is_off_2_weekend_rest_of_dwelling[i])) mean_internal_temperature_rest_of_dwelling_T2_table_9c = [] for i in range(12): mean_internal_temperature_rest_of_dwelling_T2_table_9c.append(((5 * T_weekday_rest_of_dwelling[i] + 2 * T_weekend_rest_of_dwelling[i]) / 7) + temperature_adjustment_table_4e) return dict(T_weekday_living_room=T_weekday_living_room, T_weekend_living_room=T_weekend_living_room, mean_internal_temperature_living_room_T1_Table_9c=mean_internal_temperature_living_room_T1_Table_9c, T_weekday_rest_of_dwelling=T_weekday_rest_of_dwelling, T_weekend_rest_of_dwelling=T_weekend_rest_of_dwelling, mean_internal_temperature_rest_of_dwelling_T2_table_9c=mean_internal_temperature_rest_of_dwelling_T2_table_9c )
45.649254
125
0.721269
771
6,117
5.006485
0.070039
0.106218
0.148705
0.256995
0.92228
0.86658
0.808549
0.791192
0.738601
0.682902
0
0.017146
0.227726
6,117
134
126
45.649254
0.799958
0.381233
0
0.125
0
0
0
0
0
0
0
0
0
1
0.020833
false
0
0
0
0.041667
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
50fd5cac28515be83d4c763d0b1e4b1120ac0eb5
137
py
Python
the_complete_python_&_postgreSQL_developer_course/magic_numbers_in_python/for_loop.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
the_complete_python_&_postgreSQL_developer_course/magic_numbers_in_python/for_loop.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
the_complete_python_&_postgreSQL_developer_course/magic_numbers_in_python/for_loop.py
supermonkeyparadise/python
ce8799d643dd7af2b1cb5bc9179bcd83be9769d6
[ "MIT" ]
null
null
null
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for number in numbers: print(number) print() for number in numbers: print(number**2)
13.7
40
0.591241
25
137
3.24
0.6
0.222222
0.271605
0.444444
0.716049
0.716049
0
0
0
0
0
0.106796
0.248175
137
9
41
15.222222
0.679612
0
0
0.333333
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
0
0
1
0
7
0fbd7486a2efd25f9eb9f925de7ac7aa69577e03
138
py
Python
autograd_cupy/sparse/__init__.py
ericmjl/autograd-cupy
493a90cabae42f9e0fdbea77cef758aff659604f
[ "MIT" ]
3
2018-08-03T00:11:17.000Z
2018-12-27T17:47:54.000Z
autograd_cupy/sparse/__init__.py
ericmjl/autograd-cupy
493a90cabae42f9e0fdbea77cef758aff659604f
[ "MIT" ]
null
null
null
autograd_cupy/sparse/__init__.py
ericmjl/autograd-cupy
493a90cabae42f9e0fdbea77cef758aff659604f
[ "MIT" ]
null
null
null
from .sparse_wrapper import * from . import sparse_vjps from . import sparse_jvps from . import sparse_vspaces from . import sparse_boxes
23
29
0.811594
20
138
5.35
0.4
0.373832
0.598131
0
0
0
0
0
0
0
0
0
0.144928
138
5
30
27.6
0.90678
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
0fbffd8c629d5f677e78458b946ac7b8790e2b5e
27,135
gyp
Python
chrome/app/locales/locales.gyp
zachlatta/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
1
2021-09-24T22:49:10.000Z
2021-09-24T22:49:10.000Z
chrome/app/locales/locales.gyp
changbai1980/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
null
null
null
chrome/app/locales/locales.gyp
changbai1980/chromium
c4625eefca763df86471d798ee5a4a054b4716ae
[ "BSD-3-Clause" ]
null
null
null
{ 'variables': { 'chromium_code': 1, 'chrome_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', 'app_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/app', 'webkit_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/webkit', # TODO(sgk): eliminate this; see comment in build/common.gypi 'msvs_debug_link_incremental': '1', }, 'includes': [ '../../../build/common.gypi', ], 'target_defaults': { 'type': 'loadable_module', 'dependencies': [ '../../chrome.gyp:chrome_strings', '../../../webkit/webkit.gyp:webkit_strings', '../../../app/app.gyp:app_strings', ], 'msvs_settings': { 'VCLinkerTool': { 'BaseAddress': '0x3CF00000', 'OutputFile': '$(OutDir)\\locales\\$(ProjectName).dll', 'LinkIncremental': '1', # 1 == No 'LinkTimeCodeGeneration': '0', 'ResourceOnlyDLL': 'true', }, }, 'defines': [ '_USRDLL', 'GENERATED_RESOURCES_DLL_EXPORTS', ], 'include_dirs': [ '<(chrome_grit_out_dir)', ], }, 'conditions': [ ['OS=="win"', { 'targets': [ { 'target_name': 'ar', 'msvs_guid': '3AB90E6A-56FF-4C9D-B918-AB76DDBF8BE8', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ar.rc', '<(chrome_grit_out_dir)/locale_settings_ar.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ar.rc', '<(webkit_grit_out_dir)/webkit_strings_ar.rc', '<(app_grit_out_dir)/app_strings_ar.rc', '<(app_grit_out_dir)/app_locale_settings_ar.rc', ], }, { 'target_name': 'bg', 'msvs_guid': '5BDB7EE1-A1FD-410C-9598-21519A1B7952', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_bg.rc', '<(chrome_grit_out_dir)/locale_settings_bg.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_bg.rc', '<(webkit_grit_out_dir)/webkit_strings_bg.rc', '<(app_grit_out_dir)/app_strings_bg.rc', '<(app_grit_out_dir)/app_locale_settings_bg.rc', ], }, { 'target_name': 'bn', 'msvs_guid': '4B60E8B8-416F-40B2-8A54-F75970A21992', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_bn.rc', '<(chrome_grit_out_dir)/locale_settings_bn.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_bn.rc', '<(webkit_grit_out_dir)/webkit_strings_bn.rc', '<(app_grit_out_dir)/app_strings_bn.rc', '<(app_grit_out_dir)/app_locale_settings_bn.rc', ], }, { 'target_name': 'ca', 'msvs_guid': 'F7790A54-4078-4E4A-8231-818BE9FB1F94', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ca.rc', '<(chrome_grit_out_dir)/locale_settings_ca.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ca.rc', '<(webkit_grit_out_dir)/webkit_strings_ca.rc', '<(app_grit_out_dir)/app_strings_ca.rc', '<(app_grit_out_dir)/app_locale_settings_ca.rc', ], }, { 'target_name': 'cs', 'msvs_guid': '7EA8C4AB-F9C6-4FA1-8B0A-74F5650430B2', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_cs.rc', '<(chrome_grit_out_dir)/locale_settings_cs.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_cs.rc', '<(webkit_grit_out_dir)/webkit_strings_cs.rc', '<(app_grit_out_dir)/app_strings_cs.rc', '<(app_grit_out_dir)/app_locale_settings_cs.rc', ], }, { 'target_name': 'da', 'msvs_guid': 'A493331B-3180-49FE-8D0E-D121645E63AD', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_da.rc', '<(chrome_grit_out_dir)/locale_settings_da.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_da.rc', '<(webkit_grit_out_dir)/webkit_strings_da.rc', '<(app_grit_out_dir)/app_strings_da.rc', '<(app_grit_out_dir)/app_locale_settings_da.rc', ], }, { 'target_name': 'de', 'msvs_guid': 'BA62FF5E-08A6-4102-9675-C12E8C9D4CC0', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_de.rc', '<(chrome_grit_out_dir)/locale_settings_de.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_de.rc', '<(webkit_grit_out_dir)/webkit_strings_de.rc', '<(app_grit_out_dir)/app_strings_de.rc', '<(app_grit_out_dir)/app_locale_settings_de.rc', ], }, { 'target_name': 'el', 'msvs_guid': 'D314F1B3-9299-4866-8362-08BF811B0FA3', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_el.rc', '<(chrome_grit_out_dir)/locale_settings_el.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_el.rc', '<(webkit_grit_out_dir)/webkit_strings_el.rc', '<(app_grit_out_dir)/app_strings_el.rc', '<(app_grit_out_dir)/app_locale_settings_el.rc', ], }, { 'target_name': 'en-GB', 'msvs_guid': '34231B28-C51C-4C1C-AF07-C763668B1404', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_en-GB.rc', '<(chrome_grit_out_dir)/locale_settings_en-GB.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_en-GB.rc', '<(webkit_grit_out_dir)/webkit_strings_en-GB.rc', '<(app_grit_out_dir)/app_strings_en-GB.rc', '<(app_grit_out_dir)/app_locale_settings_en-GB.rc', ], }, { 'target_name': 'en-US', 'msvs_guid': 'CAE2D1E6-3F19-492F-A35C-68AA7ACAD6D3', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_en-US.rc', '<(chrome_grit_out_dir)/locale_settings_en-US.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_en-US.rc', '<(webkit_grit_out_dir)/webkit_strings_en-US.rc', '<(app_grit_out_dir)/app_strings_en-US.rc', '<(app_grit_out_dir)/app_locale_settings_en-US.rc', ], }, { 'target_name': 'es-419', 'msvs_guid': 'FA660037-EB40-4A43-AA9D-9653C57F2789', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_es-419.rc', '<(chrome_grit_out_dir)/locale_settings_es-419.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_es-419.rc', '<(webkit_grit_out_dir)/webkit_strings_es-419.rc', '<(app_grit_out_dir)/app_strings_es-419.rc', '<(app_grit_out_dir)/app_locale_settings_es-419.rc', ], }, { 'target_name': 'es', 'msvs_guid': '5AEA4BF6-27CD-47FC-9370-D87771CFA196', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_es.rc', '<(chrome_grit_out_dir)/locale_settings_es.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_es.rc', '<(webkit_grit_out_dir)/webkit_strings_es.rc', '<(app_grit_out_dir)/app_strings_es.rc', '<(app_grit_out_dir)/app_locale_settings_es.rc', ], }, { 'target_name': 'et', 'msvs_guid': '0557BC3C-DE87-4127-BDAA-9BD9BDB13FB4', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_et.rc', '<(chrome_grit_out_dir)/locale_settings_et.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_et.rc', '<(webkit_grit_out_dir)/webkit_strings_et.rc', '<(app_grit_out_dir)/app_strings_et.rc', '<(app_grit_out_dir)/app_locale_settings_et.rc', ], }, { 'target_name': 'fi', 'msvs_guid': '64D81334-DE73-457D-8FC1-9492508A2663', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_fi.rc', '<(chrome_grit_out_dir)/locale_settings_fi.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_fi.rc', '<(webkit_grit_out_dir)/webkit_strings_fi.rc', '<(app_grit_out_dir)/app_strings_fi.rc', '<(app_grit_out_dir)/app_locale_settings_fi.rc', ], }, { 'target_name': 'fil', 'msvs_guid': '3A932C39-AFA9-4BDC-B775-F71A426D04BF', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_fil.rc', '<(chrome_grit_out_dir)/locale_settings_fil.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_fil.rc', '<(webkit_grit_out_dir)/webkit_strings_fil.rc', '<(app_grit_out_dir)/app_strings_fil.rc', '<(app_grit_out_dir)/app_locale_settings_fil.rc', ], }, { 'target_name': 'fr', 'msvs_guid': '0D54A5C4-B78B-41A2-BF8A-5DA48AC90495', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_fr.rc', '<(chrome_grit_out_dir)/locale_settings_fr.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_fr.rc', '<(webkit_grit_out_dir)/webkit_strings_fr.rc', '<(app_grit_out_dir)/app_strings_fr.rc', '<(app_grit_out_dir)/app_locale_settings_fr.rc', ], }, { 'target_name': 'gu', 'msvs_guid': '256DECCE-9886-4C21-96A5-EE47DF5E07E9', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_gu.rc', '<(chrome_grit_out_dir)/locale_settings_gu.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_gu.rc', '<(webkit_grit_out_dir)/webkit_strings_gu.rc', '<(app_grit_out_dir)/app_strings_gu.rc', '<(app_grit_out_dir)/app_locale_settings_gu.rc', ], }, { 'target_name': 'he', 'msvs_guid': 'A28310B8-7BD0-4CDF-A7D8-59CAB42AA1C4', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_he.rc', '<(chrome_grit_out_dir)/locale_settings_he.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_he.rc', '<(webkit_grit_out_dir)/webkit_strings_he.rc', '<(app_grit_out_dir)/app_strings_he.rc', '<(app_grit_out_dir)/app_locale_settings_he.rc', ], }, { 'target_name': 'hi', 'msvs_guid': '228DD844-9926-420E-B193-6973BF2A4D0B', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_hi.rc', '<(chrome_grit_out_dir)/locale_settings_hi.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_hi.rc', '<(webkit_grit_out_dir)/webkit_strings_hi.rc', '<(app_grit_out_dir)/app_strings_hi.rc', '<(app_grit_out_dir)/app_locale_settings_hi.rc', ], }, { 'target_name': 'hr', 'msvs_guid': 'CE1426F6-7D2B-4574-9929-58387BF7B05F', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_hr.rc', '<(chrome_grit_out_dir)/locale_settings_hr.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_hr.rc', '<(webkit_grit_out_dir)/webkit_strings_hr.rc', '<(app_grit_out_dir)/app_strings_hr.rc', '<(app_grit_out_dir)/app_locale_settings_hr.rc', ], }, { 'target_name': 'hu', 'msvs_guid': 'AFF332BF-AF3D-4D35-86FC-42A727F01D36', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_hu.rc', '<(chrome_grit_out_dir)/locale_settings_hu.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_hu.rc', '<(webkit_grit_out_dir)/webkit_strings_hu.rc', '<(app_grit_out_dir)/app_strings_hu.rc', '<(app_grit_out_dir)/app_locale_settings_hu.rc', ], }, { 'target_name': 'id', 'msvs_guid': 'E3DF045F-2174-4685-9CF7-0630A79F324B', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_id.rc', '<(chrome_grit_out_dir)/locale_settings_id.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_id.rc', '<(webkit_grit_out_dir)/webkit_strings_id.rc', '<(app_grit_out_dir)/app_strings_id.rc', '<(app_grit_out_dir)/app_locale_settings_id.rc', ], }, { 'target_name': 'it', 'msvs_guid': '275F2993-EE9B-4E00-9C85-10A182FD423A', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_it.rc', '<(chrome_grit_out_dir)/locale_settings_it.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_it.rc', '<(webkit_grit_out_dir)/webkit_strings_it.rc', '<(app_grit_out_dir)/app_strings_it.rc', '<(app_grit_out_dir)/app_locale_settings_it.rc', ], }, { 'target_name': 'ja', 'msvs_guid': 'B2D715CE-4CBB-415A-A032-E700C90ADF91', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ja.rc', '<(chrome_grit_out_dir)/locale_settings_ja.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ja.rc', '<(webkit_grit_out_dir)/webkit_strings_ja.rc', '<(app_grit_out_dir)/app_strings_ja.rc', '<(app_grit_out_dir)/app_locale_settings_ja.rc', ], }, { 'target_name': 'kn', 'msvs_guid': '3E6B24F6-9FA9-4066-859E-BF747FA3080A', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_kn.rc', '<(chrome_grit_out_dir)/locale_settings_kn.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_kn.rc', '<(webkit_grit_out_dir)/webkit_strings_kn.rc', '<(app_grit_out_dir)/app_strings_kn.rc', '<(app_grit_out_dir)/app_locale_settings_kn.rc', ], }, { 'target_name': 'ko', 'msvs_guid': '32167995-4014-4E4C-983B-F7E17C24EB25', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ko.rc', '<(chrome_grit_out_dir)/locale_settings_ko.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ko.rc', '<(webkit_grit_out_dir)/webkit_strings_ko.rc', '<(app_grit_out_dir)/app_strings_ko.rc', '<(app_grit_out_dir)/app_locale_settings_ko.rc', ], }, { 'target_name': 'lt', 'msvs_guid': '80E37CB5-059D-4F4B-AEF6-08265468D368', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_lt.rc', '<(chrome_grit_out_dir)/locale_settings_lt.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_lt.rc', '<(webkit_grit_out_dir)/webkit_strings_lt.rc', '<(app_grit_out_dir)/app_strings_lt.rc', '<(app_grit_out_dir)/app_locale_settings_lt.rc', ], }, { 'target_name': 'lv', 'msvs_guid': 'A5C5D801-4026-49F2-BBF1-250941855306', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_lv.rc', '<(chrome_grit_out_dir)/locale_settings_lv.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_lv.rc', '<(webkit_grit_out_dir)/webkit_strings_lv.rc', '<(app_grit_out_dir)/app_strings_lv.rc', '<(app_grit_out_dir)/app_locale_settings_lv.rc', ], }, { 'target_name': 'ml', 'msvs_guid': 'CAB69303-0F02-4C68-A12E-FFE55DB52526', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ml.rc', '<(chrome_grit_out_dir)/locale_settings_ml.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ml.rc', '<(webkit_grit_out_dir)/webkit_strings_ml.rc', '<(app_grit_out_dir)/app_strings_ml.rc', '<(app_grit_out_dir)/app_locale_settings_ml.rc', ], }, { 'target_name': 'mr', 'msvs_guid': 'A464166F-8507-49B4-9B02-5CB77C498B25', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_mr.rc', '<(chrome_grit_out_dir)/locale_settings_mr.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_mr.rc', '<(webkit_grit_out_dir)/webkit_strings_mr.rc', '<(app_grit_out_dir)/app_strings_mr.rc', '<(app_grit_out_dir)/app_locale_settings_mr.rc', ], }, { 'target_name': 'nb', 'msvs_guid': 'B30B0E1F-1CE9-4DEF-A752-7498FD709C1F', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_nb.rc', '<(chrome_grit_out_dir)/locale_settings_nb.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_nb.rc', '<(webkit_grit_out_dir)/webkit_strings_nb.rc', '<(app_grit_out_dir)/app_strings_nb.rc', '<(app_grit_out_dir)/app_locale_settings_nb.rc', ], }, { 'target_name': 'nl', 'msvs_guid': '63011A7B-CE4D-4DF1-B5DA-1B133C14A2E8', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_nl.rc', '<(chrome_grit_out_dir)/locale_settings_nl.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_nl.rc', '<(webkit_grit_out_dir)/webkit_strings_nl.rc', '<(app_grit_out_dir)/app_strings_nl.rc', '<(app_grit_out_dir)/app_locale_settings_nl.rc', ], }, { 'target_name': 'or', 'msvs_guid': 'E07D267C-34C3-4DDB-8B41-94697808714A', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_or.rc', '<(chrome_grit_out_dir)/locale_settings_or.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_or.rc', '<(webkit_grit_out_dir)/webkit_strings_or.rc', '<(app_grit_out_dir)/app_strings_or.rc', '<(app_grit_out_dir)/app_locale_settings_or.rc', ], }, { 'target_name': 'pl', 'msvs_guid': '9F53807E-9382-47BD-8371-E5D04F517E9C', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_pl.rc', '<(chrome_grit_out_dir)/locale_settings_pl.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_pl.rc', '<(webkit_grit_out_dir)/webkit_strings_pl.rc', '<(app_grit_out_dir)/app_strings_pl.rc', '<(app_grit_out_dir)/app_locale_settings_pl.rc', ], }, { 'target_name': 'pt-BR', 'msvs_guid': '2F914112-2657-49EC-8EA6-3BA63340DE27', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_pt-BR.rc', '<(chrome_grit_out_dir)/locale_settings_pt-BR.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_pt-BR.rc', '<(webkit_grit_out_dir)/webkit_strings_pt-BR.rc', '<(app_grit_out_dir)/app_strings_pt-BR.rc', '<(app_grit_out_dir)/app_locale_settings_pt-BR.rc', ], }, { 'target_name': 'pt-PT', 'msvs_guid': '0A13F602-B497-4BC1-ABD8-03CA8E95B2AF', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_pt-PT.rc', '<(chrome_grit_out_dir)/locale_settings_pt-PT.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_pt-PT.rc', '<(webkit_grit_out_dir)/webkit_strings_pt-PT.rc', '<(app_grit_out_dir)/app_strings_pt-PT.rc', '<(app_grit_out_dir)/app_locale_settings_pt-PT.rc', ], }, { 'target_name': 'ro', 'msvs_guid': 'C70D3509-57C4-4326-90C1-2EC0AE34848D', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ro.rc', '<(chrome_grit_out_dir)/locale_settings_ro.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ro.rc', '<(webkit_grit_out_dir)/webkit_strings_ro.rc', '<(app_grit_out_dir)/app_strings_ro.rc', '<(app_grit_out_dir)/app_locale_settings_ro.rc', ], }, { 'target_name': 'ru', 'msvs_guid': '7D456640-3619-4D23-A56D-E0084400CCBF', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ru.rc', '<(chrome_grit_out_dir)/locale_settings_ru.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ru.rc', '<(webkit_grit_out_dir)/webkit_strings_ru.rc', '<(app_grit_out_dir)/app_strings_ru.rc', '<(app_grit_out_dir)/app_locale_settings_ru.rc', ], }, { 'target_name': 'sk', 'msvs_guid': '82F5BFE5-FDCE-47D4-8B38-BEEBED561681', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_sk.rc', '<(chrome_grit_out_dir)/locale_settings_sk.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_sk.rc', '<(webkit_grit_out_dir)/webkit_strings_sk.rc', '<(app_grit_out_dir)/app_strings_sk.rc', '<(app_grit_out_dir)/app_locale_settings_sk.rc', ], }, { 'target_name': 'sl', 'msvs_guid': 'C2A444C2-9D74-4AD7-AE7C-04F5EDA17060', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_sl.rc', '<(chrome_grit_out_dir)/locale_settings_sl.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_sl.rc', '<(webkit_grit_out_dir)/webkit_strings_sl.rc', '<(app_grit_out_dir)/app_strings_sl.rc', '<(app_grit_out_dir)/app_locale_settings_sl.rc', ], }, { 'target_name': 'sr', 'msvs_guid': '300C6A09-663E-48B6-8E07-A0D50CAF8F25', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_sr.rc', '<(chrome_grit_out_dir)/locale_settings_sr.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_sr.rc', '<(webkit_grit_out_dir)/webkit_strings_sr.rc', '<(app_grit_out_dir)/app_strings_sr.rc', '<(app_grit_out_dir)/app_locale_settings_sr.rc', ], }, { 'target_name': 'sv', 'msvs_guid': 'B0D5BD91-6153-4CA6-BC2F-4E3BD43E5DB7', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_sv.rc', '<(chrome_grit_out_dir)/locale_settings_sv.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_sv.rc', '<(webkit_grit_out_dir)/webkit_strings_sv.rc', '<(app_grit_out_dir)/app_strings_sv.rc', '<(app_grit_out_dir)/app_locale_settings_sv.rc', ], }, { 'target_name': 'ta', 'msvs_guid': '7A0BA0C5-0D90-49AE-919A-4BE096F69E4F', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_ta.rc', '<(chrome_grit_out_dir)/locale_settings_ta.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_ta.rc', '<(webkit_grit_out_dir)/webkit_strings_ta.rc', '<(app_grit_out_dir)/app_strings_ta.rc', '<(app_grit_out_dir)/app_locale_settings_ta.rc', ], }, { 'target_name': 'te', 'msvs_guid': '9D13D9B8-6C28-42A7-935C-B769EBC55BAA', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_te.rc', '<(chrome_grit_out_dir)/locale_settings_te.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_te.rc', '<(webkit_grit_out_dir)/webkit_strings_te.rc', '<(app_grit_out_dir)/app_strings_te.rc', '<(app_grit_out_dir)/app_locale_settings_te.rc', ], }, { 'target_name': 'th', 'msvs_guid': '226B3533-1FF3-42F6-A8E3-C4DDBC955290', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_th.rc', '<(chrome_grit_out_dir)/locale_settings_th.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_th.rc', '<(webkit_grit_out_dir)/webkit_strings_th.rc', '<(app_grit_out_dir)/app_strings_th.rc', '<(app_grit_out_dir)/app_locale_settings_th.rc', ], }, { 'target_name': 'tr', 'msvs_guid': '65C78BBB-8FCB-48E4-94C8-1F0F981929AF', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_tr.rc', '<(chrome_grit_out_dir)/locale_settings_tr.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_tr.rc', '<(webkit_grit_out_dir)/webkit_strings_tr.rc', '<(app_grit_out_dir)/app_strings_tr.rc', '<(app_grit_out_dir)/app_locale_settings_tr.rc', ], }, { 'target_name': 'uk', 'msvs_guid': '182D578D-2DAC-4BB7-AFEC-9A2855E56F94', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_uk.rc', '<(chrome_grit_out_dir)/locale_settings_uk.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_uk.rc', '<(webkit_grit_out_dir)/webkit_strings_uk.rc', '<(app_grit_out_dir)/app_strings_uk.rc', '<(app_grit_out_dir)/app_locale_settings_uk.rc', ], }, { 'target_name': 'vi', 'msvs_guid': 'DA5C6FCB-FCFD-49B8-8DDA-8351638096DB', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_vi.rc', '<(chrome_grit_out_dir)/locale_settings_vi.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_vi.rc', '<(webkit_grit_out_dir)/webkit_strings_vi.rc', '<(app_grit_out_dir)/app_strings_vi.rc', '<(app_grit_out_dir)/app_locale_settings_vi.rc', ], }, { 'target_name': 'zh-CN', 'msvs_guid': 'C0C7DA58-C90D-4BDE-AE44-588997339F5D', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_zh-CN.rc', '<(chrome_grit_out_dir)/locale_settings_zh-CN.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_zh-CN.rc', '<(webkit_grit_out_dir)/webkit_strings_zh-CN.rc', '<(app_grit_out_dir)/app_strings_zh-CN.rc', '<(app_grit_out_dir)/app_locale_settings_zh-CN.rc', ], }, { 'target_name': 'zh-TW', 'msvs_guid': 'E7B11CF0-FE40-4A69-AE20-1B882F4D7585', 'sources': [ '<(chrome_grit_out_dir)/generated_resources_zh-TW.rc', '<(chrome_grit_out_dir)/locale_settings_zh-TW.rc', '<(chrome_grit_out_dir)/strings$(CHROMIUM_BUILD)_zh-TW.rc', '<(webkit_grit_out_dir)/webkit_strings_zh-TW.rc', '<(app_grit_out_dir)/app_strings_zh-TW.rc', '<(app_grit_out_dir)/app_locale_settings_zh-TW.rc', ], }, ], }], ], }
42.004644
72
0.576046
3,200
27,135
4.35875
0.115
0.152567
0.217952
0.174362
0.757671
0.755592
0.736736
0.442501
0.062661
0
0
0.053302
0.273337
27,135
645
73
42.069767
0.654072
0.002469
0
0.165109
0
0
0.648537
0.583949
0
0
0.000369
0.00155
0
1
0
true
0
0
0
0
0
0
0
0
null
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
1
0
0
0
0
0
0
7
e871346c5084348eaafec8ab39a8c1f24e4a54c8
8,128
py
Python
zExtraLearning/MLPrep/tf2.0/NbExtracts/12tf2_0_long_distance.py
talk2sunil83/UpgradLearning
70c4f993c68ce5030e9df0edd15004bbb9fc71e7
[ "Apache-2.0" ]
null
null
null
zExtraLearning/MLPrep/tf2.0/NbExtracts/12tf2_0_long_distance.py
talk2sunil83/UpgradLearning
70c4f993c68ce5030e9df0edd15004bbb9fc71e7
[ "Apache-2.0" ]
null
null
null
zExtraLearning/MLPrep/tf2.0/NbExtracts/12tf2_0_long_distance.py
talk2sunil83/UpgradLearning
70c4f993c68ce5030e9df0edd15004bbb9fc71e7
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """TF2.0 Long Distance.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/11lA6vCQ3jrhCLKZ6oUgwagEOUQfFZnui """ # Commented out IPython magic to ensure Python compatibility. # Install TensorFlow import matplotlib.pyplot as plt import pandas as pd import numpy as np from tensorflow.keras.optimizers import SGD, Adam from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, SimpleRNN, GRU, LSTM, Dense, Flatten, GlobalMaxPool1D import tensorflow as tf print(tf.__version__) # More imports # build the dataset # This is a nonlinear AND long-distance dataset # (Actually, we will test long-distance vs. short-distance patterns) # Start with a small T and increase it later T = 10 D = 1 X = [] Y = [] def get_label(x, i1, i2, i3): # x = sequence if x[i1] < 0 and x[i2] < 0 and x[i3] < 0: return 1 if x[i1] < 0 and x[i2] > 0 and x[i3] > 0: return 1 if x[i1] > 0 and x[i2] < 0 and x[i3] > 0: return 1 if x[i1] > 0 and x[i2] > 0 and x[i3] < 0: return 1 return 0 for t in range(5000): x = np.random.randn(T) X.append(x) y = get_label(x, -1, -2, -3) # short distance # y = get_label(x, 0, 1, 2) # long distance Y.append(y) X = np.array(X) Y = np.array(Y) N = len(X) # Try a linear model first - note: it is classification now! i = Input(shape=(T,)) x = Dense(1, activation='sigmoid')(i) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the network r = model.fit( X, Y, epochs=100, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too - should be around 50% plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now try a simple RNN inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 # x = LSTM(5)(i) x = SimpleRNN(5)(i) # x = GRU(5)(i) # method 2 # x = LSTM(5, return_sequences=True)(i) # x = GlobalMaxPool1D()(x) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', # optimizer='rmsprop', # optimizer='adam', optimizer=Adam(lr=0.01), # optimizer=SGD(lr=0.1, momentum=0.9), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=200, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now change to the long distance problem # Start with a small T and increase it later T = 10 D = 1 X = [] Y = [] for t in range(5000): x = np.random.randn(T) X.append(x) y = get_label(x, 0, 1, 2) # long distance Y.append(y) X = np.array(X) Y = np.array(Y) N = len(X) # Now test our Simple RNN again inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = SimpleRNN(5)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=200, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now test our LSTM inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = LSTM(5)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=200, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Make the problem harder by making T larger T = 20 D = 1 X = [] Y = [] for t in range(5000): x = np.random.randn(T) X.append(x) y = get_label(x, 0, 1, 2) # long distance Y.append(y) X = np.array(X) Y = np.array(Y) N = len(X) # Now test our Simple RNN again inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = SimpleRNN(5)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=200, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now test our LSTM inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = LSTM(5)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=200, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now test our GRU inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = GRU(5)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=400, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Make the problem harder by making T larger T = 30 D = 1 X = [] Y = [] for t in range(5000): x = np.random.randn(T) X.append(x) y = get_label(x, 0, 1, 2) # long distance Y.append(y) X = np.array(X) Y = np.array(Y) N = len(X) # Now test our LSTM inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 1 x = LSTM(15)(i) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=400, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend() # Now try a LSTM with Global Max Pooling inputs = np.expand_dims(X, -1) # make the RNN i = Input(shape=(T, D)) # method 2 x = LSTM(5, return_sequences=True)(i) x = GlobalMaxPool1D()(x) x = Dense(1, activation='sigmoid')(x) model = Model(i, x) model.compile( loss='binary_crossentropy', optimizer=Adam(lr=0.01), metrics=['accuracy'], ) # train the RNN r = model.fit( inputs, Y, epochs=100, validation_split=0.5, ) # Plot the loss plt.plot(r.history['loss'], label='loss') plt.plot(r.history['val_loss'], label='val_loss') plt.legend() # Plot the accuracy too plt.plot(r.history['accuracy'], label='acc') plt.plot(r.history['val_accuracy'], label='val_acc') plt.legend()
19.491607
96
0.647023
1,355
8,128
3.826568
0.129151
0.048602
0.055545
0.104147
0.834908
0.824494
0.824494
0.824494
0.824494
0.824494
0
0.030262
0.178765
8,128
416
97
19.538462
0.746517
0.224779
0
0.834646
1
0
0.127413
0
0
0
0
0
0
1
0.003937
false
0
0.027559
0
0.051181
0.003937
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
d704b607a67e3a5a82fa3d941b9c1d98f5e04961
8,580
py
Python
tests/channels/test_walletwrapper.py
febuiles/two1-python
88704487dba7715f97a0980781d4c0efb2ea7fc4
[ "BSD-2-Clause-FreeBSD" ]
415
2016-06-10T00:46:55.000Z
2021-10-16T00:56:06.000Z
tests/channels/test_walletwrapper.py
febuiles/two1-python
88704487dba7715f97a0980781d4c0efb2ea7fc4
[ "BSD-2-Clause-FreeBSD" ]
25
2016-06-11T13:48:59.000Z
2021-01-05T11:19:30.000Z
tests/channels/test_walletwrapper.py
febuiles/two1-python
88704487dba7715f97a0980781d4c0efb2ea7fc4
[ "BSD-2-Clause-FreeBSD" ]
109
2016-06-11T05:17:05.000Z
2021-12-22T11:02:22.000Z
import codecs import pytest import two1.bitcoin as bitcoin import two1.channels.statemachine as statemachine import two1.channels.walletwrapper as walletwrapper import tests.channels.mock as mock @pytest.fixture(params=[ walletwrapper.Two1WalletWrapper(mock.MockTwo1Wallet(), mock.MockBlockchain()) ]) def wallet(request): return request.param def test_walletwrapper(wallet): # Check get_public_key() assert wallet.get_public_key().compressed_bytes == bitcoin.PublicKey.from_hex("04ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dc3ad232846aad9dc0ecc9328a79956522f532ef9e67435bdc05900cf9f4d1383").compressed_bytes # nopep8 # Payment Channel with 100000 deposit, 1000 minimum output, 10000 fee redeem_script = statemachine.PaymentChannelRedeemScript( mock.MockPaymentChannelServer.PRIVATE_KEY.public_key, mock.MockTwo1Wallet.PRIVATE_KEY.public_key, 1450223410) # Check create_deposit_tx() deposit_tx = wallet.create_deposit_tx(redeem_script.address(), 100000 + 1000, 10000) assert deposit_tx.to_hex() == "010000000119de54dd7043927219cca4c06cc8b94c7c862b6486b0f989ea4c6569fb34383d010000006b483045022100c45e5bd8d00caa1cd3ad46e078ec132c9c505b3168d1d1ffe6285cf054f54ed302203ea12c4203ccee8a9de616cc22f081eed47a78660ce0a01cb3a97e302178a573012103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dffffffff0198b101000000000017a9149bc3354ccfd998cf16628449b940e6914210f1098700000000" # nopep8 # Check create_refund_tx() refund_tx = wallet.create_refund_tx(deposit_tx, redeem_script, redeem_script.expiration_time, 10000) assert refund_tx.to_hex() == "0100000001ef513a66dd5f79c0b6cac9b74192b6d405724a7f559979f5aad5ab848c551a7e000000009d483045022100d00fb043ab32361c4e574e4f7f59ba0b3d1c2fbe758c3d26555cb3748e3270050220729cb95327245aa6f428f87b1e13cbc9c82dfa6dbc2bac0fc4641fc720dc0b220101004c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacfeffffff01888a0100000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac32a77056" # nopep8 # Check create_payment_tx() with 1000 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 1000, 10000) assert payment_tx.to_hex() == "0100000001ef513a66dd5f79c0b6cac9b74192b6d405724a7f559979f5aad5ab848c551a7e000000009c483045022100e0758baae39dfb1c4402c37a3382ae96a34786734265ea2bc94977299dfd2573022047957838a067ad0bbd575ec219e71c1c750685f6a70da3baa9d294c8a8202d7b01514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff02e8030000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488aca0860100000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check create_payment_tx() with 21001 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 21001, 10000) assert payment_tx.to_hex() == "0100000001ef513a66dd5f79c0b6cac9b74192b6d405724a7f559979f5aad5ab848c551a7e000000009c4830450221009d19b49f540af728a3ce978bad1c4bf6d162a6f24f74dd11bde72e706521c08a02200ce0dd828018741434f74ee7a4c7bfb9e74c56d20246966b3a893d8bb13c871101514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff0209520000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488ac7f380100000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check create_payment_tx() with 21002 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 21002, 10000) assert payment_tx.to_hex() == "0100000001ef513a66dd5f79c0b6cac9b74192b6d405724a7f559979f5aad5ab848c551a7e000000009c483045022100bd2a89446c9d5985ee711747f35b8e367a90eb13970aec1b3a3ad11e01da7ac602205405fe99d5fe590fb13f0b7698e306e3bbcdd83855e156eb8e9a8901f887229f01514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff020a520000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488ac7e380100000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check sign() sig = wallet.sign(str(deposit_tx.hash).encode('ascii'), redeem_script.customer_public_key) assert sig.to_der() == codecs.decode("30450221008f51b6565a8ee67c32529ed840116c44e1f60a628c51ac59720cc8c6df1b5eab02204ccc32c89f81425f483c64c6f8dd77e57eefd3b6a5b7548d1875f5ef3f86cf27", 'hex_codec') # nopep8 # Payment Channel with 300000 deposit, 1000 minimum output, 20000 fee redeem_script = statemachine.PaymentChannelRedeemScript(mock.MockPaymentChannelServer.PRIVATE_KEY.public_key, mock.MockTwo1Wallet.PRIVATE_KEY.public_key, 1450223410) # nopep8 # Check create_deposit_tx() deposit_tx = wallet.create_deposit_tx(redeem_script.address(), 300000 + 1000, 20000) assert deposit_tx.to_hex() == "010000000119de54dd7043927219cca4c06cc8b94c7c862b6486b0f989ea4c6569fb34383d010000006a4730440220047aed529aa7c5d1c576a80e3d831e3fee6b1bca9375df742867578e098fea32022029b7fdeda98ef67458bfd91a18df43e8e1ca13f700b87bd366f5dc49588da0c8012103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dffffffff01e8e504000000000017a9149bc3354ccfd998cf16628449b940e6914210f1098700000000" # nopep8 # Check create_refund_tx() refund_tx = wallet.create_refund_tx(deposit_tx, redeem_script, redeem_script.expiration_time, 20000) assert refund_tx.to_hex() == "0100000001dd7962b5c22a192ed7f7e6327816038a765dfd6d40c871c681461d34b86caff2000000009d483045022100a54c4494f2a6b5877364b52d010ec68512369d73eb05b662875c47ae53ab3e8f02203fbd1fe956afaecd8c7de6ffd1670a86b5ddead1aa16641bf3e3075e6e79f6130101004c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacfeffffff01c8970400000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac32a77056" # nopep8 # Check create_payment_tx() with 1000 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 1000, 20000) assert payment_tx.to_hex() == "0100000001dd7962b5c22a192ed7f7e6327816038a765dfd6d40c871c681461d34b86caff2000000009c483045022100be91f07d2d1542e3d3634aea874c46a7cc5d9a8d91889823656c114e187432f90220626998d4026665b0337b0acf536e591e1f84c04ebcfc959a4500bd9491e6597501514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff02e8030000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488ace0930400000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check create_payment_tx() with 5000 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 5000, 20000) assert payment_tx.to_hex() == "0100000001dd7962b5c22a192ed7f7e6327816038a765dfd6d40c871c681461d34b86caff2000000009b4730440220724d1417af1af427129ec1508d4c34b05171bdbf5561a79a8e3e310962975de802200a069a951e65a1c450d8208f3ebd1a97bbf9bd8fafd2da79796253bc543fc61301514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff0288130000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488ac40840400000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check create_payment_tx() with 7123 payment_tx = wallet.create_payment_tx(deposit_tx, redeem_script, 7123, 20000) assert payment_tx.to_hex() == "0100000001dd7962b5c22a192ed7f7e6327816038a765dfd6d40c871c681461d34b86caff2000000009b4730440220315bb43d150e2eb1311235c8e0e93b3b9173e5f4d3dc48b190e6a5cebf9221e80220767d24f5bf24ad39338843918e1004176b2d81db8eb214d2cc2da4bccfb347df01514c5063210316f5d704b828c3252432886a843649730e08ae01bbbd5c6bde63756d7f54f961ad670432a77056b175682103ee071c95cb772e57a6d8f4f987e9c61b857e63d9f3b5be7a84bdba0b5847099dacffffffff02d31b0000000000001976a914a5f30391271dfccc133d321960ffe1dccc88e1b488acf57b0400000000001976a914b42fb00f78266bba89feee86036df44401320fba88ac00000000" # nopep8 # Check sign() sig = wallet.sign(str(deposit_tx.hash).encode('ascii'), redeem_script.customer_public_key) assert sig.to_der() == codecs.decode("30440220075489106453c13a48eeb71d69b7dae439b2c68afa16785a6b4228f568bf805202203f948072a04582d12fa33f0e962af35c536453043244a5681a2643bb2738438c", 'hex_codec') # nopep8
114.4
596
0.905361
420
8,580
18.204762
0.202381
0.02825
0.023542
0.027465
0.206906
0.196704
0.161392
0.161392
0.161392
0.161392
0
0.482524
0.056294
8,580
74
597
115.945946
0.461776
0.070163
0
0.05
0
0
0.687217
0.683694
0
1
0
0
0.325
1
0.05
false
0
0.15
0.025
0.225
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
0
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
7
d7140f1c89b04cd448a0f212bf81bc97b13fe092
15,708
py
Python
gym_wmgds/envs/robotics/fetch/pick_and_place_multi.py
ozcell/gym_wmgds_ma
c2cb22943913361947216b908d50decc46616e99
[ "Python-2.0", "OLDAP-2.7" ]
1
2020-12-23T16:38:15.000Z
2020-12-23T16:38:15.000Z
gym_wmgds/envs/robotics/fetch/pick_and_place_multi.py
ozcell/gym_wmgds_ma
c2cb22943913361947216b908d50decc46616e99
[ "Python-2.0", "OLDAP-2.7" ]
null
null
null
gym_wmgds/envs/robotics/fetch/pick_and_place_multi.py
ozcell/gym_wmgds_ma
c2cb22943913361947216b908d50decc46616e99
[ "Python-2.0", "OLDAP-2.7" ]
null
null
null
import os from gym_wmgds import utils from gym_wmgds.envs.robotics import fetch_multi_env # Ensure we get the path separator correct on windows MODEL_XML_PATH = os.path.join('fetch', 'pick_and_place_multi.xml') MODEL_HARD_XML_PATH = os.path.join('fetch', 'pick_and_place_hard_multi.xml') MODEL_OBSTACLE_XML_PATH = os.path.join('fetch', 'pick_and_place_obstacle_multi.xml') MODEL_SHELF_XML_PATH = os.path.join('fetch', 'pick_and_place_shelf_multi.xml') MODEL_INSERTION_XML_PATH = os.path.join('fetch', 'pick_and_place_insertion_multi.xml') class FetchPickAndPlaceMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } global MODEL_XML_PATH if hide_extra_objs: MODEL_XML_PATH = os.path.join('fetch', 'pick_and_place_multi_hidden.xml') fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp) utils.EzPickle.__init__(self) class FetchPickAndPlaceHardMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, target_in_the_air_percent=1.5, target_in_the_air_lower=0.05) utils.EzPickle.__init__(self) class FetchPickAndPlaceHard2MultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, obj_range_lower=[-0.225,-0.325], obj_range_upper=[0.225,0.325], target_range_lower=[-0.225,-0.325,0.00], target_range_upper=[0.225,0.325,0.00], use_table_center=[True,True]) utils.EzPickle.__init__(self) class FetchPickAndPlaceHardestMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, obj_range_lower=[-0.225,-0.325], obj_range_upper=[0.225,0.325], target_range_lower=[-0.225,-0.325,0.00], target_range_upper=[0.225,0.325,0.00], target_in_the_air_percent=1.5, target_in_the_air_lower=0.05, use_table_center=[True,True]) utils.EzPickle.__init__(self) class FetchPickAndPlaceObstacleMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_OBSTACLE_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, obj_range_lower=[-0.15,-0.15], obj_range_upper=[0.15,0.05], target_range_lower=[-0.15,0.125,0.00], target_range_upper=[0.15,0.25,0.00], ) utils.EzPickle.__init__(self) class FetchPickAndPlaceShelfMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_SHELF_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=False, target_stacked=False, target_offset=[0.00,0.00,0.20], obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, obj_range_lower=[-0.15,-0.15], obj_range_upper=[0.15,0.05], target_range_lower=[-0.15,0.125,0.00], target_range_upper=[0.15,0.25,0.00], ) utils.EzPickle.__init__(self) class FetchPickAndPlaceInsertionMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=False): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_INSERTION_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=False, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp) utils.EzPickle.__init__(self) class FetchPickAndPlaceFloorMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in_the_air=False, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp) class FetchPickAndPlaceGrippedMultiEnv(fetch_multi_env.FetchMultiEnv, utils.EzPickle): def __init__(self, reward_type='sparse', n_objects=1, obj_action_type=[0,1,2], observe_obj_grp=False, obj_range=0.15, hide_extra_objs=True): initial_qpos = { 'robot0:slide0': 0.405, 'robot0:slide1': 0.48, 'robot0:slide2': 0.0, 'object0:joint': [1.25, 0.53, 0.4, 1., 0., 0., 0.], 'object1:joint': [0.10, 0.025, 0.025, 1., 0., 0., 0.], 'object2:joint': [0.20, 0.025, 0.025, 1., 0., 0., 0.], 'object3:joint': [0.30, 0.025, 0.025, 1., 0., 0., 0.], 'object4:joint': [0.40, 0.025, 0.025, 1., 0., 0., 0.], 'object5:joint': [0.50, 0.025, 0.025, 1., 0., 0., 0.], 'object6:joint': [0.60, 0.025, 0.025, 1., 0., 0., 0.], 'object7:joint': [0.70, 0.025, 0.025, 1., 0., 0., 0.], 'object8:joint': [0.80, 0.025, 0.025, 1., 0., 0., 0.], 'object9:joint': [0.90, 0.025, 0.025, 1., 0., 0., 0.] } global MODEL_XML_PATH if hide_extra_objs: MODEL_XML_PATH = os.path.join('fetch', 'pick_and_place_multi_hidden.xml') fetch_multi_env.FetchMultiEnv.__init__( self, MODEL_XML_PATH, block_gripper=False, n_substeps=20, gripper_extra_height=0., target_in_the_air=True, target_stacked=False, target_offset=0.0, obj_range=obj_range, target_range=0.15, distance_threshold=0.05, initial_qpos=initial_qpos, reward_type=reward_type, n_objects=n_objects, obj_action_type=obj_action_type, observe_obj_grp=observe_obj_grp, gripped_object=True) utils.EzPickle.__init__(self)
59.275472
145
0.578304
2,471
15,708
3.432618
0.050182
0.046451
0.031832
0.042443
0.934449
0.928437
0.928437
0.928437
0.928437
0.912403
0
0.157017
0.240196
15,708
264
146
59.5
0.553666
0.003247
0
0.843621
0
0
0.116385
0.013542
0
0
0
0
0
1
0.037037
false
0
0.012346
0
0.08642
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
d7234fa516ffe9657e696cd2ba317ee4ee901b15
10,378
py
Python
src/runs/proper_experiments/v100_maze/v106_metrics.py
Michael-Beukman/NEATNoveltyPCG
2441d80eb0f6dd288a00ebb56c432963cefc879d
[ "MIT" ]
5
2022-01-26T23:19:46.000Z
2022-02-10T20:24:19.000Z
src/runs/proper_experiments/v100_maze/v106_metrics.py
Michael-Beukman/NEATNoveltyPCG
2441d80eb0f6dd288a00ebb56c432963cefc879d
[ "MIT" ]
null
null
null
src/runs/proper_experiments/v100_maze/v106_metrics.py
Michael-Beukman/NEATNoveltyPCG
2441d80eb0f6dd288a00ebb56c432963cefc879d
[ "MIT" ]
null
null
null
""" This is an experiment where we run our and other metrics across many different levels and compare the following: - Our diversity vs compression distance - Our Difficulty vs Leniency """ import glob import os import pickle from typing import List from common.utils import get_date from games.maze.maze_game import MazeGame from games.maze.maze_level import MazeLevel from metrics.a_star.a_star_metrics import AStarDifficultyMetric, AStarDiversityAndDifficultyMetric, AStarDiversityMetric, AStarEditDistanceDiversityMetric from metrics.average_pairwise_distance import AveragePairWiseDistanceMetric from metrics.horn.compression_distance import CompressionDistanceMetric from metrics.horn.leniency import LeniencyMetric from metrics.metric import Metric from metrics.rl.tabular.rl_agent_metric import RLAgentMetric from metrics.rl.tabular.rl_difficulty_metric import RLDifficultyMetric from metrics.solvability import SolvabilityMetric import ray from analysis.proper_experiments.v100.analyse_106 import main as analyse_things def main(): ray.init() pickles = [ '../results/v2_test_ga/Maze/DirectGANoveltySolvability/2021-07-03_10-03-41/50/100/3/seed_3_name_v2_test_ga_2021-07-03_10-16-06.p', '../results/v2_test_ga/Maze/DirectGANoveltySolvability/2021-07-03_10-03-41/50/100/2/seed_2_name_v2_test_ga_2021-07-03_10-15-55.p', '../results/v2_test_ga/Maze/DirectGANoveltySolvability/2021-07-03_10-03-41/50/100/1/seed_1_name_v2_test_ga_2021-07-03_10-15-54.p', '../results/v2_test_ga/Maze/DirectGANoveltySolvability/2021-07-03_10-03-41/50/100/0/seed_0_name_v2_test_ga_2021-07-03_10-16-01.p', ] + [ '../results/experiments/experiment_105_a/Maze/NEAT/2021-08-19_07-16-59/100/139/0/seed_0_name_experiment_105_a_2021-08-19_09-54-05.p', '../results/experiments/experiment_105_a/Maze/NEAT/2021-08-19_07-16-59/100/139/1/seed_1_name_experiment_105_a_2021-08-19_09-59-59.p', '../results/experiments/experiment_105_a/Maze/NEAT/2021-08-19_07-16-59/100/139/2/seed_2_name_experiment_105_a_2021-08-19_09-55-52.p', '../results/experiments/experiment_105_a/Maze/NEAT/2021-08-19_07-16-59/100/139/3/seed_3_name_experiment_105_a_2021-08-19_09-57-12.p', '../results/experiments/experiment_105_a/Maze/NEAT/2021-08-19_07-16-59/100/139/4/seed_4_name_experiment_105_a_2021-08-19_09-58-24.p', ] + [ '../results/v2_test_ga/Maze/DirectGAEntropySolvability/2021-07-31_08-56-26/10/100/3/seed_3_name_v2_test_ga_2021-07-31_09-14-05.p', '../results/v2_test_ga/Maze/DirectGAEntropySolvability/2021-07-31_08-56-26/10/100/2/seed_2_name_v2_test_ga_2021-07-31_09-14-10.p', '../results/v2_test_ga/Maze/DirectGAEntropySolvability/2021-07-31_08-56-26/10/100/1/seed_1_name_v2_test_ga_2021-07-31_09-14-04.p', '../results/v2_test_ga/Maze/DirectGAEntropySolvability/2021-07-31_08-56-26/10/100/0/seed_0_name_v2_test_ga_2021-07-31_09-14-31.p', ] + [ 'results/maze/pcgrl/turtle/train_proper_turtle_0917/run_seed_1.p', 'results/maze/pcgrl/turtle/train_proper_turtle_0917/run_seed_2.p', 'results/maze/pcgrl/turtle/train_proper_turtle_0917/run_seed_3.p', 'results/maze/pcgrl/turtle/train_proper_turtle_0917/run_seed_4.p', 'results/maze/pcgrl/turtle/train_proper_turtle_0917/run_seed_5.p', ] + [ 'results/maze/pcgrl/wide/train_proper_wide_0915/run_seed_1.p', 'results/maze/pcgrl/wide/train_proper_wide_0915/run_seed_2.p', 'results/maze/pcgrl/wide/train_proper_wide_0915/run_seed_3.p', 'results/maze/pcgrl/wide/train_proper_wide_0915/run_seed_4.p', 'results/maze/pcgrl/wide/train_proper_wide_0915/run_seed_5.p', ] + [ '../results/v4_test_neat_sweep_more_test_things/Maze/NeatNoveltySolvabilityRandomPadding/2021-08-13_08-11-07/100/0/seed_0_name_v4_test_neat_sweep_more_test_things_2021-08-13_09-36-53.p', '../results/v4_test_neat_sweep_more_test_things/Maze/NeatNoveltySolvabilityRandomPadding/2021-08-13_08-11-07/100/1/seed_1_name_v4_test_neat_sweep_more_test_things_2021-08-13_11-09-00.p', '../results/v4_test_neat_sweep_more_test_things/Maze/NeatNoveltySolvabilityRandomPadding/2021-08-13_08-11-07/100/2/seed_2_name_v4_test_neat_sweep_more_test_things_2021-08-13_12-34-17.p', '../results/v4_test_neat_sweep_more_test_things/Maze/NeatNoveltySolvabilityRandomPadding/2021-08-13_08-11-07/100/3/seed_3_name_v4_test_neat_sweep_more_test_things_2021-08-13_14-03-46.p', ] + [ '../results/experiments/experiment_102_d_visual_diversity/Maze/DirectGA/2021-09-29_07-25-28/100/100/1/True/True/0/seed_0_name_experiment_102_d_visual_diversity_2021-09-29_09-49-47.p', '../results/experiments/experiment_102_d_visual_diversity/Maze/DirectGA/2021-09-29_07-25-28/100/100/1/True/True/1/seed_1_name_experiment_102_d_visual_diversity_2021-09-29_10-40-47.p', '../results/experiments/experiment_102_d_visual_diversity/Maze/DirectGA/2021-09-29_07-25-28/100/100/1/True/True/2/seed_2_name_experiment_102_d_visual_diversity_2021-09-29_09-01-09.p', '../results/experiments/experiment_102_d_visual_diversity/Maze/DirectGA/2021-09-29_07-25-28/100/100/1/True/True/3/seed_3_name_experiment_102_d_visual_diversity_2021-09-29_11-27-20.p', '../results/experiments/experiment_102_d_visual_diversity/Maze/DirectGA/2021-09-29_07-25-28/100/100/1/True/True/4/seed_4_name_experiment_102_d_visual_diversity_2021-09-29_11-09-06.p', ] + [ '../results/experiments/experiment_102_f_visual_diversity_rerun_batch/Maze/DirectGA/2021-10-03_08-34-50/50/100/0/True/True/0/seed_0_name_experiment_102_f_visual_diversity_rerun_batch_2021-10-03_09-12-00.p', '../results/experiments/experiment_102_f_visual_diversity_rerun_batch/Maze/DirectGA/2021-10-03_08-34-50/50/100/0/True/True/1/seed_1_name_experiment_102_f_visual_diversity_rerun_batch_2021-10-03_09-21-28.p', '../results/experiments/experiment_102_f_visual_diversity_rerun_batch/Maze/DirectGA/2021-10-03_08-34-50/50/100/0/True/True/2/seed_2_name_experiment_102_f_visual_diversity_rerun_batch_2021-10-03_08-53-46.p', '../results/experiments/experiment_102_f_visual_diversity_rerun_batch/Maze/DirectGA/2021-10-03_08-34-50/50/100/0/True/True/3/seed_3_name_experiment_102_f_visual_diversity_rerun_batch_2021-10-03_09-11-53.p', '../results/experiments/experiment_102_f_visual_diversity_rerun_batch/Maze/DirectGA/2021-10-03_08-34-50/50/100/0/True/True/4/seed_4_name_experiment_102_f_visual_diversity_rerun_batch_2021-10-03_09-32-38.p', ] + [ '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/False/0/seed_0_name_experiment_102_aaa_rerun_only_best_2021-09-16_08-18-25.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/False/1/seed_1_name_experiment_102_aaa_rerun_only_best_2021-09-16_08-18-19.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/False/2/seed_2_name_experiment_102_aaa_rerun_only_best_2021-09-16_08-19-23.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/False/3/seed_3_name_experiment_102_aaa_rerun_only_best_2021-09-16_08-18-30.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/False/4/seed_4_name_experiment_102_aaa_rerun_only_best_2021-09-16_08-18-01.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/True/0/seed_0_name_experiment_102_aaa_rerun_only_best_2021-09-16_13-13-52.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/True/1/seed_1_name_experiment_102_aaa_rerun_only_best_2021-09-16_13-18-39.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/True/2/seed_2_name_experiment_102_aaa_rerun_only_best_2021-09-16_13-04-45.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/True/3/seed_3_name_experiment_102_aaa_rerun_only_best_2021-09-16_13-12-30.p', '../results/experiments/experiment_102_aaa_rerun_only_best/Maze/DirectGA/2021-09-16_07-51-09/100/100/1/True/True/4/seed_4_name_experiment_102_aaa_rerun_only_best_2021-09-16_13-17-46.p', ] print("LEN = ", len(pickles)) game = MazeGame(MazeLevel()) def get_metrics(g): parent = AStarDiversityAndDifficultyMetric(g, number_of_times_to_do_evaluation=5) div = AStarDiversityMetric(g, parent) diff = AStarDifficultyMetric(g, parent) return [ SolvabilityMetric(g), LeniencyMetric(g), CompressionDistanceMetric(g), AveragePairWiseDistanceMetric(g), div, diff, AStarEditDistanceDiversityMetric(g, parent) ], parent @ray.remote def single_func(index: int, pickle_name: str): metrics, parent = get_metrics(game) mydic = { 'name': pickle_name } with open(pickle_name, 'rb') as f: ans = pickle.load(f) levels = ans['levels'] for k, metric in enumerate(metrics): print( f"Index {index} starting with metric {metric.name()} {k+1} / {len(metrics)}") mydic[metric.name()] = metric.evaluate(levels) mydic['test_parent'] = parent return mydic futures = [single_func.remote(i, pickles[i]) for i in range(len(pickles))] all_values = (ray.get(futures)) d = f'../results/experiments/106/runs/{get_date()}' os.makedirs(d, exist_ok=True) FILENAME = f"{d}/data.p" with open(FILENAME, 'wb+') as f: pickle.dump(all_values, f) return FILENAME if __name__ == '__main__': FILE = main() import matplotlib.pyplot as plt analyse_things( [ 'LeniencyMetric', 'AStarDifficultyMetric' ], file_to_use=FILE ) plt.close() analyse_things([ 'CompressionDistanceMetric', 'EditDistanceMetric', 'HammingDistanceMetric', 'AStarDiversityMetric' ], 'diversity', file_to_use=FILE)
69.651007
214
0.758528
1,715
10,378
4.229155
0.12828
0.050738
0.06549
0.099959
0.719978
0.705088
0.704536
0.703433
0.679994
0.670068
0
0.170153
0.115437
10,378
148
215
70.121622
0.619935
0.017441
0
0.061538
0
0.292308
0.691236
0.673177
0
0
0
0
0
1
0.023077
false
0
0.138462
0
0.184615
0.015385
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
7
d7398e4a644f9cc30f10196c0cfe03ce08214108
80
py
Python
modules/some_module.py
kl4m4/PythonCLITemplate
46dbd0173dfa6ae42fa80eb0652956c7c7cf3f9b
[ "Unlicense" ]
null
null
null
modules/some_module.py
kl4m4/PythonCLITemplate
46dbd0173dfa6ae42fa80eb0652956c7c7cf3f9b
[ "Unlicense" ]
null
null
null
modules/some_module.py
kl4m4/PythonCLITemplate
46dbd0173dfa6ae42fa80eb0652956c7c7cf3f9b
[ "Unlicense" ]
null
null
null
def some_function_in_module(): print("Hello from some_function_in_module()")
40
49
0.7875
12
80
4.75
0.666667
0.421053
0.491228
0.701754
0
0
0
0
0
0
0
0
0.1
80
2
49
40
0.791667
0
0
0
0
0
0.444444
0.308642
0
0
0
0
0
1
0.5
true
0
0
0
0.5
0.5
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
1
0
0
0
0
1
0
8