sequence
stringlengths 902
12k
| docstring
stringlengths 4
15.2k
|
---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_distant'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '11', '21', '31', '44', '49']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '9', 'type': 'argument_list', 'children': ['10']}; {'id': '10', 'type': 'string', 'children': [], 'value': '"Loading distant Zotero data..."'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_references'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'get_references'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'reference_types'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'get_reference_types'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'reference_templates'}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'get_reference_templates'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'reference_types'}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'string', 'children': [], 'value': '"Distant Zotero data loaded."'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'cache'}; {'id': '54', 'type': 'argument_list', 'children': []}
|
Load the distant Zotero data.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'extract_audio'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'channels'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'rate'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '16000'}; {'id': '11', 'type': 'block', 'children': ['12', '26', '57', '74', '97', '108', '126']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'temp'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'tempfile'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'NamedTemporaryFile'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '23']}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'.wav'"}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '25', 'type': 'False', 'children': []}; {'id': '26', 'type': 'if_statement', 'children': ['27', '36']}; {'id': '27', 'type': 'not_operator', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '36', 'type': 'block', 'children': ['37', '47']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'string', 'children': [], 'value': '"The given file does not exist: {}"'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '47', 'type': 'raise_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'string', 'children': [], 'value': '"Invalid filepath: {}"'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '57', 'type': 'if_statement', 'children': ['58', '63']}; {'id': '58', 'type': 'not_operator', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'which'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'string', 'children': [], 'value': '"ffmpeg"'}; {'id': '63', 'type': 'block', 'children': ['64', '69']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'string', 'children': [], 'value': '"ffmpeg: Executable not found on machine."'}; {'id': '69', 'type': 'raise_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'string', 'children': [], 'value': '"Dependency not found: ffmpeg"'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '77', 'type': 'list', 'children': ['78', '79', '80', '81', '82', '83', '87', '88', '92', '93', '94'], 'value': '["ffmpeg", "-y", "-i", filename,\n "-ac", str(channels), "-ar", str(rate),\n "-loglevel", "error", temp.name]'}; {'id': '78', 'type': 'string', 'children': [], 'value': '"ffmpeg"'}; {'id': '79', 'type': 'string', 'children': [], 'value': '"-y"'}; {'id': '80', 'type': 'string', 'children': [], 'value': '"-i"'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '82', 'type': 'string', 'children': [], 'value': '"-ac"'}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'channels'}; {'id': '87', 'type': 'string', 'children': [], 'value': '"-ar"'}; {'id': '88', 'type': 'call', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'rate'}; {'id': '92', 'type': 'string', 'children': [], 'value': '"-loglevel"'}; {'id': '93', 'type': 'string', 'children': [], 'value': '"error"'}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'temp'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'use_shell'}; {'id': '100', 'type': 'conditional_expression', 'children': ['101', '102', '107'], 'value': 'if'}; {'id': '101', 'type': 'True', 'children': []}; {'id': '102', 'type': 'comparison_operator', 'children': ['103', '106'], 'value': '=='}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '106', 'type': 'string', 'children': [], 'value': '"nt"'}; {'id': '107', 'type': 'False', 'children': []}; {'id': '108', 'type': 'expression_statement', 'children': ['109']}; {'id': '109', 'type': 'call', 'children': ['110', '113']}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'check_output'}; {'id': '113', 'type': 'argument_list', 'children': ['114', '115', '123']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '115', 'type': 'keyword_argument', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'stdin'}; {'id': '117', 'type': 'call', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'devnull'}; {'id': '123', 'type': 'keyword_argument', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'use_shell'}; {'id': '126', 'type': 'return_statement', 'children': ['127']}; {'id': '127', 'type': 'expression_list', 'children': ['128', '131']}; {'id': '128', 'type': 'attribute', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'temp'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'rate'}
|
Extract audio from an input file to a temporary WAV file.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'on_any_event'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '9', '12']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'delegate'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'delegates'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '19']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'delegate'}; {'id': '18', 'type': 'string', 'children': [], 'value': '"on_any_event"'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'delegate'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'on_any_event'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'event'}
|
On any event method
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'processing_blocks'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '23', '43']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'sbi_ids'}; {'id': '9', 'type': 'attribute', 'children': ['10', '18']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'Subarray'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_name'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'sbi_ids'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'pbs'}; {'id': '22', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '23', 'type': 'for_statement', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sbi_id'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'sbi_ids'}; {'id': '26', 'type': 'block', 'children': ['27', '34']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'sbi'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'SchedulingBlockInstance'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'sbi_id'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'pbs'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sbi'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'processing_block_ids'}; {'id': '43', 'type': 'return_statement', 'children': ['44']}; {'id': '44', 'type': 'expression_list', 'children': ['45', '46']}; {'id': '45', 'type': 'string', 'children': [], 'value': "'PB'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'pbs'}
|
Return list of PBs associated with the subarray.
<http://www.esrf.eu/computing/cs/tango/pytango/v920/server_api/server.html#PyTango.server.pipe>
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '6', 'type': 'block', 'children': ['7', '23']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_decode'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '23', 'type': 'for_statement', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'process'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'c'}
|
Process text, writing it to the virtual screen while handling
ANSI escape codes.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_service_config'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '55']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '18']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'config_path'}; {'id': '18', 'type': 'block', 'children': ['19', '53']}; {'id': '19', 'type': 'try_statement', 'children': ['20', '37']}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'makedirs'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '33']}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'config_path'}; {'id': '37', 'type': 'except_clause', 'children': ['38', '42']}; {'id': '38', 'type': 'as_pattern', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'OSError'}; {'id': '40', 'type': 'as_pattern_target', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'if_statement', 'children': ['44', '51']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '48'], 'value': '!='}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'errno'}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'errno'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'EEXIST'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'raise_statement', 'children': []}; {'id': '53', 'type': 'return_statement', 'children': ['54']}; {'id': '54', 'type': 'dictionary', 'children': []}; {'id': '55', 'type': 'with_statement', 'children': ['56', '68']}; {'id': '56', 'type': 'with_clause', 'children': ['57']}; {'id': '57', 'type': 'with_item', 'children': ['58']}; {'id': '58', 'type': 'as_pattern', 'children': ['59', '66']}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'config_path'}; {'id': '65', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '66', 'type': 'as_pattern_target', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'return_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'data'}
|
Reads in config file of UAA credential information
or generates one as a side-effect if not yet
initialized.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'transform_e1e2'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'e1'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'e2'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'center_x'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'center_y'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '14', 'type': 'block', 'children': ['15', '21', '27', '40', '54', '75']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'x_shift'}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '20'], 'value': '-'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'center_x'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'y_shift'}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '26'], 'value': '-'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'center_y'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'x_'}; {'id': '30', 'type': 'binary_operator', 'children': ['31', '37'], 'value': '-'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '36'], 'value': '*'}; {'id': '32', 'type': '()', 'children': ['33']}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '-'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'e1'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'x_shift'}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '39'], 'value': '*'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'e2'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'y_shift'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'y_'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '48'], 'value': '+'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '47'], 'value': '*'}; {'id': '45', 'type': 'unary_operator', 'children': ['46'], 'value': '-'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'e2'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'x_shift'}; {'id': '48', 'type': 'binary_operator', 'children': ['49', '53'], 'value': '*'}; {'id': '49', 'type': '()', 'children': ['50']}; {'id': '50', 'type': 'binary_operator', 'children': ['51', '52'], 'value': '+'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'e1'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'y_shift'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'det'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'binary_operator', 'children': ['63', '72'], 'value': '+'}; {'id': '63', 'type': 'binary_operator', 'children': ['64', '68'], 'value': '*'}; {'id': '64', 'type': '()', 'children': ['65']}; {'id': '65', 'type': 'binary_operator', 'children': ['66', '67'], 'value': '-'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'e1'}; {'id': '68', 'type': '()', 'children': ['69']}; {'id': '69', 'type': 'binary_operator', 'children': ['70', '71'], 'value': '+'}; {'id': '70', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'e1'}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '74'], 'value': '**'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'e2'}; {'id': '74', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '75', 'type': 'return_statement', 'children': ['76']}; {'id': '76', 'type': 'expression_list', 'children': ['77', '80']}; {'id': '77', 'type': 'binary_operator', 'children': ['78', '79'], 'value': '/'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'x_'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'det'}; {'id': '80', 'type': 'binary_operator', 'children': ['81', '82'], 'value': '/'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'y_'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'det'}
|
maps the coordinates x, y with eccentricities e1 e2 into a new elliptical coordiante system
:param x:
:param y:
:param e1:
:param e2:
:param center_x:
:param center_y:
:return:
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_string'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '47', '117']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '9', 'type': 'string', 'children': [], 'value': "''"}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14', '27']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'prior_delim'}; {'id': '14', 'type': 'block', 'children': ['15', '21']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'prior_delim'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'prior_delim'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'else_clause', 'children': ['28']}; {'id': '28', 'type': 'block', 'children': ['29', '35', '41']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'augmented_assignment', 'children': ['37', '38'], 'value': '+='}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'update_chars'}; {'id': '46', 'type': 'argument_list', 'children': []}; {'id': '47', 'type': 'while_statement', 'children': ['48', '49']}; {'id': '48', 'type': 'True', 'children': []}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'if_statement', 'children': ['51', '56', '89', '103']}; {'id': '51', 'type': 'comparison_operator', 'children': ['52', '55'], 'value': '=='}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '56', 'type': 'block', 'children': ['57', '63']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'update_chars'}; {'id': '62', 'type': 'argument_list', 'children': []}; {'id': '63', 'type': 'if_statement', 'children': ['64', '69', '82']}; {'id': '64', 'type': 'comparison_operator', 'children': ['65', '68'], 'value': '=='}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '69', 'type': 'block', 'children': ['70', '76']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'augmented_assignment', 'children': ['72', '73'], 'value': '+='}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '73', 'type': 'binary_operator', 'children': ['74', '75'], 'value': '*'}; {'id': '74', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'update_chars'}; {'id': '81', 'type': 'argument_list', 'children': []}; {'id': '82', 'type': 'else_clause', 'children': ['83']}; {'id': '83', 'type': 'block', 'children': ['84', '88']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'augmented_assignment', 'children': ['86', '87'], 'value': '+='}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '88', 'type': 'break_statement', 'children': []}; {'id': '89', 'type': 'elif_clause', 'children': ['90', '95']}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '94'], 'value': '=='}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '95', 'type': 'block', 'children': ['96', '102']}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'prior_delim'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'delim'}; {'id': '102', 'type': 'break_statement', 'children': []}; {'id': '103', 'type': 'else_clause', 'children': ['104']}; {'id': '104', 'type': 'block', 'children': ['105', '111']}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'augmented_assignment', 'children': ['107', '108'], 'value': '+='}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'call', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'update_chars'}; {'id': '116', 'type': 'argument_list', 'children': []}; {'id': '117', 'type': 'return_statement', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'word'}
|
Tokenize a Fortran string.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prepare_read'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '7', 'type': 'string', 'children': [], 'value': "'readlines'"}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '10', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '11', 'type': 'block', 'children': ['12', '81']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '18', '29', '48', '69']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'readlines'"}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'elif_clause', 'children': ['30', '35']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'if_statement', 'children': ['37', '40']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '39'], 'value': '=='}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '39', 'type': 'string', 'children': [], 'value': "'read'"}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "''"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '48', 'type': 'elif_clause', 'children': ['49', '54']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '58', 'type': 'call', 'children': ['59', '68']}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '67']}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '64', 'type': 'argument_list', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'else_clause', 'children': ['70']}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'raise_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '%'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'Unable to handle data of type %r'"}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '81', 'type': 'return_statement', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'data'}
|
Prepare various input types for parsing.
Args:
data (iter): Data to read
method (str): Method to process data with
mode (str): Custom mode to process with, if data is a file
Returns:
list: List suitable for parsing
Raises:
TypeError: Invalid value for data
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_log_block_num'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'bl'}; {'id': '6', 'type': 'block', 'children': ['7', '20']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '12']}; {'id': '8', 'type': 'not_operator', 'children': ['9']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_initialized'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'raise_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'pycdlibexception'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'PyCdlibInternalError'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'CL record not yet initialized!'"}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'child_log_block_num'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'bl'}
|
Set the logical block number for the child.
Parameters:
bl - Logical block number of the child.
Returns:
Nothing.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_access_token'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '78']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'is_access_token_expired'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '23', '54', '70']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '17']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'is_debug_enabled'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'requesting new access_token'"}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'get_access_token'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '34', '39', '44', '49']}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'client_id'}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'client_id'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'client_secret'}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'client_secret'}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'app_url'}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'app_url'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'expires_at'}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '65'], 'value': '+'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '64', 'type': 'argument_list', 'children': []}; {'id': '65', 'type': 'binary_operator', 'children': ['66', '69'], 'value': '/'}; {'id': '66', 'type': 'subscript', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '68', 'type': 'string', 'children': [], 'value': "'expires_in'"}; {'id': '69', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'access_token'}; {'id': '75', 'type': 'subscript', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'access_token'"}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'access_token'}
|
get a valid access token
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'match'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'device'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '10', 'type': 'generator_expression', 'children': ['11', '20']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'match_value'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '19']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'device'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '20', 'type': 'for_in_clause', 'children': ['21', '24']}; {'id': '21', 'type': 'pattern_list', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_match'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '30', 'type': 'argument_list', 'children': []}
|
Check if the device object matches this filter.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'threaded_start'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'no_init'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '26', '33', '39']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'thread'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'Thread'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '20']}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'init_connections'}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '22', 'type': 'dictionary', 'children': ['23']}; {'id': '23', 'type': 'pair', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'no_init'"}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'no_init'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'thread'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'setDaemon'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'True', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'thread'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'thread'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '44', 'type': 'argument_list', 'children': []}
|
Spawns a worker thread to set up the zookeeper connection
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'template_name'}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11', '22', '31']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '14', 'type': 'call', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'get_template'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'template_name'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'render'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '40']}; {'id': '33', 'type': 'attribute', 'children': ['34', '39']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'TemplateFileWriter'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '40', 'type': 'argument_list', 'children': ['41', '44', '47']}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'content'}
|
Write a file according to the template name
Args:
destination (string): the destination location
filename (string): the filename that will be written
template_name (string): the name of the template
kwargs (dict): all attribute that will be passed to the template
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_effective_perm_list_from_iter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'perm_iter'}; {'id': '6', 'type': 'block', 'children': ['7', '16']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'highest_perm_str'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_highest_perm_from_iter'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'perm_iter'}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': '()', 'children': ['18']}; {'id': '18', 'type': 'conditional_expression', 'children': ['19', '25', '28'], 'value': 'if'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_equal_or_lower_perm_list'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'highest_perm_str'}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'is not'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'highest_perm_str'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'None', 'children': []}
|
Return list of effective permissions for for highest permission in
``perm_iter``, ordered lower to higher, or None if ``perm_iter`` is empty.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_block_publisher'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'state_hash'}; {'id': '6', 'type': 'block', 'children': ['7', '18']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'state_view'}; {'id': '10', 'type': 'call', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_state_view_factory'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'create_view'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'state_hash'}; {'id': '18', 'type': 'try_statement', 'children': ['19', '89']}; {'id': '19', 'type': 'block', 'children': ['20', '34', '44']}; {'id': '20', 'type': 'class_definition', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'BatchPublisher'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'function_definition', 'children': ['24', '25', '28']}; {'id': '24', 'type': 'function_name', 'children': [], 'value': 'send'}; {'id': '25', 'type': 'parameters', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'transactions'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'raise_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'InvalidGenesisConsensusError'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'Consensus cannot send transactions during genesis.'"}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'consensus'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'ConsensusFactory'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'get_configured_consensus_module'}; {'id': '41', 'type': 'argument_list', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'NULL_BLOCK_IDENTIFIER'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'state_view'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'consensus'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'BlockPublisher'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '56', '61', '66', '71', '76']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'BlockCache'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': '_block_store'}; {'id': '56', 'type': 'keyword_argument', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'state_view_factory'}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': '_state_view_factory'}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'batch_publisher'}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'BatchPublisher'}; {'id': '65', 'type': 'argument_list', 'children': []}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'data_dir'}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': '_data_dir'}; {'id': '71', 'type': 'keyword_argument', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'config_dir'}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': '_config_dir'}; {'id': '76', 'type': 'keyword_argument', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'validator_id'}; {'id': '78', 'type': 'call', 'children': ['79', '88']}; {'id': '79', 'type': 'attribute', 'children': ['80', '87']}; {'id': '80', 'type': 'call', 'children': ['81', '86']}; {'id': '81', 'type': 'attribute', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': '_identity_signer'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'get_public_key'}; {'id': '86', 'type': 'argument_list', 'children': []}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'as_hex'}; {'id': '88', 'type': 'argument_list', 'children': []}; {'id': '89', 'type': 'except_clause', 'children': ['90', '94']}; {'id': '90', 'type': 'as_pattern', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'UnknownConsensusModuleError'}; {'id': '92', 'type': 'as_pattern_target', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '94', 'type': 'block', 'children': ['95']}; {'id': '95', 'type': 'raise_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'InvalidGenesisStateError'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'e'}
|
Returns the block publisher based on the consensus module set by the
"sawtooth_settings" transaction family.
Args:
state_hash (str): The current state root hash for reading settings.
Raises:
InvalidGenesisStateError: if any errors occur getting the
BlockPublisher.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'unlock'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'locked'}; {'id': '14', 'type': 'block', 'children': ['15', '32', '38']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_privkey'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'decode_keyfile_json'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'keystore'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'UTF-8'"}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'locked'}; {'id': '37', 'type': 'False', 'children': []}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_fill_address'}; {'id': '43', 'type': 'argument_list', 'children': []}
|
Unlock the account with a password.
If the account is already unlocked, nothing happens, even if the password is wrong.
Raises:
ValueError: (originating in ethereum.keys) if the password is wrong
(and the account is locked)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'hybrid_meco_frequency'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'm1'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'm2'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'chi1'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'chi2'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'qm1'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'qm2'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15', '24', '33']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '19']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': 'is'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'qm1'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'qm1'}; {'id': '23', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '24', 'type': 'if_statement', 'children': ['25', '28']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'is'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'qm2'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'qm2'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'velocity_to_frequency'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '46']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'hybrid_meco_velocity'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42', '43', '44', '45']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'm1'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'm2'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'chi1'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'chi2'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'qm1'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'qm2'}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '+'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'm1'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'm2'}
|
Return the frequency of the hybrid MECO
Parameters
----------
m1 : float
Mass of the primary object in solar masses.
m2 : float
Mass of the secondary object in solar masses.
chi1: float
Dimensionless spin of the primary object.
chi2: float
Dimensionless spin of the secondary object.
qm1: {None, float}, optional
Quadrupole-monopole term of the primary object (1 for black holes).
If None, will be set to qm1 = 1.
qm2: {None, float}, optional
Quadrupole-monopole term of the secondary object (1 for black holes).
If None, will be set to qm2 = 1.
Returns
-------
f: float
The frequency (in Hz) of the hybrid MECO
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_tex'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '11', '23', '28', '42']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'datadir'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'livvkit'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'index_dir'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'outdir'}; {'id': '14', 'type': 'call', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'datadir'}; {'id': '22', 'type': 'string', 'children': [], 'value': '"tex"'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'outdir'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'data_files'}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'glob'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'glob'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '39']}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '+'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'datadir'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"/**/*.json"'}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'recursive'}; {'id': '41', 'type': 'True', 'children': []}; {'id': '42', 'type': 'for_statement', 'children': ['43', '44', '45']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'each'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'data_files'}; {'id': '45', 'type': 'block', 'children': ['46', '55', '62', '87']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'functions'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'read_json'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'each'}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'tex'}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'translate_page'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '65', 'type': 'call', 'children': ['66', '71']}; {'id': '66', 'type': 'attribute', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'outdir'}; {'id': '73', 'type': 'call', 'children': ['74', '84']}; {'id': '74', 'type': 'attribute', 'children': ['75', '83']}; {'id': '75', 'type': 'call', 'children': ['76', '81']}; {'id': '76', 'type': 'attribute', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'basename'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'each'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '86']}; {'id': '85', 'type': 'string', 'children': [], 'value': "'json'"}; {'id': '86', 'type': 'string', 'children': [], 'value': "'tex'"}; {'id': '87', 'type': 'with_statement', 'children': ['88', '98']}; {'id': '88', 'type': 'with_clause', 'children': ['89']}; {'id': '89', 'type': 'with_item', 'children': ['90']}; {'id': '90', 'type': 'as_pattern', 'children': ['91', '96']}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '93', 'type': 'argument_list', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '95', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '96', 'type': 'as_pattern_target', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '98', 'type': 'block', 'children': ['99']}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'call', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'tex'}
|
Finds all of the output data files, and writes them out to .tex
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_tibiadata_datetime'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'date_dict'}; {'id': '5', 'type': 'type', 'children': ['6']}; {'id': '6', 'type': 'generic_type', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'Optional'}; {'id': '8', 'type': 'type_parameter', 'children': ['9']}; {'id': '9', 'type': 'type', 'children': ['10']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '13', 'type': 'block', 'children': ['14', '38', '64', '77']}; {'id': '14', 'type': 'try_statement', 'children': ['15', '30']}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '19', 'type': 'call', 'children': ['20', '25']}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'strptime'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '29']}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'date_dict'}; {'id': '28', 'type': 'string', 'children': [], 'value': '"date"'}; {'id': '29', 'type': 'string', 'children': [], 'value': '"%Y-%m-%d %H:%M:%S.%f"'}; {'id': '30', 'type': 'except_clause', 'children': ['31', '35']}; {'id': '31', 'type': 'tuple', 'children': ['32', '33', '34']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'None', 'children': []}; {'id': '38', 'type': 'if_statement', 'children': ['39', '44', '49', '60']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '43'], 'value': '=='}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'date_dict'}; {'id': '42', 'type': 'string', 'children': [], 'value': '"timezone"'}; {'id': '43', 'type': 'string', 'children': [], 'value': '"CET"'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'timezone_offset'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '49', 'type': 'elif_clause', 'children': ['50', '55']}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '54'], 'value': '=='}; {'id': '51', 'type': 'subscript', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'date_dict'}; {'id': '53', 'type': 'string', 'children': [], 'value': '"timezone"'}; {'id': '54', 'type': 'string', 'children': [], 'value': '"CEST"'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'timezone_offset'}; {'id': '59', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '60', 'type': 'else_clause', 'children': ['61']}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'return_statement', 'children': ['63']}; {'id': '63', 'type': 'None', 'children': []}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '-'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'timedelta'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'keyword_argument', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'hours'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'timezone_offset'}; {'id': '77', 'type': 'return_statement', 'children': ['78']}; {'id': '78', 'type': 'call', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'keyword_argument', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'tzinfo'}; {'id': '85', 'type': 'attribute', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'utc'}
|
Parses time objects from the TibiaData API.
Time objects are made of a dictionary with three keys:
date: contains a string representation of the time
timezone: a string representation of the timezone the date time is based on
timezone_type: the type of representation used in the timezone key
Parameters
----------
date_dict: :class:`dict`
Dictionary representing the time object.
Returns
-------
:class:`datetime.date`, optional
The represented datetime, in UTC.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_properties'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'recursive'}; {'id': '8', 'type': 'block', 'children': ['9', '38', '48', '58', '87', '104']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'list', 'children': ['18', '21', '22'], 'value': "[pathobj.drive,\n 'api/storage',\n str(pathobj.relative_to(pathobj.drive)).strip('/')]"}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'drive'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'api/storage'"}; {'id': '22', 'type': 'call', 'children': ['23', '36']}; {'id': '23', 'type': 'attribute', 'children': ['24', '35']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'relative_to'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'drive'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '41', 'type': 'dictionary', 'children': ['42']}; {'id': '42', 'type': 'pair', 'children': ['43', '44']}; {'id': '43', 'type': 'string', 'children': [], 'value': "'properties'"}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'encode_properties'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '48', 'type': 'if_statement', 'children': ['49', '51']}; {'id': '49', 'type': 'not_operator', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'recursive'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '57']}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '56', 'type': 'string', 'children': [], 'value': "'recursive'"}; {'id': '57', 'type': 'string', 'children': [], 'value': "'0'"}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '63']}; {'id': '60', 'type': 'pattern_list', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'rest_put'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69', '72', '77', '82']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'auth'}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'auth'}; {'id': '77', 'type': 'keyword_argument', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'verify'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'verify'}; {'id': '82', 'type': 'keyword_argument', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'cert'}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'pathobj'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'cert'}; {'id': '87', 'type': 'if_statement', 'children': ['88', '95']}; {'id': '88', 'type': 'boolean_operator', 'children': ['89', '92'], 'value': 'and'}; {'id': '89', 'type': 'comparison_operator', 'children': ['90', '91'], 'value': '=='}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '91', 'type': 'integer', 'children': [], 'value': '404'}; {'id': '92', 'type': 'comparison_operator', 'children': ['93', '94'], 'value': 'in'}; {'id': '93', 'type': 'string', 'children': [], 'value': '"Unable to find item"'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '95', 'type': 'block', 'children': ['96']}; {'id': '96', 'type': 'raise_statement', 'children': ['97']}; {'id': '97', 'type': 'call', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'OSError'}; {'id': '99', 'type': 'argument_list', 'children': ['100', '101']}; {'id': '100', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '101', 'type': 'binary_operator', 'children': ['102', '103'], 'value': '%'}; {'id': '102', 'type': 'string', 'children': [], 'value': '"No such file or directory: \'%s\'"'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '104', 'type': 'if_statement', 'children': ['105', '108']}; {'id': '105', 'type': 'comparison_operator', 'children': ['106', '107'], 'value': '!='}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '107', 'type': 'integer', 'children': [], 'value': '204'}; {'id': '108', 'type': 'block', 'children': ['109']}; {'id': '109', 'type': 'raise_statement', 'children': ['110']}; {'id': '110', 'type': 'call', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'text'}
|
Set artifact properties
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'power_on'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '10', '15']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_default_parameter', 'children': ['6', '7', '9']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'typed_default_parameter', 'children': ['11', '12', '14']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'wait'}; {'id': '12', 'type': 'type', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '14', 'type': 'False', 'children': []}; {'id': '15', 'type': 'typed_default_parameter', 'children': ['16', '17', '19']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'wait_interval'}; {'id': '17', 'type': 'type', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '19', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '20', 'type': 'block', 'children': ['21', '30', '41', '86']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '24', 'type': 'dictionary', 'children': ['25']}; {'id': '25', 'type': 'pair', 'children': ['26', '27']}; {'id': '26', 'type': 'string', 'children': [], 'value': '"system_id"'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'system_id'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '34']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': 'is not'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '33', 'type': 'None', 'children': []}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '40']}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '39', 'type': 'string', 'children': [], 'value': '"comment"'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '41', 'type': 'try_statement', 'children': ['42', '58']}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': '_data'}; {'id': '48', 'type': 'await', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '55']}; {'id': '50', 'type': 'attribute', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': '_handler'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'power_on'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'dictionary_splat', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '58', 'type': 'except_clause', 'children': ['59', '63']}; {'id': '59', 'type': 'as_pattern', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'CallError'}; {'id': '61', 'type': 'as_pattern_target', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'if_statement', 'children': ['65', '72', '83']}; {'id': '65', 'type': 'comparison_operator', 'children': ['66', '69'], 'value': '=='}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'HTTPStatus'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'FORBIDDEN'}; {'id': '72', 'type': 'block', 'children': ['73', '77']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '76', 'type': 'string', 'children': [], 'value': '"Not allowed to power on machine."'}; {'id': '77', 'type': 'raise_statement', 'children': ['78', '82']}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'OperationNotAllowed'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '83', 'type': 'else_clause', 'children': ['84']}; {'id': '84', 'type': 'block', 'children': ['85']}; {'id': '85', 'type': 'raise_statement', 'children': []}; {'id': '86', 'type': 'if_statement', 'children': ['87', '97', '100']}; {'id': '87', 'type': 'boolean_operator', 'children': ['88', '90'], 'value': 'or'}; {'id': '88', 'type': 'not_operator', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'wait'}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '94'], 'value': '=='}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'power_state'}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'PowerState'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'UNKNOWN'}; {'id': '97', 'type': 'block', 'children': ['98']}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '100', 'type': 'else_clause', 'children': ['101']}; {'id': '101', 'type': 'block', 'children': ['102', '137', '165']}; {'id': '102', 'type': 'while_statement', 'children': ['103', '110']}; {'id': '103', 'type': 'comparison_operator', 'children': ['104', '107'], 'value': '=='}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'power_state'}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'PowerState'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'OFF'}; {'id': '110', 'type': 'block', 'children': ['111', '119']}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'await', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'asyncio'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'wait_interval'}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '124']}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': '_data'}; {'id': '124', 'type': 'await', 'children': ['125']}; {'id': '125', 'type': 'call', 'children': ['126', '131']}; {'id': '126', 'type': 'attribute', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': '_handler'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '131', 'type': 'argument_list', 'children': ['132']}; {'id': '132', 'type': 'keyword_argument', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'system_id'}; {'id': '134', 'type': 'attribute', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'system_id'}; {'id': '137', 'type': 'if_statement', 'children': ['138', '145']}; {'id': '138', 'type': 'comparison_operator', 'children': ['139', '142'], 'value': '=='}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'power_state'}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'PowerState'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'ERROR'}; {'id': '145', 'type': 'block', 'children': ['146', '159']}; {'id': '146', 'type': 'expression_statement', 'children': ['147']}; {'id': '147', 'type': 'assignment', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '149', 'type': 'call', 'children': ['150', '153']}; {'id': '150', 'type': 'attribute', 'children': ['151', '152']}; {'id': '151', 'type': 'string', 'children': [], 'value': '"{hostname} failed to power on."'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '153', 'type': 'argument_list', 'children': ['154']}; {'id': '154', 'type': 'keyword_argument', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '159', 'type': 'raise_statement', 'children': ['160']}; {'id': '160', 'type': 'call', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'PowerError'}; {'id': '162', 'type': 'argument_list', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '165', 'type': 'return_statement', 'children': ['166']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Power on.
:param comment: Reason machine was powered on.
:type comment: `str`
:param wait: If specified, wait until the machine is powered on.
:type wait: `bool`
:param wait_interval: How often to poll, defaults to 5 seconds.
:type wait_interval: `int`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'list_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '7', 'type': 'dictionary_splat_pattern', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '9', 'type': 'block', 'children': ['10', '19', '69']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'trigger_id'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'trigger_id'"}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'trigger'}; {'id': '22', 'type': 'call', 'children': ['23', '66']}; {'id': '23', 'type': 'attribute', 'children': ['24', '65']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'TriggerService'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '37', '40', '43', '54']}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'trigger_id'}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '39', 'type': 'True', 'children': []}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'user__is_active'}; {'id': '42', 'type': 'True', 'children': []}; {'id': '43', 'type': 'keyword_argument', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'provider_failed__lt'}; {'id': '45', 'type': 'call', 'children': ['46', '51']}; {'id': '46', 'type': 'attribute', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'DJANGO_TH'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'string', 'children': [], 'value': "'failed_tries'"}; {'id': '53', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'consumer_failed__lt'}; {'id': '56', 'type': 'call', 'children': ['57', '62']}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'DJANGO_TH'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': "'failed_tries'"}; {'id': '64', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'select_related'}; {'id': '66', 'type': 'argument_list', 'children': ['67', '68']}; {'id': '67', 'type': 'string', 'children': [], 'value': "'consumer__name'"}; {'id': '68', 'type': 'string', 'children': [], 'value': "'provider__name'"}; {'id': '69', 'type': 'try_statement', 'children': ['70', '152']}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'with_statement', 'children': ['72', '83']}; {'id': '72', 'type': 'with_clause', 'children': ['73']}; {'id': '73', 'type': 'with_item', 'children': ['74']}; {'id': '74', 'type': 'as_pattern', 'children': ['75', '81']}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'Pool'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'keyword_argument', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'processes'}; {'id': '80', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '81', 'type': 'as_pattern_target', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '83', 'type': 'block', 'children': ['84', '90', '102', '111', '117', '129', '138']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '87', 'type': 'call', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'Read'}; {'id': '89', 'type': 'argument_list', 'children': []}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'assignment', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '93', 'type': 'call', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'map_async'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'reading'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'trigger'}; {'id': '102', 'type': 'expression_statement', 'children': ['103']}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'keyword_argument', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '110', 'type': 'integer', 'children': [], 'value': '360'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'Pub'}; {'id': '116', 'type': 'argument_list', 'children': []}; {'id': '117', 'type': 'expression_statement', 'children': ['118']}; {'id': '118', 'type': 'assignment', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '120', 'type': 'call', 'children': ['121', '124']}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'map_async'}; {'id': '124', 'type': 'argument_list', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'publishing'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'trigger'}; {'id': '129', 'type': 'expression_statement', 'children': ['130']}; {'id': '130', 'type': 'call', 'children': ['131', '134']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '134', 'type': 'argument_list', 'children': ['135']}; {'id': '135', 'type': 'keyword_argument', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '137', 'type': 'integer', 'children': [], 'value': '360'}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'call', 'children': ['140', '143']}; {'id': '140', 'type': 'attribute', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'cache'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '143', 'type': 'argument_list', 'children': ['144']}; {'id': '144', 'type': 'binary_operator', 'children': ['145', '148'], 'value': '+'}; {'id': '145', 'type': 'binary_operator', 'children': ['146', '147'], 'value': '+'}; {'id': '146', 'type': 'string', 'children': [], 'value': "'django_th'"}; {'id': '147', 'type': 'string', 'children': [], 'value': "'_fire_trigger_'"}; {'id': '148', 'type': 'call', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '150', 'type': 'argument_list', 'children': ['151']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'trigger_id'}; {'id': '152', 'type': 'except_clause', 'children': ['153', '157']}; {'id': '153', 'type': 'as_pattern', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'TimeoutError'}; {'id': '155', 'type': 'as_pattern_target', 'children': ['156']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '157', 'type': 'block', 'children': ['158']}; {'id': '158', 'type': 'expression_statement', 'children': ['159']}; {'id': '159', 'type': 'call', 'children': ['160', '163']}; {'id': '160', 'type': 'attribute', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'e'}
|
get the trigger to fire
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_hising'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'J'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '28', '35', '49']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'poly'}; {'id': '14', 'type': 'dictionary_comprehension', 'children': ['15', '19']}; {'id': '15', 'type': 'pair', 'children': ['16', '18']}; {'id': '16', 'type': 'tuple', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '19', 'type': 'for_in_clause', 'children': ['20', '23']}; {'id': '20', 'type': 'pattern_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '27', 'type': 'argument_list', 'children': []}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'poly'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'J'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '39']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': 'is not'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '38', 'type': 'None', 'children': []}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '48']}; {'id': '42', 'type': 'subscript', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'poly'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'frozenset'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'poly'}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'Vartype'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'SPIN'}
|
Construct a binary polynomial from a higher-order Ising problem.
Args:
h (dict):
The linear biases.
J (dict):
The higher-order biases.
offset (optional, default=0.0):
Constant offset applied to the model.
Returns:
:obj:`.BinaryPolynomial`
Examples:
>>> poly = dimod.BinaryPolynomial.from_hising({'a': 2}, {'ab': -1}, 0)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'authenticate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '7', 'type': 'block', 'children': ['8', '27']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_query_'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17', '18']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'/users/authenticate'"}; {'id': '17', 'type': 'string', 'children': [], 'value': "'POST'"}; {'id': '18', 'type': 'keyword_argument', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '20', 'type': 'dictionary', 'children': ['21', '24']}; {'id': '21', 'type': 'pair', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'username'"}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '24', 'type': 'pair', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'password'"}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '27', 'type': 'if_statement', 'children': ['28', '33', '43']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '32'], 'value': '=='}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '201'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '41']}; {'id': '36', 'type': 'attribute', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'string', 'children': [], 'value': '\'"\''}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'raise_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'string', 'children': [], 'value': "'Authentication invalid.'"}
|
Authenticates your user and returns an auth token.
:param str username: Hummingbird username.
:param str password: Hummingbird password.
:returns: str -- The Auth Token
:raises: ValueError -- If the Authentication is wrong
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'age'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'aff4_type'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'Get'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'attribute', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'Schema'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'TYPE'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '21', '26']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'aff4_type'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'aff4_type'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'age'}; {'id': '26', 'type': 'else_clause', 'children': ['27']}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'rdfvalue'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'RDFDatetime'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'Now'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
RDFDatetime at which the object was created.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getLogs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'argument_filters'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'fromBlock'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'toBlock'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'blockHash'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '31', '39', '50', '58', '64', '74', '86', '114', '125', '138']}; {'id': '18', 'type': 'if_statement', 'children': ['19', '23']}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'concatenated_string', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': '"This method can be only called on "'}; {'id': '30', 'type': 'string', 'children': [], 'value': '"an instated contract with an address"'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'abi'}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_get_event_abi'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': 'is'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'argument_filters'}; {'id': '42', 'type': 'None', 'children': []}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'argument_filters'}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '49', 'type': 'argument_list', 'children': []}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': '_filters'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'dictionary_splat', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'argument_filters'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'blkhash_set'}; {'id': '61', 'type': 'comparison_operator', 'children': ['62', '63'], 'value': 'is not'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'blockHash'}; {'id': '63', 'type': 'None', 'children': []}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'blknum_set'}; {'id': '67', 'type': 'boolean_operator', 'children': ['68', '71'], 'value': 'or'}; {'id': '68', 'type': 'comparison_operator', 'children': ['69', '70'], 'value': 'is not'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'fromBlock'}; {'id': '70', 'type': 'None', 'children': []}; {'id': '71', 'type': 'comparison_operator', 'children': ['72', '73'], 'value': 'is not'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'toBlock'}; {'id': '73', 'type': 'None', 'children': []}; {'id': '74', 'type': 'if_statement', 'children': ['75', '78']}; {'id': '75', 'type': 'boolean_operator', 'children': ['76', '77'], 'value': 'and'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'blkhash_set'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'blknum_set'}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'raise_statement', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'ValidationError'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'concatenated_string', 'children': ['84', '85']}; {'id': '84', 'type': 'string', 'children': [], 'value': "'blockHash cannot be set at the same'"}; {'id': '85', 'type': 'string', 'children': [], 'value': "' time as fromBlock or toBlock'"}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '91']}; {'id': '88', 'type': 'pattern_list', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'data_filter_set'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'event_filter_params'}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'construct_event_filter_params'}; {'id': '93', 'type': 'argument_list', 'children': ['94', '95', '100', '103', '106', '109']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'abi'}; {'id': '95', 'type': 'keyword_argument', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'contract_address'}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '100', 'type': 'keyword_argument', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'argument_filters'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': '_filters'}; {'id': '103', 'type': 'keyword_argument', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'fromBlock'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'fromBlock'}; {'id': '106', 'type': 'keyword_argument', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'toBlock'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'toBlock'}; {'id': '109', 'type': 'keyword_argument', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '114', 'type': 'if_statement', 'children': ['115', '118']}; {'id': '115', 'type': 'comparison_operator', 'children': ['116', '117'], 'value': 'is not'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'blockHash'}; {'id': '117', 'type': 'None', 'children': []}; {'id': '118', 'type': 'block', 'children': ['119']}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '124']}; {'id': '121', 'type': 'subscript', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'event_filter_params'}; {'id': '123', 'type': 'string', 'children': [], 'value': "'blockHash'"}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'blockHash'}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'assignment', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'logs'}; {'id': '128', 'type': 'call', 'children': ['129', '136']}; {'id': '129', 'type': 'attribute', 'children': ['130', '135']}; {'id': '130', 'type': 'attribute', 'children': ['131', '134']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'web3'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'eth'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'getLogs'}; {'id': '136', 'type': 'argument_list', 'children': ['137']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'event_filter_params'}; {'id': '138', 'type': 'return_statement', 'children': ['139']}; {'id': '139', 'type': 'call', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '141', 'type': 'generator_expression', 'children': ['142', '147']}; {'id': '142', 'type': 'call', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'get_event_data'}; {'id': '144', 'type': 'argument_list', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'abi'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '147', 'type': 'for_in_clause', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'logs'}
|
Get events for this contract instance using eth_getLogs API.
This is a stateless method, as opposed to createFilter.
It can be safely called against nodes which do not provide
eth_newFilter API, like Infura nodes.
If there are many events,
like ``Transfer`` events for a popular token,
the Ethereum node might be overloaded and timeout
on the underlying JSON-RPC call.
Example - how to get all ERC-20 token transactions
for the latest 10 blocks:
.. code-block:: python
from = max(mycontract.web3.eth.blockNumber - 10, 1)
to = mycontract.web3.eth.blockNumber
events = mycontract.events.Transfer.getLogs(fromBlock=from, toBlock=to)
for e in events:
print(e["args"]["from"],
e["args"]["to"],
e["args"]["value"])
The returned processed log values will look like:
.. code-block:: python
(
AttributeDict({
'args': AttributeDict({}),
'event': 'LogNoArguments',
'logIndex': 0,
'transactionIndex': 0,
'transactionHash': HexBytes('...'),
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
'blockHash': HexBytes('...'),
'blockNumber': 3
}),
AttributeDict(...),
...
)
See also: :func:`web3.middleware.filter.local_filter_middleware`.
:param argument_filters:
:param fromBlock: block number or "latest", defaults to "latest"
:param toBlock: block number or "latest". Defaults to "latest"
:param blockHash: block hash. blockHash cannot be set at the
same time as fromBlock or toBlock
:yield: Tuple of :class:`AttributeDict` instances
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '6', 'type': 'block', 'children': ['7', '15']}; {'id': '7', 'type': 'import_from_statement', 'children': ['8', '11', '13']}; {'id': '8', 'type': 'dotted_name', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'astropy'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'units'}; {'id': '11', 'type': 'dotted_name', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'au'}; {'id': '13', 'type': 'dotted_name', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '27']}; {'id': '17', 'type': 'attribute', 'children': ['18', '26']}; {'id': '18', 'type': '()', 'children': ['19']}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '25'], 'value': '/'}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '24'], 'value': '*'}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'au_per_d'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'au'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'to'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'unit'}
|
Convert this velocity to the given AstroPy unit.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shape'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'type', 'children': ['6']}; {'id': '6', 'type': 'generic_type', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'Tuple'}; {'id': '8', 'type': 'type_parameter', 'children': ['9', '11']}; {'id': '9', 'type': 'type', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '11', 'type': 'type', 'children': ['12']}; {'id': '12', 'type': 'ellipsis', 'children': [], 'value': '...'}; {'id': '13', 'type': 'block', 'children': ['14', '23', '36', '44', '63', '78']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'nmb_place'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'nmb_time'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'attribute', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'hydpy'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'pub'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'timegrids'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'nmb_others'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'collections'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'deque'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'for_statement', 'children': ['45', '46', '53']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'sequence'}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'nmb_others'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'sequence'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'nmb_others_max'}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '73', 'type': 'argument_list', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'nmb_others'}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '77', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '87'], 'value': '+'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'sort_timeplaceentries'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'nmb_time'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'nmb_place'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'nmb_others_max'}
|
Required shape of |NetCDFVariableDeep.array|.
For the default configuration, the first axis corresponds to the
number of devices, and the second one to the number of timesteps.
We show this for the 0-dimensional input sequence |lland_inputs.Nied|:
>>> from hydpy.core.examples import prepare_io_example_1
>>> nodes, elements = prepare_io_example_1()
>>> from hydpy.core.netcdftools import NetCDFVariableDeep
>>> ncvar = NetCDFVariableDeep('input_nied', isolate=False, timeaxis=1)
>>> for element in elements:
... ncvar.log(element.model.sequences.inputs.nied, None)
>>> ncvar.shape
(3, 4)
For higher dimensional sequences, each new entry corresponds
to the maximum number of fields the respective sequences require.
In the next example, we select the 1-dimensional sequence
|lland_fluxes.NKor|. The maximum number 3 (last value of the
returned |tuple|) is due to the third element defining three
hydrological response units:
>>> ncvar = NetCDFVariableDeep('flux_nkor', isolate=False, timeaxis=1)
>>> for element in elements:
... ncvar.log(element.model.sequences.fluxes.nkor, None)
>>> ncvar.shape
(3, 4, 3)
When using the first axis for time (`timeaxis=0`) the order of the
first two |tuple| entries turns:
>>> ncvar = NetCDFVariableDeep('flux_nkor', isolate=False, timeaxis=0)
>>> for element in elements:
... ncvar.log(element.model.sequences.fluxes.nkor, None)
>>> ncvar.shape
(4, 3, 3)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'any_ends_with'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'string_list'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '7', 'type': 'block', 'children': ['8', '20', '28', '34', '48']}; {'id': '8', 'type': 'try_statement', 'children': ['9', '14']}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 's_base'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '14', 'type': 'except_clause', 'children': ['15']}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 's_base'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'is_string'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 's_base'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '31']}; {'id': '29', 'type': 'not_operator', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'is_string'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'False', 'children': []}; {'id': '34', 'type': 'for_statement', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'string_list'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'if_statement', 'children': ['39', '45']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'True', 'children': []}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'False', 'children': []}
|
Returns true iff one of the strings in string_list ends in
pattern.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tokenize_string'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'separator'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '16', '20', '80', '87']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '11', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '15', 'type': 'string', 'children': [], 'value': '""'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'found_escape'}; {'id': '19', 'type': 'False', 'children': []}; {'id': '20', 'type': 'for_statement', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '23', 'type': 'block', 'children': ['24', '49']}; {'id': '24', 'type': 'if_statement', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'found_escape'}; {'id': '26', 'type': 'block', 'children': ['27', '44', '48']}; {'id': '27', 'type': 'if_statement', 'children': ['28', '31', '36']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '30'], 'value': '=='}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'separator'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'augmented_assignment', 'children': ['34', '35'], 'value': '+='}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'separator'}; {'id': '36', 'type': 'else_clause', 'children': ['37']}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'augmented_assignment', 'children': ['40', '41'], 'value': '+='}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '43'], 'value': '+'}; {'id': '42', 'type': 'string', 'children': [], 'value': '"\\\\"'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'found_escape'}; {'id': '47', 'type': 'False', 'children': []}; {'id': '48', 'type': 'continue_statement', 'children': []}; {'id': '49', 'type': 'if_statement', 'children': ['50', '53', '58', '74']}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '52'], 'value': '=='}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '52', 'type': 'string', 'children': [], 'value': '"\\\\"'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'found_escape'}; {'id': '57', 'type': 'True', 'children': []}; {'id': '58', 'type': 'elif_clause', 'children': ['59', '62']}; {'id': '59', 'type': 'comparison_operator', 'children': ['60', '61'], 'value': '=='}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'separator'}; {'id': '62', 'type': 'block', 'children': ['63', '70']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '73', 'type': 'string', 'children': [], 'value': '""'}; {'id': '74', 'type': 'else_clause', 'children': ['75']}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'augmented_assignment', 'children': ['78', '79'], 'value': '+='}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '87', 'type': 'return_statement', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'results'}
|
Split string with given separator unless the separator is escaped with backslash
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dispatch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'method_frame'}; {'id': '6', 'type': 'block', 'children': ['7', '20']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '10', 'type': 'call', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'dispatch_map'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'method_frame'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'method_id'}; {'id': '20', 'type': 'if_statement', 'children': ['21', '22', '39']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '22', 'type': 'block', 'children': ['23', '34']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '26', 'type': 'call', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'channel'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'clear_synchronous_cb'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'method_frame'}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'raise_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'InvalidMethod'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'binary_operator', 'children': ['48', '49'], 'value': '%'}; {'id': '48', 'type': 'string', 'children': [], 'value': '"no method is registered with id: %d"'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'method_frame'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'method_id'}
|
Dispatch a method for this protocol.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'jsonld'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'datasets'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '21', '52']}; {'id': '7', 'type': 'import_from_statement', 'children': ['8', '12']}; {'id': '8', 'type': 'dotted_name', 'children': ['9', '10', '11']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'renku'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'models'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_json'}; {'id': '12', 'type': 'dotted_name', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '14', 'type': 'import_from_statement', 'children': ['15', '19']}; {'id': '15', 'type': 'dotted_name', 'children': ['16', '17', '18']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'renku'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'models'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_jsonld'}; {'id': '19', 'type': 'dotted_name', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'asjsonld'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '24', 'type': 'list_comprehension', 'children': ['25', '49']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'asjsonld'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'basedir'}; {'id': '31', 'type': 'call', 'children': ['32', '37']}; {'id': '32', 'type': 'attribute', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'relpath'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'attribute', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': '__reference__'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '49', 'type': 'for_in_clause', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'datasets'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '64', 'type': 'integer', 'children': [], 'value': '2'}
|
Format datasets as JSON-LD.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'updateDatasetMenu'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '22', '51']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '9', 'type': 'True', 'children': []}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'current'}; {'id': '13', 'type': 'call', 'children': ['14', '21']}; {'id': '14', 'type': 'attribute', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'vtgui'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'dbs_tree_view'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'currentIndex'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'if_statement', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'current'}; {'id': '24', 'type': 'block', 'children': ['25', '38']}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'leaf'}; {'id': '28', 'type': 'call', 'children': ['29', '36']}; {'id': '29', 'type': 'attribute', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'vtgui'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'dbs_tree_model'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'nodeFromIndex'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'current'}; {'id': '38', 'type': 'if_statement', 'children': ['39', '46']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '43'], 'value': 'in'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'leaf'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'node_kind'}; {'id': '43', 'type': 'tuple', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "u'group'"}; {'id': '45', 'type': 'string', 'children': [], 'value': "u'root group'"}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '50', 'type': 'False', 'children': []}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '58']}; {'id': '53', 'type': 'attribute', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'plot_action'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'setEnabled'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'enabled'}
|
Update the `export` QAction when the Dataset menu is pulled down.
This method is a slot. See class ctor for details.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_typecast_value'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '18', '23', '39', '55']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': '=='}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '11', 'type': 'attribute', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'entities'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'Type'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'BOOLEAN'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '22'], 'value': '=='}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'true'"}; {'id': '23', 'type': 'elif_clause', 'children': ['24', '33']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': '=='}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '26', 'type': 'attribute', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'entities'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'Type'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'INTEGER'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '39', 'type': 'elif_clause', 'children': ['40', '49']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': '=='}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '42', 'type': 'attribute', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'entities'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'Type'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'DOUBLE'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'value'}
|
Helper method to determine actual value based on type of feature variable.
Args:
value: Value in string form as it was parsed from datafile.
type: Type denoting the feature flag type.
Return:
Value type-casted based on type of feature variable.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'publish_topology_closed'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'topology_id'}; {'id': '6', 'type': 'block', 'children': ['7', '14']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'TopologyClosedEvent'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'topology_id'}; {'id': '14', 'type': 'for_statement', 'children': ['15', '16', '19']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'subscriber'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '__topology_listeners'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'try_statement', 'children': ['21', '29']}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'subscriber'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'closed'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '29', 'type': 'except_clause', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_handle_exception'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
Publish a TopologyClosedEvent to all topology listeners.
:Parameters:
- `topology_id`: A unique identifier for the topology this server
is a part of.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_validate_columns'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '23']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'geom_cols'}; {'id': '9', 'type': 'set', 'children': ['10', '11']}; {'id': '10', 'type': 'string', 'children': [], 'value': "'the_geom'"}; {'id': '11', 'type': 'string', 'children': [], 'value': "'the_geom_webmercator'"}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'col_overlap'}; {'id': '15', 'type': 'binary_operator', 'children': ['16', '22'], 'value': '&'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'style_cols'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'geom_cols'}; {'id': '23', 'type': 'if_statement', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'col_overlap'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'raise_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'concatenated_string', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'Style columns cannot be geometry '"}; {'id': '34', 'type': 'string', 'children': [], 'value': "'columns. `{col}` was chosen.'"}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'string', 'children': [], 'value': "','"}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'col_overlap'}
|
Validate the options in the styles
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'go'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'gconfig'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '23', '49']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'rconfig'}; {'id': '10', 'type': 'subscript', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'gconfig'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'rejester'"}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'which_worker'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'rconfig'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'worker'"}; {'id': '22', 'type': 'string', 'children': [], 'value': "'fork_worker'"}; {'id': '23', 'type': 'if_statement', 'children': ['24', '27', '39']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': '=='}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'which_worker'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'fork_worker'"}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'yakonfig'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'set_default_config'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '36']}; {'id': '34', 'type': 'list', 'children': ['35'], 'value': '[rejester]'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'rejester'}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'gconfig'}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'start_logging'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'gconfig'}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'logpath'}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'start_worker'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'which_worker'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'rconfig'}
|
Actually run the worker.
This does some required housekeeping, like setting up logging for
:class:`~rejester.workers.MultiWorker` and establishing the global
:mod:`yakonfig` configuration. This expects to be called with the
:mod:`yakonfig` configuration unset.
:param dict gconfig: the :mod:`yakonfig` global configuration
:param args: command-line arguments
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'restore'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'hist_uid'}; {'id': '6', 'type': 'block', 'children': ['7', '21', '30', '38', '49', '62', '75', '95', '113']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '15', '17']}; {'id': '8', 'type': 'subscript', 'children': ['9', '14']}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'check_post_role'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'string', 'children': [], 'value': "'ADMIN'"}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'pass_statement', 'children': []}; {'id': '17', 'type': 'else_clause', 'children': ['18']}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'MWikiHist'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'get_by_uid'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'hist_uid'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '32', '34']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'pass_statement', 'children': []}; {'id': '34', 'type': 'else_clause', 'children': ['35']}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'False', 'children': []}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'MWiki'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'get_by_uid'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'wiki_id'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'cur_cnt'}; {'id': '52', 'type': 'call', 'children': ['53', '58']}; {'id': '53', 'type': 'attribute', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'tornado'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'escape'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'xhtml_unescape'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'cnt_md'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'old_cnt'}; {'id': '65', 'type': 'call', 'children': ['66', '71']}; {'id': '66', 'type': 'attribute', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'tornado'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'escape'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'xhtml_unescape'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'cnt_md'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'MWiki'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'update_cnt'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'wiki_id'}; {'id': '84', 'type': 'dictionary', 'children': ['85', '88']}; {'id': '85', 'type': 'pair', 'children': ['86', '87']}; {'id': '86', 'type': 'string', 'children': [], 'value': "'cnt_md'"}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'old_cnt'}; {'id': '88', 'type': 'pair', 'children': ['89', '90']}; {'id': '89', 'type': 'string', 'children': [], 'value': "'user_name'"}; {'id': '90', 'type': 'attribute', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'userinfo'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'user_name'}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'MWikiHist'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'update_cnt'}; {'id': '100', 'type': 'argument_list', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'histinfo'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'uid'}; {'id': '104', 'type': 'dictionary', 'children': ['105', '108']}; {'id': '105', 'type': 'pair', 'children': ['106', '107']}; {'id': '106', 'type': 'string', 'children': [], 'value': "'cnt_md'"}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'cur_cnt'}; {'id': '108', 'type': 'pair', 'children': ['109', '110']}; {'id': '109', 'type': 'string', 'children': [], 'value': "'user_name'"}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'user_name'}; {'id': '113', 'type': 'if_statement', 'children': ['114', '119', '134']}; {'id': '114', 'type': 'comparison_operator', 'children': ['115', '118'], 'value': '=='}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '118', 'type': 'string', 'children': [], 'value': "'1'"}; {'id': '119', 'type': 'block', 'children': ['120']}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'redirect'}; {'id': '125', 'type': 'argument_list', 'children': ['126']}; {'id': '126', 'type': 'call', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'string', 'children': [], 'value': "'/wiki/{0}'"}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '130', 'type': 'argument_list', 'children': ['131']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '134', 'type': 'elif_clause', 'children': ['135', '140']}; {'id': '135', 'type': 'comparison_operator', 'children': ['136', '139'], 'value': '=='}; {'id': '136', 'type': 'attribute', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '139', 'type': 'string', 'children': [], 'value': "'2'"}; {'id': '140', 'type': 'block', 'children': ['141']}; {'id': '141', 'type': 'expression_statement', 'children': ['142']}; {'id': '142', 'type': 'call', 'children': ['143', '146']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'redirect'}; {'id': '146', 'type': 'argument_list', 'children': ['147']}; {'id': '147', 'type': 'call', 'children': ['148', '151']}; {'id': '148', 'type': 'attribute', 'children': ['149', '150']}; {'id': '149', 'type': 'string', 'children': [], 'value': "'/page/{0}.html'"}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '151', 'type': 'argument_list', 'children': ['152']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'postinfo'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'uid'}
|
Restore by ID
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'can_execute'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'boolean_operator', 'children': ['8', '12'], 'value': 'and'}; {'id': '8', 'type': 'not_operator', 'children': ['9']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_disabled'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '14', 'type': 'generator_expression', 'children': ['15', '24']}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '19'], 'value': '=='}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'dep'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'dep'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'S_OK'}; {'id': '24', 'type': 'for_in_clause', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dep'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'deps'}
|
True if we can execute the callback.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_value'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10', '54']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '__is_value_array'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'if_statement', 'children': ['12', '17', '25']}; {'id': '12', 'type': 'comparison_operator', 'children': ['13', '16'], 'value': '=='}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '__bit_size'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '__value'}; {'id': '25', 'type': 'else_clause', 'children': ['26']}; {'id': '26', 'type': 'block', 'children': ['27', '31', '52']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '30', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '31', 'type': 'for_statement', 'children': ['32', '33', '39']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '__report_count'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': '__getitem__'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '52', 'type': 'return_statement', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '54', 'type': 'else_clause', 'children': ['55']}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': '__value'}
|
Retreive usage value within report
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_answer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'answer_id'}; {'id': '6', 'type': 'block', 'children': ['7', '17', '24', '39', '54', '73', '77', '81', '120', '130', '151']}; {'id': '7', 'type': 'import_from_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'dotted_name', 'children': ['9', '10', '11', '12']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'dlkit'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'abstract_osid'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'primitives'}; {'id': '13', 'type': 'aliased_import', 'children': ['14', '16']}; {'id': '14', 'type': 'dotted_name', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Id'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ABCId'}; {'id': '17', 'type': 'import_from_statement', 'children': ['18', '22']}; {'id': '18', 'type': 'relative_import', 'children': ['19', '20']}; {'id': '19', 'type': 'import_prefix', 'children': []}; {'id': '20', 'type': 'dotted_name', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '22', 'type': 'dotted_name', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'Answer'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'JSONClientValidated'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31', '34']}; {'id': '30', 'type': 'string', 'children': [], 'value': "'assessment'"}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '33', 'type': 'string', 'children': [], 'value': "'Item'"}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'runtime'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_runtime'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '46']}; {'id': '40', 'type': 'not_operator', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'answer_id'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ABCId'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'raise_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'errors'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'InvalidArgument'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'the argument is not a valid OSID Id'"}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'find_one'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'dictionary', 'children': ['63']}; {'id': '63', 'type': 'pair', 'children': ['64', '65']}; {'id': '64', 'type': 'string', 'children': [], 'value': "'answers._id'"}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'ObjectId'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'answer_id'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'get_identifier'}; {'id': '72', 'type': 'argument_list', 'children': []}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '76', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '80', 'type': 'False', 'children': []}; {'id': '81', 'type': 'for_statement', 'children': ['82', '83', '86']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '83', 'type': 'subscript', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '85', 'type': 'string', 'children': [], 'value': "'answers'"}; {'id': '86', 'type': 'block', 'children': ['87', '112', '116']}; {'id': '87', 'type': 'if_statement', 'children': ['88', '100']}; {'id': '88', 'type': 'comparison_operator', 'children': ['89', '92'], 'value': '=='}; {'id': '89', 'type': 'subscript', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '91', 'type': 'string', 'children': [], 'value': "'_id'"}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'ObjectId'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'answer_id'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'get_identifier'}; {'id': '99', 'type': 'argument_list', 'children': []}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'answer_map'}; {'id': '104', 'type': 'call', 'children': ['105', '110']}; {'id': '105', 'type': 'attribute', 'children': ['106', '109']}; {'id': '106', 'type': 'subscript', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '108', 'type': 'string', 'children': [], 'value': "'answers'"}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '110', 'type': 'argument_list', 'children': ['111']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'augmented_assignment', 'children': ['114', '115'], 'value': '+='}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '115', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'assignment', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '119', 'type': 'True', 'children': []}; {'id': '120', 'type': 'if_statement', 'children': ['121', '123']}; {'id': '121', 'type': 'not_operator', 'children': ['122']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '123', 'type': 'block', 'children': ['124']}; {'id': '124', 'type': 'raise_statement', 'children': ['125']}; {'id': '125', 'type': 'call', 'children': ['126', '129']}; {'id': '126', 'type': 'attribute', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'errors'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'OperationFailed'}; {'id': '129', 'type': 'argument_list', 'children': []}; {'id': '130', 'type': 'expression_statement', 'children': ['131']}; {'id': '131', 'type': 'call', 'children': ['132', '150']}; {'id': '132', 'type': 'attribute', 'children': ['133', '149']}; {'id': '133', 'type': 'call', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'Answer'}; {'id': '135', 'type': 'argument_list', 'children': ['136', '139', '144']}; {'id': '136', 'type': 'keyword_argument', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'osid_object_map'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'answer_map'}; {'id': '139', 'type': 'keyword_argument', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'runtime'}; {'id': '141', 'type': 'attribute', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': '_runtime'}; {'id': '144', 'type': 'keyword_argument', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'proxy'}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': '_proxy'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': '_delete'}; {'id': '150', 'type': 'argument_list', 'children': []}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'call', 'children': ['153', '156']}; {'id': '153', 'type': 'attribute', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'save'}; {'id': '156', 'type': 'argument_list', 'children': ['157']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'item'}
|
Deletes the ``Answer`` identified by the given ``Id``.
arg: answer_id (osid.id.Id): the ``Id`` of the ``Answer`` to
delete
raise: NotFound - an ``Answer`` was not found identified by the
given ``Id``
raise: NullArgument - ``answer_id`` is ``null``
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure occurred
*compliance: mandatory -- This method must be implemented.*
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_json'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'create_sections'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'create_options'}; {'id': '11', 'type': 'False', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '21', '100']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'is_dict'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '21', 'type': 'for_statement', 'children': ['22', '23', '24']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '24', 'type': 'block', 'children': ['25', '40', '62']}; {'id': '25', 'type': 'if_statement', 'children': ['26', '27', '32']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'is_dict'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '32', 'type': 'else_clause', 'children': ['33']}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '40', 'type': 'if_statement', 'children': ['41', '48']}; {'id': '41', 'type': 'not_operator', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'has_section'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'if_statement', 'children': ['50', '51', '59']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'create_sections'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'add_section'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '59', 'type': 'else_clause', 'children': ['60']}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'continue_statement', 'children': []}; {'id': '62', 'type': 'for_statement', 'children': ['63', '66', '79']}; {'id': '63', 'type': 'pattern_list', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '66', 'type': '()', 'children': ['67']}; {'id': '67', 'type': 'conditional_expression', 'children': ['68', '75', '76'], 'value': 'if'}; {'id': '68', 'type': 'call', 'children': ['69', '74']}; {'id': '69', 'type': 'attribute', 'children': ['70', '73']}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '74', 'type': 'argument_list', 'children': []}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'is_dict'}; {'id': '76', 'type': 'subscript', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '78', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'if_statement', 'children': ['81', '90']}; {'id': '81', 'type': 'boolean_operator', 'children': ['82', '89'], 'value': 'or'}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'has_option'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'create_options'}; {'id': '90', 'type': 'block', 'children': ['91']}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '96', 'type': 'argument_list', 'children': ['97', '98', '99']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'section'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'target'}
|
Given a confmanager object and a dictionary object, import the values from the dictionary into the object, optionally adding sections and options as it goes.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'show_error'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '6', 'type': 'block', 'children': ['7', '13']}; {'id': '7', 'type': 'assert_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'string_types'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'post'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'error'"}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'message'}
|
Send an error message to the active client. The new error will be
displayed on any active GUI clients.
Args:
message (str): Plain-text message to display.
Returns:
None
>>> s = _syncthing()
>>> s.system.show_error('my error msg')
>>> s.system.errors()[0]
... # doctest: +ELLIPSIS
ErrorEvent(when=datetime.datetime(...), message='"my error msg"')
>>> s.system.clear_errors()
>>> s.system.errors()
[]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'generate_lifetime_subparser'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'subparsers'}; {'id': '5', 'type': 'block', 'children': ['6', '33', '42', '49', '56', '63', '78', '93']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'subparsers'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'add_parser'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15', '20', '25', '28']}; {'id': '14', 'type': 'string', 'children': [], 'value': "'lifetime'"}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'LIFETIME_DESCRIPTION'}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'epilog'}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'LIFETIME_EPILOG'}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'formatter_class'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ParagraphFormatter'}; {'id': '28', 'type': 'keyword_argument', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'LIFETIME_HELP'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'set_defaults'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'lifetime_report'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'add_tokenizer_argument'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'add_common_arguments'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'add_query_arguments'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70', '75']}; {'id': '69', 'type': 'string', 'children': [], 'value': "'results'"}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'LIFETIME_RESULTS_HELP'}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'metavar'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'RESULTS'"}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '83', 'type': 'argument_list', 'children': ['84', '85', '90']}; {'id': '84', 'type': 'string', 'children': [], 'value': "'label'"}; {'id': '85', 'type': 'keyword_argument', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'LIFETIME_LABEL_HELP'}; {'id': '90', 'type': 'keyword_argument', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'metavar'}; {'id': '92', 'type': 'string', 'children': [], 'value': "'LABEL'"}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '98', 'type': 'argument_list', 'children': ['99', '100', '105']}; {'id': '99', 'type': 'string', 'children': [], 'value': "'output'"}; {'id': '100', 'type': 'keyword_argument', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'REPORT_OUTPUT_HELP'}; {'id': '105', 'type': 'keyword_argument', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'metavar'}; {'id': '107', 'type': 'string', 'children': [], 'value': "'OUTPUT'"}
|
Adds a sub-command parser to `subparsers` to make a lifetime report.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'results'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'apikey'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'watch'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '10', 'type': 'block', 'children': ['11', '21', '29', '55']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'run_get_status'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18', '19', '20']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'apikey'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'format_run_status'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'watch'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'for_statement', 'children': ['33', '34', '46']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'watch_run_status'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38', '39', '40', '41']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'apikey'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '45'], 'value': '*'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '*'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '24'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '60'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '60'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'format_run_status'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '55', 'type': 'if_statement', 'children': ['56', '61', '90', '120']}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '60'], 'value': '=='}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'state'"}; {'id': '60', 'type': 'string', 'children': [], 'value': "'completed'"}; {'id': '61', 'type': 'block', 'children': ['62', '67', '77', '82']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'string', 'children': [], 'value': '"Downloading result"'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '70', 'type': 'call', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'run_get_result_text'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74', '75', '76']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'apikey'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'string', 'children': [], 'value': '"Received result"'}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '85', 'type': 'argument_list', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '90', 'type': 'elif_clause', 'children': ['91', '96']}; {'id': '91', 'type': 'comparison_operator', 'children': ['92', '95'], 'value': '=='}; {'id': '92', 'type': 'subscript', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'state'"}; {'id': '95', 'type': 'string', 'children': [], 'value': "'error'"}; {'id': '96', 'type': 'block', 'children': ['97', '102', '112']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'call', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'string', 'children': [], 'value': '"There was an error"'}; {'id': '102', 'type': 'expression_statement', 'children': ['103']}; {'id': '103', 'type': 'assignment', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'error_result'}; {'id': '105', 'type': 'call', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'run_get_result_text'}; {'id': '107', 'type': 'argument_list', 'children': ['108', '109', '110', '111']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'apikey'}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '115', 'type': 'argument_list', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'error_result'}; {'id': '117', 'type': 'keyword_argument', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '120', 'type': 'else_clause', 'children': ['121']}; {'id': '121', 'type': 'block', 'children': ['122']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'call', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '125', 'type': 'argument_list', 'children': ['126']}; {'id': '126', 'type': 'string', 'children': [], 'value': '"No result yet"'}
|
Check to see if results are available for a particular mapping
and if so download.
Authentication is carried out using the --apikey option which
must be provided. Depending on the server operating mode this
may return a mask, a linkage table, or a permutation. Consult
the entity service documentation for details.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_cups_allowed'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '5', 'type': 'block', 'children': ['6', '64']}; {'id': '6', 'type': 'decorated_definition', 'children': ['7', '12']}; {'id': '7', 'type': 'decorator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'wraps'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '12', 'type': 'function_definition', 'children': ['13', '14', '19']}; {'id': '13', 'type': 'function_name', 'children': [], 'value': 'decorator'}; {'id': '14', 'type': 'parameters', 'children': ['15', '17']}; {'id': '15', 'type': 'list_splat_pattern', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '17', 'type': 'dictionary_splat_pattern', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '19', 'type': 'block', 'children': ['20', '29', '56']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'cups'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'cups'"}; {'id': '29', 'type': 'if_statement', 'children': ['30', '47']}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'boolean_operator', 'children': ['32', '39'], 'value': 'and'}; {'id': '32', 'type': 'boolean_operator', 'children': ['33', '34'], 'value': 'and'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'cups'}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'current_user'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'is_authenticated'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'not_operator', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'current_user'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'allowed'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'cups'}; {'id': '46', 'type': 'string', 'children': [], 'value': "'cups'"}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '55']}; {'id': '50', 'type': 'attribute', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'current_app'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'login_manager'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'unauthorized'}; {'id': '55', 'type': 'argument_list', 'children': []}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '62']}; {'id': '60', 'type': 'list_splat', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '62', 'type': 'dictionary_splat', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '64', 'type': 'return_statement', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'decorator'}
|
Check if CUPS is allowd by token
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'start'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '26', '35', '42']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'yield', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_do_connect'}; {'id': '12', 'type': 'argument_list', 'children': []}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_LOGGER'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20', '23']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'connected to snapserver on %s:%s'"}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_host'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_port'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '29', 'type': 'yield', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'synchronize'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': '_on_server_connect'}; {'id': '47', 'type': 'argument_list', 'children': []}
|
Initiate server connection.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_key_filters'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'key_filters'}; {'id': '6', 'type': 'block', 'children': ['7', '19', '28']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '12'], 'value': '=='}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_input_mode'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'query'"}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'raise_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'Key filters are not supported in a query.'"}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_key_filters'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'key_filters'}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Adds key filters to the inputs.
:param key_filters: a list of filters
:type key_filters: list
:rtype: :class:`RiakMapReduce`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_emit'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '18']}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_html_dir'}; {'id': '18', 'type': 'block', 'children': ['19', '28']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_report_file'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_report_file'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'flush'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
Append content to the main report file.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_allow_future'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '36', '50']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_queryset'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'post_edit_permission'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'{}.edit_{}'"}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '29']}; {'id': '22', 'type': 'attribute', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_meta'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'app_label'}; {'id': '29', 'type': 'attribute', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_meta'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'model_name'}; {'id': '36', 'type': 'if_statement', 'children': ['37', '47']}; {'id': '37', 'type': 'call', 'children': ['38', '45']}; {'id': '38', 'type': 'attribute', 'children': ['39', '44']}; {'id': '39', 'type': 'attribute', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'has_perm'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'post_edit_permission'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'True', 'children': []}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'False', 'children': []}
|
Only superusers and users with the permission can edit the post.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_managing_editor'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '23']}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'managing_editor'}; {'id': '13', 'type': 'attribute', 'children': ['14', '22']}; {'id': '14', 'type': 'call', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'soup'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'find'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'managingeditor'"}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '23', 'type': 'except_clause', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'AttributeError'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'managing_editor'}; {'id': '31', 'type': 'None', 'children': []}
|
Parses managing editor and set value
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'date_this_decade'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'before_today'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'after_today'}; {'id': '10', 'type': 'False', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '20', '38', '51']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '19', 'type': 'argument_list', 'children': []}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'this_decade_start'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '36', '37']}; {'id': '26', 'type': 'binary_operator', 'children': ['27', '30'], 'value': '-'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'year'}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '35'], 'value': '%'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'year'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'next_decade_start'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '49', '50']}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '48'], 'value': '+'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'this_decade_start'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'year'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '51', 'type': 'if_statement', 'children': ['52', '55', '64', '78', '92']}; {'id': '52', 'type': 'boolean_operator', 'children': ['53', '54'], 'value': 'and'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'before_today'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'after_today'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'date_between_dates'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'this_decade_start'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'next_decade_start'}; {'id': '64', 'type': 'elif_clause', 'children': ['65', '69']}; {'id': '65', 'type': 'boolean_operator', 'children': ['66', '68'], 'value': 'and'}; {'id': '66', 'type': 'not_operator', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'before_today'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'after_today'}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'return_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'date_between_dates'}; {'id': '75', 'type': 'argument_list', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'next_decade_start'}; {'id': '78', 'type': 'elif_clause', 'children': ['79', '83']}; {'id': '79', 'type': 'boolean_operator', 'children': ['80', '82'], 'value': 'and'}; {'id': '80', 'type': 'not_operator', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'after_today'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'before_today'}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'date_between_dates'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'this_decade_start'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'today'}; {'id': '92', 'type': 'else_clause', 'children': ['93']}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'return_statement', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'today'}
|
Gets a Date object for the decade year.
:param before_today: include days in current decade before today
:param after_today: include days in current decade after today
:example Date('2012-04-04')
:return Date
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'binary_op'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'blen'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'array'"}; {'id': '16', 'type': 'dictionary_splat_pattern', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '18', 'type': 'block', 'children': ['19', '41']}; {'id': '19', 'type': 'if_statement', 'children': ['20', '34']}; {'id': '20', 'type': 'boolean_operator', 'children': ['21', '26'], 'value': 'and'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'shape'"}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '33'], 'value': '=='}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '40', 'type': 'tuple', 'children': []}; {'id': '41', 'type': 'if_statement', 'children': ['42', '48', '77', '119']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'isscalar'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '48', 'type': 'block', 'children': ['49', '60']}; {'id': '49', 'type': 'function_definition', 'children': ['50', '51', '53']}; {'id': '50', 'type': 'function_name', 'children': [], 'value': 'f'}; {'id': '51', 'type': 'parameters', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'block'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'block'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '60', 'type': 'return_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'map_blocks'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '65', '66', '69', '72', '75']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'blen'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'blen'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '75', 'type': 'dictionary_splat', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '77', 'type': 'elif_clause', 'children': ['78', '87']}; {'id': '78', 'type': 'comparison_operator', 'children': ['79', '83'], 'value': '=='}; {'id': '79', 'type': 'call', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '87', 'type': 'block', 'children': ['88', '100']}; {'id': '88', 'type': 'function_definition', 'children': ['89', '90', '93']}; {'id': '89', 'type': 'function_name', 'children': [], 'value': 'f'}; {'id': '90', 'type': 'parameters', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'return_statement', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'call', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'map_blocks'}; {'id': '103', 'type': 'argument_list', 'children': ['104', '107', '108', '111', '114', '117']}; {'id': '104', 'type': 'tuple', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'other'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '108', 'type': 'keyword_argument', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'blen'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'blen'}; {'id': '111', 'type': 'keyword_argument', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '114', 'type': 'keyword_argument', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '117', 'type': 'dictionary_splat', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '119', 'type': 'else_clause', 'children': ['120']}; {'id': '120', 'type': 'block', 'children': ['121']}; {'id': '121', 'type': 'raise_statement', 'children': ['122']}; {'id': '122', 'type': 'call', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'NotImplementedError'}; {'id': '124', 'type': 'argument_list', 'children': ['125']}; {'id': '125', 'type': 'string', 'children': [], 'value': "'argument type not supported'"}
|
Compute a binary operation block-wise over `data`.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'iter_identities'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'stanza'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'for_statement', 'children': ['10', '15', '22']}; {'id': '10', 'type': 'pattern_list', 'children': ['11', '14']}; {'id': '11', 'type': 'tuple_pattern', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'category'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'type_'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_identities'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23', '40']}; {'id': '23', 'type': 'for_statement', 'children': ['24', '27', '32']}; {'id': '24', 'type': 'pattern_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '31', 'type': 'argument_list', 'children': []}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'yield', 'children': ['35']}; {'id': '35', 'type': 'expression_list', 'children': ['36', '37', '38', '39']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'category'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'type_'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '40', 'type': 'if_statement', 'children': ['41', '43']}; {'id': '41', 'type': 'not_operator', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'yield', 'children': ['46']}; {'id': '46', 'type': 'expression_list', 'children': ['47', '48', '49', '50']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'category'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'type_'}; {'id': '49', 'type': 'None', 'children': []}; {'id': '50', 'type': 'None', 'children': []}
|
Return an iterator of tuples describing the identities of the node.
:param stanza: The IQ request stanza
:type stanza: :class:`~aioxmpp.IQ` or :data:`None`
:rtype: iterable of (:class:`str`, :class:`str`, :class:`str` or
:data:`None`, :class:`str` or :data:`None`) tuples
:return: :xep:`30` identities of this node
`stanza` can be the :class:`aioxmpp.IQ` stanza of the request. This can
be used to hide a node depending on who is asking. If the returned
iterable is empty, the :class:`~.DiscoServer` returns an
``<item-not-found/>`` error.
`stanza` may be :data:`None` if the identities are queried without
a specific request context. In that case, implementors should assume
that the result is visible to everybody.
.. note::
Subclasses must allow :data:`None` for `stanza` and default it to
:data:`None`.
Return an iterator which yields tuples consisting of the category, the
type, the language code and the name of each identity declared in this
:class:`Node`.
Both the language code and the name may be :data:`None`, if no names or
a name without language code have been declared.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_tenant'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tenant'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '22', '33']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'tenant_id'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'get_id'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'tenant'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '21'], 'value': '%'}; {'id': '20', 'type': 'string', 'children': [], 'value': '"tenants/%s"'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'tenant_id'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '27']}; {'id': '24', 'type': 'pattern_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'resp_body'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'method_delete'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '39']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '38'], 'value': '=='}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '404'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'raise_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'TenantNotFound'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '%'}; {'id': '47', 'type': 'string', 'children': [], 'value': '"Tenant \'%s\' does not exist."'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'tenant'}
|
ADMIN ONLY. Removes the tenant from the system. There is no 'undo'
available, so you should be certain that the tenant specified is the
tenant you wish to delete.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_find_neighbor_and_lambda'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'neighbor_indices'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'neighbor_distances'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'core_distances'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'min_samples'}; {'id': '8', 'type': 'block', 'children': ['9', '15', '32', '51', '59', '65', '95']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'neighbor_core_distances'}; {'id': '12', 'type': 'subscript', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'core_distances'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'neighbor_indices'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'point_core_distances'}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '22'], 'value': '*'}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'neighbor_distances'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'min_samples'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ones'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'subscript', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'neighbor_indices'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'mr_distances'}; {'id': '35', 'type': 'call', 'children': ['36', '47']}; {'id': '36', 'type': 'attribute', 'children': ['37', '46']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'vstack'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'tuple', 'children': ['43', '44', '45']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'neighbor_core_distances'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'point_core_distances'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'neighbor_distances'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'nn_index'}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'mr_distances'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'argmin'}; {'id': '58', 'type': 'argument_list', 'children': []}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'nearest_neighbor'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'neighbor_indices'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'nn_index'}; {'id': '65', 'type': 'if_statement', 'children': ['66', '71', '80']}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '70'], 'value': '>'}; {'id': '67', 'type': 'subscript', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'mr_distances'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'nn_index'}; {'id': '70', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '71', 'type': 'block', 'children': ['72']}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'assignment', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'lambda_'}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '/'}; {'id': '76', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '77', 'type': 'subscript', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'mr_distances'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'nn_index'}; {'id': '80', 'type': 'else_clause', 'children': ['81']}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'lambda_'}; {'id': '85', 'type': 'attribute', 'children': ['86', '94']}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'finfo'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'double'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'expression_list', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'nearest_neighbor'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'lambda_'}
|
Find the nearest mutual reachability neighbor of a point, and compute
the associated lambda value for the point, given the mutual reachability
distance to a nearest neighbor.
Parameters
----------
neighbor_indices : array (2 * min_samples, )
An array of raw distance based nearest neighbor indices.
neighbor_distances : array (2 * min_samples, )
An array of raw distances to the nearest neighbors.
core_distances : array (n_samples, )
An array of core distances for all points
min_samples : int
The min_samples value used to generate core distances.
Returns
-------
neighbor : int
The index into the full raw data set of the nearest mutual reachability
distance neighbor of the point.
lambda_ : float
The lambda value at which this point joins/merges with `neighbor`.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getNameOwner'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'busName'}; {'id': '6', 'type': 'block', 'children': ['7', '30']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'callRemote'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16', '17', '20', '23', '27']}; {'id': '15', 'type': 'string', 'children': [], 'value': "'/org/freedesktop/DBus'"}; {'id': '16', 'type': 'string', 'children': [], 'value': "'GetNameOwner'"}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'interface'}; {'id': '19', 'type': 'string', 'children': [], 'value': "'org.freedesktop.DBus'"}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'s'"}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '25', 'type': 'list', 'children': ['26'], 'value': '[busName]'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'busName'}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '29', 'type': 'string', 'children': [], 'value': "'org.freedesktop.DBus'"}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'd'}
|
Calls org.freedesktop.DBus.GetNameOwner
@rtype: L{twisted.internet.defer.Deferred}
@returns: a Deferred to the unique connection name owning the bus name
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_named_graph'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'store_id'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_STORE'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '10', 'type': 'True', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '27', '34', '44', '67']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '19']}; {'id': '13', 'type': 'not_operator', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'URIRef'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'URIRef'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'DjangoStore'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'store_id'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'Graph'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '44', 'type': 'if_statement', 'children': ['45', '56']}; {'id': '45', 'type': 'comparison_operator', 'children': ['46', '55'], 'value': '!='}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'None', 'children': []}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'VALID_STORE'}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'raise_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"The store identified by {0} is not a valid store"'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'store_id'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'graph'}
|
Returns an open named graph.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'DbGetExportdDeviceListForClass'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'argin'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '23']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_log'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'string', 'children': [], 'value': '"In DbGetExportdDeviceListForClass()"'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'argin'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'replace_wildcard'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'argin'}; {'id': '23', 'type': 'return_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'db'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'get_exported_device_list_for_class'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'argin'}
|
Query the database for device exported for the specified class.
:param argin: Class name
:type: tango.DevString
:return: Device exported list
:rtype: tango.DevVarStringArray
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_compile_to_sklearn'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'expr'}; {'id': '6', 'type': 'block', 'children': ['7', '23', '33', '41']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'sklearn_pipeline_str'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'generate_pipeline_code'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '20']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'expr_to_tree'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'expr'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_pset'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'sklearn_pipeline'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'eval'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'sklearn_pipeline_str'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'operators_context'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'sklearn_pipeline'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'memory'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_memory'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sklearn_pipeline'}
|
Compile a DEAP pipeline into a sklearn pipeline.
Parameters
----------
expr: DEAP individual
The DEAP pipeline to be compiled
Returns
-------
sklearn_pipeline: sklearn.pipeline.Pipeline
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_policy'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'defaultHeaders'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13', '64']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '12'], 'value': 'is not'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14', '60']}; {'id': '14', 'type': 'for_statement', 'children': ['15', '18', '23']}; {'id': '15', 'type': 'pattern_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'defaultHeaders'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'block', 'children': ['24', '39']}; {'id': '24', 'type': 'if_statement', 'children': ['25', '30']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'not in'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '38']}; {'id': '33', 'type': 'subscript', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': '=='}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '42', 'type': 'string', 'children': [], 'value': "'pins'"}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '51']}; {'id': '46', 'type': 'subscript', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '57'], 'value': '+'}; {'id': '52', 'type': 'subscript', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'defaultHeaders'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '60', 'type': 'return_statement', 'children': ['61']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '64', 'type': 'else_clause', 'children': ['65']}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'inputs'}
|
rewrite update policy so that additional pins are added and not overwritten
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'organization_deidentify_template_path'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'organization'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'deidentify_template'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'return_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '17']}; {'id': '10', 'type': 'attribute', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'google'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'api_core'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'path_template'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'expand'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19', '22']}; {'id': '18', 'type': 'string', 'children': [], 'value': '"organizations/{organization}/deidentifyTemplates/{deidentify_template}"'}; {'id': '19', 'type': 'keyword_argument', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'organization'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'organization'}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'deidentify_template'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'deidentify_template'}
|
Return a fully-qualified organization_deidentify_template string.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'show_calltip'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'doc'}; {'id': '8', 'type': 'string', 'children': [], 'value': "''"}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'parameter'}; {'id': '11', 'type': 'string', 'children': [], 'value': "''"}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'parameter_doc'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_DEFAULT_TITLE_COLOR'}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'is_python'}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'block', 'children': ['22', '30', '46', '55']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'point'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_calculate_position'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '35']}; {'id': '32', 'type': 'pattern_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'tiptext'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'wrapped_lines'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_format_signature'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42', '43', '44', '45']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'doc'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'parameter'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'parameter_doc'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'is_python'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': '_update_stylesheet'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'calltip_widget'}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '62']}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'calltip_widget'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'show_tip'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64', '65']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'point'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'tiptext'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'wrapped_lines'}
|
Show calltip.
Calltips look like tooltips but will not disappear if mouse hovers
them. They are useful for displaying signature information on methods
and functions.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'copy_func'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '6', 'type': 'type', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'Callable'}; {'id': '8', 'type': 'type', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'Callable'}; {'id': '10', 'type': 'block', 'children': ['11', '40', '50', '58']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'copied'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'types'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'FunctionType'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '22', '25', '30', '35']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '__code__'}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '__globals__'}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'argdefs'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '__defaults__'}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'closure'}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': '__closure__'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'copied'}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'functools'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'update_wrapper'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'copied'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'copied'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '__kwdefaults__'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '__kwdefaults__'}; {'id': '58', 'type': 'return_statement', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'copied'}
|
Returns a copy of a function.
:param func: The function to copy.
:returns: The copied function.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'hyphenation'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'phrase'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '7', 'type': 'string', 'children': [], 'value': "'json'"}; {'id': '8', 'type': 'block', 'children': ['9', '18', '36', '45']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'base_url'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Vocabulary'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '__get_api_link'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': '"wordnik"'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'base_url'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '33']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'phrase'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '35', 'type': 'string', 'children': [], 'value': '"hyphenation"'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'Vocabulary'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '__return_json'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '45', 'type': 'if_statement', 'children': ['46', '47', '58']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '55']}; {'id': '50', 'type': 'attribute', 'children': ['51', '54']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'Response'}; {'id': '53', 'type': 'argument_list', 'children': []}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'respond'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '58', 'type': 'else_clause', 'children': ['59']}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'return_statement', 'children': ['61']}; {'id': '61', 'type': 'False', 'children': []}
|
Returns back the stress points in the "phrase" passed
:param phrase: word for which hyphenation is to be found
:param format: response structure type. Defaults to: "json"
:returns: returns a json object as str, False if invalid phrase
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'wait'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '6', 'type': 'string', 'children': [], 'value': "''"}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '13', 'type': 'block', 'children': ['14', '19', '46', '53', '77', '165']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '17', 'type': 'list', 'children': ['18'], 'value': '[StaleElementReferenceException]'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'StaleElementReferenceException'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '23']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '22'], 'value': 'is not'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '22', 'type': 'None', 'children': []}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'try_statement', 'children': ['25', '36']}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '36', 'type': 'except_clause', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '53', 'type': 'if_statement', 'children': ['54', '56']}; {'id': '54', 'type': 'not_operator', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'string', 'children': [], 'value': '"Could not recover from Exception(s): {}"'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'string', 'children': [], 'value': "', '"}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'list_comprehension', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '74', 'type': 'for_in_clause', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '77', 'type': 'function_definition', 'children': ['78', '79', '81']}; {'id': '78', 'type': 'function_name', 'children': [], 'value': 'wrapper'}; {'id': '79', 'type': 'parameters', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '81', 'type': 'block', 'children': ['82', '163']}; {'id': '82', 'type': 'function_definition', 'children': ['83', '84', '89']}; {'id': '83', 'type': 'function_name', 'children': [], 'value': 'wait_handler'}; {'id': '84', 'type': 'parameters', 'children': ['85', '87']}; {'id': '85', 'type': 'list_splat_pattern', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '87', 'type': 'dictionary_splat_pattern', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '89', 'type': 'block', 'children': ['90', '93', '97', '107', '158']}; {'id': '90', 'type': 'import_statement', 'children': ['91']}; {'id': '91', 'type': 'dotted_name', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'poll_freq'}; {'id': '96', 'type': 'float', 'children': [], 'value': '0.5'}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'end_time'}; {'id': '100', 'type': 'binary_operator', 'children': ['101', '106'], 'value': '+'}; {'id': '101', 'type': 'call', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '105', 'type': 'argument_list', 'children': []}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '107', 'type': 'while_statement', 'children': ['108', '115']}; {'id': '108', 'type': 'comparison_operator', 'children': ['109', '114'], 'value': '<='}; {'id': '109', 'type': 'call', 'children': ['110', '113']}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '113', 'type': 'argument_list', 'children': []}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'end_time'}; {'id': '115', 'type': 'block', 'children': ['116', '147', '154']}; {'id': '116', 'type': 'try_statement', 'children': ['117', '133']}; {'id': '117', 'type': 'block', 'children': ['118', '128']}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'assignment', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '121', 'type': 'call', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '123', 'type': 'argument_list', 'children': ['124', '126']}; {'id': '124', 'type': 'list_splat', 'children': ['125']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '126', 'type': 'dictionary_splat', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '128', 'type': 'if_statement', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '130', 'type': 'block', 'children': ['131']}; {'id': '131', 'type': 'return_statement', 'children': ['132']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '133', 'type': 'except_clause', 'children': ['134', '138']}; {'id': '134', 'type': 'as_pattern', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'exc'}; {'id': '136', 'type': 'as_pattern_target', 'children': ['137']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '138', 'type': 'block', 'children': ['139', '146']}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'call', 'children': ['141', '144']}; {'id': '141', 'type': 'attribute', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'LOGGER'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '144', 'type': 'argument_list', 'children': ['145']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '146', 'type': 'pass_statement', 'children': []}; {'id': '147', 'type': 'expression_statement', 'children': ['148']}; {'id': '148', 'type': 'call', 'children': ['149', '152']}; {'id': '149', 'type': 'attribute', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '152', 'type': 'argument_list', 'children': ['153']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'poll_freq'}; {'id': '154', 'type': 'expression_statement', 'children': ['155']}; {'id': '155', 'type': 'augmented_assignment', 'children': ['156', '157'], 'value': '*='}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'poll_freq'}; {'id': '157', 'type': 'float', 'children': [], 'value': '1.25'}; {'id': '158', 'type': 'raise_statement', 'children': ['159']}; {'id': '159', 'type': 'call', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '161', 'type': 'argument_list', 'children': ['162']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '163', 'type': 'return_statement', 'children': ['164']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'wait_handler'}; {'id': '165', 'type': 'return_statement', 'children': ['166']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'wrapper'}
|
Decorator to handle generic waiting situations.
Will handle StaleElementReferenceErrors.
:param msg: Error message
:param exceptions: Extra exceptions to handle
:param timeout: time to keep trying (default: 10 seconds)
:return: the result of the decorated function
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rotation'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '33']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'rotation'}; {'id': '9', 'type': 'call', 'children': ['10', '15']}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_libinput'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'libinput_event_tablet_tool_get_rotation'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_handle'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'changed'}; {'id': '22', 'type': 'call', 'children': ['23', '29']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27', '28']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_libinput'}; {'id': '27', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'libinput_event_tablet_tool_rotation_has_changed'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_handle'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'expression_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'rotation'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'changed'}
|
The current Z rotation of the tool in degrees, clockwise
from the tool's logical neutral position and whether it has changed
in this event.
For tools of type :attr:`~libinput.constant.TabletToolType.MOUSE`
and :attr:`~libinput.constant.TabletToolType.LENS` the logical
neutral position is pointing to the current logical north
of the tablet. For tools of type
:attr:`~libinput.constant.TabletToolType.BRUSH`, the logical
neutral position is with the buttons pointing up.
If this axis does not exist on the current tool, this property is
(0, :obj:`False`).
Returns:
(float, bool): The current value of the the axis and whether it has
changed.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'anscombe'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '29', '35', '100']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '16']}; {'id': '7', 'type': 'pattern_list', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '9', 'type': 'tuple_pattern', 'children': ['10', '13']}; {'id': '10', 'type': 'tuple_pattern', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'axa'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'axb'}; {'id': '13', 'type': 'tuple_pattern', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'axc'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'axd'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'plt'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'subplots'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '23', '26']}; {'id': '21', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '22', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sharex'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'col'"}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'sharey'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'row'"}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'colors'}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'get_color_cycle'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'for_statement', 'children': ['36', '40', '50']}; {'id': '36', 'type': 'pattern_list', 'children': ['37', '38', '39']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'ax'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44', '49']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ANSCOMBE'}; {'id': '44', 'type': 'tuple', 'children': ['45', '46', '47', '48']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'axa'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'axb'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'axc'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'axd'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'colors'}; {'id': '50', 'type': 'block', 'children': ['51', '57', '63', '71', '79', '90']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '56', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'ax'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'set_xlim'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70']}; {'id': '69', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '70', 'type': 'integer', 'children': [], 'value': '15'}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'ax'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'set_ylim'}; {'id': '76', 'type': 'argument_list', 'children': ['77', '78']}; {'id': '77', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '78', 'type': 'integer', 'children': [], 'value': '15'}; {'id': '79', 'type': 'expression_statement', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'ax'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'scatter'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '86', '87']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'draw_best_fit'}; {'id': '93', 'type': 'argument_list', 'children': ['94', '95', '96', '97']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'ax'}; {'id': '97', 'type': 'keyword_argument', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'tuple', 'children': ['102', '103', '104', '105']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'axa'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'axb'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'axc'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'axd'}
|
Creates 2x2 grid plot of the 4 anscombe datasets for illustration.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_ui'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'gtk'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Entry'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'widget'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'entry'}
|
Create the user interface
create_ui is a method called during the Delegate's
initialisation process, to create, add to, or modify any UI
created by GtkBuilder files.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'integrate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '20', '33']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': 'is'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'trapezoidIntegration'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'wave'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ans'}
|
Integrate the throughput over the specified wavelength set.
If no wavelength set is specified, the built-in one is used.
Integration is done using :meth:`~Integrator.trapezoidIntegration`
with ``x=wave`` and ``y=throughput``.
Also see :ref:`pysynphot-formula-equvw`.
Parameters
----------
wave : array_like or `None`
Wavelength set for integration.
Returns
-------
ans : float
Integrated sum.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_all_parcels'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'return_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'parcels'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'get_all_parcels'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '20', '23']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_get_resource_root'}; {'id': '19', 'type': 'argument_list', 'children': []}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'view'}
|
Get all parcels in this cluster.
@return: A list of ApiParcel objects.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_attr_info'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'binary_view'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '24']}; {'id': '6', 'type': 'global_statement', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': '_ATTR_BASIC'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '14']}; {'id': '10', 'type': 'pattern_list', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'attr_type'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'attr_len'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'non_resident'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_ATTR_BASIC'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'unpack'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'binary_view'}; {'id': '21', 'type': 'slice', 'children': ['22', '23']}; {'id': '22', 'type': 'colon', 'children': []}; {'id': '23', 'type': 'integer', 'children': [], 'value': '9'}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'tuple', 'children': ['26', '30', '31']}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'AttrTypes'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'attr_type'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'attr_len'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'non_resident'}
|
Gets basic information from a binary stream to allow correct processing of
the attribute header.
This function allows the interpretation of the Attribute type, attribute length
and if the attribute is non resident.
Args:
binary_view (memoryview of bytearray) - A binary stream with the
information of the attribute
Returns:
An tuple with the attribute type, the attribute length, in bytes, and
if the attribute is resident or not.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_render_internal_label'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '25', '38', '51']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'ncc'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_num_complete_chars'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'bar'}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_lbl'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'center'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'iwidth'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'cm_chars'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_comp_style'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'bar'}; {'id': '35', 'type': 'slice', 'children': ['36', '37']}; {'id': '36', 'type': 'colon', 'children': []}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ncc'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'em_chars'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_empt_style'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'bar'}; {'id': '48', 'type': 'slice', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'ncc'}; {'id': '50', 'type': 'colon', 'children': []}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'string', 'children': [], 'value': "f'{self._first}{cm_chars}{em_chars}{self._last}'"}
|
Render with a label inside the bar graph.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_action_group_names'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'get_group_names'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'itertools'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'chain'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'list_splat', 'children': ['21']}; {'id': '21', 'type': 'list', 'children': ['22', '28', '34'], 'value': "[self._get_array('add'),\n self._get_array('remove'),\n self._get_array('isolation-group')]"}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_get_array'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'add'"}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_get_array'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'remove'"}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_get_array'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'string', 'children': [], 'value': "'isolation-group'"}
|
Return all the security group names configured in this action.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '16', '26', '32']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'call', 'children': ['7', '10']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'basicConfig'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'keyword_argument', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'DEBUG'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '25']}; {'id': '18', 'type': 'attribute', 'children': ['19', '24']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'load_config'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ConfigLoader'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '31', 'type': 'True', 'children': []}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '45']}; {'id': '40', 'type': 'attribute', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'engine'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'subscript', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'argv'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '1'}
|
Module level test.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'A_hollow_cylinder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'Di'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'Do'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'L'}; {'id': '7', 'type': 'block', 'children': ['8', '10', '18', '26', '38', '50']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'side_o'}; {'id': '13', 'type': 'binary_operator', 'children': ['14', '17'], 'value': '*'}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '*'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'Do'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'L'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'side_i'}; {'id': '21', 'type': 'binary_operator', 'children': ['22', '25'], 'value': '*'}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '24'], 'value': '*'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'Di'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'L'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'cap_circle'}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '37'], 'value': '*'}; {'id': '30', 'type': 'binary_operator', 'children': ['31', '36'], 'value': '/'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '33'], 'value': '*'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '**'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'Do'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'cap_removed'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '49'], 'value': '*'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '48'], 'value': '/'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '45'], 'value': '*'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '45', 'type': 'binary_operator', 'children': ['46', '47'], 'value': '**'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'Di'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '57'], 'value': '-'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '56'], 'value': '+'}; {'id': '53', 'type': 'binary_operator', 'children': ['54', '55'], 'value': '+'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'side_o'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'side_i'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'cap_circle'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'cap_removed'}
|
r'''Returns the surface area of a hollow cylinder.
.. math::
A = \pi D_o L + \pi D_i L + 2\cdot \frac{\pi D_o^2}{4}
- 2\cdot \frac{\pi D_i^2}{4}
Parameters
----------
Di : float
Diameter of the hollow in the cylinder, [m]
Do : float
Diameter of the exterior of the cylinder, [m]
L : float
Length of the cylinder, [m]
Returns
-------
A : float
Surface area [m^2]
Examples
--------
>>> A_hollow_cylinder(0.005, 0.01, 0.1)
0.004830198704894308
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_milestone'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'milestone_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'deadline'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'party_id'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'notify'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'move_upcoming_milestones'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'move_upcoming_milestones_off_weekends'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17', '23', '32', '47', '74', '101']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '22'], 'value': '%'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'/milestones/update/%u'"}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'milestone_id'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ET'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'Element'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'request'"}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_create_milestone_elem'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44', '45', '46']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'deadline'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'party_id'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'notify'}; {'id': '47', 'type': 'if_statement', 'children': ['48', '51']}; {'id': '48', 'type': 'comparison_operator', 'children': ['49', '50'], 'value': 'is not'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'move_upcoming_milestones'}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '63', '64']}; {'id': '54', 'type': 'attribute', 'children': ['55', '62']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'ET'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'SubElement'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '61', 'type': 'string', 'children': [], 'value': "'move-upcoming-milestones'"}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '63', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '64', 'type': 'call', 'children': ['65', '73']}; {'id': '65', 'type': 'attribute', 'children': ['66', '72']}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '71', 'type': 'argument_list', 'children': []}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '73', 'type': 'argument_list', 'children': []}; {'id': '74', 'type': 'if_statement', 'children': ['75', '78']}; {'id': '75', 'type': 'comparison_operator', 'children': ['76', '77'], 'value': 'is not'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'move_upcoming_milestones_off_weekends'}; {'id': '77', 'type': 'None', 'children': []}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'expression_statement', 'children': ['80']}; {'id': '80', 'type': 'assignment', 'children': ['81', '90', '91']}; {'id': '81', 'type': 'attribute', 'children': ['82', '89']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'ET'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'SubElement'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '88', 'type': 'string', 'children': [], 'value': "'move-upcoming-milestones-off-weekends'"}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '90', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '91', 'type': 'call', 'children': ['92', '100']}; {'id': '92', 'type': 'attribute', 'children': ['93', '99']}; {'id': '93', 'type': 'call', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '98', 'type': 'argument_list', 'children': []}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '100', 'type': 'argument_list', 'children': []}; {'id': '101', 'type': 'return_statement', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '106']}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': '_request'}; {'id': '106', 'type': 'argument_list', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'req'}
|
Modifies a single milestone. You can use this to shift the deadline of
a single milestone, and optionally shift the deadlines of subsequent
milestones as well.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_read_mode_qsopt'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '7', 'type': 'block', 'children': ['8', '17', '26', '35', '71']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'rvrr'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_read_binary'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ttld'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_read_unpack'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'noun'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_read_fileng'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '40', 'type': 'argument_list', 'children': ['41', '44', '47', '60', '63']}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'req_rate'}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '57']}; {'id': '52', 'type': 'subscript', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'rvrr'}; {'id': '54', 'type': 'slice', 'children': ['55', '56']}; {'id': '55', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '56', 'type': 'colon', 'children': []}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '59', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'ttl_diff'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'ttld'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'nounce'}; {'id': '65', 'type': 'subscript', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'noun'}; {'id': '67', 'type': 'slice', 'children': ['68', '69']}; {'id': '68', 'type': 'colon', 'children': []}; {'id': '69', 'type': 'unary_operator', 'children': ['70'], 'value': '-'}; {'id': '70', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'data'}
|
Read Quick-Start Response option.
Positional arguments:
* size - int, length of option
* kind - int, 27 (Quick-Start Response)
Returns:
* dict -- extracted Quick-Start Response (QS) option
Structure of TCP QSopt [RFC 4782]:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Kind | Length=8 | Resv. | Rate | TTL Diff |
| | | |Request| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| QS Nonce | R |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Octets Bits Name Description
0 0 tcp.qs.kind Kind (27)
1 8 tcp.qs.length Length (8)
2 16 - Reserved (must be zero)
2 20 tcp.qs.req_rate Request Rate
3 24 tcp.qs.ttl_diff TTL Difference
4 32 tcp.qs.nounce QS Nounce
7 62 - Reserved (must be zero)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_item_key'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '6', 'type': 'block', 'children': ['7', '32']}; {'id': '7', 'type': 'try_statement', 'children': ['8', '17']}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '12', 'type': 'subscript', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '14', 'type': 'subscript', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '16', 'type': 'string', 'children': [], 'value': "'key'"}; {'id': '17', 'type': 'except_clause', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'string', 'children': [], 'value': '"No \'key\' available in {}"'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '32', 'type': 'if_statement', 'children': ['33', '38', '43']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'return_statement', 'children': ['40']}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Return the value of the item 'key'.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_fw_dict'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '19', '61', '72', '82', '100']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'if_statement', 'children': ['11', '16']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '15'], 'value': 'is'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'fw_id'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}; {'id': '22', 'type': 'dictionary', 'children': ['23', '26', '31', '36', '41', '46', '51', '56']}; {'id': '23', 'type': 'pair', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'rules'"}; {'id': '25', 'type': 'dictionary', 'children': []}; {'id': '26', 'type': 'pair', 'children': ['27', '28']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'tenant_name'"}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'tenant_name'}; {'id': '31', 'type': 'pair', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': "'tenant_id'"}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'tenant_id'}; {'id': '36', 'type': 'pair', 'children': ['37', '38']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'fw_id'"}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'fw_id'}; {'id': '41', 'type': 'pair', 'children': ['42', '43']}; {'id': '42', 'type': 'string', 'children': [], 'value': "'fw_name'"}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'fw_name'}; {'id': '46', 'type': 'pair', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'firewall_policy_id'"}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'active_pol_id'}; {'id': '51', 'type': 'pair', 'children': ['52', '53']}; {'id': '52', 'type': 'string', 'children': [], 'value': "'fw_type'"}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'fw_type'}; {'id': '56', 'type': 'pair', 'children': ['57', '58']}; {'id': '57', 'type': 'string', 'children': [], 'value': "'router_id'"}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'router_id'}; {'id': '61', 'type': 'if_statement', 'children': ['62', '69']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '66'], 'value': 'not in'}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'active_pol_id'}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'policies'}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'return_statement', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'assignment', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'pol_dict'}; {'id': '75', 'type': 'subscript', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'policies'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'active_pol_id'}; {'id': '82', 'type': 'for_statement', 'children': ['83', '84', '87']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'rule'}; {'id': '84', 'type': 'subscript', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'pol_dict'}; {'id': '86', 'type': 'string', 'children': [], 'value': "'rule_dict'"}; {'id': '87', 'type': 'block', 'children': ['88']}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '95']}; {'id': '90', 'type': 'subscript', 'children': ['91', '94']}; {'id': '91', 'type': 'subscript', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}; {'id': '93', 'type': 'string', 'children': [], 'value': "'rules'"}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'rule'}; {'id': '95', 'type': 'subscript', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'rules'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'rule'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'fw_dict'}
|
This API creates a FW dictionary from the local attributes.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fill_nulls'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'block', 'children': ['10', '16']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '13', 'type': 'list', 'children': ['14', '15'], 'value': '[None, ""]'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'string', 'children': [], 'value': '""'}; {'id': '16', 'type': 'try_statement', 'children': ['17', '36']}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '25']}; {'id': '20', 'type': 'subscript', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '25', 'type': 'call', 'children': ['26', '33']}; {'id': '26', 'type': 'attribute', 'children': ['27', '32']}; {'id': '27', 'type': 'subscript', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'nan'}; {'id': '36', 'type': 'except_clause', 'children': ['37', '41']}; {'id': '37', 'type': 'as_pattern', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '39', 'type': 'as_pattern_target', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'e'}
|
Fill all null values with NaN values in a column.
Null values are ``None`` or en empty string
:param col: column name
:type col: str
:example: ``ds.fill_nulls("mycol")``
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search_function'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '22', '26', '66', '77']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '9'], 'value': 'in'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_CACHE'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'subscript', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_CACHE'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'norm_encoding'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'normalize_encoding'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'codec'}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'if_statement', 'children': ['27', '30', '42']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '29'], 'value': 'in'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'norm_encoding'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'UTF8_VAR_NAMES'}; {'id': '30', 'type': 'block', 'children': ['31', '38']}; {'id': '31', 'type': 'import_from_statement', 'children': ['32', '36']}; {'id': '32', 'type': 'dotted_name', 'children': ['33', '34', '35']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ftfy'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'bad_codecs'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'utf8_variants'}; {'id': '36', 'type': 'dotted_name', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'CODEC_INFO'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'codec'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'CODEC_INFO'}; {'id': '42', 'type': 'elif_clause', 'children': ['43', '49']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'norm_encoding'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'string', 'children': [], 'value': "'sloppy_'"}; {'id': '49', 'type': 'block', 'children': ['50', '57']}; {'id': '50', 'type': 'import_from_statement', 'children': ['51', '55']}; {'id': '51', 'type': 'dotted_name', 'children': ['52', '53', '54']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ftfy'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'bad_codecs'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'sloppy'}; {'id': '55', 'type': 'dotted_name', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'CODECS'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'codec'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'CODECS'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'norm_encoding'}; {'id': '66', 'type': 'if_statement', 'children': ['67', '70']}; {'id': '67', 'type': 'comparison_operator', 'children': ['68', '69'], 'value': 'is not'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'codec'}; {'id': '69', 'type': 'None', 'children': []}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '76']}; {'id': '73', 'type': 'subscript', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': '_CACHE'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'codec'}; {'id': '77', 'type': 'return_statement', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'codec'}
|
Register our "bad codecs" with Python's codecs API. This involves adding
a search function that takes in an encoding name, and returns a codec
for that encoding if it knows one, or None if it doesn't.
The encodings this will match are:
- Encodings of the form 'sloppy-windows-NNNN' or 'sloppy-iso-8859-N',
where the non-sloppy version is an encoding that leaves some bytes
unmapped to characters.
- The 'utf-8-variants' encoding, which has the several aliases seen
above.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'lock'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '28']}; {'id': '9', 'type': 'attribute', 'children': ['10', '27']}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'hmac'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'new'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '21']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'hexdigest'}; {'id': '28', 'type': 'argument_list', 'children': []}
|
Locks the given text using the given key and returns the result
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_calc_d'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'aod700'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '22', '48']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'p0'}; {'id': '10', 'type': 'float', 'children': [], 'value': '101325.'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'dp'}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '/'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '16', 'type': '()', 'children': ['17']}; {'id': '17', 'type': 'binary_operator', 'children': ['18', '19'], 'value': '+'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '18'}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '21'], 'value': '*'}; {'id': '20', 'type': 'integer', 'children': [], 'value': '152'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'aod700'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '38'], 'value': '+'}; {'id': '26', 'type': 'binary_operator', 'children': ['27', '37'], 'value': '+'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '34'], 'value': '+'}; {'id': '28', 'type': 'binary_operator', 'children': ['29', '31'], 'value': '*'}; {'id': '29', 'type': 'unary_operator', 'children': ['30'], 'value': '-'}; {'id': '30', 'type': 'float', 'children': [], 'value': '0.337'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '33'], 'value': '**'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'aod700'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '34', 'type': 'binary_operator', 'children': ['35', '36'], 'value': '*'}; {'id': '35', 'type': 'float', 'children': [], 'value': '0.63'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'aod700'}; {'id': '37', 'type': 'float', 'children': [], 'value': '0.116'}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '40'], 'value': '*'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dp'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'binary_operator', 'children': ['46', '47'], 'value': '/'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'p0'}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'd'}
|
Calculate the d coefficient.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'init0'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dae'}; {'id': '6', 'type': 'block', 'children': ['7', '19']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '16']}; {'id': '9', 'type': 'subscript', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'dae'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'v0'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '28']}; {'id': '21', 'type': 'subscript', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'dae'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'mul'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'qg'}
|
Set initial voltage and reactive power for PQ.
Overwrites Bus.voltage values
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'safe_unicode'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '5', 'type': 'block', 'children': ['6', '21', '37']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '27']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'utf8'"}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'string'}
|
Safely transform any object into utf8 encoded bytes
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'separate_struct_array'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '6', 'type': 'block', 'children': ['7', '78', '95', '117']}; {'id': '7', 'type': 'try_statement', 'children': ['8', '29']}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'cumsum'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'list_comprehension', 'children': ['18', '26']}; {'id': '18', 'type': 'attribute', 'children': ['19', '25']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'itemsize'}; {'id': '26', 'type': 'for_in_clause', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '29', 'type': 'except_clause', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '31', 'type': 'block', 'children': ['32', '43', '59', '71']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'dtype_size'}; {'id': '35', 'type': 'attribute', 'children': ['36', '42']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'itemsize'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'num_fields'}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '53'], 'value': '/'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '53', 'type': '()', 'children': ['54']}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '58'], 'value': '*'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'dtype_size'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'cumsum'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '70'], 'value': '*'}; {'id': '68', 'type': 'list', 'children': ['69'], 'value': '[dtype_size]'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'dtype_size'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'num_fields'}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '74', 'type': 'binary_operator', 'children': ['75', '77'], 'value': '*'}; {'id': '75', 'type': 'list', 'children': ['76'], 'value': '[dtypes]'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'num_fields'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '81', 'type': 'call', 'children': ['82', '93']}; {'id': '82', 'type': 'attribute', 'children': ['83', '92']}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'concatenate'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'list', 'children': ['89', '91'], 'value': '[[0], offsets]'}; {'id': '89', 'type': 'list', 'children': ['90'], 'value': '[0]'}; {'id': '90', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'astype'}; {'id': '93', 'type': 'argument_list', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'assignment', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'uint_array'}; {'id': '98', 'type': 'call', 'children': ['99', '109']}; {'id': '99', 'type': 'attribute', 'children': ['100', '108']}; {'id': '100', 'type': 'call', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'uint8'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'reshape'}; {'id': '109', 'type': 'argument_list', 'children': ['110']}; {'id': '110', 'type': 'binary_operator', 'children': ['111', '114'], 'value': '+'}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '114', 'type': 'tuple', 'children': ['115']}; {'id': '115', 'type': 'unary_operator', 'children': ['116'], 'value': '-'}; {'id': '116', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '117', 'type': 'return_statement', 'children': ['118']}; {'id': '118', 'type': 'list_comprehension', 'children': ['119', '141']}; {'id': '119', 'type': 'call', 'children': ['120', '139']}; {'id': '120', 'type': 'attribute', 'children': ['121', '138']}; {'id': '121', 'type': 'call', 'children': ['122', '137']}; {'id': '122', 'type': 'attribute', 'children': ['123', '136']}; {'id': '123', 'type': 'subscript', 'children': ['124', '125', '126']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'uint_array'}; {'id': '125', 'type': 'ellipsis', 'children': [], 'value': '...'}; {'id': '126', 'type': 'slice', 'children': ['127', '130', '131']}; {'id': '127', 'type': 'subscript', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '130', 'type': 'colon', 'children': []}; {'id': '131', 'type': 'subscript', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'offsets'}; {'id': '133', 'type': 'binary_operator', 'children': ['134', '135'], 'value': '+'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '135', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'flatten'}; {'id': '137', 'type': 'argument_list', 'children': []}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '139', 'type': 'argument_list', 'children': ['140']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '141', 'type': 'for_in_clause', 'children': ['142', '145']}; {'id': '142', 'type': 'pattern_list', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '145', 'type': 'call', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'dtypes'}
|
Takes an array with a structured dtype, and separates it out into
a list of arrays with dtypes coming from the input ``dtypes``.
Does the inverse of ``join_struct_arrays``.
:param np.ndarray array: Structured array.
:param dtypes: List of ``np.dtype``, or just a ``np.dtype`` and the number of
them is figured out automatically by counting bytes.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_blockdata'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '26', '33', '84']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '17']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '16'], 'value': 'is'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'to_bytes'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '25', 'type': 'string', 'children': [], 'value': '"latin-1"'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '37', '60']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': '<='}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '256'}; {'id': '37', 'type': 'block', 'children': ['38', '50']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_writeStruct'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45', '46']}; {'id': '44', 'type': 'string', 'children': [], 'value': '">B"'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '46', 'type': 'tuple', 'children': ['47']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'TC_BLOCKDATA'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '_writeStruct'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57', '58']}; {'id': '56', 'type': 'string', 'children': [], 'value': '">B"'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '58', 'type': 'tuple', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '60', 'type': 'else_clause', 'children': ['61']}; {'id': '61', 'type': 'block', 'children': ['62', '74']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_writeStruct'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69', '70']}; {'id': '68', 'type': 'string', 'children': [], 'value': '">B"'}; {'id': '69', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '70', 'type': 'tuple', 'children': ['71']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'TC_BLOCKDATALONG'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': '_writeStruct'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81', '82']}; {'id': '80', 'type': 'string', 'children': [], 'value': '">I"'}; {'id': '81', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '82', 'type': 'tuple', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '91']}; {'id': '86', 'type': 'attribute', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'object_stream'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'obj'}
|
Appends a block of data to the serialization stream
:param obj: String form of the data block
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'preproc_directive'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'type', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '7', 'type': 'block', 'children': ['8', '16', '33']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '15']}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_stream'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'save_context'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'if_statement', 'children': ['17', '24']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'read_until'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': '"\\n"'}; {'id': '23', 'type': 'string', 'children': [], 'value': "'\\\\'"}; {'id': '24', 'type': 'block', 'children': ['25']}; {'id': '25', 'type': 'return_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': '_stream'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'validate_context'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_stream'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'restore_context'}; {'id': '40', 'type': 'argument_list', 'children': []}
|
Consume a preproc directive.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'hostname'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '16', '24', '28', '126', '132']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_default_ret'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'current_name'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'subscript', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '__salt__'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'cimc.get_hostname'"}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'req_change'}; {'id': '27', 'type': 'False', 'children': []}; {'id': '28', 'type': 'try_statement', 'children': ['29', '99']}; {'id': '29', 'type': 'block', 'children': ['30', '39']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '34']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': '!='}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'current_name'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'req_change'}; {'id': '38', 'type': 'True', 'children': []}; {'id': '39', 'type': 'if_statement', 'children': ['40', '41', '91']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'req_change'}; {'id': '41', 'type': 'block', 'children': ['42', '51', '69', '77', '85']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': '__salt__'}; {'id': '48', 'type': 'string', 'children': [], 'value': "'cimc.set_hostname'"}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '51', 'type': 'if_statement', 'children': ['52', '54']}; {'id': '52', 'type': 'not_operator', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '54', 'type': 'block', 'children': ['55', '61', '67']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '60']}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'result'"}; {'id': '60', 'type': 'False', 'children': []}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '66']}; {'id': '63', 'type': 'subscript', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '65', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '66', 'type': 'string', 'children': [], 'value': '"Error setting hostname."'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '76']}; {'id': '71', 'type': 'subscript', 'children': ['72', '75']}; {'id': '72', 'type': 'subscript', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'changes'"}; {'id': '75', 'type': 'string', 'children': [], 'value': "'before'"}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'current_name'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '84']}; {'id': '79', 'type': 'subscript', 'children': ['80', '83']}; {'id': '80', 'type': 'subscript', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '82', 'type': 'string', 'children': [], 'value': "'changes'"}; {'id': '83', 'type': 'string', 'children': [], 'value': "'after'"}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'assignment', 'children': ['87', '90']}; {'id': '87', 'type': 'subscript', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '89', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '90', 'type': 'string', 'children': [], 'value': '"Hostname modified."'}; {'id': '91', 'type': 'else_clause', 'children': ['92']}; {'id': '92', 'type': 'block', 'children': ['93']}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '98']}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '97', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '98', 'type': 'string', 'children': [], 'value': '"Hostname already configured. No changes required."'}; {'id': '99', 'type': 'except_clause', 'children': ['100', '104']}; {'id': '100', 'type': 'as_pattern', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '102', 'type': 'as_pattern_target', 'children': ['103']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '104', 'type': 'block', 'children': ['105', '111', '117', '124']}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '110']}; {'id': '107', 'type': 'subscript', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '109', 'type': 'string', 'children': [], 'value': "'result'"}; {'id': '110', 'type': 'False', 'children': []}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '116']}; {'id': '113', 'type': 'subscript', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '115', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '116', 'type': 'string', 'children': [], 'value': '"Error occurred setting hostname."'}; {'id': '117', 'type': 'expression_statement', 'children': ['118']}; {'id': '118', 'type': 'call', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '122', 'type': 'argument_list', 'children': ['123']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '124', 'type': 'return_statement', 'children': ['125']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'assignment', 'children': ['128', '131']}; {'id': '128', 'type': 'subscript', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '130', 'type': 'string', 'children': [], 'value': "'result'"}; {'id': '131', 'type': 'True', 'children': []}; {'id': '132', 'type': 'return_statement', 'children': ['133']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Ensures that the hostname is set to the specified value.
.. versionadded:: 2019.2.0
name: The name of the module function to execute.
hostname(str): The hostname of the server.
SLS Example:
.. code-block:: yaml
set_name:
cimc.hostname:
- hostname: foobar
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'component_acting_parent_tag'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'parent_tag'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '6', 'type': 'block', 'children': ['7', '49']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13', '43']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '12'], 'value': '=='}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'parent_tag'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '12', 'type': 'string', 'children': [], 'value': '"fig-group"'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'if_statement', 'children': ['15', '27', '39']}; {'id': '15', 'type': '()', 'children': ['16']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '26'], 'value': '>'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'find_previous_siblings'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': '"fig"'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'acting_parent_tag'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'first'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'extract_nodes'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'parent_tag'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"fig"'}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'None', 'children': []}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'acting_parent_tag'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'parent_tag'}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'acting_parent_tag'}
|
Only intended for use in getting components, look for tag name of fig-group
and if so, find the first fig tag inside it as the acting parent tag
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'restore_site_properties'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'site_property'}; {'id': '7', 'type': 'string', 'children': [], 'value': '"ff_map"'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '26', '36', '46', '57', '77', '104', '154']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '21']}; {'id': '13', 'type': 'not_operator', 'children': ['14']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '20'], 'value': '=='}; {'id': '15', 'type': 'subscript', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'control_params'}; {'id': '19', 'type': 'string', 'children': [], 'value': '"filetype"'}; {'id': '20', 'type': 'string', 'children': [], 'value': '"pdb"'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'raise_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '29', 'type': 'boolean_operator', 'children': ['30', '31'], 'value': 'or'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '31', 'type': 'subscript', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'control_params'}; {'id': '35', 'type': 'string', 'children': [], 'value': '"output"'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'bma'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'BabelMolAdaptor'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'from_file'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '45', 'type': 'string', 'children': [], 'value': '"pdb"'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'pbm'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'pb'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'Molecule'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'bma'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': '_obmol'}; {'id': '57', 'type': 'assert_statement', 'children': ['58']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '65'], 'value': '=='}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'pbm'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'residues'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'list_comprehension', 'children': ['69', '72']}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '71', 'type': 'string', 'children': [], 'value': '"number"'}; {'id': '72', 'type': 'for_in_clause', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'param_list'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'packed_mol'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'convert_obatoms_to_molecule'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '92', '101']}; {'id': '85', 'type': 'attribute', 'children': ['86', '91']}; {'id': '86', 'type': 'subscript', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'pbm'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'residues'}; {'id': '90', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'atoms'}; {'id': '92', 'type': 'keyword_argument', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'residue_name'}; {'id': '94', 'type': 'attribute', 'children': ['95', '100']}; {'id': '95', 'type': 'subscript', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'pbm'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'residues'}; {'id': '99', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '101', 'type': 'keyword_argument', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'site_property'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'site_property'}; {'id': '104', 'type': 'for_statement', 'children': ['105', '106', '113']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'resid'}; {'id': '106', 'type': 'subscript', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'pbm'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'residues'}; {'id': '110', 'type': 'slice', 'children': ['111', '112']}; {'id': '111', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '112', 'type': 'colon', 'children': []}; {'id': '113', 'type': 'block', 'children': ['114', '133']}; {'id': '114', 'type': 'expression_statement', 'children': ['115']}; {'id': '115', 'type': 'assignment', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'mol'}; {'id': '117', 'type': 'call', 'children': ['118', '121']}; {'id': '118', 'type': 'attribute', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'convert_obatoms_to_molecule'}; {'id': '121', 'type': 'argument_list', 'children': ['122', '125', '130']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'resid'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'atoms'}; {'id': '125', 'type': 'keyword_argument', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'residue_name'}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'resid'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '130', 'type': 'keyword_argument', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'site_property'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'site_property'}; {'id': '133', 'type': 'for_statement', 'children': ['134', '135', '136']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'site'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'mol'}; {'id': '136', 'type': 'block', 'children': ['137']}; {'id': '137', 'type': 'expression_statement', 'children': ['138']}; {'id': '138', 'type': 'call', 'children': ['139', '142']}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'packed_mol'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '142', 'type': 'argument_list', 'children': ['143', '146', '149']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'site'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'species'}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'site'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'coords'}; {'id': '149', 'type': 'keyword_argument', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'properties'}; {'id': '151', 'type': 'attribute', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'site'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'properties'}; {'id': '154', 'type': 'return_statement', 'children': ['155']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'packed_mol'}
|
Restore the site properties for the final packed molecule.
Args:
site_property (str):
filename (str): path to the final packed molecule.
Returns:
Molecule
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'predict_files'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '6', 'type': 'block', 'children': ['7', '17', '80']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'imgs'}; {'id': '10', 'type': 'binary_operator', 'children': ['11', '13'], 'value': '*'}; {'id': '11', 'type': 'list', 'children': ['12'], 'value': '[0]'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '17', 'type': 'for_statement', 'children': ['18', '21', '25']}; {'id': '18', 'type': 'pattern_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '25', 'type': 'block', 'children': ['26', '40', '52', '59', '74']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '29', 'type': 'call', 'children': ['30', '38']}; {'id': '30', 'type': 'attribute', 'children': ['31', '37']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'cv2'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'imread'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'astype'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'string', 'children': [], 'value': "'float64'"}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'cv2'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'resize'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '49', 'type': 'tuple', 'children': ['50', '51']}; {'id': '50', 'type': 'integer', 'children': [], 'value': '224'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '224'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'preprocess_input'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '59', 'type': 'if_statement', 'children': ['60', '63']}; {'id': '60', 'type': 'comparison_operator', 'children': ['61', '62'], 'value': 'is'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '62', 'type': 'None', 'children': []}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'string', 'children': [], 'value': "'failed to open: {}, continuing...'"}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '79']}; {'id': '76', 'type': 'subscript', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'imgs'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '87']}; {'id': '82', 'type': 'attribute', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'predict'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'call', 'children': ['89', '92']}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'imgs'}
|
reads files off disk, resizes them
and then predicts them, files should
be a list or itrerable of file paths
that lead to images, they are then
loaded with opencv, resized, and predicted
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'invoice_id'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '8', 'type': 'block', 'children': ['9', '21']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'string', 'children': [], 'value': '"{}/{}"'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'base_url'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'invoice_id'}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'delete_url'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28', '29']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '28', 'type': 'dictionary', 'children': []}; {'id': '29', 'type': 'dictionary_splat', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Delete an invoice
You can delete an invoice which is in the draft state.
Args:
invoice_id : Id for delete the invoice
Returns:
The response is always be an empty array like this - []
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_resource'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'resource_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'attributes'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'parents'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'issuer'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'default'"}; {'id': '13', 'type': 'block', 'children': ['14', '22', '26', '52', '65']}; {'id': '14', 'type': 'assert_statement', 'children': ['15', '21']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'attributes'}; {'id': '19', 'type': '()', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '21', 'type': 'string', 'children': [], 'value': '"attributes expected to be dict"'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'attrs'}; {'id': '25', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '26', 'type': 'for_statement', 'children': ['27', '28', '33']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'attributes'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'attrs'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'dictionary', 'children': ['41', '44', '47']}; {'id': '41', 'type': 'pair', 'children': ['42', '43']}; {'id': '42', 'type': 'string', 'children': [], 'value': "'issuer'"}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'issuer'}; {'id': '44', 'type': 'pair', 'children': ['45', '46']}; {'id': '45', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': "'value'"}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'attributes'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '55', 'type': 'dictionary', 'children': ['56', '59', '62']}; {'id': '56', 'type': 'pair', 'children': ['57', '58']}; {'id': '57', 'type': 'string', 'children': [], 'value': '"resourceIdentifier"'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'resource_id'}; {'id': '59', 'type': 'pair', 'children': ['60', '61']}; {'id': '60', 'type': 'string', 'children': [], 'value': '"parents"'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'parents'}; {'id': '62', 'type': 'pair', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"attributes"'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'attrs'}; {'id': '65', 'type': 'return_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': '_put_resource'}; {'id': '70', 'type': 'argument_list', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'resource_id'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'body'}
|
Will add the given resource with a given identifier and attribute
dictionary.
example/
add_resource('/asset/12', {'id': 12, 'manufacturer': 'GE'})
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'scraper'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '17', '26']}; {'id': '6', 'type': 'global_statement', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'scrapers'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '11', 'type': 'attribute', 'children': ['12', '16']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'scraper'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'string', 'children': [], 'value': "''"}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '17', 'type': 'if_statement', 'children': ['18', '20']}; {'id': '18', 'type': 'not_operator', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'raise_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'No language specified for your scraper.'"}; {'id': '26', 'type': 'if_statement', 'children': ['27', '33', '43']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'scrapers'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'has_key'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '41']}; {'id': '36', 'type': 'attribute', 'children': ['37', '40']}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'scrapers'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'scraper'}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '50']}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'scrapers'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '50', 'type': 'list', 'children': ['51'], 'value': '[scraper]'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'scraper'}
|
Registers a scraper to make it available for the generic scraping interface.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_red_listing_validation'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'listing'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'listing'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'try_statement', 'children': ['11', '20']}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'jsonschema'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'listing'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'cwl_job_listing_schema'}; {'id': '20', 'type': 'except_clause', 'children': ['21', '25']}; {'id': '21', 'type': 'as_pattern', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ValidationError'}; {'id': '23', 'type': 'as_pattern_target', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'raise_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'RedValidationError'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': '\'REDFILE listing of input "{}" does not comply with jsonschema: {}\''}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'context'}
|
Raises an RedValidationError, if the given listing does not comply with cwl_job_listing_schema.
If listing is None or an empty list, no exception is thrown.
:param key: The input key to build an error message if needed.
:param listing: The listing to validate
:raise RedValidationError: If the given listing does not comply with cwl_job_listing_schema
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_ilwdchar_class'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'tbl_name'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'col_name'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'globals'}; {'id': '10', 'type': 'argument_list', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '24', '30', '34', '44', '70', '76', '82', '99']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '15', 'type': 'tuple', 'children': ['16', '20']}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'tbl_name'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'col_name'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cls_name'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '29'], 'value': '%'}; {'id': '28', 'type': 'string', 'children': [], 'value': '"%s_%s_class"'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '30', 'type': 'assert_statement', 'children': ['31']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': '!='}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'cls_name'}; {'id': '33', 'type': 'string', 'children': [], 'value': '"get_ilwdchar_class"'}; {'id': '34', 'type': 'try_statement', 'children': ['35', '40']}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'cls_name'}; {'id': '40', 'type': 'except_clause', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'pass_statement', 'children': []}; {'id': '44', 'type': 'class_definition', 'children': ['45', '46', '50']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'new_class'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '_ilwd'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'ilwdchar'}; {'id': '50', 'type': 'block', 'children': ['51', '55', '61']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': '__slots__'}; {'id': '54', 'type': 'tuple', 'children': []}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '60']}; {'id': '57', 'type': 'pattern_list', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'index_offset'}; {'id': '64', 'type': 'call', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '%'}; {'id': '68', 'type': 'string', 'children': [], 'value': '"%s:%s:"'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'new_class'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'cls_name'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '81']}; {'id': '78', 'type': 'subscript', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'cls_name'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'new_class'}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'copy_reg'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'new_class'}; {'id': '89', 'type': 'lambda', 'children': ['90', '92']}; {'id': '90', 'type': 'lambda_parameters', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '92', 'type': 'tuple', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'ilwdchar'}; {'id': '94', 'type': 'tuple', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '99', 'type': 'return_statement', 'children': ['100']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'new_class'}
|
Searches this module's namespace for a subclass of _ilwd.ilwdchar
whose table_name and column_name attributes match those provided.
If a matching subclass is found it is returned; otherwise a new
class is defined, added to this module's namespace, and returned.
Example:
>>> process_id = get_ilwdchar_class("process", "process_id")
>>> x = process_id(10)
>>> str(type(x))
"<class 'pycbc_glue.ligolw.ilwd.process_process_id_class'>"
>>> str(x)
'process:process_id:10'
Retrieving and storing the class provides a convenient mechanism
for quickly constructing new ID objects.
Example:
>>> for i in range(10):
... print str(process_id(i))
...
process:process_id:0
process:process_id:1
process:process_id:2
process:process_id:3
process:process_id:4
process:process_id:5
process:process_id:6
process:process_id:7
process:process_id:8
process:process_id:9
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_infer_decorator_callchain'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '24', '47', '62', '93']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'FunctionDef'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'return_statement', 'children': ['15']}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'if_statement', 'children': ['17', '21']}; {'id': '17', 'type': 'not_operator', 'children': ['18']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'None', 'children': []}; {'id': '24', 'type': 'try_statement', 'children': ['25', '40']}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'infer_call_result'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '40', 'type': 'except_clause', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'InferenceError'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'None', 'children': []}; {'id': '47', 'type': 'if_statement', 'children': ['48', '55']}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'bases'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'Instance'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': '_proxied'}; {'id': '62', 'type': 'if_statement', 'children': ['63', '68']}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'ClassDef'}; {'id': '68', 'type': 'block', 'children': ['69', '81']}; {'id': '69', 'type': 'if_statement', 'children': ['70', '78']}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'is_subtype_of'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '%'}; {'id': '76', 'type': 'string', 'children': [], 'value': '"%s.classmethod"'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'BUILTINS'}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'string', 'children': [], 'value': '"classmethod"'}; {'id': '81', 'type': 'if_statement', 'children': ['82', '90']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'is_subtype_of'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'binary_operator', 'children': ['88', '89'], 'value': '%'}; {'id': '88', 'type': 'string', 'children': [], 'value': '"%s.staticmethod"'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'BUILTINS'}; {'id': '90', 'type': 'block', 'children': ['91']}; {'id': '91', 'type': 'return_statement', 'children': ['92']}; {'id': '92', 'type': 'string', 'children': [], 'value': '"staticmethod"'}; {'id': '93', 'type': 'return_statement', 'children': ['94']}; {'id': '94', 'type': 'None', 'children': []}
|
Detect decorator call chaining and see if the end result is a
static or a classmethod.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.