sequence
stringlengths
1.16k
23.8k
docstring
stringlengths
5
7.69k
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'validate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'expect_header_row'}; {'id': '8', 'type': 'True', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'ignore_lines'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '14', 'type': 'False', 'children': []}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '17', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '20', 'type': 'None', 'children': []}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'report_unexpected_exceptions'}; {'id': '23', 'type': 'True', 'children': []}; {'id': '24', 'type': 'block', 'children': ['25', '31', '45', '69']}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'problem_generator'}; {'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': 'ivalidate'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40', '41', '42', '43', '44']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'expect_header_row'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'ignore_lines'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'report_unexpected_exceptions'}; {'id': '45', 'type': 'for_statement', 'children': ['46', '49', '53']}; {'id': '46', 'type': 'pattern_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'problem_generator'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'if_statement', 'children': ['55', '61']}; {'id': '55', 'type': 'boolean_operator', 'children': ['56', '58'], 'value': 'or'}; {'id': '56', 'type': 'not_operator', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '60'], 'value': '<'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '61', 'type': 'block', 'children': ['62']}; {'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': 'problems'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '69', 'type': 'return_statement', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'problems'}
Validate `data` and return a list of validation problems found. Arguments --------- `data` - any source of row-oriented data, e.g., as provided by a `csv.reader`, or a list of lists of strings, or ... `expect_header_row` - does the data contain a header row (i.e., the first record is a list of field names)? Defaults to True. `ignore_lines` - ignore n lines (rows) at the beginning of the data `summarize` - only report problem codes, no other details `limit` - report at most n problems `context` - a dictionary of any additional information to be added to any problems found - useful if problems are being aggregated from multiple validators `report_unexpected_exceptions` - value check function, value predicates, record check functions, record predicates, and other user-supplied validation functions may raise unexpected exceptions. If this argument is true, any unexpected exceptions will be reported as validation problems; if False, unexpected exceptions will be handled silently.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_emit_search_criteria'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'user_ids'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'job_ids'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'task_ids'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'labels'}; {'id': '8', 'type': 'block', 'children': ['9', '14', '19', '26', '31', '38', '53']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'string', 'children': [], 'value': "'Delete running jobs:'"}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': "' user:'"}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'binary_operator', 'children': ['24', '25'], 'value': '%'}; {'id': '24', 'type': 'string', 'children': [], 'value': "' %s\\n'"}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'user_ids'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'string', 'children': [], 'value': "' job-id:'"}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '%'}; {'id': '36', 'type': 'string', 'children': [], 'value': "' %s\\n'"}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'job_ids'}; {'id': '38', 'type': 'if_statement', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'task_ids'}; {'id': '40', 'type': 'block', 'children': ['41', '46']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'string', 'children': [], 'value': "' task-id:'"}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'binary_operator', 'children': ['51', '52'], 'value': '%'}; {'id': '51', 'type': 'string', 'children': [], 'value': "' %s\\n'"}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'task_ids'}; {'id': '53', 'type': 'if_statement', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'labels'}; {'id': '55', 'type': 'block', 'children': ['56', '61']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'string', 'children': [], 'value': "' labels:'"}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'binary_operator', 'children': ['66', '67'], 'value': '%'}; {'id': '66', 'type': 'string', 'children': [], 'value': "' %s\\n'"}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'labels'}
Print the filters used to delete tasks. Use raw flags as arguments.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_retrieve_certificate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'access_token'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '9', 'type': 'block', 'children': ['10', '17', '25', '35', '52', '60', '67', '75', '87', '96', '106', '115', '138', '204']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'string', 'children': [], 'value': '"Retrieve certificate with token."'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'key_pair'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'PKey'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'key_pair'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'generate_key'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'TYPE_RSA'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '2048'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'private_key'}; {'id': '38', 'type': 'call', 'children': ['39', '50']}; {'id': '39', 'type': 'attribute', 'children': ['40', '49']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'dump_privatekey'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'FILETYPE_PEM'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'key_pair'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'cert_request'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'X509Req'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'cert_request'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'set_pubkey'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'key_pair'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'cert_request'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'sign'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'key_pair'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'md5'"}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'der_cert_req'}; {'id': '78', 'type': 'call', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'dump_certificate_request'}; {'id': '82', 'type': 'argument_list', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'crypto'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'FILETYPE_ASN1'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'cert_request'}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'encoded_cert_req'}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'base64'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'b64encode'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'der_cert_req'}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '99', 'type': 'dictionary', 'children': ['100', '103']}; {'id': '100', 'type': 'pair', 'children': ['101', '102']}; {'id': '101', 'type': 'string', 'children': [], 'value': "'access_token'"}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'access_token'}; {'id': '103', 'type': 'pair', 'children': ['104', '105']}; {'id': '104', 'type': 'string', 'children': [], 'value': "'token_type'"}; {'id': '105', 'type': 'string', 'children': [], 'value': "'Bearer'"}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'OAuth2Session'}; {'id': '111', 'type': 'argument_list', 'children': ['112']}; {'id': '112', 'type': 'keyword_argument', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '118', 'type': 'call', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'post'}; {'id': '122', 'type': 'argument_list', 'children': ['123', '126', '132', '135']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'certificate_url'}; {'id': '126', 'type': 'keyword_argument', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '128', 'type': 'dictionary', 'children': ['129']}; {'id': '129', 'type': 'pair', 'children': ['130', '131']}; {'id': '130', 'type': 'string', 'children': [], 'value': "'certificate_request'"}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'encoded_cert_req'}; {'id': '132', 'type': 'keyword_argument', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'verify'}; {'id': '134', 'type': 'False', 'children': []}; {'id': '135', 'type': 'keyword_argument', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '138', 'type': 'if_statement', 'children': ['139', '142', '183']}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'ok'}; {'id': '142', 'type': 'block', 'children': ['143', '155', '176']}; {'id': '143', 'type': 'expression_statement', 'children': ['144']}; {'id': '144', 'type': 'assignment', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '146', 'type': 'call', 'children': ['147', '150']}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'string', 'children': [], 'value': '"{} {}"'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '150', 'type': 'argument_list', 'children': ['151', '154']}; {'id': '151', 'type': 'attribute', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'private_key'}; {'id': '155', 'type': 'with_statement', 'children': ['156', '168']}; {'id': '156', 'type': 'with_clause', 'children': ['157']}; {'id': '157', 'type': 'with_item', 'children': ['158']}; {'id': '158', 'type': 'as_pattern', 'children': ['159', '166']}; {'id': '159', 'type': 'call', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '161', 'type': 'argument_list', 'children': ['162', '165']}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'esgf_credentials'}; {'id': '165', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '166', 'type': 'as_pattern_target', 'children': ['167']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'fh'}; {'id': '168', 'type': 'block', 'children': ['169']}; {'id': '169', 'type': 'expression_statement', 'children': ['170']}; {'id': '170', 'type': 'call', 'children': ['171', '174']}; {'id': '171', 'type': 'attribute', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'fh'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '174', 'type': 'argument_list', 'children': ['175']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '176', 'type': 'expression_statement', 'children': ['177']}; {'id': '177', 'type': 'call', 'children': ['178', '181']}; {'id': '178', 'type': 'attribute', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '181', 'type': 'argument_list', 'children': ['182']}; {'id': '182', 'type': 'string', 'children': [], 'value': "'Fetched certificate successfully.'"}; {'id': '183', 'type': 'else_clause', 'children': ['184']}; {'id': '184', 'type': 'block', 'children': ['185', '199']}; {'id': '185', 'type': 'expression_statement', 'children': ['186']}; {'id': '186', 'type': 'assignment', 'children': ['187', '188']}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '188', 'type': 'call', 'children': ['189', '192']}; {'id': '189', 'type': 'attribute', 'children': ['190', '191']}; {'id': '190', 'type': 'string', 'children': [], 'value': '"Could not get certificate: {} {}"'}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '192', 'type': 'argument_list', 'children': ['193', '196']}; {'id': '193', 'type': 'attribute', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '196', 'type': 'attribute', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'reason'}; {'id': '199', 'type': 'raise_statement', 'children': ['200']}; {'id': '200', 'type': 'call', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '202', 'type': 'argument_list', 'children': ['203']}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '204', 'type': 'return_statement', 'children': ['205']}; {'id': '205', 'type': 'True', 'children': []}
Generates a new private key and certificate request, submits the request to be signed by the SLCS CA and returns the certificate.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_scan_footpaths_to_departure_stop'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'connection_dep_stop'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'connection_dep_time'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'arrival_time_target'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'for_statement', 'children': ['10', '14', '28']}; {'id': '10', 'type': 'pattern_list', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'neighbor'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'data'}; {'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': '_walk_network'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'edges_iter'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '25']}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'nbunch'}; {'id': '23', 'type': 'list', 'children': ['24'], 'value': '[connection_dep_stop]'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'connection_dep_stop'}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '27', 'type': 'True', 'children': []}; {'id': '28', 'type': 'block', 'children': ['29', '35', '45', '57']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'd_walk'}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'d_walk'"}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'neighbor_dep_time'}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '40'], 'value': '-'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'connection_dep_time'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '/'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'd_walk'}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_walk_speed'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'pt'}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'LabelTimeSimple'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '54']}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'departure_time'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'neighbor_dep_time'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'arrival_time_target'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'arrival_time_target'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '66']}; {'id': '59', 'type': 'attribute', 'children': ['60', '65']}; {'id': '60', 'type': 'subscript', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': '_stop_profiles'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'neighbor'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'update_pareto_optimal_tuples'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'pt'}
A helper method for scanning the footpaths. Updates self._stop_profiles accordingly
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_token'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '28']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'string', 'children': [], 'value': '"&"'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '18', 'type': 'list_comprehension', 'children': ['19', '25']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'string', 'children': [], 'value': '"="'}; {'id': '25', 'type': 'for_in_clause', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'dictionary_comprehension', 'children': ['30', '33']}; {'id': '30', 'type': 'pair', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '33', 'type': 'for_in_clause', 'children': ['34', '37']}; {'id': '34', 'type': 'pattern_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'items'}
parse the responses containing the tokens Parameters ---------- response : str The response containing the tokens Returns ------- dict The parsed tokens
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_timestamp'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'microsecond_timestamp'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '25']}; {'id': '8', 'type': 'attribute', 'children': ['9', '24']}; {'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': 'datetime'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'fromtimestamp'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '19']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '18'], 'value': '//'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'microsecond_timestamp'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '1000000'}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'utc'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'microsecond'}; {'id': '28', 'type': '()', 'children': ['29']}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '31'], 'value': '%'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'microsecond_timestamp'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '1000000'}
Convert a microsecond timestamp to a UTC datetime instance.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_updateDutyCycles'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'overlaps'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '7', 'type': 'block', 'children': ['8', '22', '36', '44', '50', '56', '70', '85']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'overlapArray'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_numColumns'}; {'id': '19', 'type': 'keyword_argument', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'realDType'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'activeArray'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_numColumns'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'realDType'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '43']}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'overlapArray'}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': '>'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'overlaps'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '49']}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'activeArray'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': '_dutyCyclePeriod'}; {'id': '56', 'type': 'if_statement', 'children': ['57', '63']}; {'id': '57', 'type': '()', 'children': ['58']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '60'], 'value': '>'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': '_iterationNum'}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': '_iterationNum'}; {'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': '_overlapDutyCycles'}; {'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': '_updateDutyCyclesHelper'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '83', '84']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': '_overlapDutyCycles'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'overlapArray'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'assignment', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': '_activeDutyCycles'}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': '_updateDutyCyclesHelper'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '98', '99']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': '_activeDutyCycles'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'activeArray'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'period'}
Updates the duty cycles for each column. The OVERLAP duty cycle is a moving average of the number of inputs which overlapped with the each column. The ACTIVITY duty cycles is a moving average of the frequency of activation for each column. Parameters: ---------------------------- :param overlaps: An array containing the overlap score for each column. The overlap score for a column is defined as the number of synapses in a "connected state" (connected synapses) that are connected to input bits which are turned on. :param activeColumns: An array containing the indices of the active columns, the sparse set of columns which survived inhibition
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge_dicts'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'changes'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '11', '16']}; {'id': '8', 'type': 'pattern_list', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'changes'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'if_statement', 'children': ['18', '23', '36']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'merge_dicts'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '35']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'setdefault'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '34', 'type': 'dictionary', 'children': []}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '36', 'type': 'else_clause', 'children': ['37']}; {'id': '37', 'type': 'block', 'children': ['38']}; {'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': 'base'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'setdefault'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'v'}
Merge b into a recursively, without overwriting values. :param base: the dict that will be altered. :param changes: changes to update base.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'CALLCODE'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'gas'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': '_ignored_'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'in_offset'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'in_size'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'out_offset'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'out_size'}; {'id': '12', 'type': 'block', 'children': ['13', '47']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'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': 'world'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'start_transaction'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '27', '36', '41', '44']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'CALLCODE'"}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'data'}; {'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_buffer'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'in_offset'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'in_size'}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'caller'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'gas'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'gas'}; {'id': '47', 'type': 'raise_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'StartTx'}; {'id': '50', 'type': 'argument_list', 'children': []}
Message-call into this account with alternative account's code
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'does_not_contain_duplicates'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '36']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '28']}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '25']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '16'], 'value': '=='}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'set'}; {'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': 'val'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'except_clause', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'raise_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'val is not iterable'"}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_err'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '%'}; {'id': '43', 'type': 'string', 'children': [], 'value': "'Expected <%s> to not contain duplicates, but did.'"}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'val'}
Asserts that val is iterable and does not contain any duplicate items.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_json'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11', '21', '27']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'model_to_dict'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '18', 'type': 'keyword_argument', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '26']}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '25', 'type': 'string', 'children': [], 'value': 'u"version"'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'JSON_SPEC'}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34', '37']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'allow_nan'}; {'id': '36', 'type': 'False', 'children': []}; {'id': '37', 'type': 'dictionary_splat', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
Return the model as a JSON document. ``kwargs`` are passed on to ``json.dumps``. Parameters ---------- model : cobra.Model The cobra model to represent. sort : bool, optional Whether to sort the metabolites, reactions, and genes or maintain the order defined in the model. Returns ------- str String representation of the cobra model as a JSON document. See Also -------- save_json_model : Write directly to a file. json.dumps : Base function.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'output_image_link'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_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': 'renderer'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'image_link'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '21', '27']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'url'"}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'target'"}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'string', 'children': [], 'value': "'alt'"}
Pass through rest role.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compare'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'compare_locs'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '23']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '20']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '16'], 'value': '!='}; {'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': 'left'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'False', 'children': []}; {'id': '23', 'type': 'if_statement', 'children': ['24', '31', '82', '124']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'ast'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'AST'}; {'id': '31', 'type': 'block', 'children': ['32', '56', '80']}; {'id': '32', 'type': 'for_statement', 'children': ['33', '34', '37']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': '_fields'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'if_statement', 'children': ['39', '53']}; {'id': '39', 'type': 'not_operator', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'compare'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '48']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'False', 'children': []}; {'id': '56', 'type': 'if_statement', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'compare_locs'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'for_statement', 'children': ['60', '61', '64']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'loc'}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': '_locs'}; {'id': '64', 'type': 'block', 'children': ['65']}; {'id': '65', 'type': 'if_statement', 'children': ['66', '77']}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '72'], 'value': '!='}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'loc'}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'loc'}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'False', 'children': []}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'True', 'children': []}; {'id': '82', 'type': 'elif_clause', 'children': ['83', '88']}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '85', 'type': 'argument_list', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '88', 'type': 'block', 'children': ['89', '102', '122']}; {'id': '89', 'type': 'if_statement', 'children': ['90', '99']}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '95'], 'value': '!='}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '93', 'type': 'argument_list', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '99', 'type': 'block', 'children': ['100']}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'False', 'children': []}; {'id': '102', 'type': 'for_statement', 'children': ['103', '106', '111']}; {'id': '103', 'type': 'pattern_list', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'left_elt'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'right_elt'}; {'id': '106', 'type': 'call', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '111', 'type': 'block', 'children': ['112']}; {'id': '112', 'type': 'if_statement', 'children': ['113', '119']}; {'id': '113', 'type': 'not_operator', 'children': ['114']}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'compare'}; {'id': '116', 'type': 'argument_list', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'left_elt'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'right_elt'}; {'id': '119', 'type': 'block', 'children': ['120']}; {'id': '120', 'type': 'return_statement', 'children': ['121']}; {'id': '121', 'type': 'False', 'children': []}; {'id': '122', 'type': 'return_statement', 'children': ['123']}; {'id': '123', 'type': 'True', 'children': []}; {'id': '124', 'type': 'else_clause', 'children': ['125']}; {'id': '125', 'type': 'block', 'children': ['126']}; {'id': '126', 'type': 'return_statement', 'children': ['127']}; {'id': '127', 'type': 'comparison_operator', 'children': ['128', '129'], 'value': '=='}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'right'}
An AST comparison function. Returns ``True`` if all fields in ``left`` are equal to fields in ``right``; if ``compare_locs`` is true, all locations should match as well.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'invalidate_cache'}; {'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']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_use_cache'}; {'id': '10', 'type': 'block', 'children': ['11', '17']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'augmented_assignment', 'children': ['13', '16'], 'value': '+='}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_cache_version'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '24']}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_cache'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'increment'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'cached_httpbl_{0}_version'"}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'format'}; {'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': '_api_key'}
Invalidate httpBL cache
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rewind'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '22', '36', '52', '60', '68', '76']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '15']}; {'id': '8', 'type': 'attribute', 'children': ['9', '14']}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'FileRecordStream'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'rewind'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'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': 'close'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_file'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_filename'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_mode'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_reader'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'csv'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'reader'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '_file'}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'dialect'}; {'id': '51', 'type': 'string', 'children': [], 'value': '"excel"'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '_reader'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '67']}; {'id': '62', 'type': 'attribute', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '_reader'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '67', 'type': 'argument_list', 'children': []}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '75']}; {'id': '70', 'type': 'attribute', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '_reader'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '75', 'type': 'argument_list', 'children': []}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': '_recordCount'}; {'id': '81', 'type': 'integer', 'children': [], 'value': '0'}
Put us back at the beginning of the file again.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'nested_formula_parser'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'check'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '11', '27', '36', '70', '75', '81', '90', '135', '290', '294', '331']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '14', 'type': 'call', 'children': ['15', '24']}; {'id': '15', 'type': 'attribute', 'children': ['16', '23']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'['"}; {'id': '22', 'type': 'string', 'children': [], 'value': "''"}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': "']'"}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'charge_splits'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'bracketed_charge_re'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '36', 'type': 'if_statement', 'children': ['37', '43', '50']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '42'], 'value': '>'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'charge_splits'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '1'}; {'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': 'formula'}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'charge_splits'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '50', 'type': 'else_clause', 'children': ['51']}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '55', 'type': 'subscript', 'children': ['56', '69']}; {'id': '56', 'type': 'call', 'children': ['57', '67']}; {'id': '57', 'type': 'attribute', 'children': ['58', '66']}; {'id': '58', 'type': 'subscript', 'children': ['59', '65']}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'string', 'children': [], 'value': "'+'"}; {'id': '65', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '69', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '73', 'type': 'list', 'children': ['74'], 'value': '[[]]'}; {'id': '74', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '78', 'type': 'subscript', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '80', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'tokens'}; {'id': '84', 'type': 'call', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'formula_token_matcher_rational'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'findall'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '90', 'type': 'if_statement', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'check'}; {'id': '92', 'type': 'block', 'children': ['93', '111', '125']}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'token_letters'}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'list_comprehension', 'children': ['100', '101', '104', '107']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '101', 'type': 'for_in_clause', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'tokens'}; {'id': '104', 'type': 'for_in_clause', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '107', 'type': 'if_clause', 'children': ['108']}; {'id': '108', 'type': 'comparison_operator', 'children': ['109', '110'], 'value': 'in'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'letter_set'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'formula_letters'}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '116', 'type': 'generator_expression', 'children': ['117', '118', '121']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '118', 'type': 'for_in_clause', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'formula'}; {'id': '121', 'type': 'if_clause', 'children': ['122']}; {'id': '122', 'type': 'comparison_operator', 'children': ['123', '124'], 'value': 'in'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'letter_set'}; {'id': '125', 'type': 'if_statement', 'children': ['126', '129']}; {'id': '126', 'type': 'comparison_operator', 'children': ['127', '128'], 'value': '!='}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'formula_letters'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'token_letters'}; {'id': '129', 'type': 'block', 'children': ['130']}; {'id': '130', 'type': 'raise_statement', 'children': ['131']}; {'id': '131', 'type': 'call', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'string', 'children': [], 'value': "'Input may not be a formula; extra letters were detected'"}; {'id': '135', 'type': 'for_statement', 'children': ['136', '137', '138']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'tokens'}; {'id': '138', 'type': 'block', 'children': ['139']}; {'id': '139', 'type': 'if_statement', 'children': ['140', '143', '158', '224', '241']}; {'id': '140', 'type': 'comparison_operator', 'children': ['141', '142'], 'value': '=='}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '142', 'type': 'string', 'children': [], 'value': '"("'}; {'id': '143', 'type': 'block', 'children': ['144', '151']}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'call', 'children': ['146', '149']}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '149', 'type': 'argument_list', 'children': ['150']}; {'id': '150', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'assignment', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '154', 'type': 'subscript', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '156', 'type': 'unary_operator', 'children': ['157'], 'value': '-'}; {'id': '157', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '158', 'type': 'elif_clause', 'children': ['159', '162']}; {'id': '159', 'type': 'comparison_operator', 'children': ['160', '161'], 'value': '=='}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '161', 'type': 'string', 'children': [], 'value': '")"'}; {'id': '162', 'type': 'block', 'children': ['163', '167', '204', '210', '217']}; {'id': '163', 'type': 'expression_statement', 'children': ['164']}; {'id': '164', 'type': 'assignment', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '166', 'type': 'dictionary', 'children': []}; {'id': '167', 'type': 'for_statement', 'children': ['168', '169', '170']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '170', 'type': 'block', 'children': ['171']}; {'id': '171', 'type': 'for_statement', 'children': ['172', '175', '180']}; {'id': '172', 'type': 'pattern_list', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '179', 'type': 'argument_list', 'children': []}; {'id': '180', 'type': 'block', 'children': ['181']}; {'id': '181', 'type': 'if_statement', 'children': ['182', '185', '196']}; {'id': '182', 'type': 'comparison_operator', 'children': ['183', '184'], 'value': 'in'}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '185', 'type': 'block', 'children': ['186']}; {'id': '186', 'type': 'expression_statement', 'children': ['187']}; {'id': '187', 'type': 'assignment', 'children': ['188', '191']}; {'id': '188', 'type': 'subscript', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '191', 'type': 'binary_operator', 'children': ['192', '195'], 'value': '+'}; {'id': '192', 'type': 'subscript', 'children': ['193', '194']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '196', 'type': 'else_clause', 'children': ['197']}; {'id': '197', 'type': 'block', 'children': ['198']}; {'id': '198', 'type': 'expression_statement', 'children': ['199']}; {'id': '199', 'type': 'assignment', 'children': ['200', '203']}; {'id': '200', 'type': 'subscript', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '204', 'type': 'expression_statement', 'children': ['205']}; {'id': '205', 'type': 'call', 'children': ['206', '209']}; {'id': '206', 'type': 'attribute', 'children': ['207', '208']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '209', 'type': 'argument_list', 'children': []}; {'id': '210', 'type': 'expression_statement', 'children': ['211']}; {'id': '211', 'type': 'assignment', 'children': ['212', '213']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '213', 'type': 'subscript', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '215', 'type': 'unary_operator', 'children': ['216'], 'value': '-'}; {'id': '216', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '217', 'type': 'expression_statement', 'children': ['218']}; {'id': '218', 'type': 'call', 'children': ['219', '222']}; {'id': '219', 'type': 'attribute', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '222', 'type': 'argument_list', 'children': ['223']}; {'id': '223', 'type': 'identifier', 'children': [], 'value': 'temp_dict'}; {'id': '224', 'type': 'elif_clause', 'children': ['225', '230']}; {'id': '225', 'type': 'call', 'children': ['226', '229']}; {'id': '226', 'type': 'attribute', 'children': ['227', '228']}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '228', 'type': 'identifier', 'children': [], 'value': 'isalpha'}; {'id': '229', 'type': 'argument_list', 'children': []}; {'id': '230', 'type': 'block', 'children': ['231']}; {'id': '231', 'type': 'expression_statement', 'children': ['232']}; {'id': '232', 'type': 'call', 'children': ['233', '236']}; {'id': '233', 'type': 'attribute', 'children': ['234', '235']}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '236', 'type': 'argument_list', 'children': ['237']}; {'id': '237', 'type': 'dictionary', 'children': ['238']}; {'id': '238', 'type': 'pair', 'children': ['239', '240']}; {'id': '239', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '240', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '241', 'type': 'else_clause', 'children': ['242']}; {'id': '242', 'type': 'block', 'children': ['243', '250', '257', '266']}; {'id': '243', 'type': 'expression_statement', 'children': ['244']}; {'id': '244', 'type': 'assignment', 'children': ['245', '246']}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '246', 'type': 'call', 'children': ['247', '248']}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '248', 'type': 'argument_list', 'children': ['249']}; {'id': '249', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '250', 'type': 'expression_statement', 'children': ['251']}; {'id': '251', 'type': 'assignment', 'children': ['252', '253']}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'v_int'}; {'id': '253', 'type': 'call', 'children': ['254', '255']}; {'id': '254', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '255', 'type': 'argument_list', 'children': ['256']}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '257', 'type': 'if_statement', 'children': ['258', '261']}; {'id': '258', 'type': 'comparison_operator', 'children': ['259', '260'], 'value': '=='}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'v_int'}; {'id': '260', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '261', 'type': 'block', 'children': ['262']}; {'id': '262', 'type': 'expression_statement', 'children': ['263']}; {'id': '263', 'type': 'assignment', 'children': ['264', '265']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'v_int'}; {'id': '266', 'type': 'expression_statement', 'children': ['267']}; {'id': '267', 'type': 'assignment', 'children': ['268', '272']}; {'id': '268', 'type': 'subscript', 'children': ['269', '270']}; {'id': '269', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '270', 'type': 'unary_operator', 'children': ['271'], 'value': '-'}; {'id': '271', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '272', 'type': 'dictionary_comprehension', 'children': ['273', '278']}; {'id': '273', 'type': 'pair', 'children': ['274', '275']}; {'id': '274', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '275', 'type': 'binary_operator', 'children': ['276', '277'], 'value': '*'}; {'id': '276', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '277', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '278', 'type': 'for_in_clause', 'children': ['279', '282']}; {'id': '279', 'type': 'pattern_list', 'children': ['280', '281']}; {'id': '280', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '281', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '282', 'type': 'call', 'children': ['283', '289']}; {'id': '283', 'type': 'attribute', 'children': ['284', '288']}; {'id': '284', 'type': 'subscript', 'children': ['285', '286']}; {'id': '285', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '286', 'type': 'unary_operator', 'children': ['287'], 'value': '-'}; {'id': '287', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '288', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '289', 'type': 'argument_list', 'children': []}; {'id': '290', 'type': 'expression_statement', 'children': ['291']}; {'id': '291', 'type': 'assignment', 'children': ['292', '293']}; {'id': '292', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '293', 'type': 'dictionary', 'children': []}; {'id': '294', 'type': 'for_statement', 'children': ['295', '296', '297']}; {'id': '295', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '296', 'type': 'identifier', 'children': [], 'value': 'last'}; {'id': '297', 'type': 'block', 'children': ['298']}; {'id': '298', 'type': 'for_statement', 'children': ['299', '302', '307']}; {'id': '299', 'type': 'pattern_list', 'children': ['300', '301']}; {'id': '300', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '301', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '302', 'type': 'call', 'children': ['303', '306']}; {'id': '303', 'type': 'attribute', 'children': ['304', '305']}; {'id': '304', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '305', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '306', 'type': 'argument_list', 'children': []}; {'id': '307', 'type': 'block', 'children': ['308']}; {'id': '308', 'type': 'if_statement', 'children': ['309', '312', '323']}; {'id': '309', 'type': 'comparison_operator', 'children': ['310', '311'], 'value': 'in'}; {'id': '310', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '311', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '312', 'type': 'block', 'children': ['313']}; {'id': '313', 'type': 'expression_statement', 'children': ['314']}; {'id': '314', 'type': 'assignment', 'children': ['315', '318']}; {'id': '315', 'type': 'subscript', 'children': ['316', '317']}; {'id': '316', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '317', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '318', 'type': 'binary_operator', 'children': ['319', '322'], 'value': '+'}; {'id': '319', 'type': 'subscript', 'children': ['320', '321']}; {'id': '320', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '321', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '322', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '323', 'type': 'else_clause', 'children': ['324']}; {'id': '324', 'type': 'block', 'children': ['325']}; {'id': '325', 'type': 'expression_statement', 'children': ['326']}; {'id': '326', 'type': 'assignment', 'children': ['327', '330']}; {'id': '327', 'type': 'subscript', 'children': ['328', '329']}; {'id': '328', 'type': 'identifier', 'children': [], 'value': 'ans'}; {'id': '329', 'type': 'identifier', 'children': [], 'value': 'ele'}; {'id': '330', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '331', 'type': 'return_statement', 'children': ['332']}; {'id': '332', 'type': 'identifier', 'children': [], 'value': 'ans'}
r'''Improved formula parser which handles braces and their multipliers, as well as rational element counts. Strips charges from the end of a formula first. Accepts repeated chemical units. Performs no sanity checking that elements are actually elements. As it uses regular expressions for matching, errors are mostly just ignored. Parameters ---------- formula : str Formula string, very simply formats only. check : bool If `check` is True, a simple check will be performed to determine if a formula is not a formula and an exception will be raised if it is not, [-] Returns ------- atoms : dict dictionary of counts of individual atoms, indexed by symbol with proper capitalization, [-] Notes ----- Inspired by the approach taken by CrazyMerlyn on a reddit DailyProgrammer challenge, at https://www.reddit.com/r/dailyprogrammer/comments/6eerfk/20170531_challenge_317_intermediate_counting/ Examples -------- >>> pprint(nested_formula_parser('Pd(NH3)4.0001+2')) {'H': 12.0003, 'N': 4.0001, 'Pd': 1}
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'textpath'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '6', 'type': 'block', 'children': ['7', '119']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '16']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '15'], 'value': '=='}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_textpaths'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '16', 'type': 'block', 'children': ['17', '31', '39', '74', '92', '108']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '24']}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_ctx'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'font'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'font'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'fontsize'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '34', 'type': 'subscript', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '48']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '47'], 'value': '>'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'augmented_assignment', 'children': ['51', '52'], 'value': '+='}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '73'], 'value': '+'}; {'id': '53', 'type': 'binary_operator', 'children': ['54', '64'], 'value': '+'}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '63'], 'value': '+'}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '57'], 'value': '+'}; {'id': '56', 'type': 'string', 'children': [], 'value': '" ("'}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'binary_operator', 'children': ['61', '62'], 'value': '+'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'string', 'children': [], 'value': '"/"'}; {'id': '64', 'type': 'call', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '73', 'type': 'string', 'children': [], 'value': '")"'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '77', 'type': 'call', 'children': ['78', '83']}; {'id': '78', 'type': 'attribute', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': '_ctx'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'textpath'}; {'id': '83', 'type': 'argument_list', 'children': ['84', '85', '86', '87']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '85', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '86', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': '_w'}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '95', 'type': 'call', 'children': ['96', '101']}; {'id': '96', 'type': 'attribute', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': '_ctx'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'textheight'}; {'id': '101', 'type': 'argument_list', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '103', 'type': 'keyword_argument', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': '_w'}; {'id': '108', 'type': 'expression_statement', 'children': ['109']}; {'id': '109', 'type': 'call', 'children': ['110', '115']}; {'id': '110', 'type': 'attribute', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': '_textpaths'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '115', 'type': 'argument_list', 'children': ['116']}; {'id': '116', 'type': 'tuple', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '119', 'type': 'return_statement', 'children': ['120']}; {'id': '120', 'type': 'subscript', 'children': ['121', '124']}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': '_textpaths'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'i'}
Returns a cached textpath of the given text in queue.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_identities'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '21', '41']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '13', 'type': 'call', 'children': ['14', '19']}; {'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': 'xpath_ctxt'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'xpathEval'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': '"d:identity"'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': 'is not'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '24', 'type': 'None', 'children': []}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'for_statement', 'children': ['27', '28', '29']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'DiscoIdentity'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'ret'}
List the identity objects contained in `self`. :return: the list of identities. :returntype: `list` of `DiscoIdentity`
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '46']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tilemap'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '18', '21', '32', '35', '38', '41', '44']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '8', 'type': 'dictionary', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'bbox'}; {'id': '11', 'type': 'list', 'children': ['12', '14', '16', '17'], 'value': '[-180,-90,180,90]'}; {'id': '12', 'type': 'unary_operator', 'children': ['13'], 'value': '-'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '180'}; {'id': '14', 'type': 'unary_operator', 'children': ['15'], 'value': '-'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '90'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '180'}; {'id': '17', 'type': 'integer', 'children': [], 'value': '90'}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'zoom'}; {'id': '20', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'api_key'}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'string', 'children': [], 'value': "'MAPBOX_API_KEY'"}; {'id': '31', 'type': 'None', 'children': []}; {'id': '32', 'type': 'default_parameter', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '34', 'type': 'None', 'children': []}; {'id': '35', 'type': 'default_parameter', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'image_bounds'}; {'id': '37', 'type': 'None', 'children': []}; {'id': '38', 'type': 'default_parameter', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '40', 'type': 'string', 'children': [], 'value': '"vector-user-provided"'}; {'id': '41', 'type': 'default_parameter', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '43', 'type': 'string', 'children': [], 'value': '"GBDX_Task_Output"'}; {'id': '44', 'type': 'dictionary_splat_pattern', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '46', 'type': 'block', 'children': ['47', '63', '68', '78', '91', '107', '119', '123', '133', '150', '169', '184', '194', '245']}; {'id': '47', 'type': 'try_statement', 'children': ['48', '55']}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'import_from_statement', 'children': ['50', '53']}; {'id': '50', 'type': 'dotted_name', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'IPython'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'display'}; {'id': '53', 'type': 'dotted_name', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'display'}; {'id': '55', 'type': 'except_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57', '62']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'string', 'children': [], 'value': '"IPython is required to produce maps."'}; {'id': '62', 'type': 'return_statement', 'children': []}; {'id': '63', 'type': 'assert_statement', 'children': ['64', '67']}; {'id': '64', 'type': 'comparison_operator', 'children': ['65', '66'], 'value': 'is not'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'api_key'}; {'id': '66', 'type': 'None', 'children': []}; {'id': '67', 'type': 'string', 'children': [], 'value': '"No Mapbox API Key found. You can either pass in a token or set the MAPBOX_API_KEY environment variable."'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'wkt'}; {'id': '71', 'type': 'attribute', 'children': ['72', '77']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'box'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'list_splat', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'bbox'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'wkt'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'features'}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '85', 'type': 'argument_list', 'children': ['86', '87', '88']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'wkt'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '88', 'type': 'keyword_argument', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'union'}; {'id': '94', 'type': 'call', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'cascaded_union'}; {'id': '96', 'type': 'argument_list', 'children': ['97']}; {'id': '97', 'type': 'list_comprehension', 'children': ['98', '104']}; {'id': '98', 'type': 'call', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'subscript', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '103', 'type': 'string', 'children': [], 'value': "'geometry'"}; {'id': '104', 'type': 'for_in_clause', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'features'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '112']}; {'id': '109', 'type': 'pattern_list', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'lon'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'lat'}; {'id': '112', 'type': 'subscript', 'children': ['113', '118']}; {'id': '113', 'type': 'attribute', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'union'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'centroid'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'coords'}; {'id': '118', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '122', 'type': 'string', 'children': [], 'value': "'https://vector.geobigdata.io/insight-vector/api/mvt/{z}/{x}/{y}?'"}; {'id': '123', 'type': 'expression_statement', 'children': ['124']}; {'id': '124', 'type': 'augmented_assignment', 'children': ['125', '126'], 'value': '+='}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '126', 'type': 'call', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'string', 'children': [], 'value': "'q={}&index={}'"}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '130', 'type': 'argument_list', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '133', 'type': 'if_statement', 'children': ['134', '144']}; {'id': '134', 'type': 'boolean_operator', 'children': ['135', '138'], 'value': 'and'}; {'id': '135', 'type': 'comparison_operator', 'children': ['136', '137'], 'value': 'is not'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '137', 'type': 'None', 'children': []}; {'id': '138', 'type': 'not_operator', 'children': ['139']}; {'id': '139', 'type': 'call', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '141', 'type': 'argument_list', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '144', 'type': 'block', 'children': ['145']}; {'id': '145', 'type': 'expression_statement', 'children': ['146']}; {'id': '146', 'type': 'assignment', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '148', 'type': 'list', 'children': ['149'], 'value': '[styles]'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'assignment', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'map_id'}; {'id': '153', 'type': 'call', 'children': ['154', '157']}; {'id': '154', 'type': 'attribute', 'children': ['155', '156']}; {'id': '155', 'type': 'string', 'children': [], 'value': '"map_{}"'}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '157', 'type': 'argument_list', 'children': ['158']}; {'id': '158', 'type': 'call', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '160', 'type': 'argument_list', 'children': ['161']}; {'id': '161', 'type': 'call', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '168', 'type': 'argument_list', 'children': []}; {'id': '169', 'type': 'expression_statement', 'children': ['170']}; {'id': '170', 'type': 'assignment', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'map_data'}; {'id': '172', 'type': 'call', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'VectorTileLayer'}; {'id': '174', 'type': 'argument_list', 'children': ['175', '176', '179', '182']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '176', 'type': 'keyword_argument', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'source_name'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '179', 'type': 'keyword_argument', 'children': ['180', '181']}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'styles'}; {'id': '182', 'type': 'dictionary_splat', 'children': ['183']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '184', 'type': 'expression_statement', 'children': ['185']}; {'id': '185', 'type': 'assignment', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'image_layer'}; {'id': '187', 'type': 'call', 'children': ['188', '191']}; {'id': '188', 'type': 'attribute', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': '_build_image_layer'}; {'id': '191', 'type': 'argument_list', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'image_bounds'}; {'id': '194', 'type': 'expression_statement', 'children': ['195']}; {'id': '195', 'type': 'assignment', 'children': ['196', '197']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '197', 'type': 'call', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'BaseTemplate'}; {'id': '199', 'type': 'argument_list', 'children': ['200', '201']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'map_id'}; {'id': '201', 'type': 'dictionary_splat', 'children': ['202']}; {'id': '202', 'type': 'dictionary', 'children': ['203', '206', '209', '212', '222', '232', '235', '238']}; {'id': '203', 'type': 'pair', 'children': ['204', '205']}; {'id': '204', 'type': 'string', 'children': [], 'value': '"lat"'}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'lat'}; {'id': '206', 'type': 'pair', 'children': ['207', '208']}; {'id': '207', 'type': 'string', 'children': [], 'value': '"lon"'}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'lon'}; {'id': '209', 'type': 'pair', 'children': ['210', '211']}; {'id': '210', 'type': 'string', 'children': [], 'value': '"zoom"'}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'zoom'}; {'id': '212', 'type': 'pair', 'children': ['213', '214']}; {'id': '213', 'type': 'string', 'children': [], 'value': '"datasource"'}; {'id': '214', 'type': 'call', 'children': ['215', '218']}; {'id': '215', 'type': 'attribute', 'children': ['216', '217']}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '218', 'type': 'argument_list', 'children': ['219']}; {'id': '219', 'type': 'attribute', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'map_data'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'datasource'}; {'id': '222', 'type': 'pair', 'children': ['223', '224']}; {'id': '223', 'type': 'string', 'children': [], 'value': '"layers"'}; {'id': '224', 'type': 'call', 'children': ['225', '228']}; {'id': '225', 'type': 'attribute', 'children': ['226', '227']}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '228', 'type': 'argument_list', 'children': ['229']}; {'id': '229', 'type': 'attribute', 'children': ['230', '231']}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'map_data'}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '232', 'type': 'pair', 'children': ['233', '234']}; {'id': '233', 'type': 'string', 'children': [], 'value': '"image_layer"'}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'image_layer'}; {'id': '235', 'type': 'pair', 'children': ['236', '237']}; {'id': '236', 'type': 'string', 'children': [], 'value': '"mbkey"'}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'api_key'}; {'id': '238', 'type': 'pair', 'children': ['239', '240']}; {'id': '239', 'type': 'string', 'children': [], 'value': '"token"'}; {'id': '240', 'type': 'attribute', 'children': ['241', '244']}; {'id': '241', 'type': 'attribute', 'children': ['242', '243']}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'gbdx_connection'}; {'id': '244', 'type': 'identifier', 'children': [], 'value': 'access_token'}; {'id': '245', 'type': 'expression_statement', 'children': ['246']}; {'id': '246', 'type': 'call', 'children': ['247', '250']}; {'id': '247', 'type': 'attribute', 'children': ['248', '249']}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '249', 'type': 'identifier', 'children': [], 'value': 'inject'}; {'id': '250', 'type': 'argument_list', 'children': []}
Renders a mapbox gl map from a vector service query
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'min'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'constraints'}; {'id': '6', 'type': 'typed_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '8', 'type': 'type', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'BitVec'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'M'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '10000'}; {'id': '13', 'type': 'block', 'children': ['14', '20']}; {'id': '14', 'type': 'assert_statement', 'children': ['15']}; {'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': 'X'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'BitVec'}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'optimize'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27', '28', '29']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'constraints'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'minimize'"}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'M'}
Iteratively finds the minimum value for a symbol within given constraints. :param constraints: constraints that the expression must fulfil :param X: a symbol or expression :param M: maximum number of iterations allowed
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_graph_from_data'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '8', 'type': 'block', 'children': ['9', '26', '40']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '16']}; {'id': '11', 'type': 'subscript', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'arguments'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'{VERBOSE}'"}; {'id': '16', 'type': 'call', 'children': ['17', '25']}; {'id': '17', 'type': 'attribute', 'children': ['18', '24']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'upper'}; {'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': 'results'}; {'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': '_run_ccdr'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'nx'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'relabel_nodes'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '52']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'nx'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'DiGraph'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '52', 'type': 'dictionary_comprehension', 'children': ['53', '56']}; {'id': '53', 'type': 'pair', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '56', 'type': 'for_in_clause', 'children': ['57', '60']}; {'id': '57', 'type': 'pattern_list', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'columns'}
Apply causal discovery on observational data using CCDr. Args: data (pandas.DataFrame): DataFrame containing the data Returns: networkx.DiGraph: Solution given by the CCDR algorithm.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'SetWindowText'}; {'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': 'text'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'type', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '11', 'type': 'block', 'children': ['12', '18', '27']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'NativeWindowHandle'}; {'id': '18', 'type': 'if_statement', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'SetWindowText'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'False', 'children': []}
Call native SetWindowText if control has a valid native handle.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_poll_read'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'expected'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'timeout_s'}; {'id': '8', 'type': 'float', 'children': [], 'value': '5.0'}; {'id': '9', 'type': 'block', 'children': ['10', '18', '25', '29', '107']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'bytearray'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'expected'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '29', 'type': 'while_statement', 'children': ['30', '39']}; {'id': '30', 'type': 'comparison_operator', 'children': ['31', '38'], 'value': '<='}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '37'], 'value': '-'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'timeout_s'}; {'id': '39', 'type': 'block', 'children': ['40', '56', '71', '86', '90', '100']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '45']}; {'id': '42', 'type': 'pattern_list', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ftdi'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'read_data'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': '_ctx'}; {'id': '53', 'type': 'binary_operator', 'children': ['54', '55'], 'value': '-'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'expected'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '56', 'type': 'if_statement', 'children': ['57', '60']}; {'id': '57', 'type': 'comparison_operator', 'children': ['58', '59'], 'value': '<'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '59', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'raise_statement', 'children': ['62']}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'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': "'ftdi_read_data failed with error code {0}.'"}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '81']}; {'id': '73', 'type': 'subscript', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '75', 'type': 'slice', 'children': ['76', '77', '78']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '77', 'type': 'colon', 'children': []}; {'id': '78', 'type': 'binary_operator', 'children': ['79', '80'], 'value': '+'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '81', 'type': 'subscript', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '83', 'type': 'slice', 'children': ['84', '85']}; {'id': '84', 'type': 'colon', 'children': []}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'augmented_assignment', 'children': ['88', '89'], 'value': '+='}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '90', 'type': 'if_statement', 'children': ['91', '94']}; {'id': '91', 'type': 'comparison_operator', 'children': ['92', '93'], 'value': '>='}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'expected'}; {'id': '94', 'type': 'block', 'children': ['95']}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'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': 'sleep'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'float', 'children': [], 'value': '0.01'}; {'id': '107', 'type': 'raise_statement', 'children': ['108']}; {'id': '108', 'type': 'call', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '110', 'type': 'argument_list', 'children': ['111']}; {'id': '111', 'type': 'call', 'children': ['112', '115']}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'string', 'children': [], 'value': "'Timeout while polling ftdi_read_data for {0} bytes!'"}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '115', 'type': 'argument_list', 'children': ['116']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'expected'}
Helper function to continuously poll reads on the FTDI device until an expected number of bytes are returned. Will throw a timeout error if no data is received within the specified number of timeout seconds. Returns the read data as a string if successful, otherwise raises an execption.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_sg'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'sg'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'rule_id'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '9', 'type': 'block', 'children': ['10', '27', '33', '121']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'db_sg'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'db_api'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'security_group_find'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19', '22']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '19', 'type': 'keyword_argument', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'sg'}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'scope'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'db_api'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ONE'}; {'id': '27', 'type': 'if_statement', 'children': ['28', '30']}; {'id': '28', 'type': 'not_operator', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'db_sg'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'None', 'children': []}; {'id': '33', 'type': 'with_statement', 'children': ['34', '43']}; {'id': '34', 'type': 'with_clause', 'children': ['35']}; {'id': '35', 'type': 'with_item', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '42']}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'begin'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'block', 'children': ['44', '65', '74', '88', '94']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'job_body'}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '57', '60']}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '54'], 'value': '%'}; {'id': '53', 'type': 'string', 'children': [], 'value': '"%s sg rule %s"'}; {'id': '54', 'type': 'tuple', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'rule_id'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'resource_id'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'rule_id'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'tenant_id'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'db_sg'}; {'id': '64', 'type': 'string', 'children': [], 'value': "'tenant_id'"}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'job_body'}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'keyword_argument', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'job_body'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'job_api'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'create_job'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '87']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'elevated'}; {'id': '86', 'type': 'argument_list', 'children': []}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'job_body'}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'rpc_client'}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'QuarkSGAsyncProducerClient'}; {'id': '93', 'type': 'argument_list', 'children': []}; {'id': '94', 'type': 'try_statement', 'children': ['95', '107']}; {'id': '95', 'type': 'block', 'children': ['96']}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'call', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'rpc_client'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'populate_subtasks'}; {'id': '101', 'type': 'argument_list', 'children': ['102', '103', '104']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'sg'}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '106', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '107', 'type': 'except_clause', 'children': ['108', '111']}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'om_exc'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'MessagingTimeout'}; {'id': '111', 'type': 'block', 'children': ['112', '119']}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'LOG'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'string', 'children': [], 'value': '"Failed to create subtasks. Rabbit running?"'}; {'id': '119', 'type': 'return_statement', 'children': ['120']}; {'id': '120', 'type': 'None', 'children': []}; {'id': '121', 'type': 'return_statement', 'children': ['122']}; {'id': '122', 'type': 'dictionary', 'children': ['123']}; {'id': '123', 'type': 'pair', 'children': ['124', '125']}; {'id': '124', 'type': 'string', 'children': [], 'value': '"job_id"'}; {'id': '125', 'type': 'subscript', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '127', 'type': 'string', 'children': [], 'value': "'id'"}
Begins the async update process.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_doSave'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'isInsert'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '21', '32', '43']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '16']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '15'], 'value': 'is'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'newDict'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'asDict'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'forStorage'}; {'id': '31', 'type': 'True', 'children': []}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'key'}; {'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': '_get_key_for_id'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47', '141']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': 'is'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'isInsert'}; {'id': '46', 'type': 'True', 'children': []}; {'id': '47', 'type': 'block', 'children': ['48', '109', '119']}; {'id': '48', 'type': 'for_statement', 'children': ['49', '50', '53']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '53', 'type': 'block', 'children': ['54', '68', '77']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'fieldValue'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'newDict'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'getDefaultValue'}; {'id': '67', 'type': 'argument_list', 'children': []}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'hset'}; {'id': '73', 'type': 'argument_list', 'children': ['74', '75', '76']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'fieldValue'}; {'id': '77', 'type': 'if_statement', 'children': ['78', '81', '90']}; {'id': '78', 'type': 'comparison_operator', 'children': ['79', '80'], 'value': '=='}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'fieldValue'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'IR_NULL_STR'}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '89']}; {'id': '84', 'type': 'subscript', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': '_origData'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'irNull'}; {'id': '90', 'type': 'else_clause', 'children': ['91']}; {'id': '91', 'type': 'block', 'children': ['92']}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '99']}; {'id': '94', 'type': 'subscript', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': '_origData'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': '__getattribute__'}; {'id': '103', 'type': 'argument_list', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '105', 'type': 'call', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '109', 'type': 'expression_statement', 'children': ['110']}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': '_add_id_to_keys'}; {'id': '114', 'type': 'argument_list', 'children': ['115', '118']}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '119', 'type': 'for_statement', 'children': ['120', '121', '124']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'indexedField'}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'indexedFields'}; {'id': '124', 'type': 'block', 'children': ['125']}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'call', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': '_add_id_to_index'}; {'id': '130', 'type': 'argument_list', 'children': ['131', '132', '135', '140']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'indexedField'}; {'id': '132', 'type': 'attribute', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '135', 'type': 'subscript', 'children': ['136', '139']}; {'id': '136', 'type': 'attribute', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': '_origData'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'indexedField'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '141', 'type': 'else_clause', 'children': ['142']}; {'id': '142', 'type': 'block', 'children': ['143', '151']}; {'id': '143', 'type': 'expression_statement', 'children': ['144']}; {'id': '144', 'type': 'assignment', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'updatedFields'}; {'id': '146', 'type': 'call', 'children': ['147', '150']}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'getUpdatedFields'}; {'id': '150', 'type': 'argument_list', 'children': []}; {'id': '151', 'type': 'for_statement', 'children': ['152', '155', '160']}; {'id': '152', 'type': 'pattern_list', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'fieldValue'}; {'id': '155', 'type': 'call', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'updatedFields'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '159', 'type': 'argument_list', 'children': []}; {'id': '160', 'type': 'block', 'children': ['161', '167', '176', '185', '194', '225']}; {'id': '161', 'type': 'expression_statement', 'children': ['162']}; {'id': '162', 'type': 'assignment', 'children': ['163', '166']}; {'id': '163', 'type': 'tuple_pattern', 'children': ['164', '165']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'oldValue'}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'newValue'}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'fieldValue'}; {'id': '167', 'type': 'expression_statement', 'children': ['168']}; {'id': '168', 'type': 'assignment', 'children': ['169', '170']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'oldValueForStorage'}; {'id': '170', 'type': 'call', 'children': ['171', '174']}; {'id': '171', 'type': 'attribute', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'toStorage'}; {'id': '174', 'type': 'argument_list', 'children': ['175']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'oldValue'}; {'id': '176', 'type': 'expression_statement', 'children': ['177']}; {'id': '177', 'type': 'assignment', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'newValueForStorage'}; {'id': '179', 'type': 'call', 'children': ['180', '183']}; {'id': '180', 'type': 'attribute', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'toStorage'}; {'id': '183', 'type': 'argument_list', 'children': ['184']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'newValue'}; {'id': '185', 'type': 'expression_statement', 'children': ['186']}; {'id': '186', 'type': 'call', 'children': ['187', '190']}; {'id': '187', 'type': 'attribute', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'hset'}; {'id': '190', 'type': 'argument_list', 'children': ['191', '192', '193']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'newValueForStorage'}; {'id': '194', 'type': 'if_statement', 'children': ['195', '200']}; {'id': '195', 'type': 'comparison_operator', 'children': ['196', '197'], 'value': 'in'}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '197', 'type': 'attribute', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'indexedFields'}; {'id': '200', 'type': 'block', 'children': ['201', '213']}; {'id': '201', 'type': 'expression_statement', 'children': ['202']}; {'id': '202', 'type': 'call', 'children': ['203', '206']}; {'id': '203', 'type': 'attribute', 'children': ['204', '205']}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '205', 'type': 'identifier', 'children': [], 'value': '_rem_id_from_index'}; {'id': '206', 'type': 'argument_list', 'children': ['207', '208', '211', '212']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '208', 'type': 'attribute', 'children': ['209', '210']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '210', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'oldValueForStorage'}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '213', 'type': 'expression_statement', 'children': ['214']}; {'id': '214', 'type': 'call', 'children': ['215', '218']}; {'id': '215', 'type': 'attribute', 'children': ['216', '217']}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '217', 'type': 'identifier', 'children': [], 'value': '_add_id_to_index'}; {'id': '218', 'type': 'argument_list', 'children': ['219', '220', '223', '224']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '220', 'type': 'attribute', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '223', 'type': 'identifier', 'children': [], 'value': 'newValueForStorage'}; {'id': '224', 'type': 'identifier', 'children': [], 'value': 'pipeline'}; {'id': '225', 'type': 'expression_statement', 'children': ['226']}; {'id': '226', 'type': 'assignment', 'children': ['227', '232']}; {'id': '227', 'type': 'subscript', 'children': ['228', '231']}; {'id': '228', 'type': 'attribute', 'children': ['229', '230']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '230', 'type': 'identifier', 'children': [], 'value': '_origData'}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'thisField'}; {'id': '232', 'type': 'identifier', 'children': [], 'value': 'newValue'}
_doSave - Internal function to save a single object. Don't call this directly. Use "save" instead. If a pipeline is provided, the operations (setting values, updating indexes, etc) will be queued into that pipeline. Otherwise, everything will be executed right away. @param obj - Object to save @param isInsert - Bool, if insert or update. Either way, obj._id is expected to be set. @param conn - Redis connection @param pipeline - Optional pipeline, if present the items will be queued onto it. Otherwise, go directly to conn.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_definite_clause'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '13']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'string', 'children': [], 'value': '"Return the antecedents and the consequent of a definite clause."'}; {'id': '8', 'type': 'assert_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'is_definite_clause'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '13', 'type': 'if_statement', 'children': ['14', '20', '25']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'is_symbol'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'expression_list', 'children': ['23', '24']}; {'id': '23', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '25', 'type': 'else_clause', 'children': ['26']}; {'id': '26', 'type': 'block', 'children': ['27', '35']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '32']}; {'id': '29', 'type': 'pattern_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'antecedent'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'consequent'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '35', 'type': 'return_statement', 'children': ['36']}; {'id': '36', 'type': 'expression_list', 'children': ['37', '41']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'conjuncts'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'antecedent'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'consequent'}
Return the antecedents and the consequent of a definite clause.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'data_cosine'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '6', 'type': 'integer', 'children': [], 'value': '1024'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'A'}; {'id': '9', 'type': 'float', 'children': [], 'value': '0.1'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'sampling'}; {'id': '12', 'type': 'float', 'children': [], 'value': '1024.'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'freq'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '200'}; {'id': '16', 'type': 'block', 'children': ['17', '19', '35', '57']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'arange'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26', '32']}; {'id': '25', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '26', 'type': 'binary_operator', 'children': ['27', '31'], 'value': '/'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'sampling'}; {'id': '32', 'type': 'binary_operator', 'children': ['33', '34'], 'value': '/'}; {'id': '33', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'sampling'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '49'], 'value': '+'}; {'id': '39', 'type': 'call', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'cos'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '48'], 'value': '*'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '47'], 'value': '*'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '46'], 'value': '*'}; {'id': '45', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'freq'}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '51'], 'value': '*'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'A'}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'randn'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'x'}
r"""Return a noisy cosine at a given frequency. :param N: the final data size :param A: the strength of the noise :param float sampling: sampling frequency of the input :attr:`data`. :param float freq: the frequency :math:`f_0` of the cosine. .. math:: x[t] = cos(2\pi t * f_0) + A w[t] where w[t] is a white noise of variance 1. .. doctest:: >>> from spectrum import data_cosine >>> a = data_cosine(N=1024, sampling=1024, A=0.5, freq=100)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tiles_to_affine_shape'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '23', '71']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '9']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'raise_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'string', 'children': [], 'value': '"no tiles provided"'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'pixel_size'}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '21', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'pixel_x_size'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '30']}; {'id': '25', 'type': 'pattern_list', 'children': ['26', '27', '28', '29']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'bottom'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '30', 'type': 'tuple', 'children': ['31', '41', '51', '61']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'list_comprehension', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '38', 'type': 'for_in_clause', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'list_comprehension', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'bottom'}; {'id': '48', 'type': 'for_in_clause', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'list_comprehension', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '58', 'type': 'for_in_clause', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'list_comprehension', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '68', 'type': 'for_in_clause', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'tiles'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'tuple', 'children': ['73', '83']}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'Affine'}; {'id': '75', 'type': 'argument_list', 'children': ['76', '77', '78', '79', '80', '82']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'pixel_size'}; {'id': '77', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '80', 'type': 'unary_operator', 'children': ['81'], 'value': '-'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'pixel_size'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'Shape'}; {'id': '85', 'type': 'argument_list', 'children': ['86', '101']}; {'id': '86', 'type': 'keyword_argument', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '88', 'type': 'call', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '93', 'type': 'argument_list', 'children': ['94', '100']}; {'id': '94', 'type': 'binary_operator', 'children': ['95', '99'], 'value': '/'}; {'id': '95', 'type': '()', 'children': ['96']}; {'id': '96', 'type': 'binary_operator', 'children': ['97', '98'], 'value': '-'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'right'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'left'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'pixel_size'}; {'id': '100', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '101', 'type': 'keyword_argument', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'height'}; {'id': '103', 'type': 'call', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'call', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '115']}; {'id': '109', 'type': 'binary_operator', 'children': ['110', '114'], 'value': '/'}; {'id': '110', 'type': '()', 'children': ['111']}; {'id': '111', 'type': 'binary_operator', 'children': ['112', '113'], 'value': '-'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'bottom'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'pixel_size'}; {'id': '115', 'type': 'integer', 'children': [], 'value': '0'}
Return Affine and shape of combined tiles. Parameters ---------- tiles : iterable an iterable containing BufferedTiles Returns ------- Affine, Shape
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'gain'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '5', 'type': 'block', 'children': ['6', '23', '45', '63', '81', '100']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'Ys'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'nan_to_num'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'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': 'swhlab'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ap'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'getAvgBySweep'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'freq'"}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'Xs'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'clampValues'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'subscript', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'dataX'}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '44'], 'value': '+'}; {'id': '39', 'type': 'subscript', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'protoSeqX'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '44', 'type': 'float', 'children': [], 'value': '.01'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'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': 'swhlab'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'plot'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'new'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54', '57', '60']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'abf'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '56', 'type': 'string', 'children': [], 'value': '"gain function"'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'xlabel'}; {'id': '59', 'type': 'string', 'children': [], 'value': '"command current (pA)"'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'ylabel'}; {'id': '62', 'type': 'string', 'children': [], 'value': '"average inst. freq. (Hz)"'}; {'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': 'pylab'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'plot'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70', '71', '72', '75', '78']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'Xs'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'Ys'}; {'id': '71', 'type': 'string', 'children': [], 'value': "'.-'"}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'ms'}; {'id': '74', 'type': 'integer', 'children': [], 'value': '20'}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '77', 'type': 'float', 'children': [], 'value': '.5'}; {'id': '78', 'type': 'keyword_argument', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '80', 'type': 'string', 'children': [], 'value': "'b'"}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'pylab'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'axhline'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88', '91', '94', '97']}; {'id': '87', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '88', 'type': 'keyword_argument', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '90', 'type': 'float', 'children': [], 'value': '.5'}; {'id': '91', 'type': 'keyword_argument', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'lw'}; {'id': '93', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '94', 'type': 'keyword_argument', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'color'}; {'id': '96', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '97', 'type': 'keyword_argument', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'ls'}; {'id': '99', 'type': 'string', 'children': [], 'value': '"--"'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'call', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'pylab'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'margins'}; {'id': '105', 'type': 'argument_list', 'children': ['106', '107']}; {'id': '106', 'type': 'float', 'children': [], 'value': '.1'}; {'id': '107', 'type': 'float', 'children': [], 'value': '.1'}
easy way to plot a gain function.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'privacy_policy'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'subscription_policy'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'default_parameter', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'is_managed'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21', '112']}; {'id': '21', 'type': 'with_statement', 'children': ['22', '31']}; {'id': '22', 'type': 'with_clause', 'children': ['23']}; {'id': '23', 'type': 'with_item', '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': 'db'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'begin_nested'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'block', 'children': ['32', '43', '54', '73', '92', '103']}; {'id': '32', 'type': 'if_statement', 'children': ['33', '36']}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '35'], 'value': 'is not'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '35', 'type': 'None', 'children': []}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': 'is not'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '46', 'type': 'None', 'children': []}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '66']}; {'id': '55', 'type': '()', 'children': ['56']}; {'id': '56', 'type': 'boolean_operator', 'children': ['57', '60'], 'value': 'and'}; {'id': '57', 'type': 'comparison_operator', 'children': ['58', '59'], 'value': 'is not'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'privacy_policy'}; {'id': '59', 'type': 'None', 'children': []}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'PrivacyPolicy'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'privacy_policy'}; {'id': '66', 'type': 'block', 'children': ['67']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'privacy_policy'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'privacy_policy'}; {'id': '73', 'type': 'if_statement', 'children': ['74', '85']}; {'id': '74', 'type': '()', 'children': ['75']}; {'id': '75', 'type': 'boolean_operator', 'children': ['76', '79'], 'value': 'and'}; {'id': '76', 'type': 'comparison_operator', 'children': ['77', '78'], 'value': 'is not'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'subscription_policy'}; {'id': '78', 'type': 'None', 'children': []}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'SubscriptionPolicy'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'subscription_policy'}; {'id': '85', 'type': 'block', 'children': ['86']}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'subscription_policy'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'subscription_policy'}; {'id': '92', 'type': 'if_statement', 'children': ['93', '96']}; {'id': '93', 'type': 'comparison_operator', 'children': ['94', '95'], 'value': 'is not'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'is_managed'}; {'id': '95', 'type': 'None', 'children': []}; {'id': '96', 'type': 'block', 'children': ['97']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '102']}; {'id': '99', 'type': 'attribute', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'is_managed'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'is_managed'}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'call', 'children': ['105', '110']}; {'id': '105', 'type': 'attribute', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'db'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'merge'}; {'id': '110', 'type': 'argument_list', 'children': ['111']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '112', 'type': 'return_statement', 'children': ['113']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'self'}
Update group. :param name: Name of group. :param description: Description of group. :param privacy_policy: PrivacyPolicy :param subscription_policy: SubscriptionPolicy :returns: Updated group
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'select'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '6', 'type': 'False', 'children': []}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'auto'}; {'id': '12', 'type': 'False', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'if_statement', 'children': ['15', '16', '132']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '16', 'type': 'block', 'children': ['17', '24', '28', '42', '46', '86']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '23', 'type': 'True', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'try_statement', 'children': ['29', '38']}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'Course'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'get_selected'}; {'id': '37', 'type': 'argument_list', 'children': []}; {'id': '38', 'type': 'except_clause', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'NoCourseSelected'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'pass_statement', 'children': []}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '45', 'type': 'dictionary', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '49', '69']}; {'id': '47', 'type': 'not_operator', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'Menu'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'launch'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59', '68']}; {'id': '58', 'type': 'string', 'children': [], 'value': '"Select a course"'}; {'id': '59', 'type': 'call', 'children': ['60', '67']}; {'id': '60', 'type': 'attribute', 'children': ['61', '66']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'Course'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '65', 'type': 'argument_list', 'children': []}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '67', 'type': 'argument_list', 'children': []}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '69', 'type': 'else_clause', 'children': ['70']}; {'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': 'ret'}; {'id': '75', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'Course'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'comparison_operator', 'children': ['82', '85'], 'value': '=='}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'Course'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '86', 'type': 'if_statement', 'children': ['87', '90', '124']}; {'id': '87', 'type': 'comparison_operator', 'children': ['88', '89'], 'value': 'in'}; {'id': '88', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '90', 'type': 'block', 'children': ['91', '99', '103', '119', '123']}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '98']}; {'id': '93', 'type': 'attribute', 'children': ['94', '97']}; {'id': '94', 'type': 'subscript', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '96', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'set_select'}; {'id': '98', 'type': 'argument_list', 'children': []}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'call', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '102', 'type': 'argument_list', 'children': []}; {'id': '103', 'type': 'if_statement', 'children': ['104', '111']}; {'id': '104', 'type': 'comparison_operator', 'children': ['105', '110'], 'value': '=='}; {'id': '105', 'type': 'attribute', 'children': ['106', '109']}; {'id': '106', 'type': 'subscript', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '108', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '110', 'type': 'string', 'children': [], 'value': '""'}; {'id': '111', 'type': 'block', 'children': ['112']}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'select_a_path'}; {'id': '115', 'type': 'argument_list', 'children': ['116']}; {'id': '116', 'type': 'keyword_argument', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'auto'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'auto'}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'call', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'skip'}; {'id': '122', 'type': 'argument_list', 'children': []}; {'id': '123', 'type': 'return_statement', 'children': []}; {'id': '124', 'type': 'else_clause', 'children': ['125']}; {'id': '125', 'type': 'block', 'children': ['126', '131']}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'call', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '129', 'type': 'argument_list', 'children': ['130']}; {'id': '130', 'type': 'string', 'children': [], 'value': '"You can select the course with `tmc select --course`"'}; {'id': '131', 'type': 'return_statement', 'children': []}; {'id': '132', 'type': 'else_clause', 'children': ['133']}; {'id': '133', 'type': 'block', 'children': ['134', '138', '152', '156', '190']}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'assignment', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'selected'}; {'id': '137', 'type': 'None', 'children': []}; {'id': '138', 'type': 'try_statement', 'children': ['139', '148']}; {'id': '139', 'type': 'block', 'children': ['140']}; {'id': '140', 'type': 'expression_statement', 'children': ['141']}; {'id': '141', 'type': 'assignment', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'selected'}; {'id': '143', 'type': 'call', 'children': ['144', '147']}; {'id': '144', 'type': 'attribute', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'Exercise'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'get_selected'}; {'id': '147', 'type': 'argument_list', 'children': []}; {'id': '148', 'type': 'except_clause', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'NoExerciseSelected'}; {'id': '150', 'type': 'block', 'children': ['151']}; {'id': '151', 'type': 'pass_statement', 'children': []}; {'id': '152', 'type': 'expression_statement', 'children': ['153']}; {'id': '153', 'type': 'assignment', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '155', 'type': 'dictionary', 'children': []}; {'id': '156', 'type': 'if_statement', 'children': ['157', '159', '177']}; {'id': '157', 'type': 'not_operator', 'children': ['158']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '159', 'type': 'block', 'children': ['160']}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'assignment', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '163', 'type': 'call', 'children': ['164', '167']}; {'id': '164', 'type': 'attribute', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'Menu'}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'launch'}; {'id': '167', 'type': 'argument_list', 'children': ['168', '169', '176']}; {'id': '168', 'type': 'string', 'children': [], 'value': '"Select an exercise"'}; {'id': '169', 'type': 'attribute', 'children': ['170', '175']}; {'id': '170', 'type': 'call', 'children': ['171', '174']}; {'id': '171', 'type': 'attribute', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'Course'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'get_selected'}; {'id': '174', 'type': 'argument_list', 'children': []}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'exercises'}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'selected'}; {'id': '177', 'type': 'else_clause', 'children': ['178']}; {'id': '178', 'type': 'block', 'children': ['179']}; {'id': '179', 'type': 'expression_statement', 'children': ['180']}; {'id': '180', 'type': 'assignment', 'children': ['181', '184']}; {'id': '181', 'type': 'subscript', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '183', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '184', 'type': 'call', 'children': ['185', '188']}; {'id': '185', 'type': 'attribute', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'Exercise'}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'byid'}; {'id': '188', 'type': 'argument_list', 'children': ['189']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '190', 'type': 'if_statement', 'children': ['191', '194']}; {'id': '191', 'type': 'comparison_operator', 'children': ['192', '193'], 'value': 'in'}; {'id': '192', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '194', 'type': 'block', 'children': ['195', '203']}; {'id': '195', 'type': 'expression_statement', 'children': ['196']}; {'id': '196', 'type': 'call', 'children': ['197', '202']}; {'id': '197', 'type': 'attribute', 'children': ['198', '201']}; {'id': '198', 'type': 'subscript', 'children': ['199', '200']}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '200', 'type': 'string', 'children': [], 'value': '"item"'}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'set_select'}; {'id': '202', 'type': 'argument_list', 'children': []}; {'id': '203', 'type': 'expression_statement', 'children': ['204']}; {'id': '204', 'type': 'call', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '206', 'type': 'argument_list', 'children': ['207']}; {'id': '207', 'type': 'call', 'children': ['208', '211']}; {'id': '208', 'type': 'attribute', 'children': ['209', '210']}; {'id': '209', 'type': 'string', 'children': [], 'value': '"Selected {}"'}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '211', 'type': 'argument_list', 'children': ['212']}; {'id': '212', 'type': 'subscript', 'children': ['213', '214']}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '214', 'type': 'string', 'children': [], 'value': '"item"'}
Select a course or an exercise.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'buildTagMap'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '5', 'type': 'list_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '63']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'built'}; {'id': '11', 'type': 'dictionary', 'children': []}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '15']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '22', '39', '55']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'items'"}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'for_statement', 'children': ['24', '27', '32']}; {'id': '24', 'type': 'pattern_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'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': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'built'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '39', 'type': 'elif_clause', 'children': ['40', '44']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'isList'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'for_statement', 'children': ['46', '47', '48']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '54']}; {'id': '51', 'type': 'subscript', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'built'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '62']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'built'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'portion'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'built'}
Turns a list of maps, lists, or scalars into a single map. Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and NESTING_RESET_TAGS maps out of lists and partial maps.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_data_sharing_consent'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer_uuid'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'program_uuid'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '23']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'EnterpriseCustomer'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'apps'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'get_model'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'enterprise'"}; {'id': '22', 'type': 'string', 'children': [], 'value': "'EnterpriseCustomer'"}; {'id': '23', 'type': 'try_statement', 'children': ['24', '42']}; {'id': '24', 'type': 'block', 'children': ['25', '35']}; {'id': '25', 'type': 'if_statement', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'get_course_data_sharing_consent'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33', '34']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer_uuid'}; {'id': '35', 'type': 'return_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'get_program_data_sharing_consent'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40', '41']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'program_uuid'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer_uuid'}; {'id': '42', 'type': 'except_clause', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'EnterpriseCustomer'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'DoesNotExist'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'return_statement', 'children': ['48']}; {'id': '48', 'type': 'None', 'children': []}
Get the data sharing consent object associated with a certain user, enterprise customer, and other scope. :param username: The user that grants consent :param enterprise_customer_uuid: The consent requester :param course_id (optional): A course ID to which consent may be related :param program_uuid (optional): A program to which consent may be related :return: The data sharing consent object, or None if the enterprise customer for the given UUID does not exist.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update_cache_stats'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12', '34']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'is'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '22']}; {'id': '15', 'type': 'attribute', 'children': ['16', '21']}; {'id': '16', 'type': 'subscript', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_CACHE_STATS'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'access_stats'"}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'setdefault'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '24', 'type': 'dictionary', 'children': ['25', '28', '31']}; {'id': '25', 'type': 'pair', 'children': ['26', '27']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'hit'"}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'pair', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'miss'"}; {'id': '30', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '31', 'type': 'pair', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': "'expired'"}; {'id': '33', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '34', 'type': 'else_clause', 'children': ['35']}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'augmented_assignment', 'children': ['38', '47'], 'value': '+='}; {'id': '38', 'type': 'subscript', 'children': ['39', '46']}; {'id': '39', 'type': 'subscript', 'children': ['40', '45']}; {'id': '40', 'type': 'subscript', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_CACHE_STATS'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'access_stats'"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '1'}
Update the cache stats. If no cache-result is specified, we iniitialize the key. Otherwise, we increment the correct cache-result. Note the behavior for expired. A client can be expired and the key still exists.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_DropCommonSuffixes'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '5', 'type': 'block', 'children': ['6', '105']}; {'id': '6', 'type': 'for_statement', 'children': ['7', '8', '59']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'itertools'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'chain'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '37']}; {'id': '13', 'type': 'generator_expression', 'children': ['14', '24']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '%'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'%s.%s'"}; {'id': '16', 'type': 'tuple', 'children': ['17', '23']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'test_suffix'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'lstrip'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'_'"}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '24', 'type': 'for_in_clause', 'children': ['25', '28']}; {'id': '25', 'type': 'pattern_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'test_suffix'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'itertools'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'product'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_test_suffixes'}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'GetNonHeaderExtensions'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'generator_expression', 'children': ['38', '43']}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '40'], 'value': '%'}; {'id': '39', 'type': 'string', 'children': [], 'value': "'%s.%s'"}; {'id': '40', 'type': 'tuple', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '43', 'type': 'for_in_clause', 'children': ['44', '47']}; {'id': '44', 'type': 'pattern_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'itertools'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'product'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '56']}; {'id': '52', 'type': 'list', 'children': ['53', '54', '55'], 'value': "['inl', 'imp', 'internal']"}; {'id': '53', 'type': 'string', 'children': [], 'value': "'inl'"}; {'id': '54', 'type': 'string', 'children': [], 'value': "'imp'"}; {'id': '55', 'type': 'string', 'children': [], 'value': "'internal'"}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'GetHeaderExtensions'}; {'id': '58', 'type': 'argument_list', 'children': []}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'if_statement', 'children': ['61', '92']}; {'id': '61', 'type': '()', 'children': ['62']}; {'id': '62', 'type': 'boolean_operator', 'children': ['63', '79'], 'value': 'and'}; {'id': '63', 'type': 'boolean_operator', 'children': ['64', '70'], 'value': 'and'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '70', 'type': 'comparison_operator', 'children': ['71', '75'], 'value': '>'}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '89'], 'value': 'in'}; {'id': '80', 'type': 'subscript', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '82', 'type': 'binary_operator', 'children': ['83', '88'], 'value': '-'}; {'id': '83', 'type': 'unary_operator', 'children': ['84'], 'value': '-'}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '88', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '89', 'type': 'tuple', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '91', 'type': 'string', 'children': [], 'value': "'_'"}; {'id': '92', 'type': 'block', 'children': ['93']}; {'id': '93', 'type': 'return_statement', 'children': ['94']}; {'id': '94', 'type': 'subscript', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '96', 'type': 'slice', 'children': ['97', '98']}; {'id': '97', 'type': 'colon', 'children': []}; {'id': '98', 'type': 'binary_operator', 'children': ['99', '104'], 'value': '-'}; {'id': '99', 'type': 'unary_operator', 'children': ['100'], 'value': '-'}; {'id': '100', 'type': 'call', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '102', 'type': 'argument_list', 'children': ['103']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '104', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '105', 'type': 'return_statement', 'children': ['106']}; {'id': '106', 'type': 'subscript', 'children': ['107', '115']}; {'id': '107', 'type': 'call', 'children': ['108', '113']}; {'id': '108', 'type': 'attribute', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'splitext'}; {'id': '113', 'type': 'argument_list', 'children': ['114']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '115', 'type': 'integer', 'children': [], 'value': '0'}
Drops common suffixes like _test.cc or -inl.h from filename. For example: >>> _DropCommonSuffixes('foo/foo-inl.h') 'foo/foo' >>> _DropCommonSuffixes('foo/bar/foo.cc') 'foo/bar/foo' >>> _DropCommonSuffixes('foo/foo_internal.h') 'foo/foo' >>> _DropCommonSuffixes('foo/foo_unusualinternal.h') 'foo/foo_unusualinternal' Args: filename: The input filename. Returns: The filename with the common suffix removed.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'style_string'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ansi_style'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'colormode'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'nested'}; {'id': '9', 'type': 'False', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '17', '36', '51']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '16']}; {'id': '13', 'type': 'pattern_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ansi_start_code'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ansi_end_code'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ansi_style'}; {'id': '17', 'type': 'if_statement', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'PY2'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'if_statement', 'children': ['21', '26']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_ENCODING'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '39', 'type': 'call', 'children': ['40', '46']}; {'id': '40', 'type': 'attribute', 'children': ['41', '45']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'UNICODE'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'ansi'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'NEST_PLACEHOLDER'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'ansi_start_code'}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'{start_code}{string}{end_code}{nest_ph}'"}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '56', 'type': 'argument_list', 'children': ['57', '60', '63', '66']}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'start_code'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ansi_start_code'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'end_code'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'ansi_end_code'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'nest_ph'}; {'id': '68', 'type': 'conditional_expression', 'children': ['69', '72', '73'], 'value': 'if'}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'ansi'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'NEST_PLACEHOLDER'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'nested'}; {'id': '73', 'type': 'string', 'children': [], 'value': "''"}
Style the given string according to the given ANSI style string. :param str string: the string to style :param tuple ansi_style: the styling string returned by ``translate_style`` :param int colormode: the color mode to use. See ``translate_rgb_to_ansi_code`` :returns: a string containing proper ANSI sequence
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_build_path'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'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': 'block', 'children': ['8']}; {'id': '8', 'type': 'return_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'chain'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '21']}; {'id': '17', 'type': 'tuple', 'children': ['18']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'args'}
Build path with endpoint and args :param args: Tokens in the endpoint URL :type args: :py:class:`unicode`
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '35', '46', '57', '66']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'osf'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_setup_osf'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '13', 'type': 'if_statement', 'children': ['14', '25']}; {'id': '14', 'type': 'boolean_operator', 'children': ['15', '20'], 'value': 'or'}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '19'], 'value': 'is'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'osf'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '24'], 'value': 'is'}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'osf'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'password'}; {'id': '24', 'type': 'None', 'children': []}; {'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': 'sys'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'concatenated_string', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'To remove a file you need to provide a username and'"}; {'id': '34', 'type': 'string', 'children': [], 'value': "' password.'"}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'osf'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '51']}; {'id': '48', 'type': 'pattern_list', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'remote_path'}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'split_storage'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '66', 'type': 'for_statement', 'children': ['67', '68', '71']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '71', 'type': 'block', 'children': ['72']}; {'id': '72', 'type': 'if_statement', 'children': ['73', '81']}; {'id': '73', 'type': 'comparison_operator', 'children': ['74', '80'], 'value': '=='}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'norm_remote_path'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'remote_path'}; {'id': '81', 'type': 'block', 'children': ['82']}; {'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': 'f'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '87', 'type': 'argument_list', 'children': []}
Remove a file from the project's storage. The first part of the remote path is interpreted as the name of the storage provider. If there is no match the default (osfstorage) is used.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_md5sum'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'src_file'}; {'id': '5', 'type': 'block', 'children': ['6', '57']}; {'id': '6', 'type': 'with_statement', 'children': ['7', '17']}; {'id': '7', 'type': 'with_clause', 'children': ['8']}; {'id': '8', 'type': 'with_item', 'children': ['9']}; {'id': '9', 'type': 'as_pattern', 'children': ['10', '15']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'src_file'}; {'id': '14', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '15', 'type': 'as_pattern_target', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'src_data'}; {'id': '17', 'type': 'block', 'children': ['18', '26', '44']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'src_content'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'src_data'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'if_statement', 'children': ['27', '34']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '33'], 'value': '=='}; {'id': '28', 'type': 'subscript', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'version_info'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '3'}; {'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': 'src_content'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'src_content'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'src_md5'}; {'id': '47', 'type': 'call', 'children': ['48', '56']}; {'id': '48', 'type': 'attribute', 'children': ['49', '55']}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'hashlib'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'md5'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'src_content'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'hexdigest'}; {'id': '56', 'type': 'argument_list', 'children': []}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'src_md5'}
Returns md5sum of file
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'image_urls'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '33']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'all_image_urls'}; {'id': '9', 'type': 'subscript', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'finder_image_urls'}; {'id': '13', 'type': 'slice', 'children': ['14']}; {'id': '14', 'type': 'colon', 'children': []}; {'id': '15', 'type': 'for_statement', 'children': ['16', '17', '20']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'image_url'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'extender_image_urls'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': 'not in'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'image_url'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'all_image_urls'}; {'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': 'all_image_urls'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'image_url'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'all_image_urls'}
Combine finder_image_urls and extender_image_urls, remove duplicate but keep order
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_shas_to_shastore'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sha_dict'}; {'id': '5', 'type': 'block', 'children': ['6', '27']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '14', '19']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '13'], 'value': '<'}; {'id': '8', 'type': 'subscript', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'version_info'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'fn_open'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '19', 'type': 'else_clause', 'children': ['20']}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'fn_open'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'io'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '27', 'type': 'with_statement', 'children': ['28', '38']}; {'id': '28', 'type': 'with_clause', 'children': ['29']}; {'id': '29', 'type': 'with_item', 'children': ['30']}; {'id': '30', 'type': 'as_pattern', 'children': ['31', '36']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'fn_open'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'string', 'children': [], 'value': '".shastore"'}; {'id': '35', 'type': 'string', 'children': [], 'value': '"w"'}; {'id': '36', 'type': 'as_pattern_target', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'fh'}; {'id': '38', 'type': 'block', 'children': ['39', '46', '60', '75']}; {'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': 'fh'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'string', 'children': [], 'value': '"---\\n"'}; {'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': 'fh'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'sake version: {}\\n'"}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'VERSION'}; {'id': '60', 'type': 'if_statement', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'sha_dict'}; {'id': '62', 'type': 'block', 'children': ['63']}; {'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': 'fh'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'write'}; {'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': 'yaml'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'dump'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'sha_dict'}; {'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': 'fh'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'string', 'children': [], 'value': '"..."'}
Writes a sha1 dictionary stored in memory to the .shastore file
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '34']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'predict_proba'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19', '22', '25', '28', '31']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'nb_runs'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'nb_jobs'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'default_parameter', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '19', 'type': 'default_parameter', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '21', 'type': 'None', 'children': []}; {'id': '22', 'type': 'default_parameter', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ttest_threshold'}; {'id': '24', 'type': 'float', 'children': [], 'value': '0.01'}; {'id': '25', 'type': 'default_parameter', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'nb_max_runs'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '28', 'type': 'default_parameter', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'train_epochs'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '1000'}; {'id': '31', 'type': 'default_parameter', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'test_epochs'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '1000'}; {'id': '34', 'type': 'block', 'children': ['35', '55', '75', '90', '94', '98', '235', '253', '262', '271']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '41']}; {'id': '37', 'type': 'pattern_list', 'children': ['38', '39', '40']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'Nb_jobs'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'SETTINGS'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'get_default'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '49', '52']}; {'id': '46', 'type': 'tuple', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'nb_jobs'"}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'nb_jobs'}; {'id': '49', 'type': 'tuple', 'children': ['50', '51']}; {'id': '50', 'type': 'string', 'children': [], 'value': "'verbose'"}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '52', 'type': 'tuple', 'children': ['53', '54']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'gpu'"}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '58', 'type': 'call', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '74']}; {'id': '63', 'type': 'list', 'children': ['64', '69'], 'value': '[a.ravel(), b.ravel()]'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'ravel'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'ravel'}; {'id': '73', 'type': 'argument_list', 'children': []}; {'id': '74', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'TTestCriterion'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '84', '87']}; {'id': '81', 'type': 'keyword_argument', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'max_iter'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'nb_max_runs'}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'runs_per_iter'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'nb_runs'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'threshold'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'ttest_threshold'}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'assignment', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'AB'}; {'id': '93', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'BA'}; {'id': '97', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '98', 'type': 'while_statement', 'children': ['99', '106']}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'loop'}; {'id': '103', 'type': 'argument_list', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'AB'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'BA'}; {'id': '106', 'type': 'block', 'children': ['107', '209', '222']}; {'id': '107', 'type': 'if_statement', 'children': ['108', '111', '168']}; {'id': '108', 'type': 'comparison_operator', 'children': ['109', '110'], 'value': '!='}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'nb_jobs'}; {'id': '110', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '111', 'type': 'block', 'children': ['112']}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'assignment', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'result_pair'}; {'id': '115', 'type': 'call', 'children': ['116', '122']}; {'id': '116', 'type': 'call', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'Parallel'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'keyword_argument', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'n_jobs'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'nb_jobs'}; {'id': '122', 'type': 'generator_expression', 'children': ['123', '155']}; {'id': '123', 'type': 'call', 'children': ['124', '128']}; {'id': '124', 'type': 'call', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'delayed'}; {'id': '126', 'type': 'argument_list', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'GNN_instance'}; {'id': '128', 'type': 'argument_list', 'children': ['129', '130', '133', '146', '149', '152']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '130', 'type': 'keyword_argument', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '133', 'type': 'keyword_argument', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'device'}; {'id': '135', 'type': 'conditional_expression', 'children': ['136', '144', '145'], 'value': 'if'}; {'id': '136', 'type': 'call', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'string', 'children': [], 'value': "'cuda:{}'"}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '140', 'type': 'argument_list', 'children': ['141']}; {'id': '141', 'type': 'binary_operator', 'children': ['142', '143'], 'value': '%'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '145', 'type': 'string', 'children': [], 'value': "'cpu'"}; {'id': '146', 'type': 'keyword_argument', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '149', 'type': 'keyword_argument', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'train_epochs'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'train_epochs'}; {'id': '152', 'type': 'keyword_argument', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'test_epochs'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'test_epochs'}; {'id': '155', 'type': 'for_in_clause', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '157', 'type': 'call', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '159', 'type': 'argument_list', 'children': ['160', '163']}; {'id': '160', 'type': 'attribute', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '163', 'type': 'binary_operator', 'children': ['164', '167'], 'value': '+'}; {'id': '164', 'type': 'attribute', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'nb_runs'}; {'id': '168', 'type': 'else_clause', 'children': ['169']}; {'id': '169', 'type': 'block', 'children': ['170']}; {'id': '170', 'type': 'expression_statement', 'children': ['171']}; {'id': '171', 'type': 'assignment', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'result_pair'}; {'id': '173', 'type': 'list_comprehension', 'children': ['174', '196']}; {'id': '174', 'type': 'call', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'GNN_instance'}; {'id': '176', 'type': 'argument_list', 'children': ['177', '178', '181', '187', '190', '193']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '178', 'type': 'keyword_argument', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '181', 'type': 'keyword_argument', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'device'}; {'id': '183', 'type': 'conditional_expression', 'children': ['184', '185', '186'], 'value': 'if'}; {'id': '184', 'type': 'string', 'children': [], 'value': "'cuda:0'"}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'gpu'}; {'id': '186', 'type': 'string', 'children': [], 'value': "'cpu'"}; {'id': '187', 'type': 'keyword_argument', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '190', 'type': 'keyword_argument', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'train_epochs'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'train_epochs'}; {'id': '193', 'type': 'keyword_argument', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'test_epochs'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'test_epochs'}; {'id': '196', 'type': 'for_in_clause', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '198', 'type': 'call', 'children': ['199', '200']}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '200', 'type': 'argument_list', 'children': ['201', '204']}; {'id': '201', 'type': 'attribute', 'children': ['202', '203']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '204', 'type': 'binary_operator', 'children': ['205', '208'], 'value': '+'}; {'id': '205', 'type': 'attribute', 'children': ['206', '207']}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'nb_runs'}; {'id': '209', 'type': 'expression_statement', 'children': ['210']}; {'id': '210', 'type': 'call', 'children': ['211', '214']}; {'id': '211', 'type': 'attribute', 'children': ['212', '213']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'AB'}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '214', 'type': 'argument_list', 'children': ['215']}; {'id': '215', 'type': 'list_comprehension', 'children': ['216', '219']}; {'id': '216', 'type': 'subscript', 'children': ['217', '218']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'runpair'}; {'id': '218', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '219', 'type': 'for_in_clause', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'runpair'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'result_pair'}; {'id': '222', 'type': 'expression_statement', 'children': ['223']}; {'id': '223', 'type': 'call', 'children': ['224', '227']}; {'id': '224', 'type': 'attribute', 'children': ['225', '226']}; {'id': '225', 'type': 'identifier', 'children': [], 'value': 'BA'}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '227', 'type': 'argument_list', 'children': ['228']}; {'id': '228', 'type': 'list_comprehension', 'children': ['229', '232']}; {'id': '229', 'type': 'subscript', 'children': ['230', '231']}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'runpair'}; {'id': '231', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '232', 'type': 'for_in_clause', 'children': ['233', '234']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'runpair'}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'result_pair'}; {'id': '235', 'type': 'if_statement', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '237', 'type': 'block', 'children': ['238']}; {'id': '238', 'type': 'expression_statement', 'children': ['239']}; {'id': '239', 'type': 'call', 'children': ['240', '241']}; {'id': '240', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '241', 'type': 'argument_list', 'children': ['242']}; {'id': '242', 'type': 'call', 'children': ['243', '246']}; {'id': '243', 'type': 'attribute', 'children': ['244', '245']}; {'id': '244', 'type': 'string', 'children': [], 'value': '"P-value after {} runs : {}"'}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '246', 'type': 'argument_list', 'children': ['247', '250']}; {'id': '247', 'type': 'attribute', 'children': ['248', '249']}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '249', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '250', 'type': 'attribute', 'children': ['251', '252']}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'ttest_criterion'}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'p_value'}; {'id': '253', 'type': 'expression_statement', 'children': ['254']}; {'id': '254', 'type': 'assignment', 'children': ['255', '256']}; {'id': '255', 'type': 'identifier', 'children': [], 'value': 'score_AB'}; {'id': '256', 'type': 'call', 'children': ['257', '260']}; {'id': '257', 'type': 'attribute', 'children': ['258', '259']}; {'id': '258', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'mean'}; {'id': '260', 'type': 'argument_list', 'children': ['261']}; {'id': '261', 'type': 'identifier', 'children': [], 'value': 'AB'}; {'id': '262', 'type': 'expression_statement', 'children': ['263']}; {'id': '263', 'type': 'assignment', 'children': ['264', '265']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'score_BA'}; {'id': '265', 'type': 'call', 'children': ['266', '269']}; {'id': '266', 'type': 'attribute', 'children': ['267', '268']}; {'id': '267', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '268', 'type': 'identifier', 'children': [], 'value': 'mean'}; {'id': '269', 'type': 'argument_list', 'children': ['270']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'BA'}; {'id': '271', 'type': 'return_statement', 'children': ['272']}; {'id': '272', 'type': 'binary_operator', 'children': ['273', '277'], 'value': '/'}; {'id': '273', 'type': '()', 'children': ['274']}; {'id': '274', 'type': 'binary_operator', 'children': ['275', '276'], 'value': '-'}; {'id': '275', 'type': 'identifier', 'children': [], 'value': 'score_BA'}; {'id': '276', 'type': 'identifier', 'children': [], 'value': 'score_AB'}; {'id': '277', 'type': '()', 'children': ['278']}; {'id': '278', 'type': 'binary_operator', 'children': ['279', '280'], 'value': '+'}; {'id': '279', 'type': 'identifier', 'children': [], 'value': 'score_BA'}; {'id': '280', 'type': 'identifier', 'children': [], 'value': 'score_AB'}
Run multiple times GNN to estimate the causal direction. Args: a (np.ndarray): Variable 1 b (np.ndarray): Variable 2 nb_runs (int): number of runs to execute per batch (before testing for significance with t-test). nb_jobs (int): number of runs to execute in parallel. (Initialized with ``cdt.SETTINGS.NB_JOBS``) gpu (bool): use gpu (Initialized with ``cdt.SETTINGS.GPU``) idx (int): (optional) index of the pair, for printing purposes verbose (bool): verbosity (Initialized with ``cdt.SETTINGS.verbose``) ttest_threshold (float): threshold to stop the boostraps before ``nb_max_runs`` if the difference is significant nb_max_runs (int): Max number of bootstraps train_epochs (int): Number of epochs during which the model is going to be trained test_epochs (int): Number of epochs during which the model is going to be tested Returns: float: Causal score of the pair (Value : 1 if a->b and -1 if b->a)
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_config_value'}; {'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': 'fallback'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '17']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'cli_config'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'CLIConfig'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'SF_CLI_CONFIG_DIR'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'SF_CLI_ENV_VAR_PREFIX'}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'cli_config'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24', '25']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'servicefabric'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'fallback'}
Gets a config by name. In the case where the config name is not found, will use fallback value.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_day_start_ut_span'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '32']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'cur'}; {'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': 'conn'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '21', '22']}; {'id': '18', 'type': 'pattern_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'first_day_start_ut'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'last_day_start_ut'}; {'id': '21', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '22', 'type': 'call', 'children': ['23', '31']}; {'id': '23', 'type': 'attribute', 'children': ['24', '30']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cur'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'string', 'children': [], 'value': '"SELECT min(day_start_ut), max(day_start_ut) FROM days;"'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'fetchone'}; {'id': '31', 'type': 'argument_list', 'children': []}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'expression_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'first_day_start_ut'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'last_day_start_ut'}
Return the first and last day_start_ut Returns ------- first_day_start_ut: int last_day_start_ut: int
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'convert_transpose'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'w_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'scope_name'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '11', 'type': 'block', 'children': ['12', '17']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'Converting transpose ...'"}; {'id': '17', 'type': 'if_statement', 'children': ['18', '25', '55']}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '24'], 'value': '!='}; {'id': '19', 'type': 'subscript', 'children': ['20', '23']}; {'id': '20', 'type': 'subscript', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'perm'"}; {'id': '23', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'if_statement', 'children': ['27', '32', '48']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '31'], 'value': 'in'}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '32', 'type': 'block', 'children': ['33', '38']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'!!! Cannot permute batch dimension. Result may be wrong !!!'"}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'scope_name'}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '45', 'type': 'subscript', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '48', 'type': 'else_clause', 'children': ['49']}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'Skip weight matrix transpose, result may be wrong.'"}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57', '84', '104']}; {'id': '57', 'type': 'if_statement', 'children': ['58', '59', '69']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'tf_name'}; {'id': '63', 'type': 'binary_operator', 'children': ['64', '65'], 'value': '+'}; {'id': '64', 'type': 'string', 'children': [], 'value': "'PERM'"}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'random_string'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '69', 'type': 'else_clause', 'children': ['70']}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'tf_name'}; {'id': '74', 'type': 'binary_operator', 'children': ['75', '76'], 'value': '+'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'w_name'}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '83', 'type': 'argument_list', 'children': []}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'permute'}; {'id': '87', 'type': 'call', 'children': ['88', '93']}; {'id': '88', 'type': 'attribute', 'children': ['89', '92']}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'keras'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'Permute'}; {'id': '93', 'type': 'argument_list', 'children': ['94', '101']}; {'id': '94', 'type': 'subscript', 'children': ['95', '98']}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '97', 'type': 'string', 'children': [], 'value': "'perm'"}; {'id': '98', 'type': 'slice', 'children': ['99', '100']}; {'id': '99', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '100', 'type': 'colon', 'children': []}; {'id': '101', 'type': 'keyword_argument', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'tf_name'}; {'id': '104', 'type': 'expression_statement', 'children': ['105']}; {'id': '105', 'type': 'assignment', 'children': ['106', '109']}; {'id': '106', 'type': 'subscript', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'scope_name'}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'permute'}; {'id': '111', 'type': 'argument_list', 'children': ['112']}; {'id': '112', 'type': 'subscript', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'layers'}; {'id': '114', 'type': 'subscript', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '116', 'type': 'integer', 'children': [], 'value': '0'}
Convert transpose layer. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras layers
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'NaiveBayesLearner'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '23', '49', '88', '126']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'targetvals'}; {'id': '9', 'type': 'subscript', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'target_dist'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'CountingProbDist'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'targetvals'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'attr_dists'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '28', 'type': 'generator_expression', 'children': ['29', '41', '44']}; {'id': '29', 'type': 'tuple', 'children': ['30', '33']}; {'id': '30', 'type': 'tuple', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'gv'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'CountingProbDist'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'subscript', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '41', 'type': 'for_in_clause', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'gv'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'targetvals'}; {'id': '44', 'type': 'for_in_clause', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '49', 'type': 'for_statement', 'children': ['50', '51', '54']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'examples'}; {'id': '54', 'type': 'block', 'children': ['55', '63', '70']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'target'}; {'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': 'target_dist'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '70', 'type': 'for_statement', 'children': ['71', '72', '75']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '84']}; {'id': '78', 'type': 'attribute', 'children': ['79', '83']}; {'id': '79', 'type': 'subscript', 'children': ['80', '81', '82']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'attr_dists'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'subscript', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '88', 'type': 'function_definition', 'children': ['89', '90', '92']}; {'id': '89', 'type': 'function_name', 'children': [], 'value': 'predict'}; {'id': '90', 'type': 'parameters', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '92', 'type': 'block', 'children': ['93', '120']}; {'id': '93', 'type': 'function_definition', 'children': ['94', '95', '97']}; {'id': '94', 'type': 'function_name', 'children': [], 'value': 'class_probability'}; {'id': '95', 'type': 'parameters', 'children': ['96']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '97', 'type': 'block', 'children': ['98']}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': '()', 'children': ['100']}; {'id': '100', 'type': 'binary_operator', 'children': ['101', '104'], 'value': '*'}; {'id': '101', 'type': 'subscript', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'target_dist'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '104', 'type': 'call', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'product'}; {'id': '106', 'type': 'generator_expression', 'children': ['107', '115']}; {'id': '107', 'type': 'subscript', 'children': ['108', '112']}; {'id': '108', 'type': 'subscript', 'children': ['109', '110', '111']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'attr_dists'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'targetval'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '112', 'type': 'subscript', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '115', 'type': 'for_in_clause', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'dataset'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'inputs'}; {'id': '120', 'type': 'return_statement', 'children': ['121']}; {'id': '121', 'type': 'call', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'argmax'}; {'id': '123', 'type': 'argument_list', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'targetvals'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'class_probability'}; {'id': '126', 'type': 'return_statement', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'predict'}
Just count how many times each value of each input attribute occurs, conditional on the target value. Count the different target values too.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_excluded_dir'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'block', 'children': ['7', '17']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '14']}; {'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': 'is_excluded'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'True', 'children': []}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'matches_masks'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ALWAYS_EXCLUDED_DIRS'}
Determines whether or not the specified directory is excluded by the project's configuration. :param path: the path to check :type path: pathlib.Path :rtype: bool
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'calc_global_bbox'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'view_matrix'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}; {'id': '8', 'type': 'block', 'children': ['9', '28', '48', '67']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '15']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '14'], 'value': 'is not'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '14', 'type': 'None', 'children': []}; {'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': 'view_matrix'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'matrix44'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'multiply'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'view_matrix'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'mesh'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'pattern_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}; {'id': '38', 'type': 'call', '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': 'mesh'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'calc_global_bbox'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46', '47']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'view_matrix'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}; {'id': '48', 'type': 'for_statement', 'children': ['49', '50', '53']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '59']}; {'id': '56', 'type': 'pattern_list', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'calc_global_bbox'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '65', '66']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'view_matrix'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'expression_list', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'bbox_min'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'bbox_max'}
Recursive calculation of scene bbox
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'n_dir'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '16', '31']}; {'id': '6', 'type': 'expression_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': 'assert_is_dir_and_exists'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '16', 'type': 'for_statement', 'children': ['17', '18', '26']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'select_dir'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'recursive'}; {'id': '25', 'type': 'True', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'augmented_assignment', 'children': ['29', '30'], 'value': '+='}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'n'}
Count how many folders in this directory. Including folder in sub folder.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'instantiate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'repo'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '7', 'type': 'None', 'children': []}; {'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', '24', '28', '65', '69', '84', '170']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'default_transformers'}; {'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': 'repo'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'transformer'"}; {'id': '23', 'type': 'dictionary', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '27', 'type': 'dictionary', 'children': []}; {'id': '28', 'type': 'if_statement', 'children': ['29', '32', '59']}; {'id': '29', 'type': 'comparison_operator', 'children': ['30', '31'], 'value': 'is not'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '31', 'type': 'None', 'children': []}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'if_statement', 'children': ['34', '37', '47']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': 'in'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'default_transformers'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '41', 'type': 'dictionary', 'children': ['42']}; {'id': '42', 'type': 'pair', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'default_transformers'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '47', 'type': 'else_clause', 'children': ['48']}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '52', 'type': 'dictionary', 'children': ['53']}; {'id': '53', 'type': 'pair', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '55', 'type': 'dictionary', 'children': ['56']}; {'id': '56', 'type': 'pair', 'children': ['57', '58']}; {'id': '57', 'type': 'string', 'children': [], 'value': "'files'"}; {'id': '58', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '59', 'type': 'else_clause', 'children': ['60']}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'default_transformers'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'input_matching_files'}; {'id': '68', 'type': 'None', 'children': []}; {'id': '69', 'type': 'if_statement', 'children': ['70', '73']}; {'id': '70', 'type': 'comparison_operator', 'children': ['71', '72'], 'value': 'is not'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '72', 'type': 'None', 'children': []}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'input_matching_files'}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'repo'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'find_matching_files'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'list', 'children': ['83'], 'value': '[filename]'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '84', 'type': 'for_statement', 'children': ['85', '86', '87']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '87', 'type': 'block', 'children': ['88']}; {'id': '88', 'type': 'for_statement', 'children': ['89', '90', '93']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '90', 'type': 'subscript', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '93', 'type': 'block', 'children': ['94', '100']}; {'id': '94', 'type': 'if_statement', 'children': ['95', '98']}; {'id': '95', 'type': 'comparison_operator', 'children': ['96', '97'], 'value': 'not in'}; {'id': '96', 'type': 'string', 'children': [], 'value': '"files"'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '98', 'type': 'block', 'children': ['99']}; {'id': '99', 'type': 'continue_statement', 'children': []}; {'id': '100', 'type': 'if_statement', 'children': ['101', '108', '117']}; {'id': '101', 'type': 'boolean_operator', 'children': ['102', '105'], 'value': 'and'}; {'id': '102', 'type': 'comparison_operator', 'children': ['103', '104'], 'value': '=='}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '104', 'type': 'string', 'children': [], 'value': '"files"'}; {'id': '105', 'type': 'comparison_operator', 'children': ['106', '107'], 'value': 'is not'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'input_matching_files'}; {'id': '107', 'type': 'None', 'children': []}; {'id': '108', 'type': 'block', 'children': ['109']}; {'id': '109', 'type': 'expression_statement', 'children': ['110']}; {'id': '110', 'type': 'assignment', 'children': ['111', '116']}; {'id': '111', 'type': 'subscript', 'children': ['112', '115']}; {'id': '112', 'type': 'subscript', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'input_matching_files'}; {'id': '117', 'type': 'else_clause', 'children': ['118']}; {'id': '118', 'type': 'block', 'children': ['119']}; {'id': '119', 'type': 'if_statement', 'children': ['120', '138', '147']}; {'id': '120', 'type': 'boolean_operator', 'children': ['121', '128'], 'value': 'or'}; {'id': '121', 'type': 'comparison_operator', 'children': ['122', '127'], 'value': 'is'}; {'id': '122', 'type': 'subscript', 'children': ['123', '126']}; {'id': '123', 'type': 'subscript', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '127', 'type': 'None', 'children': []}; {'id': '128', 'type': 'comparison_operator', 'children': ['129', '137'], 'value': '=='}; {'id': '129', 'type': 'call', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '131', 'type': 'argument_list', 'children': ['132']}; {'id': '132', 'type': 'subscript', 'children': ['133', '136']}; {'id': '133', 'type': 'subscript', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '137', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '138', 'type': 'block', 'children': ['139']}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'assignment', 'children': ['141', '146']}; {'id': '141', 'type': 'subscript', 'children': ['142', '145']}; {'id': '142', 'type': 'subscript', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '146', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '147', 'type': 'else_clause', 'children': ['148']}; {'id': '148', 'type': 'block', 'children': ['149', '162']}; {'id': '149', 'type': 'expression_statement', 'children': ['150']}; {'id': '150', 'type': 'assignment', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'matching_files'}; {'id': '152', 'type': 'call', 'children': ['153', '156']}; {'id': '153', 'type': 'attribute', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'repo'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'find_matching_files'}; {'id': '156', 'type': 'argument_list', 'children': ['157']}; {'id': '157', 'type': 'subscript', 'children': ['158', '161']}; {'id': '158', 'type': 'subscript', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '162', 'type': 'expression_statement', 'children': ['163']}; {'id': '163', 'type': 'assignment', 'children': ['164', '169']}; {'id': '164', 'type': 'subscript', 'children': ['165', '168']}; {'id': '165', 'type': 'subscript', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'transformers'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'matching_files'}; {'id': '170', 'type': 'return_statement', 'children': ['171']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'transformers'}
Instantiate the generator and filename specification
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rt_unsubscribe'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '21']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '11'], 'value': 'is'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_subscription_id'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '20']}; {'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': 'error'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"Not subscribed."'}; {'id': '20', 'type': 'return_statement', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'await', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '31']}; {'id': '24', 'type': 'attribute', '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': '_tibber_control'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'sub_manager'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'unsubscribe'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_subscription_id'}
Unsubscribe to Tibber rt subscription.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'walk_dn'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'start_dir'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '8', 'type': 'block', 'children': ['9', '23', '29']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'start_depth'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'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': 'os'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'start_dir'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'end_depth'}; {'id': '26', 'type': 'binary_operator', 'children': ['27', '28'], 'value': '+'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'start_depth'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '29', 'type': 'for_statement', 'children': ['30', '34', '40']}; {'id': '30', 'type': 'pattern_list', 'children': ['31', '32', '33']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'subdirs'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'walk'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'start_dir'}; {'id': '40', 'type': 'block', 'children': ['41', '47']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'yield', 'children': ['43']}; {'id': '43', 'type': 'expression_list', 'children': ['44', '45', '46']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'subdirs'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '47', 'type': 'if_statement', 'children': ['48', '61']}; {'id': '48', 'type': 'comparison_operator', 'children': ['49', '60'], 'value': '>='}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '51', 'type': 'argument_list', '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': 'os'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'end_depth'}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'break_statement', 'children': []}
Walk down a directory tree. Same as os.walk but allows for a depth limit via depth argument
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'record_drop_duplicate_fields'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'record'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '14', '25', '100']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'tags'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'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': 'record'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'for_statement', 'children': ['26', '27', '28']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'tags'}; {'id': '28', 'type': 'block', 'children': ['29', '35', '41', '47']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'record'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'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': 'out'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '40', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'current_fields'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '46', 'type': 'argument_list', 'children': []}; {'id': '47', 'type': 'for_statement', 'children': ['48', '49', '50']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'full_field'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '50', 'type': 'block', 'children': ['51', '68']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '62'], 'value': '+'}; {'id': '55', 'type': 'tuple', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'full_field'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'full_field'}; {'id': '64', 'type': 'slice', 'children': ['65', '66', '67']}; {'id': '65', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '66', 'type': 'colon', 'children': []}; {'id': '67', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '68', 'type': 'if_statement', 'children': ['69', '72']}; {'id': '69', 'type': 'comparison_operator', 'children': ['70', '71'], 'value': 'not in'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'current_fields'}; {'id': '72', 'type': 'block', 'children': ['73', '80', '84']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'current_fields'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'augmented_assignment', 'children': ['82', '83'], 'value': '+='}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '83', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '91']}; {'id': '86', 'type': 'attribute', 'children': ['87', '90']}; {'id': '87', 'type': 'subscript', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'binary_operator', 'children': ['93', '98'], 'value': '+'}; {'id': '93', 'type': 'subscript', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'full_field'}; {'id': '95', 'type': 'slice', 'children': ['96', '97']}; {'id': '96', 'type': 'colon', 'children': []}; {'id': '97', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '98', 'type': 'tuple', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'out'}
Return a record where all the duplicate fields have been removed. Fields are considered identical considering also the order of their subfields.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_writePrediction'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '6', 'type': 'block', 'children': ['7', '16']}; {'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': '__predictionCache'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '16', 'type': 'if_statement', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_isBestModel'}; {'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': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '__flushPredictionCache'}; {'id': '26', 'type': 'argument_list', 'children': []}
Writes the results of one iteration of a model. The results are written to this ModelRunner's in-memory cache unless this model is the "best model" for the job. If this model is the "best model", the predictions are written out to a permanent store via a prediction output stream instance Parameters: ----------------------------------------------------------------------- result: A opf_utils.ModelResult object, which contains the input and output for this iteration
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'conf_dict'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'base_name'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'conf_dict'}; {'id': '13', 'type': 'block', 'children': ['14', '23', '29', '35', '46']}; {'id': '14', 'type': 'if_statement', 'children': ['15', '21']}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'_'"}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'continue_statement', 'children': []}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'conf_dict'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '33']}; {'id': '30', 'type': 'comparison_operator', 'children': ['31', '32'], 'value': 'is'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'Namespace'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'continue_statement', 'children': []}; {'id': '35', 'type': 'if_statement', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'base_name'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '45'], 'value': '+'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '+'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'base_name'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '52', '72', '97']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'Namespace'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'for_statement', 'children': ['54', '57', '63']}; {'id': '54', 'type': 'pattern_list', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'iteritems'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '72', 'type': 'elif_clause', 'children': ['73', '77']}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '77', 'type': 'block', 'children': ['78', '84']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '81', 'type': 'call', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '83', 'type': 'argument_list', 'children': []}; {'id': '84', 'type': 'if_statement', 'children': ['85', '88']}; {'id': '85', 'type': 'comparison_operator', 'children': ['86', '87'], 'value': 'is not'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '87', 'type': 'None', 'children': []}; {'id': '88', 'type': 'block', 'children': ['89']}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '97', 'type': 'else_clause', 'children': ['98']}; {'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': 'self'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '104', 'type': 'argument_list', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'value'}
Updates the current configuration with the values in `conf_dict`. :param dict conf_dict: Dictionary of key value settings. :param str base_name: Base namespace for setting keys.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'amz_cano_querystring'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '14', '42', '49', '56', '67', '77', '81', '127', '131', '159', '171', '181']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'safe_qs_amz_chars'}; {'id': '9', 'type': 'string', 'children': [], 'value': "'&=+'"}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'safe_qs_unresvd'}; {'id': '13', 'type': 'string', 'children': [], 'value': "'-_.~'"}; {'id': '14', 'type': 'if_statement', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'PY2'}; {'id': '16', 'type': 'block', 'children': ['17', '26', '34']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'safe_qs_amz_chars'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'safe_qs_amz_chars'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'safe_qs_unresvd'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'safe_qs_unresvd'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'unquote'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'space'}; {'id': '52', 'type': 'conditional_expression', 'children': ['53', '54', '55'], 'value': 'if'}; {'id': '53', 'type': 'string', 'children': [], 'value': "b' '"}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'PY2'}; {'id': '55', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '59', 'type': 'subscript', 'children': ['60', '66']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'space'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '70', 'type': 'call', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '74', 'type': 'keyword_argument', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'safe'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'safe_qs_amz_chars'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'qs_items'}; {'id': '80', 'type': 'dictionary', 'children': []}; {'id': '81', 'type': 'for_statement', 'children': ['82', '85', '96']}; {'id': '82', 'type': 'pattern_list', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '85', 'type': 'call', 'children': ['86', '95']}; {'id': '86', 'type': 'attribute', 'children': ['87', '94']}; {'id': '87', 'type': 'call', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'parse_qs'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '91', 'type': 'keyword_argument', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'keep_blank_values'}; {'id': '93', 'type': 'True', 'children': []}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '95', 'type': 'argument_list', 'children': []}; {'id': '96', 'type': 'block', 'children': ['97', '107', '121']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '100', 'type': 'call', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '102', 'type': 'argument_list', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '104', 'type': 'keyword_argument', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'safe'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'safe_qs_unresvd'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '110', 'type': 'list_comprehension', 'children': ['111', '118']}; {'id': '111', 'type': 'call', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '113', 'type': 'argument_list', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '115', 'type': 'keyword_argument', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'safe'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'safe_qs_unresvd'}; {'id': '118', 'type': 'for_in_clause', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'assignment', 'children': ['123', '126']}; {'id': '123', 'type': 'subscript', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'qs_items'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '127', 'type': 'expression_statement', 'children': ['128']}; {'id': '128', 'type': 'assignment', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'qs_strings'}; {'id': '130', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '131', 'type': 'for_statement', 'children': ['132', '135', '140']}; {'id': '132', 'type': 'pattern_list', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '135', 'type': 'call', 'children': ['136', '139']}; {'id': '136', 'type': 'attribute', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'qs_items'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '139', 'type': 'argument_list', 'children': []}; {'id': '140', 'type': 'block', 'children': ['141']}; {'id': '141', 'type': 'for_statement', 'children': ['142', '143', '144']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '144', 'type': 'block', 'children': ['145']}; {'id': '145', 'type': 'expression_statement', 'children': ['146']}; {'id': '146', 'type': 'call', 'children': ['147', '150']}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'qs_strings'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '150', 'type': 'argument_list', 'children': ['151']}; {'id': '151', 'type': 'call', 'children': ['152', '155']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'string', 'children': [], 'value': "'='"}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '155', 'type': 'argument_list', 'children': ['156']}; {'id': '156', 'type': 'list', 'children': ['157', '158'], 'value': '[name, val]'}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '159', 'type': 'expression_statement', 'children': ['160']}; {'id': '160', 'type': 'assignment', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '162', 'type': 'call', 'children': ['163', '166']}; {'id': '163', 'type': 'attribute', 'children': ['164', '165']}; {'id': '164', 'type': 'string', 'children': [], 'value': "'&'"}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '166', 'type': 'argument_list', 'children': ['167']}; {'id': '167', 'type': 'call', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '169', 'type': 'argument_list', 'children': ['170']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'qs_strings'}; {'id': '171', 'type': 'if_statement', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'PY2'}; {'id': '173', 'type': 'block', 'children': ['174']}; {'id': '174', 'type': 'expression_statement', 'children': ['175']}; {'id': '175', 'type': 'assignment', 'children': ['176', '177']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '177', 'type': 'call', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '179', 'type': 'argument_list', 'children': ['180']}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'qs'}; {'id': '181', 'type': 'return_statement', 'children': ['182']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'qs'}
Parse and format querystring as per AWS4 auth requirements. Perform percent quoting as needed. qs -- querystring
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map_pin'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'abstract_pin_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'physical_pin_id'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '10', '19']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'physical_pin_id'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '18']}; {'id': '13', 'type': 'subscript', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_pin_mapping'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'abstract_pin_id'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'physical_pin_id'}; {'id': '19', 'type': 'else_clause', 'children': ['20']}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_pin_mapping'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'abstract_pin_id'}; {'id': '30', 'type': 'None', 'children': []}
Maps a pin number to a physical device pin. To make it easy to change drivers without having to refactor a lot of code, this library does not use the names set by the driver to identify a pin. This function will map a number, that will be used by other functions, to a physical pin represented by the drivers pin id. That way, if you need to use another pin or change the underlying driver completly, you only need to redo the mapping. If you're developing a driver, keep in mind that your driver will not know about this. The other functions will translate the mapped pin to your id before calling your function. @arg abstract_pin_id the id that will identify this pin in the other function calls. You can choose what you want. @arg physical_pin_id the id returned in the driver. See `AbstractDriver.available_pins`. Setting it to None removes the mapping.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_naive'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '32']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'astimezone'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '16', 'type': 'if_statement', 'children': ['17', '22']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'normalize'"}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'timezone'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'normalize'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'tzinfo'}; {'id': '40', 'type': 'None', 'children': []}
Makes an aware datetime.datetime naive in a given time zone.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_zipped'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'docs_base'}; {'id': '6', 'type': 'block', 'children': ['7', '46', '71']}; {'id': '7', 'type': 'with_statement', 'children': ['8', '14']}; {'id': '8', 'type': 'with_clause', 'children': ['9']}; {'id': '9', 'type': 'with_item', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'pushd'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'docs_base'}; {'id': '14', 'type': 'block', 'children': ['15', '34']}; {'id': '15', 'type': 'with_statement', 'children': ['16', '32']}; {'id': '16', 'type': 'with_clause', 'children': ['17']}; {'id': '17', 'type': 'with_item', 'children': ['18']}; {'id': '18', 'type': 'as_pattern', 'children': ['19', '30']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'tempfile'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'NamedTemporaryFile'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '27']}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'pythonhosted-'"}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '29', 'type': 'False', 'children': []}; {'id': '30', 'type': 'as_pattern_target', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ziphandle'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'pass_statement', 'children': []}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'zip_name'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'shutil'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'make_archive'}; {'id': '41', 'type': 'argument_list', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ziphandle'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'zip'"}; {'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': 'notify'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': '"Uploading {:.1f} MiB from \'{}\' to \'{}\'..."'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '56', 'type': 'argument_list', 'children': ['57', '67', '68']}; {'id': '57', 'type': 'binary_operator', 'children': ['58', '66'], 'value': '/'}; {'id': '58', 'type': 'call', 'children': ['59', '64']}; {'id': '59', 'type': 'attribute', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'getsize'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'zip_name'}; {'id': '66', 'type': 'float', 'children': [], 'value': '1024.0'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'zip_name'}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '71', 'type': 'with_statement', 'children': ['72', '84']}; {'id': '72', 'type': 'with_clause', 'children': ['73']}; {'id': '73', 'type': 'with_item', 'children': ['74']}; {'id': '74', 'type': 'as_pattern', 'children': ['75', '82']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'io'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'zip_name'}; {'id': '81', 'type': 'string', 'children': [], 'value': "'rb'"}; {'id': '82', 'type': 'as_pattern_target', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'zipread'}; {'id': '84', 'type': 'block', 'children': ['85']}; {'id': '85', 'type': 'try_statement', 'children': ['86', '90']}; {'id': '86', 'type': 'block', 'children': ['87']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'yield', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'zipread'}; {'id': '90', 'type': 'finally_clause', 'children': ['91']}; {'id': '91', 'type': 'block', 'children': ['92', '101']}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'call', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'ziphandle'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '106']}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '106', 'type': 'argument_list', 'children': ['107']}; {'id': '107', 'type': 'binary_operator', 'children': ['108', '111'], 'value': '+'}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'ziphandle'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '111', 'type': 'string', 'children': [], 'value': "'.zip'"}
Provide a zipped stream of the docs tree.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_uuid'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '8', 'type': 'block', 'children': ['9', '19', '43']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': '<='}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '3'}; {'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': '"max length must be larger than 3"'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '26']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '25'], 'value': '>'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': '"{}..."'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '37', 'type': 'slice', 'children': ['38', '39', '40']}; {'id': '38', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '39', 'type': 'colon', 'children': []}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '-'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '43', 'type': 'return_statement', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'uuid'}
Format a UUID string :param str uuid: UUID to format :param int max_length: Maximum length of result string (> 3) :return: Formatted UUID :rtype: str :raises ValueError: If *max_length* is not larger than 3 This function formats a UUID so it is not longer than *max_length* characters. The resulting string is returned. It does so by replacing characters at the end of the *uuid* with three dots, if necessary. The idea is that the start of the *uuid* is the most important part to be able to identify the related entity. The default *max_length* is 10, which will result in a string containing the first 7 characters of the *uuid* passed in. Most of the time, such a string is still unique within a collection of UUIDs.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ignore_patterns'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '11', '14']}; {'id': '8', 'type': 'pattern_list', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'locations'}; {'id': '14', 'type': 'block', 'children': ['15', '23']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '18', 'type': 'subscript', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'storages'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '23', 'type': 'for_statement', 'children': ['24', '25', '32']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get_files'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ignore_patterns'}; {'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']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'storage'}
List all files in all locations.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_rate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'rate'}; {'id': '6', 'type': 'block', 'children': ['7', '24']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_rate'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_player_interface_property'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'Rate'"}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'dbus'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'Double'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'rate'}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_rate'}
Set the playback rate of the video as a multiple of the default playback speed Examples: >>> player.set_rate(2) # Will play twice as fast as normal speed >>> player.set_rate(0.5) # Will play half speed
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'normalize'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '23', '34', '44', '65', '71']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'asarray'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'exp'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '33'], 'value': '-'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '39'], 'value': '/'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'conventional'}; {'id': '47', 'type': '()', 'children': ['48']}; {'id': '48', 'type': 'binary_operator', 'children': ['49', '55'], 'value': '/'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'exp'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '55', 'type': 'call', 'children': ['56', '64']}; {'id': '56', 'type': 'attribute', 'children': ['57', '63']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'exp'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'lx'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '64', 'type': 'argument_list', 'children': []}; {'id': '65', 'type': 'assert_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'similar'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'conventional'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'result'}
Accepts log-values as input, exponentiates them, normalizes and returns the result. Handles underflow by rescaling so that the largest values is exactly 1.0.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__from_xml'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '20', '260']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'vns'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'get_node_ns'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '20', 'type': 'while_statement', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '22', 'type': 'block', 'children': ['23', '37', '44', '69', '254']}; {'id': '23', 'type': 'if_statement', 'children': ['24', '29']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '28'], 'value': '!='}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'element'"}; {'id': '29', 'type': 'block', 'children': ['30', '36']}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '36', 'type': 'continue_statement', 'children': []}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'ns'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'get_node_ns'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '44', 'type': 'if_statement', 'children': ['45', '61']}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'boolean_operator', 'children': ['47', '50'], 'value': 'and'}; {'id': '47', 'type': 'boolean_operator', 'children': ['48', '49'], 'value': 'and'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'ns'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'vns'}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '56'], 'value': '!='}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'ns'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '55', 'type': 'argument_list', 'children': []}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'vns'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '60', 'type': 'argument_list', 'children': []}; {'id': '61', 'type': 'block', 'children': ['62', '68']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '68', 'type': 'continue_statement', 'children': []}; {'id': '69', 'type': 'if_statement', 'children': ['70', '75', '91', '115', '137', '159', '181', '203', '225']}; {'id': '70', 'type': 'comparison_operator', 'children': ['71', '74'], 'value': '=='}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'POBOX'"}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'pobox'}; {'id': '81', 'type': 'call', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '83', 'type': 'argument_list', 'children': ['84', '89', '90']}; {'id': '84', 'type': 'call', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '88', 'type': 'argument_list', 'children': []}; {'id': '89', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '90', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '91', 'type': 'elif_clause', 'children': ['92', '99']}; {'id': '92', 'type': 'comparison_operator', 'children': ['93', '96'], 'value': 'in'}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '96', 'type': 'tuple', 'children': ['97', '98']}; {'id': '97', 'type': 'string', 'children': [], 'value': "'EXTADR'"}; {'id': '98', 'type': 'string', 'children': [], 'value': "'EXTADD'"}; {'id': '99', 'type': 'block', 'children': ['100']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'extadr'}; {'id': '105', 'type': 'call', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '107', 'type': 'argument_list', 'children': ['108', '113', '114']}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '112', 'type': 'argument_list', 'children': []}; {'id': '113', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '114', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '115', 'type': 'elif_clause', 'children': ['116', '121']}; {'id': '116', 'type': 'comparison_operator', 'children': ['117', '120'], 'value': '=='}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '120', 'type': 'string', 'children': [], 'value': "'STREET'"}; {'id': '121', 'type': 'block', 'children': ['122']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'street'}; {'id': '127', 'type': 'call', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '129', 'type': 'argument_list', 'children': ['130', '135', '136']}; {'id': '130', 'type': 'call', 'children': ['131', '134']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '134', 'type': 'argument_list', 'children': []}; {'id': '135', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '136', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '137', 'type': 'elif_clause', 'children': ['138', '143']}; {'id': '138', 'type': 'comparison_operator', 'children': ['139', '142'], 'value': '=='}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '142', 'type': 'string', 'children': [], 'value': "'LOCALITY'"}; {'id': '143', 'type': 'block', 'children': ['144']}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'assignment', 'children': ['146', '149']}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'locality'}; {'id': '149', 'type': 'call', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '151', 'type': 'argument_list', 'children': ['152', '157', '158']}; {'id': '152', 'type': 'call', 'children': ['153', '156']}; {'id': '153', 'type': 'attribute', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '156', 'type': 'argument_list', 'children': []}; {'id': '157', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '158', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '159', 'type': 'elif_clause', 'children': ['160', '165']}; {'id': '160', 'type': 'comparison_operator', 'children': ['161', '164'], 'value': '=='}; {'id': '161', 'type': 'attribute', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '164', 'type': 'string', 'children': [], 'value': "'REGION'"}; {'id': '165', 'type': 'block', 'children': ['166']}; {'id': '166', 'type': 'expression_statement', 'children': ['167']}; {'id': '167', 'type': 'assignment', 'children': ['168', '171']}; {'id': '168', 'type': 'attribute', 'children': ['169', '170']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '171', 'type': 'call', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '173', 'type': 'argument_list', 'children': ['174', '179', '180']}; {'id': '174', 'type': 'call', 'children': ['175', '178']}; {'id': '175', 'type': 'attribute', 'children': ['176', '177']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '178', 'type': 'argument_list', 'children': []}; {'id': '179', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '180', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '181', 'type': 'elif_clause', 'children': ['182', '187']}; {'id': '182', 'type': 'comparison_operator', 'children': ['183', '186'], 'value': '=='}; {'id': '183', 'type': 'attribute', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '186', 'type': 'string', 'children': [], 'value': "'PCODE'"}; {'id': '187', 'type': 'block', 'children': ['188']}; {'id': '188', 'type': 'expression_statement', 'children': ['189']}; {'id': '189', 'type': 'assignment', 'children': ['190', '193']}; {'id': '190', 'type': 'attribute', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'pcode'}; {'id': '193', 'type': 'call', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '195', 'type': 'argument_list', 'children': ['196', '201', '202']}; {'id': '196', 'type': 'call', 'children': ['197', '200']}; {'id': '197', 'type': 'attribute', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '200', 'type': 'argument_list', 'children': []}; {'id': '201', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '202', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '203', 'type': 'elif_clause', 'children': ['204', '209']}; {'id': '204', 'type': 'comparison_operator', 'children': ['205', '208'], 'value': '=='}; {'id': '205', 'type': 'attribute', 'children': ['206', '207']}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '208', 'type': 'string', 'children': [], 'value': "'CTRY'"}; {'id': '209', 'type': 'block', 'children': ['210']}; {'id': '210', 'type': 'expression_statement', 'children': ['211']}; {'id': '211', 'type': 'assignment', 'children': ['212', '215']}; {'id': '212', 'type': 'attribute', 'children': ['213', '214']}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'ctry'}; {'id': '215', 'type': 'call', 'children': ['216', '217']}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '217', 'type': 'argument_list', 'children': ['218', '223', '224']}; {'id': '218', 'type': 'call', 'children': ['219', '222']}; {'id': '219', 'type': 'attribute', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'getContent'}; {'id': '222', 'type': 'argument_list', 'children': []}; {'id': '223', 'type': 'string', 'children': [], 'value': '"utf-8"'}; {'id': '224', 'type': 'string', 'children': [], 'value': '"replace"'}; {'id': '225', 'type': 'elif_clause', 'children': ['226', '238']}; {'id': '226', 'type': 'comparison_operator', 'children': ['227', '230'], 'value': 'in'}; {'id': '227', 'type': 'attribute', 'children': ['228', '229']}; {'id': '228', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '230', 'type': 'tuple', 'children': ['231', '232', '233', '234', '235', '236', '237']}; {'id': '231', 'type': 'string', 'children': [], 'value': '"HOME"'}; {'id': '232', 'type': 'string', 'children': [], 'value': '"WORK"'}; {'id': '233', 'type': 'string', 'children': [], 'value': '"POSTAL"'}; {'id': '234', 'type': 'string', 'children': [], 'value': '"PARCEL"'}; {'id': '235', 'type': 'string', 'children': [], 'value': '"DOM"'}; {'id': '236', 'type': 'string', 'children': [], 'value': '"INTL"'}; {'id': '237', 'type': 'string', 'children': [], 'value': '"PREF"'}; {'id': '238', 'type': 'block', 'children': ['239']}; {'id': '239', 'type': 'expression_statement', 'children': ['240']}; {'id': '240', 'type': 'call', 'children': ['241', '246']}; {'id': '241', 'type': 'attribute', 'children': ['242', '245']}; {'id': '242', 'type': 'attribute', 'children': ['243', '244']}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '244', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '246', 'type': 'argument_list', 'children': ['247']}; {'id': '247', 'type': 'call', 'children': ['248', '253']}; {'id': '248', 'type': 'attribute', 'children': ['249', '252']}; {'id': '249', 'type': 'attribute', 'children': ['250', '251']}; {'id': '250', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '253', 'type': 'argument_list', 'children': []}; {'id': '254', 'type': 'expression_statement', 'children': ['255']}; {'id': '255', 'type': 'assignment', 'children': ['256', '257']}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '257', 'type': 'attribute', 'children': ['258', '259']}; {'id': '258', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '260', 'type': 'if_statement', 'children': ['261', '266', '277']}; {'id': '261', 'type': 'comparison_operator', 'children': ['262', '265'], 'value': '=='}; {'id': '262', 'type': 'attribute', 'children': ['263', '264']}; {'id': '263', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '265', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '266', 'type': 'block', 'children': ['267']}; {'id': '267', 'type': 'expression_statement', 'children': ['268']}; {'id': '268', 'type': 'assignment', 'children': ['269', '272']}; {'id': '269', 'type': 'attribute', 'children': ['270', '271']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '272', 'type': 'list', 'children': ['273', '274', '275', '276'], 'value': '["intl","postal","parcel","work"]'}; {'id': '273', 'type': 'string', 'children': [], 'value': '"intl"'}; {'id': '274', 'type': 'string', 'children': [], 'value': '"postal"'}; {'id': '275', 'type': 'string', 'children': [], 'value': '"parcel"'}; {'id': '276', 'type': 'string', 'children': [], 'value': '"work"'}; {'id': '277', 'type': 'elif_clause', 'children': ['278', '289']}; {'id': '278', 'type': 'boolean_operator', 'children': ['279', '284'], 'value': 'and'}; {'id': '279', 'type': 'comparison_operator', 'children': ['280', '281'], 'value': 'in'}; {'id': '280', 'type': 'string', 'children': [], 'value': '"dom"'}; {'id': '281', 'type': 'attribute', 'children': ['282', '283']}; {'id': '282', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '283', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '284', 'type': 'comparison_operator', 'children': ['285', '286'], 'value': 'in'}; {'id': '285', 'type': 'string', 'children': [], 'value': '"intl"'}; {'id': '286', 'type': 'attribute', 'children': ['287', '288']}; {'id': '287', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '288', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '289', 'type': 'block', 'children': ['290']}; {'id': '290', 'type': 'raise_statement', 'children': ['291']}; {'id': '291', 'type': 'call', 'children': ['292', '293']}; {'id': '292', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '293', 'type': 'argument_list', 'children': ['294']}; {'id': '294', 'type': 'string', 'children': [], 'value': '"Both \'dom\' and \'intl\' specified in vcard ADR"'}
Initialize a `VCardAdr` object from and XML element. :Parameters: - `value`: field value as an XML node :Types: - `value`: `libxml2.xmlNode`
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'strptime'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fmt'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'tzinfo'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '20']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'strptime'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'fmt'}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '29']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'tzinfo'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'tzinfo'}; {'id': '29', 'type': 'list_splat', 'children': ['30']}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '32', 'type': 'slice', 'children': ['33', '34']}; {'id': '33', 'type': 'colon', 'children': []}; {'id': '34', 'type': 'integer', 'children': [], 'value': '6'}
A function to replace strptime in the time module. Should behave identically to the strptime function except it returns a datetime.datetime object instead of a time.struct_time object. Also takes an optional tzinfo parameter which is a time zone info object.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'error'}; {'id': '3', 'type': 'parameters', 'children': ['4', '8', '10']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '6', 'type': 'type', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '8', 'type': 'list_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '10', 'type': 'dictionary_splat_pattern', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '12', 'type': 'type', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'HedgehogCommandError'}; {'id': '14', 'type': 'block', 'children': ['15', '41']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '32']}; {'id': '16', 'type': 'boolean_operator', 'children': ['17', '27'], 'value': 'and'}; {'id': '17', 'type': 'boolean_operator', 'children': ['18', '21'], 'value': 'and'}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '20'], 'value': '=='}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'FAILED_COMMAND'}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '26'], 'value': '>='}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '31'], 'value': '=='}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '31', 'type': 'string', 'children': [], 'value': '"Emergency Shutdown activated"'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'EmergencyShutdown'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '39']}; {'id': '37', 'type': 'list_splat', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '39', 'type': 'dictionary_splat', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_errors'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '49']}; {'id': '47', 'type': 'list_splat', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '49', 'type': 'dictionary_splat', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
Creates an error from the given code, and args and kwargs. :param code: The acknowledgement code :param args: Exception args :param kwargs: Exception kwargs :return: the error for the given acknowledgement code
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'start_local_env'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'recreate_containers'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '23', '36', '44', '84', '91', '102', '139', '144', '158', '163', '173', '178', '186', '196', '201', '207', '212', '222', '227', '234', '239', '245', '250', '257', '262', '272']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'assembled_spec'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'spec_assembler'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_assembled_specs'}; {'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': 'required_absent_assets'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'virtualbox'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'required_absent_assets'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'assembled_spec'}; {'id': '23', 'type': 'if_statement', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'required_absent_assets'}; {'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': 'RuntimeError'}; {'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': "'Assets {} are specified as required but are not set. Set them with `dusty assets set`'"}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'required_absent_assets'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'docker_ip'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'virtualbox'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get_docker_vm_ip'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'if_statement', 'children': ['45', '55']}; {'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': 'os'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'constants'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'COMPOSEFILE_PATH'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'try_statement', 'children': ['57', '65']}; {'id': '57', 'type': 'block', 'children': ['58']}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'stop_apps_or_services'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'rm_containers'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'recreate_containers'}; {'id': '65', 'type': 'except_clause', 'children': ['66', '70']}; {'id': '66', 'type': 'as_pattern', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'CalledProcessError'}; {'id': '68', 'type': 'as_pattern_target', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '70', 'type': 'block', 'children': ['71', '76']}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'string', 'children': [], 'value': '"WARNING: docker-compose stop failed"'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'daemon_warnings'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'clear_namespace'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'string', 'children': [], 'value': "'disk'"}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'df_info'}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'virtualbox'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'get_docker_vm_disk_info'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'keyword_argument', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'as_dict'}; {'id': '101', 'type': 'True', 'children': []}; {'id': '102', 'type': 'if_statement', 'children': ['103', '114']}; {'id': '103', 'type': 'boolean_operator', 'children': ['104', '109'], 'value': 'or'}; {'id': '104', 'type': 'comparison_operator', 'children': ['105', '106'], 'value': 'in'}; {'id': '105', 'type': 'string', 'children': [], 'value': "'M'"}; {'id': '106', 'type': 'subscript', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'df_info'}; {'id': '108', 'type': 'string', 'children': [], 'value': "'free'"}; {'id': '109', 'type': 'comparison_operator', 'children': ['110', '111'], 'value': 'in'}; {'id': '110', 'type': 'string', 'children': [], 'value': "'K'"}; {'id': '111', 'type': 'subscript', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'df_info'}; {'id': '113', 'type': 'string', 'children': [], 'value': "'free'"}; {'id': '114', 'type': 'block', 'children': ['115', '126', '134']}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'warning_msg'}; {'id': '118', 'type': 'call', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'string', 'children': [], 'value': "'VM is low on disk. Available disk: {}'"}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '122', 'type': 'argument_list', 'children': ['123']}; {'id': '123', 'type': 'subscript', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'df_info'}; {'id': '125', 'type': 'string', 'children': [], 'value': "'free'"}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'call', 'children': ['128', '131']}; {'id': '128', 'type': 'attribute', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'daemon_warnings'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '131', 'type': 'argument_list', 'children': ['132', '133']}; {'id': '132', 'type': 'string', 'children': [], 'value': "'disk'"}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'warning_msg'}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'call', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '137', 'type': 'argument_list', 'children': ['138']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'warning_msg'}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'call', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '142', 'type': 'argument_list', 'children': ['143']}; {'id': '143', 'type': 'string', 'children': [], 'value': '"Compiling together the assembled specs"'}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'assignment', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'active_repos'}; {'id': '147', 'type': 'call', 'children': ['148', '151']}; {'id': '148', 'type': 'attribute', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'spec_assembler'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'get_all_repos'}; {'id': '151', 'type': 'argument_list', 'children': ['152', '155']}; {'id': '152', 'type': 'keyword_argument', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'active_only'}; {'id': '154', 'type': 'True', 'children': []}; {'id': '155', 'type': 'keyword_argument', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'include_specs_repo'}; {'id': '157', 'type': 'False', 'children': []}; {'id': '158', 'type': 'expression_statement', 'children': ['159']}; {'id': '159', 'type': 'call', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '161', 'type': 'argument_list', 'children': ['162']}; {'id': '162', 'type': 'string', 'children': [], 'value': '"Compiling the port specs"'}; {'id': '163', 'type': 'expression_statement', 'children': ['164']}; {'id': '164', 'type': 'assignment', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'port_spec'}; {'id': '166', 'type': 'call', 'children': ['167', '170']}; {'id': '167', 'type': 'attribute', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'port_spec_compiler'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'get_port_spec_document'}; {'id': '170', 'type': 'argument_list', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'assembled_spec'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'docker_ip'}; {'id': '173', 'type': 'expression_statement', 'children': ['174']}; {'id': '174', 'type': 'call', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '176', 'type': 'argument_list', 'children': ['177']}; {'id': '177', 'type': 'string', 'children': [], 'value': '"Compiling the nginx config"'}; {'id': '178', 'type': 'expression_statement', 'children': ['179']}; {'id': '179', 'type': 'assignment', 'children': ['180', '181']}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'docker_bridge_ip'}; {'id': '181', 'type': 'call', 'children': ['182', '185']}; {'id': '182', 'type': 'attribute', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'virtualbox'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'get_docker_bridge_ip'}; {'id': '185', 'type': 'argument_list', 'children': []}; {'id': '186', 'type': 'expression_statement', 'children': ['187']}; {'id': '187', 'type': 'assignment', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'nginx_config'}; {'id': '189', 'type': 'call', 'children': ['190', '193']}; {'id': '190', 'type': 'attribute', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'nginx_compiler'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'get_nginx_configuration_spec'}; {'id': '193', 'type': 'argument_list', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'port_spec'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'docker_bridge_ip'}; {'id': '196', 'type': 'expression_statement', 'children': ['197']}; {'id': '197', 'type': 'call', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '199', 'type': 'argument_list', 'children': ['200']}; {'id': '200', 'type': 'string', 'children': [], 'value': '"Creating setup and script bash files"'}; {'id': '201', 'type': 'expression_statement', 'children': ['202']}; {'id': '202', 'type': 'call', 'children': ['203', '204']}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'make_up_command_files'}; {'id': '204', 'type': 'argument_list', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'assembled_spec'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'port_spec'}; {'id': '207', 'type': 'expression_statement', 'children': ['208']}; {'id': '208', 'type': 'call', 'children': ['209', '210']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '210', 'type': 'argument_list', 'children': ['211']}; {'id': '211', 'type': 'string', 'children': [], 'value': '"Compiling docker-compose config"'}; {'id': '212', 'type': 'expression_statement', 'children': ['213']}; {'id': '213', 'type': 'assignment', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'compose_config'}; {'id': '215', 'type': 'call', 'children': ['216', '219']}; {'id': '216', 'type': 'attribute', 'children': ['217', '218']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'compose_compiler'}; {'id': '218', 'type': 'identifier', 'children': [], 'value': 'get_compose_dict'}; {'id': '219', 'type': 'argument_list', 'children': ['220', '221']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'assembled_spec'}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'port_spec'}; {'id': '222', 'type': 'expression_statement', 'children': ['223']}; {'id': '223', 'type': 'call', 'children': ['224', '225']}; {'id': '224', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '225', 'type': 'argument_list', 'children': ['226']}; {'id': '226', 'type': 'string', 'children': [], 'value': '"Saving port forwarding to hosts file"'}; {'id': '227', 'type': 'expression_statement', 'children': ['228']}; {'id': '228', 'type': 'call', 'children': ['229', '232']}; {'id': '229', 'type': 'attribute', 'children': ['230', '231']}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'hosts'}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'update_hosts_file_from_port_spec'}; {'id': '232', 'type': 'argument_list', 'children': ['233']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'port_spec'}; {'id': '234', 'type': 'expression_statement', 'children': ['235']}; {'id': '235', 'type': 'call', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '237', 'type': 'argument_list', 'children': ['238']}; {'id': '238', 'type': 'string', 'children': [], 'value': '"Configuring NFS"'}; {'id': '239', 'type': 'expression_statement', 'children': ['240']}; {'id': '240', 'type': 'call', 'children': ['241', '244']}; {'id': '241', 'type': 'attribute', 'children': ['242', '243']}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'nfs'}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'configure_nfs'}; {'id': '244', 'type': 'argument_list', 'children': []}; {'id': '245', 'type': 'expression_statement', 'children': ['246']}; {'id': '246', 'type': 'call', 'children': ['247', '248']}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '248', 'type': 'argument_list', 'children': ['249']}; {'id': '249', 'type': 'string', 'children': [], 'value': '"Saving updated nginx config to the VM"'}; {'id': '250', 'type': 'expression_statement', 'children': ['251']}; {'id': '251', 'type': 'call', 'children': ['252', '255']}; {'id': '252', 'type': 'attribute', 'children': ['253', '254']}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'nginx'}; {'id': '254', 'type': 'identifier', 'children': [], 'value': 'update_nginx_from_config'}; {'id': '255', 'type': 'argument_list', 'children': ['256']}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'nginx_config'}; {'id': '257', 'type': 'expression_statement', 'children': ['258']}; {'id': '258', 'type': 'call', 'children': ['259', '260']}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '260', 'type': 'argument_list', 'children': ['261']}; {'id': '261', 'type': 'string', 'children': [], 'value': '"Saving Docker Compose config and starting all containers"'}; {'id': '262', 'type': 'expression_statement', 'children': ['263']}; {'id': '263', 'type': 'call', 'children': ['264', '267']}; {'id': '264', 'type': 'attribute', 'children': ['265', '266']}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'compose'}; {'id': '266', 'type': 'identifier', 'children': [], 'value': 'update_running_containers_from_spec'}; {'id': '267', 'type': 'argument_list', 'children': ['268', '269']}; {'id': '268', 'type': 'identifier', 'children': [], 'value': 'compose_config'}; {'id': '269', 'type': 'keyword_argument', 'children': ['270', '271']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'recreate_containers'}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'recreate_containers'}; {'id': '272', 'type': 'expression_statement', 'children': ['273']}; {'id': '273', 'type': 'call', 'children': ['274', '275']}; {'id': '274', 'type': 'identifier', 'children': [], 'value': 'log_to_client'}; {'id': '275', 'type': 'argument_list', 'children': ['276']}; {'id': '276', 'type': 'string', 'children': [], 'value': '"Your local environment is now started!"'}
This command will use the compilers to get compose specs will pass those specs to the systems that need them. Those systems will in turn launch the services needed to make the local environment go.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'json_struct_to_xml'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '89', '327']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '18']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '15', 'type': 'tuple', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'if_statement', 'children': ['20', '26', '44', '78']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'!'"}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'etree'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'Element'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '%'}; {'id': '36', 'type': 'string', 'children': [], 'value': "'{%s}%s'"}; {'id': '37', 'type': 'tuple', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'NS_PROTECTED'}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '41', 'type': 'slice', 'children': ['42', '43']}; {'id': '42', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '43', 'type': 'colon', 'children': []}; {'id': '44', 'type': 'elif_clause', 'children': ['45', '51']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'string', 'children': [], 'value': "'+'"}; {'id': '51', 'type': 'block', 'children': ['52', '61']}; {'id': '52', 'type': 'if_statement', 'children': ['53', '55']}; {'id': '53', 'type': 'not_operator', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'raise_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'string', 'children': [], 'value': '"JSON fields starts with +, but no custom namespace provided"'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'etree'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'Element'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'binary_operator', 'children': ['70', '71'], 'value': '%'}; {'id': '70', 'type': 'string', 'children': [], 'value': "'{%s}%s'"}; {'id': '71', 'type': 'tuple', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '73', 'type': 'subscript', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '75', 'type': 'slice', 'children': ['76', '77']}; {'id': '76', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '77', 'type': 'colon', 'children': []}; {'id': '78', 'type': 'else_clause', 'children': ['79']}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'etree'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'Element'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '89', 'type': 'if_statement', 'children': ['90', '98', '113', '128', '146', '240', '316', '323']}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '94'], 'value': 'in'}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '94', 'type': 'tuple', 'children': ['95', '96', '97']}; {'id': '95', 'type': 'string', 'children': [], 'value': "'attachments'"}; {'id': '96', 'type': 'string', 'children': [], 'value': "'grouped_events'"}; {'id': '97', 'type': 'string', 'children': [], 'value': "'media_files'"}; {'id': '98', 'type': 'block', 'children': ['99']}; {'id': '99', 'type': 'for_statement', 'children': ['100', '101', '102']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '102', 'type': 'block', 'children': ['103']}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'call', 'children': ['105', '108']}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '108', 'type': 'argument_list', 'children': ['109']}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'json_link_to_xml'}; {'id': '111', 'type': 'argument_list', 'children': ['112']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '113', 'type': 'elif_clause', 'children': ['114', '121']}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '116', 'type': 'argument_list', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '118', 'type': 'tuple', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '121', 'type': 'block', 'children': ['122']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '128', 'type': 'elif_clause', 'children': ['129', '136']}; {'id': '129', 'type': 'call', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '131', 'type': 'argument_list', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '133', 'type': 'tuple', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '136', 'type': 'block', 'children': ['137']}; {'id': '137', 'type': 'expression_statement', 'children': ['138']}; {'id': '138', 'type': 'assignment', 'children': ['139', '142']}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '142', 'type': 'call', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '144', 'type': 'argument_list', 'children': ['145']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '146', 'type': 'elif_clause', 'children': ['147', '152']}; {'id': '147', 'type': 'call', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '149', 'type': 'argument_list', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '152', 'type': 'block', 'children': ['153']}; {'id': '153', 'type': 'if_statement', 'children': ['154', '169', '180']}; {'id': '154', 'type': 'comparison_operator', 'children': ['155', '163'], 'value': '=='}; {'id': '155', 'type': 'call', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'frozenset'}; {'id': '157', 'type': 'argument_list', 'children': ['158']}; {'id': '158', 'type': 'call', 'children': ['159', '162']}; {'id': '159', 'type': 'attribute', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '162', 'type': 'argument_list', 'children': []}; {'id': '163', 'type': 'call', 'children': ['164', '165']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'frozenset'}; {'id': '165', 'type': 'argument_list', 'children': ['166']}; {'id': '166', 'type': 'tuple', 'children': ['167', '168']}; {'id': '167', 'type': 'string', 'children': [], 'value': "'type'"}; {'id': '168', 'type': 'string', 'children': [], 'value': "'coordinates'"}; {'id': '169', 'type': 'block', 'children': ['170']}; {'id': '170', 'type': 'expression_statement', 'children': ['171']}; {'id': '171', 'type': 'call', 'children': ['172', '175']}; {'id': '172', 'type': 'attribute', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '175', 'type': 'argument_list', 'children': ['176']}; {'id': '176', 'type': 'call', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'geojson_to_gml'}; {'id': '178', 'type': 'argument_list', 'children': ['179']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '180', 'type': 'else_clause', 'children': ['181']}; {'id': '181', 'type': 'block', 'children': ['182']}; {'id': '182', 'type': 'for_statement', 'children': ['183', '186', '191']}; {'id': '183', 'type': 'pattern_list', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '186', 'type': 'call', 'children': ['187', '190']}; {'id': '187', 'type': 'attribute', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '190', 'type': 'argument_list', 'children': []}; {'id': '191', 'type': 'block', 'children': ['192', '228']}; {'id': '192', 'type': 'if_statement', 'children': ['193', '203', '215']}; {'id': '193', 'type': 'boolean_operator', 'children': ['194', '197'], 'value': 'or'}; {'id': '194', 'type': 'comparison_operator', 'children': ['195', '196'], 'value': '=='}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '196', 'type': 'string', 'children': [], 'value': "'url'"}; {'id': '197', 'type': 'call', 'children': ['198', '201']}; {'id': '198', 'type': 'attribute', 'children': ['199', '200']}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '201', 'type': 'argument_list', 'children': ['202']}; {'id': '202', 'type': 'string', 'children': [], 'value': "'_url'"}; {'id': '203', 'type': 'block', 'children': ['204']}; {'id': '204', 'type': 'expression_statement', 'children': ['205']}; {'id': '205', 'type': 'assignment', 'children': ['206', '207']}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '207', 'type': 'call', 'children': ['208', '209']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'json_link_to_xml'}; {'id': '209', 'type': 'argument_list', 'children': ['210', '211']}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '211', 'type': 'call', 'children': ['212', '213']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'json_link_key_to_xml_rel'}; {'id': '213', 'type': 'argument_list', 'children': ['214']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '215', 'type': 'else_clause', 'children': ['216']}; {'id': '216', 'type': 'block', 'children': ['217']}; {'id': '217', 'type': 'expression_statement', 'children': ['218']}; {'id': '218', 'type': 'assignment', 'children': ['219', '220']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '220', 'type': 'call', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'json_struct_to_xml'}; {'id': '222', 'type': 'argument_list', 'children': ['223', '224', '225']}; {'id': '223', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '224', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '225', 'type': 'keyword_argument', 'children': ['226', '227']}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '228', 'type': 'if_statement', 'children': ['229', '232']}; {'id': '229', 'type': 'comparison_operator', 'children': ['230', '231'], 'value': 'is not'}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '231', 'type': 'None', 'children': []}; {'id': '232', 'type': 'block', 'children': ['233']}; {'id': '233', 'type': 'expression_statement', 'children': ['234']}; {'id': '234', 'type': 'call', 'children': ['235', '238']}; {'id': '235', 'type': 'attribute', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '238', 'type': 'argument_list', 'children': ['239']}; {'id': '239', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '240', 'type': 'elif_clause', 'children': ['241', '246']}; {'id': '241', 'type': 'call', 'children': ['242', '243']}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '243', 'type': 'argument_list', 'children': ['244', '245']}; {'id': '244', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '246', 'type': 'block', 'children': ['247', '253', '289']}; {'id': '247', 'type': 'expression_statement', 'children': ['248']}; {'id': '248', 'type': 'assignment', 'children': ['249', '250']}; {'id': '249', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '250', 'type': 'attribute', 'children': ['251', '252']}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '253', 'type': 'if_statement', 'children': ['254', '260', '272']}; {'id': '254', 'type': 'call', 'children': ['255', '258']}; {'id': '255', 'type': 'attribute', 'children': ['256', '257']}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '257', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '258', 'type': 'argument_list', 'children': ['259']}; {'id': '259', 'type': 'string', 'children': [], 'value': "'ies'"}; {'id': '260', 'type': 'block', 'children': ['261']}; {'id': '261', 'type': 'expression_statement', 'children': ['262']}; {'id': '262', 'type': 'assignment', 'children': ['263', '264']}; {'id': '263', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '264', 'type': 'binary_operator', 'children': ['265', '271'], 'value': '+'}; {'id': '265', 'type': 'subscript', 'children': ['266', '267']}; {'id': '266', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '267', 'type': 'slice', 'children': ['268', '269']}; {'id': '268', 'type': 'colon', 'children': []}; {'id': '269', 'type': 'unary_operator', 'children': ['270'], 'value': '-'}; {'id': '270', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '271', 'type': 'string', 'children': [], 'value': "'y'"}; {'id': '272', 'type': 'elif_clause', 'children': ['273', '279']}; {'id': '273', 'type': 'call', 'children': ['274', '277']}; {'id': '274', 'type': 'attribute', 'children': ['275', '276']}; {'id': '275', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '276', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '277', 'type': 'argument_list', 'children': ['278']}; {'id': '278', 'type': 'string', 'children': [], 'value': "'s'"}; {'id': '279', 'type': 'block', 'children': ['280']}; {'id': '280', 'type': 'expression_statement', 'children': ['281']}; {'id': '281', 'type': 'assignment', 'children': ['282', '283']}; {'id': '282', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '283', 'type': 'subscript', 'children': ['284', '285']}; {'id': '284', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '285', 'type': 'slice', 'children': ['286', '287']}; {'id': '286', 'type': 'colon', 'children': []}; {'id': '287', 'type': 'unary_operator', 'children': ['288'], 'value': '-'}; {'id': '288', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '289', 'type': 'for_statement', 'children': ['290', '291', '292']}; {'id': '290', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '291', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '292', 'type': 'block', 'children': ['293', '304']}; {'id': '293', 'type': 'expression_statement', 'children': ['294']}; {'id': '294', 'type': 'assignment', 'children': ['295', '296']}; {'id': '295', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '296', 'type': 'call', 'children': ['297', '298']}; {'id': '297', 'type': 'identifier', 'children': [], 'value': 'json_struct_to_xml'}; {'id': '298', 'type': 'argument_list', 'children': ['299', '300', '301']}; {'id': '299', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '300', 'type': 'identifier', 'children': [], 'value': 'tag_name'}; {'id': '301', 'type': 'keyword_argument', 'children': ['302', '303']}; {'id': '302', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '303', 'type': 'identifier', 'children': [], 'value': 'custom_namespace'}; {'id': '304', 'type': 'if_statement', 'children': ['305', '308']}; {'id': '305', 'type': 'comparison_operator', 'children': ['306', '307'], 'value': 'is not'}; {'id': '306', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '307', 'type': 'None', 'children': []}; {'id': '308', 'type': 'block', 'children': ['309']}; {'id': '309', 'type': 'expression_statement', 'children': ['310']}; {'id': '310', 'type': 'call', 'children': ['311', '314']}; {'id': '311', 'type': 'attribute', 'children': ['312', '313']}; {'id': '312', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '313', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '314', 'type': 'argument_list', 'children': ['315']}; {'id': '315', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '316', 'type': 'elif_clause', 'children': ['317', '320']}; {'id': '317', 'type': 'comparison_operator', 'children': ['318', '319'], 'value': 'is'}; {'id': '318', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '319', 'type': 'None', 'children': []}; {'id': '320', 'type': 'block', 'children': ['321']}; {'id': '321', 'type': 'return_statement', 'children': ['322']}; {'id': '322', 'type': 'None', 'children': []}; {'id': '323', 'type': 'else_clause', 'children': ['324']}; {'id': '324', 'type': 'block', 'children': ['325']}; {'id': '325', 'type': 'raise_statement', 'children': ['326']}; {'id': '326', 'type': 'identifier', 'children': [], 'value': 'NotImplementedError'}; {'id': '327', 'type': 'return_statement', 'children': ['328']}; {'id': '328', 'type': 'identifier', 'children': [], 'value': 'root'}
Converts a Open511 JSON fragment to XML. Takes a dict deserialized from JSON, returns an lxml Element. This won't provide a conforming document if you pass in a full JSON document; it's for translating little fragments, and is mostly used internally.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fill'}; {'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': 'iterations'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '8', 'type': 'block', 'children': ['9', '15', '96']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'used_reactions'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'for_statement', 'children': ['16', '17', '21']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'iterations'}; {'id': '21', 'type': 'block', 'children': ['22', '36', '67', '83', '90']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'slim_optimize'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '33']}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'error_value'}; {'id': '32', 'type': 'None', 'children': []}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'gapfilling optimization failed'"}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'solution'}; {'id': '39', 'type': 'list_comprehension', 'children': ['40', '52', '57']}; {'id': '40', 'type': 'call', 'children': ['41', '48']}; {'id': '41', 'type': 'attribute', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'reactions'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'get_by_id'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'rxn_id'}; {'id': '52', 'type': 'for_in_clause', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'indicators'}; {'id': '57', 'type': 'if_clause', 'children': ['58']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '64'], 'value': '>'}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': '_get_primal'}; {'id': '63', 'type': 'argument_list', 'children': []}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'integer_threshold'}; {'id': '67', 'type': 'if_statement', 'children': ['68', '75']}; {'id': '68', 'type': 'not_operator', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'solution'}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'raise_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'concatenated_string', 'children': ['81', '82']}; {'id': '81', 'type': 'string', 'children': [], 'value': "'failed to validate gapfilled model, '"}; {'id': '82', 'type': 'string', 'children': [], 'value': "'try lowering the integer_threshold'"}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'used_reactions'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'solution'}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'update_costs'}; {'id': '95', 'type': 'argument_list', 'children': []}; {'id': '96', 'type': 'return_statement', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'used_reactions'}
Perform the gapfilling by iteratively solving the model, updating the costs and recording the used reactions. Parameters ---------- iterations : int The number of rounds of gapfilling to perform. For every iteration, the penalty for every used reaction increases linearly. This way, the algorithm is encouraged to search for alternative solutions which may include previously used reactions. I.e., with enough iterations pathways including 10 steps will eventually be reported even if the shortest pathway is a single reaction. Returns ------- iterable A list of lists where each element is a list reactions that were used to gapfill the model. Raises ------ RuntimeError If the model fails to be validated (i.e. the original model with the proposed reactions added, still cannot get the required flux through the objective).
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_composed_service_dict'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'service_spec'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '25', '43', '56']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'compose_dict'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'service_spec'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'plain_dict'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_apply_env_overrides'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '24']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'env_overrides_for_app_or_service'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'service_spec'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'compose_dict'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '36']}; {'id': '27', 'type': 'attribute', 'children': ['28', '35']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'compose_dict'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'setdefault'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'volumes'"}; {'id': '34', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_get_cp_volume_mount'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'service_spec'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '48']}; {'id': '45', 'type': 'subscript', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'compose_dict'}; {'id': '47', 'type': 'string', 'children': [], 'value': "'container_name'"}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'string', 'children': [], 'value': '"dusty_{}_1"'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'service_spec'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'compose_dict'}
This function returns a dictionary of the docker_compose specifications for one service. Currently, this is just the Dusty service spec with an additional volume mount to support Dusty's cp functionality.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'new_symbolic_buffer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '8', 'type': 'block', 'children': ['9', '18', '22', '35', '47', '72', '81', '112']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'label'"}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'avoid_collisions'}; {'id': '21', 'type': 'False', 'children': []}; {'id': '22', 'type': 'if_statement', 'children': ['23', '26']}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '25'], 'value': 'is'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27', '31']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '30', 'type': 'string', 'children': [], 'value': "'buffer'"}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'avoid_collisions'}; {'id': '34', 'type': 'True', 'children': []}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'taint'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44']}; {'id': '43', 'type': 'string', 'children': [], 'value': "'taint'"}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'frozenset'}; {'id': '46', 'type': 'argument_list', 'children': []}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'expr'}; {'id': '50', 'type': 'call', 'children': ['51', '56']}; {'id': '51', 'type': 'attribute', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '_constraints'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'new_array'}; {'id': '56', 'type': 'argument_list', 'children': ['57', '60', '63', '66', '69']}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'index_max'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'value_bits'}; {'id': '65', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'taint'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'taint'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'avoid_collisions'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'avoid_collisions'}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'call', 'children': ['74', '79']}; {'id': '74', 'type': 'attribute', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': '_input_symbols'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'expr'}; {'id': '81', 'type': 'if_statement', 'children': ['82', '89']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'string', 'children': [], 'value': "'cstring'"}; {'id': '88', 'type': 'False', 'children': []}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'for_statement', 'children': ['91', '92', '98']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'binary_operator', 'children': ['96', '97'], 'value': '-'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '97', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '98', 'type': 'block', 'children': ['99']}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'call', 'children': ['101', '106']}; {'id': '101', 'type': 'attribute', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': '_constraints'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '106', 'type': 'argument_list', 'children': ['107']}; {'id': '107', 'type': 'comparison_operator', 'children': ['108', '111'], 'value': '!='}; {'id': '108', 'type': 'subscript', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'expr'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '111', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '112', 'type': 'return_statement', 'children': ['113']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'expr'}
Create and return a symbolic buffer of length `nbytes`. The buffer is not written into State's memory; write it to the state's memory to introduce it into the program state. :param int nbytes: Length of the new buffer :param str label: (keyword arg only) The label to assign to the buffer :param bool cstring: (keyword arg only) Whether or not to enforce that the buffer is a cstring (i.e. no NULL bytes, except for the last byte). (bool) :param taint: Taint identifier of the new buffer :type taint: tuple or frozenset :return: :class:`~manticore.core.smtlib.expression.Expression` representing the buffer.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'render_to_string'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '30']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '9', 'type': 'string', 'children': [], 'value': "''"}; {'id': '10', 'type': 'for_statement', 'children': ['11', '14', '19']}; {'id': '11', 'type': 'pattern_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'value'}; {'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': 'items'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'augmented_assignment', 'children': ['22', '23'], 'value': '+='}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'{}={};'"}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'values'}
Render to cookie strings.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'activateCells'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'learn'}; {'id': '8', 'type': 'True', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '16', '22', '28', '34', '50', '57']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'prevActiveCells'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'activeCells'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'prevWinnerCells'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'winnerCells'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'activeCells'}; {'id': '27', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'winnerCells'}; {'id': '33', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'segToCol'}; {'id': '37', 'type': 'lambda', 'children': ['38', '40']}; {'id': '38', 'type': 'lambda_parameters', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'segment'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '47'], 'value': '/'}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'segment'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'cell'}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'cellsPerColumn'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'identity'}; {'id': '53', 'type': 'lambda', 'children': ['54', '56']}; {'id': '54', 'type': 'lambda_parameters', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '57', 'type': 'for_statement', 'children': ['58', '59', '72']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'columnData'}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'groupby2'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63', '64', '67', '68', '71']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'identity'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'activeSegments'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'segToCol'}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'matchingSegments'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'segToCol'}; {'id': '72', 'type': 'block', 'children': ['73', '81']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '80']}; {'id': '75', 'type': 'tuple_pattern', 'children': ['76', '77', '78', '79']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'column'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'columnActiveSegments'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'columnMatchingSegments'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'columnData'}; {'id': '81', 'type': 'if_statement', 'children': ['82', '85', '149']}; {'id': '82', 'type': 'comparison_operator', 'children': ['83', '84'], 'value': 'is not'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'activeColumns'}; {'id': '84', 'type': 'None', 'children': []}; {'id': '85', 'type': 'block', 'children': ['86']}; {'id': '86', 'type': 'if_statement', 'children': ['87', '90', '117']}; {'id': '87', 'type': 'comparison_operator', 'children': ['88', '89'], 'value': 'is not'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'columnActiveSegments'}; {'id': '89', 'type': 'None', 'children': []}; {'id': '90', 'type': 'block', 'children': ['91', '105', '111']}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'cellsToAdd'}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'activatePredictedColumn'}; {'id': '98', 'type': 'argument_list', 'children': ['99', '100', '101', '102', '103', '104']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'column'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'columnActiveSegments'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'columnMatchingSegments'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'prevActiveCells'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'prevWinnerCells'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'learn'}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'augmented_assignment', 'children': ['107', '110'], 'value': '+='}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'activeCells'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'cellsToAdd'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'augmented_assignment', 'children': ['113', '116'], 'value': '+='}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'winnerCells'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'cellsToAdd'}; {'id': '117', 'type': 'else_clause', 'children': ['118']}; {'id': '118', 'type': 'block', 'children': ['119', '134', '140']}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '124']}; {'id': '121', 'type': 'tuple_pattern', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'cellsToAdd'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'winnerCell'}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'burstColumn'}; {'id': '128', 'type': 'argument_list', 'children': ['129', '130', '131', '132', '133']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'column'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'columnMatchingSegments'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'prevActiveCells'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'prevWinnerCells'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'learn'}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'augmented_assignment', 'children': ['136', '139'], 'value': '+='}; {'id': '136', 'type': 'attribute', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'activeCells'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'cellsToAdd'}; {'id': '140', 'type': 'expression_statement', 'children': ['141']}; {'id': '141', 'type': 'call', 'children': ['142', '147']}; {'id': '142', 'type': 'attribute', 'children': ['143', '146']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'winnerCells'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'winnerCell'}; {'id': '149', 'type': 'else_clause', 'children': ['150']}; {'id': '150', 'type': 'block', 'children': ['151']}; {'id': '151', 'type': 'if_statement', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'learn'}; {'id': '153', 'type': 'block', 'children': ['154']}; {'id': '154', 'type': 'expression_statement', 'children': ['155']}; {'id': '155', 'type': 'call', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'punishPredictedColumn'}; {'id': '159', 'type': 'argument_list', 'children': ['160', '161', '162', '163', '164']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'column'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'columnActiveSegments'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'columnMatchingSegments'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'prevActiveCells'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'prevWinnerCells'}
Calculate the active cells, using the current active columns and dendrite segments. Grow and reinforce synapses. :param activeColumns: (iter) A sorted list of active column indices. :param learn: (bool) If true, reinforce / punish / grow synapses. **Pseudocode:** :: for each column if column is active and has active distal dendrite segments call activatePredictedColumn if column is active and doesn't have active distal dendrite segments call burstColumn if column is inactive and has matching distal dendrite segments call punishPredictedColumn
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'wait_for_job_to_start'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'single_master'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '6', 'type': 'block', 'children': ['7', '11']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '11', 'type': 'while_statement', 'children': ['12', '13']}; {'id': '12', 'type': 'True', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14', '106']}; {'id': '14', 'type': 'try_statement', 'children': ['15', '53']}; {'id': '15', 'type': 'block', 'children': ['16', '29']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '26'], 'value': '%'}; {'id': '25', 'type': 'string', 'children': [], 'value': '"http://%s:4646/v1/job/%s"'}; {'id': '26', 'type': 'tuple', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'single_master'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '45', '47']}; {'id': '30', 'type': 'boolean_operator', 'children': ['31', '36'], 'value': 'and'}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '=='}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '200'}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '44'], 'value': '=='}; {'id': '37', 'type': 'subscript', 'children': ['38', '43']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'string', 'children': [], 'value': '"Status"'}; {'id': '44', 'type': 'string', 'children': [], 'value': '"running"'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'break_statement', 'children': []}; {'id': '47', 'type': 'else_clause', 'children': ['48']}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'raise_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'except_clause', 'children': ['54']}; {'id': '54', 'type': 'block', 'children': ['55', '68', '79', '86']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'Log'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'subscript', 'children': ['62', '67']}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'exc_info'}; {'id': '66', 'type': 'argument_list', 'children': []}; {'id': '67', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'Log'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'binary_operator', 'children': ['75', '76'], 'value': '%'}; {'id': '75', 'type': 'string', 'children': [], 'value': '"Waiting for %s to come up... %s"'}; {'id': '76', 'type': 'tuple', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'job'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'i'}; {'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': 'time'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '86', 'type': 'if_statement', 'children': ['87', '90']}; {'id': '87', 'type': 'comparison_operator', 'children': ['88', '89'], 'value': '>'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '89', 'type': 'integer', 'children': [], 'value': '20'}; {'id': '90', 'type': 'block', 'children': ['91', '98']}; {'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': 'Log'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '96', 'type': 'argument_list', 'children': ['97']}; {'id': '97', 'type': 'string', 'children': [], 'value': '"Failed to start Nomad Cluster!"'}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '103', 'type': 'argument_list', 'children': ['104']}; {'id': '104', 'type': 'unary_operator', 'children': ['105'], 'value': '-'}; {'id': '105', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '109', 'type': 'binary_operator', 'children': ['110', '111'], 'value': '+'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '111', 'type': 'integer', 'children': [], 'value': '1'}
Wait for a Nomad job to start
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pascal'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '24', '46', '86']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'errors'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'is_positive_integer'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'tuple', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '24', 'type': 'for_statement', 'children': ['25', '26', '31']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '31', 'type': 'block', 'children': ['32', '39']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '38']}; {'id': '34', 'type': 'subscript', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '45']}; {'id': '41', 'type': 'subscript', 'children': ['42', '43', '44']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '49'], 'value': '>'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'for_statement', 'children': ['52', '53', '58']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'for_statement', 'children': ['60', '61', '66']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '65']}; {'id': '64', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '66', 'type': 'block', 'children': ['67']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '73']}; {'id': '69', 'type': 'subscript', 'children': ['70', '71', '72']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '73', 'type': 'binary_operator', 'children': ['74', '80'], 'value': '+'}; {'id': '74', 'type': 'subscript', 'children': ['75', '76', '79']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '-'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '78', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '80', 'type': 'subscript', 'children': ['81', '82', '83']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '83', 'type': 'binary_operator', 'children': ['84', '85'], 'value': '-'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '85', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '86', 'type': 'return_statement', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'result'}
Return Pascal matrix :param int n: size of the matrix .. doctest:: >>> from spectrum import pascal >>> pascal(6) array([[ 1., 1., 1., 1., 1., 1.], [ 1., 2., 3., 4., 5., 6.], [ 1., 3., 6., 10., 15., 21.], [ 1., 4., 10., 20., 35., 56.], [ 1., 5., 15., 35., 70., 126.], [ 1., 6., 21., 56., 126., 252.]]) .. todo:: use the symmetric property to improve computational time if needed
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_object'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'api_token'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '7', 'type': 'block', 'children': ['8', '20', '26']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'floating_ip'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '17']}; {'id': '14', 'type': 'keyword_argument', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'api_token'}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'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': 'floating_ip'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'floating_ip'}
Class method that will return a FloatingIP object by its IP. Args: api_token: str - token ip: str - floating ip address
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_file_environment_variables'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'file_params'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '42']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'param'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'file_params'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '21']}; {'id': '16', 'type': 'subscript', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'param'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '21', 'type': 'conditional_expression', 'children': ['22', '38', '41'], 'value': 'if'}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'DATA_MOUNT_POINT'}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'param'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'docker_path'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'rstrip'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'param'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '41', 'type': 'string', 'children': [], 'value': "''"}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'env'}
Return a dictionary of environment variables for the user container.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_reg_name'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'reg_id'}; {'id': '6', 'type': 'block', 'children': ['7', '21', '34', '49']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': '>='}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'reg_id'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'X86_REG_ENDING'}; {'id': '11', 'type': 'block', 'children': ['12', '19']}; {'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': 'logger'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': '"Trying to get register name for a non-register"'}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'None', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'cs_reg_name'}; {'id': '24', 'type': 'call', 'children': ['25', '32']}; {'id': '25', 'type': 'attribute', 'children': ['26', '31']}; {'id': '26', 'type': 'attribute', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'instruction'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'reg_name'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'reg_id'}; {'id': '34', 'type': 'if_statement', 'children': ['35', '46']}; {'id': '35', 'type': 'boolean_operator', 'children': ['36', '39'], 'value': 'or'}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': 'is'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'cs_reg_name'}; {'id': '38', 'type': 'None', 'children': []}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '45'], 'value': '=='}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'cs_reg_name'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '44', 'type': 'argument_list', 'children': []}; {'id': '45', 'type': 'string', 'children': [], 'value': "'(invalid)'"}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'return_statement', 'children': ['48']}; {'id': '48', 'type': 'None', 'children': []}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '58']}; {'id': '51', 'type': 'attribute', 'children': ['52', '57']}; {'id': '52', 'type': 'attribute', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': '_regfile'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '_alias'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'cs_reg_name'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'upper'}; {'id': '63', 'type': 'argument_list', 'children': []}
Translates a register ID from the disassembler object into the register name based on manticore's alias in the register file :param int reg_id: Register ID
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'save'}; {'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': 'kwargs'}; {'id': '9', 'type': 'block', 'children': ['10', '20', '53']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'rerank'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'rerank'"}; {'id': '19', 'type': 'True', 'children': []}; {'id': '20', 'type': 'if_statement', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'rerank'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'if_statement', 'children': ['24', '28', '35', '45']}; {'id': '24', 'type': 'not_operator', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'expression_statement', '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': '_process_new_rank_obj'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'elif_clause', 'children': ['36', '43']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '40'], 'value': '=='}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'rank'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_rank_at_load'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'pass_statement', 'children': []}; {'id': '45', 'type': 'else_clause', 'children': ['46']}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_process_moved_rank_obj'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '62']}; {'id': '55', 'type': 'attribute', 'children': ['56', '61']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'RankedModel'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'save'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '65']}; {'id': '63', 'type': 'list_splat', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '65', 'type': 'dictionary_splat', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
Overridden method that handles that re-ranking of objects and the integrity of the ``rank`` field. :param rerank: Added parameter, if True will rerank other objects based on the change in this save. Defaults to True.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find'}; {'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': 'path'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'Path'}; {'id': '9', 'type': 'block', 'children': ['10', '30', '34', '57']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '17']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15', '16']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'settings_attr'"}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'paths'}; {'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': 'settings'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'settings_attr'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'path_found'}; {'id': '33', 'type': 'None', 'children': []}; {'id': '34', 'type': 'for_statement', 'children': ['35', '36', '39']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'paths'}; {'id': '39', 'type': 'block', 'children': ['40', '46']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '45'], 'value': '/'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '52']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '51', 'type': 'argument_list', 'children': []}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'path_found'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'path_found'}
Find a file in the path. The file may exist in multiple paths. The last found file will be returned. :param path: The path to find :return: The absolute path to the file or None if not found
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'scale_image'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'in_fname'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'out_fname'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'max_width'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'max_height'}; {'id': '8', 'type': 'block', 'children': ['9', '22', '31', '39', '48', '57', '74', '84', '96', '108', '120', '136', '152', '160', '167']}; {'id': '9', 'type': 'try_statement', 'children': ['10', '16']}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'import_from_statement', 'children': ['12', '14']}; {'id': '12', 'type': 'dotted_name', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'PIL'}; {'id': '14', 'type': 'dotted_name', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '16', 'type': 'except_clause', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'ImportError'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'import_statement', 'children': ['20']}; {'id': '20', 'type': 'dotted_name', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'in_fname'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '36']}; {'id': '33', 'type': 'pattern_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'width_in'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'height_in'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'scale_w'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '/'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'max_width'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'width_in'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'scale_h'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '53'], 'value': '/'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'max_height'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'height_in'}; {'id': '57', 'type': 'if_statement', 'children': ['58', '63', '68']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '62'], 'value': '<='}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '61'], 'value': '*'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'height_in'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'scale_w'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'max_height'}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'scale_w'}; {'id': '68', 'type': 'else_clause', 'children': ['69']}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'scale_h'}; {'id': '74', 'type': 'if_statement', 'children': ['75', '82']}; {'id': '75', 'type': 'boolean_operator', 'children': ['76', '79'], 'value': 'and'}; {'id': '76', 'type': 'comparison_operator', 'children': ['77', '78'], 'value': '>='}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '78', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': '=='}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'in_fname'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'out_fname'}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'return_statement', 'children': []}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'width_sc'}; {'id': '87', 'type': 'call', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'binary_operator', 'children': ['94', '95'], 'value': '*'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'width_in'}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'height_sc'}; {'id': '99', 'type': 'call', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'binary_operator', 'children': ['106', '107'], 'value': '*'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'height_in'}; {'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': 'img'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'thumbnail'}; {'id': '113', 'type': 'argument_list', 'children': ['114', '117']}; {'id': '114', 'type': 'tuple', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'width_sc'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'height_sc'}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'ANTIALIAS'}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'thumb'}; {'id': '123', 'type': 'call', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'new'}; {'id': '127', 'type': 'argument_list', 'children': ['128', '129', '132']}; {'id': '128', 'type': 'string', 'children': [], 'value': "'RGB'"}; {'id': '129', 'type': 'tuple', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'max_width'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'max_height'}; {'id': '132', 'type': 'tuple', 'children': ['133', '134', '135']}; {'id': '133', 'type': 'integer', 'children': [], 'value': '255'}; {'id': '134', 'type': 'integer', 'children': [], 'value': '255'}; {'id': '135', 'type': 'integer', 'children': [], 'value': '255'}; {'id': '136', 'type': 'expression_statement', 'children': ['137']}; {'id': '137', 'type': 'assignment', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'pos_insert'}; {'id': '139', 'type': 'tuple', 'children': ['140', '146']}; {'id': '140', 'type': 'binary_operator', 'children': ['141', '145'], 'value': '//'}; {'id': '141', 'type': '()', 'children': ['142']}; {'id': '142', 'type': 'binary_operator', 'children': ['143', '144'], 'value': '-'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'max_width'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'width_sc'}; {'id': '145', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '146', 'type': 'binary_operator', 'children': ['147', '151'], 'value': '//'}; {'id': '147', 'type': '()', 'children': ['148']}; {'id': '148', 'type': 'binary_operator', 'children': ['149', '150'], 'value': '-'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'max_height'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'height_sc'}; {'id': '151', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '152', 'type': 'expression_statement', 'children': ['153']}; {'id': '153', 'type': 'call', 'children': ['154', '157']}; {'id': '154', 'type': 'attribute', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'thumb'}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'paste'}; {'id': '157', 'type': 'argument_list', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'pos_insert'}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'call', 'children': ['162', '165']}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'thumb'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'save'}; {'id': '165', 'type': 'argument_list', 'children': ['166']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'out_fname'}; {'id': '167', 'type': 'if_statement', 'children': ['168', '177']}; {'id': '168', 'type': 'call', 'children': ['169', '174']}; {'id': '169', 'type': 'attribute', 'children': ['170', '173']}; {'id': '170', 'type': 'attribute', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '174', 'type': 'argument_list', 'children': ['175', '176']}; {'id': '175', 'type': 'string', 'children': [], 'value': "'SKLEARN_DOC_OPTIPNG'"}; {'id': '176', 'type': 'False', 'children': []}; {'id': '177', 'type': 'block', 'children': ['178']}; {'id': '178', 'type': 'try_statement', 'children': ['179', '192']}; {'id': '179', 'type': 'block', 'children': ['180']}; {'id': '180', 'type': 'expression_statement', 'children': ['181']}; {'id': '181', 'type': 'call', 'children': ['182', '185']}; {'id': '182', 'type': 'attribute', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '185', 'type': 'argument_list', 'children': ['186']}; {'id': '186', 'type': 'list', 'children': ['187', '188', '189', '190', '191'], 'value': '["optipng", "-quiet", "-o", "9", out_fname]'}; {'id': '187', 'type': 'string', 'children': [], 'value': '"optipng"'}; {'id': '188', 'type': 'string', 'children': [], 'value': '"-quiet"'}; {'id': '189', 'type': 'string', 'children': [], 'value': '"-o"'}; {'id': '190', 'type': 'string', 'children': [], 'value': '"9"'}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'out_fname'}; {'id': '192', 'type': 'except_clause', 'children': ['193', '194']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '194', 'type': 'block', 'children': ['195']}; {'id': '195', 'type': 'expression_statement', 'children': ['196']}; {'id': '196', 'type': 'call', 'children': ['197', '200']}; {'id': '197', 'type': 'attribute', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'warnings'}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '200', 'type': 'argument_list', 'children': ['201']}; {'id': '201', 'type': 'string', 'children': [], 'value': "'Install optipng to reduce the size of the \\\n generated images'"}
Scales an image with the same aspect ratio centered in an image with a given max_width and max_height if in_fname == out_fname the image can only be scaled down
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_deserialize_uint'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '32'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'padding'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '14', 'type': 'block', 'children': ['15', '23', '39', '54']}; {'id': '15', 'type': 'assert_statement', 'children': ['16']}; {'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': 'data'}; {'id': '20', 'type': 'tuple', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'bytearray'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'Array'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ABI'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': '_readBE'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32', '33', '36']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'padding'}; {'id': '35', 'type': 'True', 'children': []}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ZEXTEND'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'value'}; {'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': 'identifier', 'children': [], 'value': 'nbytes'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'padding'}; {'id': '53', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'value'}
Read a `nbytes` bytes long big endian unsigned integer from `data` starting at `offset` :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data :param nbytes: number of bytes to read starting from least significant byte :rtype: int or Expression
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prune'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'removals'}; {'id': '8', 'type': 'block', 'children': ['9', '11', '22']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'string', 'children': [], 'value': '"Rule out var=value."'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '20']}; {'id': '13', 'type': 'attribute', 'children': ['14', '19']}; {'id': '14', 'type': 'subscript', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'curr_domains'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '22', 'type': 'if_statement', 'children': ['23', '26']}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '25'], 'value': 'is not'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'removals'}; {'id': '25', 'type': 'None', 'children': []}; {'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': 'removals'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'tuple', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'value'}
Rule out var=value.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'simple_flare_find'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16', '19', '22', '25']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'times'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'mags'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'smoothbinsize'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '97'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'flare_minsigma'}; {'id': '12', 'type': 'float', 'children': [], 'value': '4.0'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'flare_maxcadencediff'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '16', 'type': 'default_parameter', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'flare_mincadencepoints'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '19', 'type': 'default_parameter', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'magsarefluxes'}; {'id': '21', 'type': 'False', 'children': []}; {'id': '22', 'type': 'default_parameter', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'savgol_polyorder'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '25', 'type': 'dictionary_splat_pattern', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'savgol_kwargs'}; {'id': '27', 'type': 'block', 'children': ['28', '39', '62', '68', '74', '80', '91', '97', '111', '117', '151']}; {'id': '28', 'type': 'if_statement', 'children': ['29', '32']}; {'id': '29', 'type': 'comparison_operator', 'children': ['30', '31'], 'value': 'is'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '31', 'type': 'None', 'children': []}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '*'}; {'id': '37', 'type': 'float', 'children': [], 'value': '0.001'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'mags'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'finiteind'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '56'], 'value': '&'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '50'], 'value': '&'}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'times'}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'mags'}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'ftimes'}; {'id': '65', 'type': 'subscript', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'times'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'finiteind'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'fmags'}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'mags'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'finiteind'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'ferrs'}; {'id': '77', 'type': 'subscript', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'finiteind'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'smoothed'}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'savgol_filter'}; {'id': '85', 'type': 'argument_list', 'children': ['86', '87', '88', '89']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'fmags'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'smoothbinsize'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'savgol_polyorder'}; {'id': '89', 'type': 'dictionary_splat', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'savgol_kwargs'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'subtracted'}; {'id': '94', 'type': 'binary_operator', 'children': ['95', '96'], 'value': '-'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'fmags'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'smoothed'}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'series_mad'}; {'id': '100', 'type': 'call', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'median'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'call', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'abs'}; {'id': '109', 'type': 'argument_list', 'children': ['110']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'subtracted'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'series_stdev'}; {'id': '114', 'type': 'binary_operator', 'children': ['115', '116'], 'value': '*'}; {'id': '115', 'type': 'float', 'children': [], 'value': '1.483'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'series_mad'}; {'id': '117', 'type': 'if_statement', 'children': ['118', '119', '134']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'magsarefluxes'}; {'id': '119', 'type': 'block', 'children': ['120']}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'extind'}; {'id': '123', 'type': 'call', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '127', 'type': 'argument_list', 'children': ['128']}; {'id': '128', 'type': 'comparison_operator', 'children': ['129', '130'], 'value': '>'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'subtracted'}; {'id': '130', 'type': '()', 'children': ['131']}; {'id': '131', 'type': 'binary_operator', 'children': ['132', '133'], 'value': '*'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'flare_minsigma'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'series_stdev'}; {'id': '134', 'type': 'else_clause', 'children': ['135']}; {'id': '135', 'type': 'block', 'children': ['136']}; {'id': '136', 'type': 'expression_statement', 'children': ['137']}; {'id': '137', 'type': 'assignment', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'extind'}; {'id': '139', 'type': 'call', 'children': ['140', '143']}; {'id': '140', 'type': 'attribute', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '143', 'type': 'argument_list', 'children': ['144']}; {'id': '144', 'type': 'comparison_operator', 'children': ['145', '146'], 'value': '<'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'subtracted'}; {'id': '146', 'type': '()', 'children': ['147']}; {'id': '147', 'type': 'binary_operator', 'children': ['148', '150'], 'value': '*'}; {'id': '148', 'type': 'unary_operator', 'children': ['149'], 'value': '-'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'flare_minsigma'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'series_stdev'}; {'id': '151', 'type': 'if_statement', 'children': ['152', '157']}; {'id': '152', 'type': 'boolean_operator', 'children': ['153', '154'], 'value': 'and'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'extind'}; {'id': '154', 'type': 'subscript', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'extind'}; {'id': '156', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '157', 'type': 'block', 'children': ['158', '164', '168']}; {'id': '158', 'type': 'expression_statement', 'children': ['159']}; {'id': '159', 'type': 'assignment', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'extrema_indices'}; {'id': '161', 'type': 'subscript', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'extind'}; {'id': '163', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '164', 'type': 'expression_statement', 'children': ['165']}; {'id': '165', 'type': 'assignment', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'flaregroups'}; {'id': '167', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '168', 'type': 'for_statement', 'children': ['169', '172', '176']}; {'id': '169', 'type': 'pattern_list', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'extrema_index'}; {'id': '172', 'type': 'call', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '174', 'type': 'argument_list', 'children': ['175']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'extrema_indices'}; {'id': '176', 'type': 'block', 'children': ['177']}; {'id': '177', 'type': 'pass_statement', 'children': []}
This finds flares in time series using the method in Walkowicz+ 2011. FIXME: finish this. Parameters ---------- times,mags,errs : np.array The input time-series to find flares in. smoothbinsize : int The number of consecutive light curve points to smooth over in the time series using a Savitsky-Golay filter. The smoothed light curve is then subtracted from the actual light curve to remove trends that potentially last `smoothbinsize` light curve points. The default value is chosen as ~6.5 hours (97 x 4 minute cadence for HATNet/HATSouth). flare_minsigma : float The minimum sigma above the median LC level to designate points as belonging to possible flares. flare_maxcadencediff : int The maximum number of light curve points apart each possible flare event measurement is allowed to be. If this is 1, then we'll look for consecutive measurements. flare_mincadencepoints : int The minimum number of light curve points (each `flare_maxcadencediff` points apart) required that are at least `flare_minsigma` above the median light curve level to call an event a flare. magsarefluxes: bool If True, indicates that mags is actually an array of fluxes. savgol_polyorder: int The polynomial order of the function used by the Savitsky-Golay filter. savgol_kwargs : extra kwargs Any remaining keyword arguments are passed directly to the `savgol_filter` function from `scipy.signal`. Returns ------- (nflares, flare_indices) : tuple Returns the total number of flares found and their time-indices (start, end) as tuples.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_microcanonical_average_spanning_cluster'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'has_spanning_cluster'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '6', 'type': 'block', 'children': ['7', '9', '15', '21', '34', '49', '80']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'r'}; {'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': 'dict'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'has_spanning_cluster'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'has_spanning_cluster'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '39']}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '38', 'type': 'string', 'children': [], 'value': "'spanning_cluster'"}; {'id': '39', 'type': '()', 'children': ['40']}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '45'], 'value': '/'}; {'id': '41', 'type': '()', 'children': ['42']}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '+'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '+'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '54']}; {'id': '51', 'type': 'subscript', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '53', 'type': 'string', 'children': [], 'value': "'spanning_cluster_ci'"}; {'id': '54', 'type': 'call', 'children': ['55', '62']}; {'id': '55', 'type': 'attribute', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'scipy'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'beta'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'ppf'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '72', '75']}; {'id': '63', 'type': 'list', 'children': ['64', '67'], 'value': '[alpha / 2, 1 - alpha / 2]'}; {'id': '64', 'type': 'binary_operator', 'children': ['65', '66'], 'value': '/'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '-'}; {'id': '68', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '69', 'type': 'binary_operator', 'children': ['70', '71'], 'value': '/'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '71', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '74'], 'value': '+'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '74', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '79'], 'value': '+'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '-'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'runs'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'ret'}
r''' Compute the average number of runs that have a spanning cluster Helper function for :func:`microcanonical_averages` Parameters ---------- has_spanning_cluster : 1-D :py:class:`numpy.ndarray` of bool Each entry is the ``has_spanning_cluster`` field of the output of :func:`sample_states`: An entry is ``True`` if there is a spanning cluster in that respective run, and ``False`` otherwise. alpha : float Significance level. Returns ------- ret : dict Spanning cluster statistics ret['spanning_cluster'] : float The average relative number (Binomial proportion) of runs that have a spanning cluster. This is the Bayesian point estimate of the posterior mean, with a uniform prior. ret['spanning_cluster_ci'] : 1-D :py:class:`numpy.ndarray` of float, size 2 The lower and upper bounds of the Binomial proportion confidence interval with uniform prior. See Also -------- sample_states : spanning cluster detection microcanonical_averages : spanning cluster statistics Notes ----- Averages and confidence intervals for Binomial proportions As Cameron [8]_ puts it, the normal approximation to the confidence interval for a Binomial proportion :math:`p` "suffers a *systematic* decline in performance (...) towards extreme values of :math:`p` near :math:`0` and :math:`1`, generating binomial [confidence intervals] with effective coverage far below the desired level." (see also References [6]_ and [7]_). A different approach to quantifying uncertainty is Bayesian inference. [5]_ For :math:`n` independent Bernoulli trails with common success probability :math:`p`, the *likelihood* to have :math:`k` successes given :math:`p` is the binomial distribution .. math:: P(k|p) = \binom{n}{k} p^k (1-p)^{n-k} \equiv B(a,b), where :math:`B(a, b)` is the *Beta distribution* with parameters :math:`a = k + 1` and :math:`b = n - k + 1`. Assuming a uniform prior :math:`P(p) = 1`, the *posterior* is [5]_ .. math:: P(p|k) = P(k|p)=B(a,b). A point estimate is the posterior mean .. math:: \bar{p} = \frac{k+1}{n+2} with the :math:`1 - \alpha` credible interval :math:`(p_l, p_u)` given by .. math:: \int_0^{p_l} dp B(a,b) = \int_{p_u}^1 dp B(a,b) = \frac{\alpha}{2}. References ---------- .. [5] Wasserman, L. All of Statistics (Springer New York, 2004), `doi:10.1007/978-0-387-21736-9 <http://dx.doi.org/10.1007/978-0-387-21736-9>`_. .. [6] DasGupta, A., Cai, T. T. & Brown, L. D. Interval Estimation for a Binomial Proportion. Statistical Science 16, 101-133 (2001). `doi:10.1214/ss/1009213286 <http://dx.doi.org/10.1214/ss/1009213286>`_. .. [7] Agresti, A. & Coull, B. A. Approximate is Better than "Exact" for Interval Estimation of Binomial Proportions. The American Statistician 52, 119-126 (1998), `doi:10.2307/2685469 <http://dx.doi.org/10.2307/2685469>`_. .. [8] Cameron, E. On the Estimation of Confidence Intervals for Binomial Population Proportions in Astronomy: The Simplicity and Superiority of the Bayesian Approach. Publications of the Astronomical Society of Australia 28, 128-139 (2011), `doi:10.1071/as10046 <http://dx.doi.org/10.1071/as10046>`_.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'BSF'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '7', 'type': 'block', 'children': ['8', '16', '29', '33', '76', '84']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '19', 'type': 'comparison_operator', 'children': ['20', '28'], 'value': '=='}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'EXTRACT'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26', '27']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'for_statement', 'children': ['34', '35', '42']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'pos'}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '42', 'type': 'block', 'children': ['43', '57']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'ITEBV'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '54', '55', '56']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'pos'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'OR'}; {'id': '64', 'type': 'argument_list', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '75'], 'value': '=='}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'EXTRACT'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '73', '74']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'pos'}; {'id': '74', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '75', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'ZF'}; {'id': '81', 'type': 'comparison_operator', 'children': ['82', '83'], 'value': '=='}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '83', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'ITEBV'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '98', '101', '106']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'ZF'}; {'id': '101', 'type': 'call', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '105', 'type': 'argument_list', 'children': []}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'res'}
Bit scan forward. Searches the source operand (second operand) for the least significant set bit (1 bit). If a least significant 1 bit is found, its bit index is stored in the destination operand (first operand). The source operand can be a register or a memory location; the destination operand is a register. The bit index is an unsigned offset from bit 0 of the source operand. If the contents source operand are 0, the contents of the destination operand is undefined:: IF SRC = 0 THEN ZF = 1; DEST is undefined; ELSE ZF = 0; temp = 0; WHILE Bit(SRC, temp) = 0 DO temp = temp + 1; DEST = temp; OD; FI; :param cpu: current CPU. :param dest: destination operand. :param src: source operand.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rename'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'await', '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': '_client'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'rename_conversation'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'hangouts_pb2'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'RenameConversationRequest'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '30', '33']}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'request_header'}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get_request_header'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'new_name'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'event_request_header'}; {'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': '_get_event_request_header'}; {'id': '39', 'type': 'argument_list', 'children': []}
Rename this conversation. Hangouts only officially supports renaming group conversations, so custom names for one-to-one conversations may or may not appear in all first party clients. Args: name (str): New name. Raises: .NetworkError: If conversation cannot be renamed.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assume_localhost'}; {'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', '13']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'attribute', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'genv'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'host_string'}; {'id': '13', 'type': 'block', 'children': ['14', '22', '31']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', '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': 'genv'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'host_string'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'localhost'"}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'genv'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'hosts'}; {'id': '29', 'type': 'list', 'children': ['30'], 'value': "['localhost']"}; {'id': '30', 'type': 'string', 'children': [], 'value': "'localhost'"}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '38']}; {'id': '33', 'type': 'attribute', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'genv'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'getpass'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'getuser'}; {'id': '42', 'type': 'argument_list', 'children': []}
Sets connection parameters to localhost, if not set already.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_BYTES_TO_BITS'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12', '26', '73']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'the_table'}; {'id': '8', 'type': 'binary_operator', 'children': ['9', '10'], 'value': '*'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '256'}; {'id': '10', 'type': 'list', 'children': ['11'], 'value': '[None]'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'bits_per_byte'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '24']}; {'id': '21', 'type': 'integer', 'children': [], 'value': '7'}; {'id': '22', 'type': 'unary_operator', 'children': ['23'], 'value': '-'}; {'id': '23', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '24', 'type': 'unary_operator', 'children': ['25'], 'value': '-'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '26', 'type': 'for_statement', 'children': ['27', '28', '32']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'integer', 'children': [], 'value': '256'}; {'id': '32', 'type': 'block', 'children': ['33', '37', '44', '62']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '*'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '42', 'type': 'list', 'children': ['43'], 'value': '[None]'}; {'id': '43', 'type': 'None', 'children': []}; {'id': '44', 'type': 'for_statement', 'children': ['45', '46', '47']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'bits_per_byte'}; {'id': '47', 'type': 'block', 'children': ['48', '58']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '53']}; {'id': '50', 'type': 'subscript', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'01'"}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '57'], 'value': '&'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'augmented_assignment', 'children': ['60', '61'], 'value': '>>='}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '67']}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'the_table'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'string', 'children': [], 'value': "''"}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '73', 'type': 'return_statement', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'the_table'}
Generate a table to convert a whole byte to binary. This code was taken from the Python Cookbook, 2nd edition - O'Reilly.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_readable'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '6', 'type': 'block', 'children': ['7', '25']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '13']}; {'id': '9', 'type': 'pattern_list', 'children': ['10', '11', '12']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'rlist'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'wlist'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'xlist'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '22', '23', '24']}; {'id': '18', 'type': 'list', 'children': ['19'], 'value': '[self._stdout]'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_stdout'}; {'id': '22', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '23', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '25', 'type': 'return_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'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': 'rlist'}
Poll ``self.stdout`` and return True if it is readable. :param float timeout: seconds to wait I/O :return: True if readable, else False :rtype: boolean
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_outgoing_sequence_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', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '9', 'type': 'argument_list', 'children': ['10']}; {'id': '10', 'type': 'list_comprehension', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '14', 'type': 'for_in_clause', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'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': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'outgoing_sequence_flows_by_id'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '25', 'type': 'argument_list', 'children': []}
Returns a list of the names of outgoing sequences. Some may be None.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_autocov'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '5', 'type': 'dictionary_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '7', 'type': 'block', 'children': ['8', '18', '29', '40', '46']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'debias'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'debias'"}; {'id': '17', 'type': 'True', 'children': []}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'axis'"}; {'id': '27', 'type': 'unary_operator', 'children': ['28'], 'value': '-'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'debias'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': '_remove_bias'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '45']}; {'id': '42', 'type': 'subscript', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'debias'"}; {'id': '45', 'type': 'False', 'children': []}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '_crosscov'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51', '52']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '52', 'type': 'dictionary_splat', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
Returns the autocovariance of signal s at all lags. Adheres to the definition sxx[k] = E{S[n]S[n+k]} = cov{S[n],S[n+k]} where E{} is the expectation operator, and S is a zero mean process
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_scalingip'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '6', 'type': 'block', 'children': ['7', '18', '27', '36', '46', '54', '58', '100', '113', '120']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'LOG'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14', '17']}; {'id': '13', 'type': 'string', 'children': [], 'value': "'create_scalingip for tenant %s and body %s'"}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'tenant_id'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'network_id'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'scaling_network_id'"}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'scaling_ip_address'"}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'requested_ports'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'ports'"}; {'id': '45', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'network'}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': '_get_network'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'network_id'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'port_fixed_ips'}; {'id': '57', 'type': 'dictionary', 'children': []}; {'id': '58', 'type': 'for_statement', 'children': ['59', '60', '61']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'req_port'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'requested_ports'}; {'id': '61', 'type': 'block', 'children': ['62', '72', '86']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_get_port'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'req_port'}; {'id': '71', 'type': 'string', 'children': [], 'value': "'port_id'"}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'assignment', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'fixed_ip'}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_get_fixed_ip'}; {'id': '77', 'type': 'argument_list', 'children': ['78', '79', '85']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'req_port'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'string', 'children': [], 'value': "'fixed_ip_address'"}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '93']}; {'id': '88', 'type': 'subscript', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'port_fixed_ips'}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '93', 'type': 'dictionary', 'children': ['94', '97']}; {'id': '94', 'type': 'pair', 'children': ['95', '96']}; {'id': '95', 'type': 'string', 'children': [], 'value': '"port"'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '97', 'type': 'pair', 'children': ['98', '99']}; {'id': '98', 'type': 'string', 'children': [], 'value': '"fixed_ip"'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'fixed_ip'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'scip'}; {'id': '103', 'type': 'call', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': '_allocate_ip'}; {'id': '105', 'type': 'argument_list', 'children': ['106', '107', '108', '109', '110']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'network'}; {'id': '108', 'type': 'None', 'children': []}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'ip_types'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'SCALING'}; {'id': '113', 'type': 'expression_statement', 'children': ['114']}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': '_create_flip'}; {'id': '116', 'type': 'argument_list', 'children': ['117', '118', '119']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'scip'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'port_fixed_ips'}; {'id': '120', 'type': 'return_statement', 'children': ['121']}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': '_make_scaling_ip_dict'}; {'id': '125', 'type': 'argument_list', 'children': ['126']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'scip'}
Allocate or reallocate a scaling IP. :param context: neutron api request context. :param content: dictionary describing the scaling ip, with keys as listed in the RESOURCE_ATTRIBUTE_MAP object in neutron/api/v2/attributes.py. All keys will be populated. :returns: Dictionary containing details for the new scaling IP. If values are declared in the fields parameter, then only those keys will be present.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'main'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '9', '20', '33', '56', '76', '96', '104', '130']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'Validate a CSV data file.'"}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'argparse'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ArgumentParser'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'description'}; {'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': 'parser'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27', '30']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'file'"}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'metavar'}; {'id': '29', 'type': 'string', 'children': [], 'value': "'FILE'"}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'a file to be validated'"}; {'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': 'add_argument'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40', '41', '44', '47', '50', '53']}; {'id': '39', 'type': 'string', 'children': [], 'value': "'-l'"}; {'id': '40', 'type': 'string', 'children': [], 'value': "'--limit'"}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '43', 'type': 'string', 'children': [], 'value': "'limit'"}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '49', 'type': 'string', 'children': [], 'value': "'store'"}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '52', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'limit the number of problems reported'"}; {'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': 'parser'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63', '64', '67', '70', '73']}; {'id': '62', 'type': 'string', 'children': [], 'value': "'-s'"}; {'id': '63', 'type': 'string', 'children': [], 'value': "'--summarize'"}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'summarize'"}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '69', 'type': 'string', 'children': [], 'value': "'store_true'"}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '72', 'type': 'False', 'children': []}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '75', 'type': 'string', 'children': [], 'value': "'output only a summary of the different types of problem found'"}; {'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': 'parser'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '83', '84', '87', '90', '93']}; {'id': '82', 'type': 'string', 'children': [], 'value': "'-e'"}; {'id': '83', 'type': 'string', 'children': [], 'value': "'--report-unexpected-exceptions'"}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '86', 'type': 'string', 'children': [], 'value': "'report_unexpected_exceptions'"}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '89', 'type': 'string', 'children': [], 'value': "'store_true'"}; {'id': '90', 'type': 'keyword_argument', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '92', 'type': 'False', 'children': []}; {'id': '93', 'type': 'keyword_argument', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '95', 'type': 'string', 'children': [], 'value': "'report any unexpected exceptions as problems'"}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'parse_args'}; {'id': '103', 'type': 'argument_list', 'children': []}; {'id': '104', 'type': 'if_statement', 'children': ['105', '116']}; {'id': '105', 'type': 'not_operator', 'children': ['106']}; {'id': '106', 'type': 'call', 'children': ['107', '112']}; {'id': '107', 'type': 'attribute', 'children': ['108', '111']}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '116', 'type': 'block', 'children': ['117', '123']}; {'id': '117', 'type': 'print_statement', 'children': ['118']}; {'id': '118', 'type': 'binary_operator', 'children': ['119', '120'], 'value': '%'}; {'id': '119', 'type': 'string', 'children': [], 'value': "'%s is not a file'"}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '123', 'type': 'expression_statement', 'children': ['124']}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '130', 'type': 'with_statement', 'children': ['131', '143']}; {'id': '131', 'type': 'with_clause', 'children': ['132']}; {'id': '132', 'type': 'with_item', 'children': ['133']}; {'id': '133', 'type': 'as_pattern', 'children': ['134', '141']}; {'id': '134', 'type': 'call', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '136', 'type': 'argument_list', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '140', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '141', 'type': 'as_pattern_target', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '143', 'type': 'block', 'children': ['144', '156', '162', '189', '207']}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'assignment', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '147', 'type': 'call', 'children': ['148', '151']}; {'id': '148', 'type': 'attribute', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'csv'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'reader'}; {'id': '151', 'type': 'argument_list', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '153', 'type': 'keyword_argument', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'delimiter'}; {'id': '155', 'type': 'string', 'children': [], 'value': "'\\t'"}; {'id': '156', 'type': 'expression_statement', 'children': ['157']}; {'id': '157', 'type': 'assignment', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'validator'}; {'id': '159', 'type': 'call', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'create_validator'}; {'id': '161', 'type': 'argument_list', 'children': []}; {'id': '162', 'type': 'expression_statement', 'children': ['163']}; {'id': '163', 'type': 'assignment', 'children': ['164', '165']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '165', 'type': 'call', 'children': ['166', '169']}; {'id': '166', 'type': 'attribute', 'children': ['167', '168']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'validator'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '169', 'type': 'argument_list', 'children': ['170', '171', '176', '181']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '171', 'type': 'keyword_argument', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '173', 'type': 'attribute', 'children': ['174', '175']}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '176', 'type': 'keyword_argument', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'report_unexpected_exceptions'}; {'id': '178', 'type': 'attribute', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'report_unexpected_exceptions'}; {'id': '181', 'type': 'keyword_argument', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '183', 'type': 'dictionary', 'children': ['184']}; {'id': '184', 'type': 'pair', 'children': ['185', '186']}; {'id': '185', 'type': 'string', 'children': [], 'value': "'file'"}; {'id': '186', 'type': 'attribute', 'children': ['187', '188']}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '189', 'type': 'expression_statement', 'children': ['190']}; {'id': '190', 'type': 'call', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'write_problems'}; {'id': '192', 'type': 'argument_list', 'children': ['193', '194', '197', '202']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '194', 'type': 'attribute', 'children': ['195', '196']}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '197', 'type': 'keyword_argument', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '199', 'type': 'attribute', 'children': ['200', '201']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'summarize'}; {'id': '202', 'type': 'keyword_argument', 'children': ['203', '204']}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '204', 'type': 'attribute', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '207', 'type': 'if_statement', 'children': ['208', '209', '217']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '209', 'type': 'block', 'children': ['210']}; {'id': '210', 'type': 'expression_statement', 'children': ['211']}; {'id': '211', 'type': 'call', 'children': ['212', '215']}; {'id': '212', 'type': 'attribute', 'children': ['213', '214']}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '215', 'type': 'argument_list', 'children': ['216']}; {'id': '216', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '217', 'type': 'else_clause', 'children': ['218']}; {'id': '218', 'type': 'block', 'children': ['219']}; {'id': '219', 'type': 'expression_statement', 'children': ['220']}; {'id': '220', 'type': 'call', 'children': ['221', '224']}; {'id': '221', 'type': 'attribute', 'children': ['222', '223']}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '223', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '224', 'type': 'argument_list', 'children': ['225']}; {'id': '225', 'type': 'integer', 'children': [], 'value': '0'}
Main function.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'functional'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '41']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_model'}; {'id': '10', 'type': 'block', 'children': ['11', '22']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '16']}; {'id': '13', 'type': 'pattern_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'parse_gpr'}; {'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': 'gene_reaction_rule'}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'eval_gpr'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '27', 'type': 'set_comprehension', 'children': ['28', '31', '36']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'gene'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '31', 'type': 'for_in_clause', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'gene'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'genes'}; {'id': '36', 'type': 'if_clause', 'children': ['37']}; {'id': '37', 'type': 'not_operator', 'children': ['38']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'gene'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'functional'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'True', 'children': []}
All required enzymes for reaction are functional. Returns ------- bool True if the gene-protein-reaction (GPR) rule is fulfilled for this reaction, or if reaction is not associated to a model, otherwise False.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_canonical_headers'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '21', '33', '43', '68', '72', '151', '155', '159', '201', '210']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'default_include_headers'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '24', 'type': 'list_comprehension', 'children': ['25', '30']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'for_in_clause', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '36', 'type': 'call', 'children': ['37', '42']}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': 'not in'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'host'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '53']}; {'id': '50', 'type': 'subscript', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '52', 'type': 'string', 'children': [], 'value': "'host'"}; {'id': '53', 'type': 'subscript', 'children': ['54', '67']}; {'id': '54', 'type': 'call', 'children': ['55', '65']}; {'id': '55', 'type': 'attribute', 'children': ['56', '64']}; {'id': '56', 'type': 'attribute', 'children': ['57', '63']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'urlparse'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'netloc'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'string', 'children': [], 'value': "':'"}; {'id': '67', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'cano_headers_dict'}; {'id': '71', 'type': 'dictionary', 'children': []}; {'id': '72', 'type': 'for_statement', 'children': ['73', '76', '81']}; {'id': '73', 'type': 'pattern_list', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '80', 'type': 'argument_list', 'children': []}; {'id': '81', 'type': 'block', 'children': ['82', '94', '107']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '85', 'type': 'call', 'children': ['86', '93']}; {'id': '86', 'type': 'attribute', 'children': ['87', '92']}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '91', 'type': 'argument_list', 'children': []}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '93', 'type': 'argument_list', 'children': []}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '97', 'type': 'call', 'children': ['98', '106']}; {'id': '98', 'type': 'attribute', 'children': ['99', '105']}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'amz_norm_whitespace'}; {'id': '103', 'type': 'argument_list', 'children': ['104']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '106', 'type': 'argument_list', 'children': []}; {'id': '107', 'type': 'if_statement', 'children': ['108', '133']}; {'id': '108', 'type': '()', 'children': ['109']}; {'id': '109', 'type': 'boolean_operator', 'children': ['110', '117'], 'value': 'or'}; {'id': '110', 'type': 'boolean_operator', 'children': ['111', '114'], 'value': 'or'}; {'id': '111', 'type': 'comparison_operator', 'children': ['112', '113'], 'value': 'in'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '114', 'type': 'comparison_operator', 'children': ['115', '116'], 'value': 'in'}; {'id': '115', 'type': 'string', 'children': [], 'value': "'*'"}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '117', 'type': '()', 'children': ['118']}; {'id': '118', 'type': 'boolean_operator', 'children': ['119', '129'], 'value': 'and'}; {'id': '119', 'type': 'boolean_operator', 'children': ['120', '123'], 'value': 'and'}; {'id': '120', 'type': 'comparison_operator', 'children': ['121', '122'], 'value': 'in'}; {'id': '121', 'type': 'string', 'children': [], 'value': "'x-amz-*'"}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'include'}; {'id': '123', 'type': 'call', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '127', 'type': 'argument_list', 'children': ['128']}; {'id': '128', 'type': 'string', 'children': [], 'value': "'x-amz-'"}; {'id': '129', 'type': 'not_operator', 'children': ['130']}; {'id': '130', 'type': 'comparison_operator', 'children': ['131', '132'], 'value': '=='}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '132', 'type': 'string', 'children': [], 'value': "'x-amz-client-context'"}; {'id': '133', 'type': 'block', 'children': ['134', '144']}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'assignment', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '137', 'type': 'call', 'children': ['138', '141']}; {'id': '138', 'type': 'attribute', 'children': ['139', '140']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'cano_headers_dict'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'setdefault'}; {'id': '141', 'type': 'argument_list', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '143', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'call', 'children': ['146', '149']}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '149', 'type': 'argument_list', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'assignment', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'cano_headers'}; {'id': '154', 'type': 'string', 'children': [], 'value': "''"}; {'id': '155', 'type': 'expression_statement', 'children': ['156']}; {'id': '156', 'type': 'assignment', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'signed_headers_list'}; {'id': '158', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '159', 'type': 'for_statement', 'children': ['160', '161', '165']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '161', 'type': 'call', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'cano_headers_dict'}; {'id': '165', 'type': 'block', 'children': ['166', '172', '184', '194']}; {'id': '166', 'type': 'expression_statement', 'children': ['167']}; {'id': '167', 'type': 'assignment', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '169', 'type': 'subscript', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'cano_headers_dict'}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '172', 'type': 'expression_statement', 'children': ['173']}; {'id': '173', 'type': 'assignment', 'children': ['174', '175']}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'string', 'children': [], 'value': "','"}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '179', 'type': 'argument_list', 'children': ['180']}; {'id': '180', 'type': 'call', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '182', 'type': 'argument_list', 'children': ['183']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '184', 'type': 'expression_statement', 'children': ['185']}; {'id': '185', 'type': 'augmented_assignment', 'children': ['186', '187'], 'value': '+='}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'cano_headers'}; {'id': '187', 'type': 'call', 'children': ['188', '191']}; {'id': '188', 'type': 'attribute', 'children': ['189', '190']}; {'id': '189', 'type': 'string', 'children': [], 'value': "'{}:{}\\n'"}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '191', 'type': 'argument_list', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '194', 'type': 'expression_statement', 'children': ['195']}; {'id': '195', 'type': 'call', 'children': ['196', '199']}; {'id': '196', 'type': 'attribute', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'signed_headers_list'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '199', 'type': 'argument_list', 'children': ['200']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'hdr'}; {'id': '201', 'type': 'expression_statement', 'children': ['202']}; {'id': '202', 'type': 'assignment', 'children': ['203', '204']}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'signed_headers'}; {'id': '204', 'type': 'call', 'children': ['205', '208']}; {'id': '205', 'type': 'attribute', 'children': ['206', '207']}; {'id': '206', 'type': 'string', 'children': [], 'value': "';'"}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '208', 'type': 'argument_list', 'children': ['209']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'signed_headers_list'}; {'id': '210', 'type': 'return_statement', 'children': ['211']}; {'id': '211', 'type': 'tuple', 'children': ['212', '213']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'cano_headers'}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'signed_headers'}
Generate the Canonical Headers section of the Canonical Request. Return the Canonical Headers and the Signed Headers strs as a tuple (canonical_headers, signed_headers). req -- Requests PreparedRequest object include -- List of headers to include in the canonical and signed headers. It's primarily included to allow testing against specific examples from Amazon. If omitted or None it includes host, content-type and any header starting 'x-amz-' except for x-amz-client context, which appears to break mobile analytics auth if included. Except for the x-amz-client-context exclusion these defaults are per the AWS documentation.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_course_data_sharing_consent'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer_uuid'}; {'id': '7', 'type': 'block', 'children': ['8', '18']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'DataSharingConsent'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'apps'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'get_model'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'consent'"}; {'id': '17', 'type': 'string', 'children': [], 'value': "'DataSharingConsent'"}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'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': 'DataSharingConsent'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'proxied_get'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '29', '32']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '32', 'type': 'keyword_argument', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer__uuid'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer_uuid'}
Get the data sharing consent object associated with a certain user of a customer for a course. :param username: The user that grants consent. :param course_id: The course for which consent is granted. :param enterprise_customer_uuid: The consent requester. :return: The data sharing consent object
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cliques'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'threshold'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '8', 'type': 'block', 'children': ['9', '13', '55']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'cliques'}; {'id': '12', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '13', 'type': 'for_statement', 'children': ['14', '15', '18']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '18', 'type': 'block', 'children': ['19', '29']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'clique'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '36']}; {'id': '30', 'type': 'comparison_operator', 'children': ['31', '35'], 'value': '>='}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'threshold'}; {'id': '36', 'type': 'block', 'children': ['37', '43']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': 'not in'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'cliques'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'cliques'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'cliques'}
Returns all the cliques in the graph of at least the given size.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_ensure_regexp'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '15', '56']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'markers'}; {'id': '10', 'type': 'string', 'children': [], 'value': '\'(+~"\\\'=[%:?!*^|&-,;/\\\\\''}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '14', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '15', 'type': 'while_statement', 'children': ['16', '17']}; {'id': '16', 'type': 'True', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '22', '31', '39', '46']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'augmented_assignment', 'children': ['20', '21'], 'value': '+='}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '21', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '22', 'type': 'if_statement', 'children': ['23', '28']}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '27'], 'value': '<'}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '26'], 'value': '-'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'True', 'children': []}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '34', 'type': 'subscript', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '-'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': 'in'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'markers'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'True', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '54']}; {'id': '47', 'type': 'boolean_operator', 'children': ['48', '51'], 'value': 'and'}; {'id': '48', 'type': 'comparison_operator', 'children': ['49', '50'], 'value': '!='}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '50', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '51', 'type': 'comparison_operator', 'children': ['52', '53'], 'value': '!='}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '53', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'break_statement', 'children': []}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'False', 'children': []}
returns True if regexp starts at n else returns False checks whether it is not a division
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'record_make_all_subfields_volatile'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'for_statement', 'children': ['7', '8', '13']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '12', 'type': 'argument_list', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'for_statement', 'children': ['15', '18', '24']}; {'id': '15', 'type': 'pattern_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'field_position'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '24', 'type': 'block', 'children': ['25']}; {'id': '25', 'type': 'for_statement', 'children': ['26', '29', '35']}; {'id': '26', 'type': 'pattern_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'subfield_position'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'if_statement', 'children': ['37', '46']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '45'], 'value': '!='}; {'id': '38', 'type': 'subscript', 'children': ['39', '42']}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '42', 'type': 'slice', 'children': ['43', '44']}; {'id': '43', 'type': 'colon', 'children': []}; {'id': '44', 'type': 'integer', 'children': [], 'value': '9'}; {'id': '45', 'type': 'string', 'children': [], 'value': '"VOLATILE:"'}; {'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': 'record_modify_subfield'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52', '53', '56', '61', '62']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '55', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '56', 'type': 'binary_operator', 'children': ['57', '58'], 'value': '+'}; {'id': '57', 'type': 'string', 'children': [], 'value': '"VOLATILE:"'}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '60', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'subfield_position'}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'field_position_local'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'field_position'}
Turns all subfields to volatile