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', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_single_header'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '23', '37']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'raw_headers'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'getRawHeaders'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '16', 'type': 'if_statement', 'children': ['17', '20']}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': 'is'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'raw_headers'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'None', 'children': []}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '28']}; {'id': '25', 'type': 'pattern_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'cgi'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'parse_header'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'raw_headers'}; {'id': '35', 'type': 'unary_operator', 'children': ['36'], 'value': '-'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'header'}
Get a single value for the given key out of the given set of headers. :param twisted.web.http_headers.Headers headers: The set of headers in which to look for the header value :param str key: The header key
{'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', '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']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '19']}; {'id': '12', 'type': 'attribute', 'children': ['13', '18']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'Deposit'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '22']}; {'id': '20', 'type': 'list_splat', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '22', 'type': 'dictionary_splat', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
Update only drafts. Status required: ``'draft'``. Meta information inside `_deposit` are preserved.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'aggregate_tree'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '5', 'type': 'block', 'children': ['6', '48', '148', '155', '169', '201']}; {'id': '6', 'type': 'function_definition', 'children': ['7', '8', '10']}; {'id': '7', 'type': 'function_name', 'children': [], 'value': '_aggregate_phase1'}; {'id': '8', 'type': 'parameters', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '10', 'type': 'block', 'children': ['11', '19', '46']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'radix'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'Radix'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'for_statement', 'children': ['20', '21', '26']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'prefixes'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'if_statement', 'children': ['28', '38']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '37'], 'value': '=='}; {'id': '29', 'type': 'attribute', 'children': ['30', '36']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'search_worst'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '48', 'type': 'function_definition', 'children': ['49', '50', '52']}; {'id': '49', 'type': 'function_name', 'children': [], 'value': '_aggregate_phase2'}; {'id': '50', 'type': 'parameters', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '52', 'type': 'block', 'children': ['53', '61', '146']}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'radix'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'Radix'}; {'id': '60', 'type': 'argument_list', 'children': []}; {'id': '61', 'type': 'for_statement', 'children': ['62', '63', '64']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'rnode'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '64', 'type': 'block', 'children': ['65', '84', '93']}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '83']}; {'id': '72', 'type': 'attribute', 'children': ['73', '82']}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'ip_network'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'rnode'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'supernet'}; {'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': 'r'}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'search_covered'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '93', 'type': 'if_statement', 'children': ['94', '100', '135']}; {'id': '94', 'type': 'comparison_operator', 'children': ['95', '99'], 'value': '=='}; {'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': 'r'}; {'id': '99', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'if_statement', 'children': ['102', '116', '124']}; {'id': '102', 'type': 'comparison_operator', 'children': ['103', '108', '113'], 'value': '=='}; {'id': '103', 'type': 'attribute', 'children': ['104', '107']}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '106', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'prefixlen'}; {'id': '108', 'type': 'attribute', 'children': ['109', '112']}; {'id': '109', 'type': 'subscript', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '111', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'prefixlen'}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'rnode'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'prefixlen'}; {'id': '116', 'type': 'block', 'children': ['117']}; {'id': '117', 'type': 'expression_statement', 'children': ['118']}; {'id': '118', 'type': 'call', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '122', 'type': 'argument_list', 'children': ['123']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '124', 'type': 'else_clause', 'children': ['125']}; {'id': '125', 'type': 'block', 'children': ['126']}; {'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': 'n_tree'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '131', 'type': 'argument_list', 'children': ['132']}; {'id': '132', 'type': 'attribute', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'rnode'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '135', 'type': 'else_clause', 'children': ['136']}; {'id': '136', 'type': 'block', 'children': ['137']}; {'id': '137', 'type': 'expression_statement', 'children': ['138']}; {'id': '138', 'type': 'call', 'children': ['139', '142']}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '142', 'type': 'argument_list', 'children': ['143']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'rnode'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '146', 'type': 'return_statement', 'children': ['147']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'n_tree'}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'assignment', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '151', 'type': 'call', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': '_aggregate_phase1'}; {'id': '153', 'type': 'argument_list', 'children': ['154']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '155', 'type': 'if_statement', 'children': ['156', '166']}; {'id': '156', 'type': 'comparison_operator', 'children': ['157', '165'], 'value': '=='}; {'id': '157', 'type': 'call', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '159', 'type': 'argument_list', 'children': ['160']}; {'id': '160', 'type': 'call', 'children': ['161', '164']}; {'id': '161', 'type': 'attribute', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'prefixes'}; {'id': '164', 'type': 'argument_list', 'children': []}; {'id': '165', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '166', 'type': 'block', 'children': ['167']}; {'id': '167', 'type': 'return_statement', 'children': ['168']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '169', 'type': 'while_statement', 'children': ['170', '171']}; {'id': '170', 'type': 'True', 'children': []}; {'id': '171', 'type': 'block', 'children': ['172', '179']}; {'id': '172', 'type': 'expression_statement', 'children': ['173']}; {'id': '173', 'type': 'assignment', 'children': ['174', '175']}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'r_tree'}; {'id': '175', 'type': 'call', 'children': ['176', '177']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': '_aggregate_phase2'}; {'id': '177', 'type': 'argument_list', 'children': ['178']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '179', 'type': 'if_statement', 'children': ['180', '191', '193']}; {'id': '180', 'type': 'comparison_operator', 'children': ['181', '186'], 'value': '=='}; {'id': '181', 'type': 'call', 'children': ['182', '185']}; {'id': '182', 'type': 'attribute', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'prefixes'}; {'id': '185', 'type': 'argument_list', 'children': []}; {'id': '186', 'type': 'call', 'children': ['187', '190']}; {'id': '187', 'type': 'attribute', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'r_tree'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'prefixes'}; {'id': '190', 'type': 'argument_list', 'children': []}; {'id': '191', 'type': 'block', 'children': ['192']}; {'id': '192', 'type': 'break_statement', 'children': []}; {'id': '193', 'type': 'else_clause', 'children': ['194']}; {'id': '194', 'type': 'block', 'children': ['195', '199']}; {'id': '195', 'type': 'expression_statement', 'children': ['196']}; {'id': '196', 'type': 'assignment', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'l_tree'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'r_tree'}; {'id': '199', 'type': 'delete_statement', 'children': ['200']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'r_tree'}; {'id': '201', 'type': 'return_statement', 'children': ['202']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'l_tree'}
Walk a py-radix tree and aggregate it. Arguments l_tree -- radix.Radix() object
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'switch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'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': 'temple'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '18']}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'new_template'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'template'}; {'id': '18', 'type': 'keyword_argument', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'new_version'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'version'}
Switch a project's template to a different template.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send_status_response'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'start_response'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'add_headers'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'is_head'}; {'id': '12', 'type': 'False', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14', '21', '25', '35', '61', '75', '81', '91', '100', '108', '133']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'get_http_status_string'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '24', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '25', 'type': 'if_statement', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'add_headers'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'add_headers'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '41']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': 'in'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '38', 'type': 'tuple', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'HTTP_NOT_MODIFIED'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'HTTP_NO_CONTENT'}; {'id': '41', 'type': 'block', 'children': ['42', '58']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'start_response'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '47', 'type': 'binary_operator', 'children': ['48', '57'], 'value': '+'}; {'id': '48', 'type': 'list', 'children': ['49', '52'], 'value': '[("Content-Length", "0"), ("Date", get_rfc1123_time())]'}; {'id': '49', 'type': 'tuple', 'children': ['50', '51']}; {'id': '50', 'type': 'string', 'children': [], 'value': '"Content-Length"'}; {'id': '51', 'type': 'string', 'children': [], 'value': '"0"'}; {'id': '52', 'type': 'tuple', 'children': ['53', '54']}; {'id': '53', 'type': 'string', 'children': [], 'value': '"Date"'}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'get_rfc1123_time'}; {'id': '56', 'type': 'argument_list', 'children': []}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '58', 'type': 'return_statement', 'children': ['59']}; {'id': '59', 'type': 'list', 'children': ['60'], 'value': '[b""]'}; {'id': '60', 'type': 'string', 'children': [], 'value': 'b""'}; {'id': '61', 'type': 'if_statement', 'children': ['62', '67']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '64'], 'value': 'in'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '64', 'type': 'tuple', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'HTTP_OK'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'HTTP_CREATED'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'DAVError'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '75', 'type': 'assert_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'DAVError'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '86']}; {'id': '83', 'type': 'pattern_list', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'content_type'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'get_response_page'}; {'id': '90', 'type': 'argument_list', 'children': []}; {'id': '91', 'type': 'if_statement', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'is_head'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'compat'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'b_empty'}; {'id': '100', 'type': 'assert_statement', 'children': ['101', '107']}; {'id': '101', 'type': 'call', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'compat'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'is_bytes'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '108', 'type': 'expression_statement', 'children': ['109']}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'start_response'}; {'id': '111', 'type': 'argument_list', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '113', 'type': 'binary_operator', 'children': ['114', '132'], 'value': '+'}; {'id': '114', 'type': 'list', 'children': ['115', '118', '123'], 'value': '[\n ("Content-Type", content_type),\n ("Date", get_rfc1123_time()),\n ("Content-Length", str(len(body))),\n ]'}; {'id': '115', 'type': 'tuple', 'children': ['116', '117']}; {'id': '116', 'type': 'string', 'children': [], 'value': '"Content-Type"'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'content_type'}; {'id': '118', 'type': 'tuple', 'children': ['119', '120']}; {'id': '119', 'type': 'string', 'children': [], 'value': '"Date"'}; {'id': '120', 'type': 'call', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'get_rfc1123_time'}; {'id': '122', 'type': 'argument_list', 'children': []}; {'id': '123', 'type': 'tuple', 'children': ['124', '125']}; {'id': '124', 'type': 'string', 'children': [], 'value': '"Content-Length"'}; {'id': '125', 'type': 'call', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '127', 'type': 'argument_list', 'children': ['128']}; {'id': '128', 'type': 'call', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '130', 'type': 'argument_list', 'children': ['131']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'body'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '133', 'type': 'return_statement', 'children': ['134']}; {'id': '134', 'type': 'list', 'children': ['135'], 'value': '[body]'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'body'}
Start a WSGI response for a DAVError or status code.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'removeTopology'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'topology_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'state_manager_name'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '61']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'topologies'}; {'id': '11', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '17']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'topologies'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'if_statement', 'children': ['19', '31', '52']}; {'id': '19', 'type': '()', 'children': ['20']}; {'id': '20', 'type': 'boolean_operator', 'children': ['21', '26'], 'value': 'and'}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '25'], 'value': '=='}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'topology_name'}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '30'], 'value': '=='}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'state_manager_name'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'state_manager_name'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'if_statement', 'children': ['33', '40']}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '37'], 'value': 'in'}; {'id': '34', 'type': 'tuple', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'topology_name'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'state_manager_name'}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'topologyInfos'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'topologyInfos'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'tuple', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'topology_name'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'state_manager_name'}; {'id': '52', 'type': 'else_clause', 'children': ['53']}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'topologies'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'topologies'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'topologies'}
Removes the topology from the local cache.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'encoder_data'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '6', 'type': 'block', 'children': ['7', '23', '43', '52', '58']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'prev_val'}; {'id': '10', 'type': 'subscript', 'children': ['11', '20']}; {'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': 'digital_response_table'}; {'id': '15', 'type': 'subscript', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_MODE'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_PIN_DATA_VALUE'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '38'], 'value': '+'}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '37'], 'value': '<<'}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'MSB'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '7'}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'LSB'}; {'id': '43', 'type': 'if_statement', 'children': ['44', '47']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': '>'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '8192'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'augmented_assignment', 'children': ['50', '51'], 'value': '-='}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '16384'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '58', 'type': 'with_statement', 'children': ['59', '66']}; {'id': '59', 'type': 'with_clause', 'children': ['60']}; {'id': '60', 'type': 'with_item', 'children': ['61']}; {'id': '61', 'type': 'attribute', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'pymata'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'data_lock'}; {'id': '66', 'type': 'block', 'children': ['67', '83']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '82']}; {'id': '69', 'type': 'subscript', 'children': ['70', '79']}; {'id': '70', 'type': 'subscript', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'digital_response_table'}; {'id': '74', 'type': 'subscript', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_MODE'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_PIN_DATA_VALUE'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '83', 'type': 'if_statement', 'children': ['84', '87']}; {'id': '84', 'type': 'comparison_operator', 'children': ['85', '86'], 'value': '!='}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'prev_val'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '87', 'type': 'block', 'children': ['88', '100']}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '91', 'type': 'subscript', 'children': ['92', '97']}; {'id': '92', 'type': 'subscript', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'digital_response_table'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_CALLBACK'}; {'id': '100', 'type': 'if_statement', 'children': ['101', '104']}; {'id': '101', 'type': 'comparison_operator', 'children': ['102', '103'], 'value': 'is not'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '103', 'type': 'None', 'children': []}; {'id': '104', 'type': 'block', 'children': ['105']}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'call', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '108', 'type': 'argument_list', 'children': ['109']}; {'id': '109', 'type': 'list', 'children': ['110', '115', '116'], 'value': '[self.pymata.ENCODER, pin,\n self.digital_response_table[pin][self.RESPONSE_TABLE_PIN_DATA_VALUE]]'}; {'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': 'pymata'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'ENCODER'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '116', 'type': 'subscript', 'children': ['117', '122']}; {'id': '117', 'type': 'subscript', 'children': ['118', '121']}; {'id': '118', 'type': 'attribute', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'digital_response_table'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'RESPONSE_TABLE_PIN_DATA_VALUE'}
This method handles the incoming encoder data message and stores the data in the digital response table. :param data: Message data from Firmata :return: No return value.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_dot_to_dec'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'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', '25', '37', '41', '52', '63', '74', '83']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '17']}; {'id': '10', 'type': 'boolean_operator', 'children': ['11', '12'], 'value': 'and'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'check'}; {'id': '12', 'type': 'not_operator', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'is_dot'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'raise_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '24'], 'value': '%'}; {'id': '23', 'type': 'string', 'children': [], 'value': '\'_dot_to_dec: invalid IP: "%s"\''}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'octets'}; {'id': '28', 'type': 'call', 'children': ['29', '35']}; {'id': '29', 'type': 'attribute', 'children': ['30', '34']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'augmented_assignment', 'children': ['43', '44'], 'value': '|='}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '51'], 'value': '<<'}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'subscript', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'octets'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '24'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'augmented_assignment', 'children': ['54', '55'], 'value': '|='}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '62'], 'value': '<<'}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'octets'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'augmented_assignment', 'children': ['65', '66'], 'value': '|='}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '66', 'type': 'binary_operator', 'children': ['67', '73'], 'value': '<<'}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'octets'}; {'id': '72', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '73', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'augmented_assignment', 'children': ['76', '77'], 'value': '|='}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'subscript', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'octets'}; {'id': '82', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '83', 'type': 'return_statement', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'dec'}
Dotted decimal notation to decimal conversion.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'initialize'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'containers'}; {'id': '6', 'type': 'block', 'children': ['7', '16']}; {'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': '_containers'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'deepcopy'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'containers'}; {'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': '__write'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'containers'}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'initialize'}; {'id': '25', 'type': 'True', 'children': []}
Initialize a new state file with the given contents. This function fails in case the state file already exists.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_quiet'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '9', 'type': 'attribute', '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': '_conversation'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self_conversation_state'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'notification_level'}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': '=='}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'hangouts_pb2'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'NOTIFICATION_LEVEL_QUIET'}
``True`` if notification level for this conversation is quiet.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_dashboard'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'panel_file'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'strict'}; {'id': '11', 'type': 'True', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '23', '33', '44', '71', '93', '114', '135', '156']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'es_enrich'}; {'id': '16', 'type': 'subscript', 'children': ['17', '22']}; {'id': '17', 'type': 'subscript', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'conf'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'es_enrichment'"}; {'id': '22', 'type': 'string', 'children': [], 'value': "'url'"}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'kibana_url'}; {'id': '26', 'type': 'subscript', 'children': ['27', '32']}; {'id': '27', 'type': 'subscript', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'conf'}; {'id': '31', 'type': 'string', 'children': [], 'value': "'panels'"}; {'id': '32', 'type': 'string', 'children': [], 'value': "'kibiter_url'"}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'mboxes_sources'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'list', 'children': ['40', '41', '42', '43'], 'value': "['pipermail', 'hyperkitty', 'groupsio', 'nntp']"}; {'id': '40', 'type': 'string', 'children': [], 'value': "'pipermail'"}; {'id': '41', 'type': 'string', 'children': [], 'value': "'hyperkitty'"}; {'id': '42', 'type': 'string', 'children': [], 'value': "'groupsio'"}; {'id': '43', 'type': 'string', 'children': [], 'value': "'nntp'"}; {'id': '44', 'type': 'if_statement', 'children': ['45', '56']}; {'id': '45', 'type': 'boolean_operator', 'children': ['46', '47'], 'value': 'and'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'any'}; {'id': '49', 'type': 'generator_expression', 'children': ['50', '53']}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '52'], 'value': 'in'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '53', 'type': 'for_in_clause', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'mboxes_sources'}; {'id': '56', 'type': 'block', 'children': ['57', '64']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'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': 'data_sources'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'string', 'children': [], 'value': "'mbox'"}; {'id': '71', 'type': 'if_statement', 'children': ['72', '78']}; {'id': '72', 'type': 'boolean_operator', 'children': ['73', '74'], 'value': 'and'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '74', 'type': '()', 'children': ['75']}; {'id': '75', 'type': 'comparison_operator', 'children': ['76', '77'], 'value': 'in'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'supybot'"}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '78', 'type': 'block', 'children': ['79', '86']}; {'id': '79', 'type': 'expression_statement', 'children': ['80']}; {'id': '80', 'type': 'assignment', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '82', 'type': 'call', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'string', 'children': [], 'value': "'irc'"}; {'id': '93', 'type': 'if_statement', 'children': ['94', '99']}; {'id': '94', 'type': 'boolean_operator', 'children': ['95', '96'], 'value': 'and'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '96', 'type': 'comparison_operator', 'children': ['97', '98'], 'value': 'in'}; {'id': '97', 'type': 'string', 'children': [], 'value': "'google_hits'"}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '99', 'type': 'block', 'children': ['100', '107']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '103', 'type': 'call', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'string', 'children': [], 'value': "'googlehits'"}; {'id': '114', 'type': 'if_statement', 'children': ['115', '120']}; {'id': '115', 'type': 'boolean_operator', 'children': ['116', '117'], 'value': 'and'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '117', 'type': 'comparison_operator', 'children': ['118', '119'], 'value': 'in'}; {'id': '118', 'type': 'string', 'children': [], 'value': "'stackexchange'"}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '120', 'type': 'block', 'children': ['121', '128']}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'assignment', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '124', 'type': 'call', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '126', 'type': 'argument_list', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '128', 'type': 'expression_statement', 'children': ['129']}; {'id': '129', 'type': 'call', 'children': ['130', '133']}; {'id': '130', 'type': 'attribute', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'string', 'children': [], 'value': "'stackoverflow'"}; {'id': '135', 'type': 'if_statement', 'children': ['136', '141']}; {'id': '136', 'type': 'boolean_operator', 'children': ['137', '138'], 'value': 'and'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '138', 'type': 'comparison_operator', 'children': ['139', '140'], 'value': 'in'}; {'id': '139', 'type': 'string', 'children': [], 'value': "'phabricator'"}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '141', 'type': 'block', 'children': ['142', '149']}; {'id': '142', 'type': 'expression_statement', 'children': ['143']}; {'id': '143', 'type': 'assignment', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '145', 'type': 'call', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '149', 'type': 'expression_statement', 'children': ['150']}; {'id': '150', 'type': 'call', 'children': ['151', '154']}; {'id': '151', 'type': 'attribute', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '154', 'type': 'argument_list', 'children': ['155']}; {'id': '155', 'type': 'string', 'children': [], 'value': "'maniphest'"}; {'id': '156', 'type': 'try_statement', 'children': ['157', '171', '182']}; {'id': '157', 'type': 'block', 'children': ['158']}; {'id': '158', 'type': 'expression_statement', 'children': ['159']}; {'id': '159', 'type': 'call', 'children': ['160', '161']}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'import_dashboard'}; {'id': '161', 'type': 'argument_list', 'children': ['162', '163', '164', '165', '168']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'es_enrich'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'kibana_url'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'panel_file'}; {'id': '165', 'type': 'keyword_argument', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'data_sources'}; {'id': '168', 'type': 'keyword_argument', 'children': ['169', '170']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'strict'}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'strict'}; {'id': '171', 'type': 'except_clause', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '173', 'type': 'block', 'children': ['174']}; {'id': '174', 'type': 'expression_statement', 'children': ['175']}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '179', 'type': 'argument_list', 'children': ['180', '181']}; {'id': '180', 'type': 'string', 'children': [], 'value': '"%s does not include release field. Not loading the panel."'}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'panel_file'}; {'id': '182', 'type': 'except_clause', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '184', 'type': 'block', 'children': ['185']}; {'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': 'logger'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '190', 'type': 'argument_list', 'children': ['191', '192']}; {'id': '191', 'type': 'string', 'children': [], 'value': '"Can not load the panel %s"'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'panel_file'}
Upload a panel to Elasticsearch if it does not exist yet. If a list of data sources is specified, upload only those elements (visualizations, searches) that match that data source. :param panel_file: file name of panel (dashobard) to upload :param data_sources: list of data sources :param strict: only upload a dashboard if it is newer than the one already existing
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_constructor_arguments'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'type', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '7', 'type': 'block', 'children': ['8', '14']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_constructor_abi_item'}; {'id': '14', 'type': 'return_statement', 'children': ['15']}; {'id': '15', 'type': 'conditional_expression', 'children': ['16', '17', '20'], 'value': 'if'}; {'id': '16', 'type': 'string', 'children': [], 'value': "'()'"}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': 'is'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'tuple_signature_for_components'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'inputs'"}
Returns the tuple type signature for the arguments of the contract constructor.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_operation_input_field_values'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'file_input'}; {'id': '7', 'type': 'block', 'children': ['8', '18', '28', '45']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'input_args'}; {'id': '11', 'type': 'subscript', 'children': ['12', '17']}; {'id': '12', 'type': 'subscript', 'children': ['13', '16']}; {'id': '13', 'type': 'subscript', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'request'"}; {'id': '16', 'type': 'string', 'children': [], 'value': "'ephemeralPipeline'"}; {'id': '17', 'type': 'string', 'children': [], 'value': "'inputParameters'"}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'vals_dict'}; {'id': '21', 'type': 'subscript', 'children': ['22', '27']}; {'id': '22', 'type': 'subscript', 'children': ['23', '26']}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'request'"}; {'id': '26', 'type': 'string', 'children': [], 'value': "'pipelineArgs'"}; {'id': '27', 'type': 'string', 'children': [], 'value': "'inputs'"}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '31', 'type': 'list_comprehension', 'children': ['32', '35', '38']}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '35', 'type': 'for_in_clause', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'input_args'}; {'id': '38', 'type': 'if_clause', 'children': ['39']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '44'], 'value': '=='}; {'id': '40', 'type': '()', 'children': ['41']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'in'}; {'id': '42', 'type': 'string', 'children': [], 'value': "'localCopy'"}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'file_input'}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'dictionary_comprehension', 'children': ['47', '52', '55']}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'vals_dict'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '52', 'type': 'for_in_clause', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '55', 'type': 'if_clause', 'children': ['56']}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '58'], 'value': 'in'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'vals_dict'}
Returns a dictionary of envs or file inputs for an operation. Args: metadata: operation metadata field file_input: True to return a dict of file inputs, False to return envs. Returns: A dictionary of input field name value pairs
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'view_maker'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '19', '46', '91']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'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': 'instance'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'sig'}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': 'in'}; {'id': '23', 'type': 'string', 'children': [], 'value': '"lang"'}; {'id': '24', 'type': 'list_comprehension', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'parameter'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '28', 'type': 'for_in_clause', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'parameter'}; {'id': '30', 'type': 'call', 'children': ['31', '45']}; {'id': '31', 'type': 'attribute', 'children': ['32', '44']}; {'id': '32', 'type': 'attribute', 'children': ['33', '43']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'inspect'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '40', 'type': 'argument_list', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '45', 'type': 'argument_list', 'children': []}; {'id': '46', 'type': 'function_definition', 'children': ['47', '48', '51']}; {'id': '47', 'type': 'function_name', 'children': [], 'value': 'route'}; {'id': '48', 'type': 'parameters', 'children': ['49']}; {'id': '49', 'type': 'dictionary_splat_pattern', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '51', 'type': 'block', 'children': ['52', '69', '78']}; {'id': '52', 'type': 'if_statement', 'children': ['53', '58']}; {'id': '53', 'type': 'boolean_operator', 'children': ['54', '55'], 'value': 'and'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'sig'}; {'id': '55', 'type': 'comparison_operator', 'children': ['56', '57'], 'value': 'not in'}; {'id': '56', 'type': 'string', 'children': [], 'value': '"lang"'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '64']}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '63', 'type': 'string', 'children': [], 'value': '"lang"'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'get_locale'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'if_statement', 'children': ['70', '73']}; {'id': '70', 'type': 'comparison_operator', 'children': ['71', '72'], 'value': 'in'}; {'id': '71', 'type': 'string', 'children': [], 'value': '"semantic"'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'delete_statement', 'children': ['75']}; {'id': '75', 'type': 'subscript', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '77', 'type': 'string', 'children': [], 'value': '"semantic"'}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'route'}; {'id': '83', 'type': 'argument_list', 'children': ['84', '89']}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '89', 'type': 'dictionary_splat', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '91', 'type': 'return_statement', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'route'}
Create a view :param name: Name of the route function to use for the view. :type name: str :return: Route function which makes use of Nemo context (such as menu informations) :rtype: function
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_container_port_mappings'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '21', '41']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'container'}; {'id': '9', 'type': 'subscript', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'container'"}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'port_mappings'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'container'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'portMappings'"}; {'id': '21', 'type': 'if_statement', 'children': ['22', '29']}; {'id': '22', 'type': 'boolean_operator', 'children': ['23', '26'], 'value': 'and'}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '25'], 'value': 'is'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'port_mappings'}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '28'], 'value': 'in'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'docker'"}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'container'}; {'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': 'port_mappings'}; {'id': '33', 'type': 'call', 'children': ['34', '39']}; {'id': '34', 'type': 'attribute', 'children': ['35', '38']}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'container'}; {'id': '37', 'type': 'string', 'children': [], 'value': "'docker'"}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'string', 'children': [], 'value': "'portMappings'"}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'port_mappings'}
Get the ``portMappings`` field for the app container.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clear'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '22', '28']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_compound_masses'}; {'id': '11', 'type': 'binary_operator', 'children': ['12', '15'], 'value': '*'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_compound_masses'}; {'id': '15', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_P'}; {'id': '21', 'type': 'float', 'children': [], 'value': '1.0'}; {'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': '_T'}; {'id': '27', 'type': 'float', 'children': [], 'value': '25.0'}; {'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': '_H'}; {'id': '33', 'type': 'float', 'children': [], 'value': '0.0'}
Set all the compound masses in the package to zero. Set the pressure to 1, the temperature to 25 and the enthalpy to zero.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'MessageToJson'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'including_default_value_fields'}; {'id': '7', 'type': 'False', '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': 'js'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_MessageToJsonObject'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'including_default_value_fields'}; {'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': 'json'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'js'}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '2'}
Converts protobuf message to JSON format. Args: message: The protocol buffers message instance to serialize. including_default_value_fields: If True, singular primitive fields, repeated fields, and map fields will always be serialized. If False, only serialize non-empty fields. Singular message fields and oneof fields are not affected by this option. Returns: A string containing the JSON formatted protocol buffer message.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_keep_alive_thread'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'while_statement', 'children': ['7', '8']}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '46']}; {'id': '9', 'type': 'with_statement', 'children': ['10', '15']}; {'id': '10', 'type': 'with_clause', 'children': ['11']}; {'id': '11', 'type': 'with_item', 'children': ['12']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_lock'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '22', '31']}; {'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': 'connected'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_ws'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'ping'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'else_clause', 'children': ['32']}; {'id': '32', 'type': 'block', 'children': ['33', '39', '45']}; {'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': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'disconnect'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_thread'}; {'id': '44', 'type': 'None', 'children': []}; {'id': '45', 'type': 'return_statement', 'children': []}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'integer', 'children': [], 'value': '30'}
Used exclusively as a thread which keeps the WebSocket alive.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'scaffolds_to_contigs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'infile'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'number_contigs'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '19', '28', '123']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'seq_reader'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'file_reader'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'infile'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'fout'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'open_file_write'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '28', 'type': 'for_statement', 'children': ['29', '30', '31']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'seq_reader'}; {'id': '31', 'type': 'block', 'children': ['32', '40', '44']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'contigs'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'contig_coords'}; {'id': '39', 'type': 'argument_list', 'children': []}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '44', 'type': 'for_statement', 'children': ['45', '46', '47']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'contig'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'contigs'}; {'id': '47', 'type': 'block', 'children': ['48', '98']}; {'id': '48', 'type': 'if_statement', 'children': ['49', '50', '68']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'number_contigs'}; {'id': '50', 'type': 'block', 'children': ['51', '64']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '60'], 'value': '+'}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '59'], 'value': '+'}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'augmented_assignment', 'children': ['66', '67'], 'value': '+='}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '67', 'type': 'integer', 'children': [], 'value': '1'}; {'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': 'name'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'list', 'children': ['79', '82', '90'], 'value': '[seq.id, str(contig.start + 1), str(contig.end + 1)]'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '82', 'type': 'call', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'binary_operator', 'children': ['86', '89'], 'value': '+'}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'contig'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '89', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'binary_operator', 'children': ['94', '97'], 'value': '+'}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'contig'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '97', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'call', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '101', 'type': 'argument_list', 'children': ['102', '120']}; {'id': '102', 'type': 'call', 'children': ['103', '106']}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'Fasta'}; {'id': '106', 'type': 'argument_list', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '108', 'type': 'subscript', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '110', 'type': 'slice', 'children': ['111', '114', '115']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'contig'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '114', 'type': 'colon', 'children': []}; {'id': '115', 'type': 'binary_operator', 'children': ['116', '119'], 'value': '+'}; {'id': '116', 'type': 'attribute', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'contig'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '119', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '120', 'type': 'keyword_argument', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'fout'}; {'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': 'utils'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'fout'}
Makes a file of contigs from scaffolds by splitting at every N. Use number_contigs=True to add .1, .2, etc onto end of each contig, instead of default to append coordinates.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parseStringList'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '5', 'type': 'block', 'children': ['6', '12']}; {'id': '6', 'type': 'assert_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '9', 'type': 'argument_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '12', 'type': 'return_statement', 'children': ['13']}; {'id': '13', 'type': 'list_comprehension', 'children': ['14', '18']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '18', 'type': 'for_in_clause', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '24', 'type': 'argument_list', 'children': []}
Parse a string of space-separated numbers, returning a Python list. :param s: (string) to parse :returns: (list) binary SDR
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_camelcase_to_underscore'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '5', 'type': 'block', 'children': ['6', '44']}; {'id': '6', 'type': 'function_definition', 'children': ['7', '8', '10']}; {'id': '7', 'type': 'function_name', 'children': [], 'value': 'upper2underscore'}; {'id': '8', 'type': 'parameters', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '14']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21', '25']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'islower'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'yield', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '25', 'type': 'else_clause', 'children': ['26']}; {'id': '26', 'type': 'block', 'children': ['27', '30']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'yield', 'children': ['29']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'_'"}; {'id': '30', 'type': 'if_statement', 'children': ['31', '36']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'isalpha'}; {'id': '35', 'type': 'argument_list', 'children': []}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'yield', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': "''"}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'upper2underscore'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'url'}
Translate camelCase into underscore format. >>> _camelcase_to_underscore('minutesBetweenSummaries') 'minutes_between_summaries'
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_loopless'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'zero_cutoff'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '17', '37', '53', '62', '85', '91', '95', '205', '212']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'zero_cutoff'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'normalize_cutoff'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'zero_cutoff'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'internal'}; {'id': '20', 'type': 'list_comprehension', 'children': ['21', '22', '32']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '22', 'type': 'for_in_clause', 'children': ['23', '26']}; {'id': '23', 'type': 'pattern_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'reactions'}; {'id': '32', 'type': 'if_clause', 'children': ['33']}; {'id': '33', 'type': 'not_operator', 'children': ['34']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'boundary'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 's_int'}; {'id': '40', 'type': 'subscript', 'children': ['41', '45', '47']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'create_stoichiometric_matrix'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '45', 'type': 'slice', 'children': ['46']}; {'id': '46', 'type': 'colon', 'children': []}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'numpy'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'internal'}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'n_int'}; {'id': '56', 'type': 'attribute', 'children': ['57', '61']}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'nullspace'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 's_int'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'T'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'max_bound'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '67', 'type': 'generator_expression', 'children': ['68', '80']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '70', 'type': 'generator_expression', 'children': ['71', '75']}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'abs'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '75', 'type': 'for_in_clause', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'bounds'}; {'id': '80', 'type': 'for_in_clause', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'reactions'}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'assignment', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'problem'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'to_add'}; {'id': '94', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '95', 'type': 'for_statement', 'children': ['96', '97', '98']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'internal'}; {'id': '98', 'type': 'block', 'children': ['99', '107', '123', '152', '165', '194']}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '102', 'type': 'subscript', 'children': ['103', '106']}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'reactions'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'indicator'}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '114', 'type': 'argument_list', 'children': ['115', '120']}; {'id': '115', 'type': 'binary_operator', 'children': ['116', '117'], 'value': '+'}; {'id': '116', 'type': 'string', 'children': [], 'value': '"indicator_"'}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '120', 'type': 'keyword_argument', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '122', 'type': 'string', 'children': [], 'value': '"binary"'}; {'id': '123', 'type': 'expression_statement', 'children': ['124']}; {'id': '124', 'type': 'assignment', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'on_off_constraint'}; {'id': '126', 'type': 'call', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'Constraint'}; {'id': '130', 'type': 'argument_list', 'children': ['131', '138', '142', '145']}; {'id': '131', 'type': 'binary_operator', 'children': ['132', '135'], 'value': '-'}; {'id': '132', 'type': 'attribute', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'flux_expression'}; {'id': '135', 'type': 'binary_operator', 'children': ['136', '137'], 'value': '*'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'max_bound'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'indicator'}; {'id': '138', 'type': 'keyword_argument', 'children': ['139', '140']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'lb'}; {'id': '140', 'type': 'unary_operator', 'children': ['141'], 'value': '-'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'max_bound'}; {'id': '142', 'type': 'keyword_argument', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'ub'}; {'id': '144', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '145', 'type': 'keyword_argument', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '147', 'type': 'binary_operator', 'children': ['148', '149'], 'value': '+'}; {'id': '148', 'type': 'string', 'children': [], 'value': '"on_off_"'}; {'id': '149', 'type': 'attribute', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '152', 'type': 'expression_statement', 'children': ['153']}; {'id': '153', 'type': 'assignment', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'delta_g'}; {'id': '155', 'type': 'call', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'Variable'}; {'id': '159', 'type': 'argument_list', 'children': ['160']}; {'id': '160', 'type': 'binary_operator', 'children': ['161', '162'], 'value': '+'}; {'id': '161', 'type': 'string', 'children': [], 'value': '"delta_g_"'}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '165', 'type': 'expression_statement', 'children': ['166']}; {'id': '166', 'type': 'assignment', 'children': ['167', '168']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'delta_g_range'}; {'id': '168', 'type': 'call', 'children': ['169', '172']}; {'id': '169', 'type': 'attribute', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'Constraint'}; {'id': '172', 'type': 'argument_list', 'children': ['173', '181', '184', '187']}; {'id': '173', 'type': 'binary_operator', 'children': ['174', '175'], 'value': '+'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'delta_g'}; {'id': '175', 'type': 'binary_operator', 'children': ['176', '180'], 'value': '*'}; {'id': '176', 'type': '()', 'children': ['177']}; {'id': '177', 'type': 'binary_operator', 'children': ['178', '179'], 'value': '+'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'max_bound'}; {'id': '179', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'indicator'}; {'id': '181', 'type': 'keyword_argument', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'lb'}; {'id': '183', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '184', 'type': 'keyword_argument', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'ub'}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'max_bound'}; {'id': '187', 'type': 'keyword_argument', 'children': ['188', '189']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '189', 'type': 'binary_operator', 'children': ['190', '191'], 'value': '+'}; {'id': '190', 'type': 'string', 'children': [], 'value': '"delta_g_range_"'}; {'id': '191', 'type': 'attribute', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'rxn'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'id'}; {'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': 'to_add'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '199', 'type': 'argument_list', 'children': ['200']}; {'id': '200', 'type': 'list', 'children': ['201', '202', '203', '204'], 'value': '[indicator, on_off_constraint, delta_g, delta_g_range]'}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'indicator'}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'on_off_constraint'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'delta_g'}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'delta_g_range'}; {'id': '205', 'type': 'expression_statement', 'children': ['206']}; {'id': '206', 'type': 'call', 'children': ['207', '210']}; {'id': '207', 'type': 'attribute', 'children': ['208', '209']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'add_cons_vars'}; {'id': '210', 'type': 'argument_list', 'children': ['211']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'to_add'}; {'id': '212', 'type': 'for_statement', 'children': ['213', '216', '220']}; {'id': '213', 'type': 'pattern_list', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '216', 'type': 'call', 'children': ['217', '218']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '218', 'type': 'argument_list', 'children': ['219']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'n_int'}; {'id': '220', 'type': 'block', 'children': ['221', '230', '248', '256', '294']}; {'id': '221', 'type': 'expression_statement', 'children': ['222']}; {'id': '222', 'type': 'assignment', 'children': ['223', '224']}; {'id': '223', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '224', 'type': 'binary_operator', 'children': ['225', '226'], 'value': '+'}; {'id': '225', 'type': 'string', 'children': [], 'value': '"nullspace_constraint_"'}; {'id': '226', 'type': 'call', 'children': ['227', '228']}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '228', 'type': 'argument_list', 'children': ['229']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '230', 'type': 'expression_statement', 'children': ['231']}; {'id': '231', 'type': 'assignment', 'children': ['232', '233']}; {'id': '232', 'type': 'identifier', 'children': [], 'value': 'nullspace_constraint'}; {'id': '233', 'type': 'call', 'children': ['234', '237']}; {'id': '234', 'type': 'attribute', 'children': ['235', '236']}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'prob'}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'Constraint'}; {'id': '237', 'type': 'argument_list', 'children': ['238', '239', '242', '245']}; {'id': '238', 'type': 'identifier', 'children': [], 'value': 'Zero'}; {'id': '239', 'type': 'keyword_argument', 'children': ['240', '241']}; {'id': '240', 'type': 'identifier', 'children': [], 'value': 'lb'}; {'id': '241', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '242', 'type': 'keyword_argument', 'children': ['243', '244']}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'ub'}; {'id': '244', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '245', 'type': 'keyword_argument', 'children': ['246', '247']}; {'id': '246', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '248', 'type': 'expression_statement', 'children': ['249']}; {'id': '249', 'type': 'call', 'children': ['250', '253']}; {'id': '250', 'type': 'attribute', 'children': ['251', '252']}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'add_cons_vars'}; {'id': '253', 'type': 'argument_list', 'children': ['254']}; {'id': '254', 'type': 'list', 'children': ['255'], 'value': '[nullspace_constraint]'}; {'id': '255', 'type': 'identifier', 'children': [], 'value': 'nullspace_constraint'}; {'id': '256', 'type': 'expression_statement', 'children': ['257']}; {'id': '257', 'type': 'assignment', 'children': ['258', '259']}; {'id': '258', 'type': 'identifier', 'children': [], 'value': 'coefs'}; {'id': '259', 'type': 'dictionary_comprehension', 'children': ['260', '277', '285']}; {'id': '260', 'type': 'pair', 'children': ['261', '274']}; {'id': '261', 'type': 'subscript', 'children': ['262', '265']}; {'id': '262', 'type': 'attribute', 'children': ['263', '264']}; {'id': '263', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'variables'}; {'id': '265', 'type': 'binary_operator', 'children': ['266', '267'], 'value': '+'}; {'id': '266', 'type': 'string', 'children': [], 'value': '"delta_g_"'}; {'id': '267', 'type': 'attribute', 'children': ['268', '273']}; {'id': '268', 'type': 'subscript', 'children': ['269', '272']}; {'id': '269', 'type': 'attribute', 'children': ['270', '271']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'reactions'}; {'id': '272', 'type': 'identifier', 'children': [], 'value': 'ridx'}; {'id': '273', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '274', 'type': 'subscript', 'children': ['275', '276']}; {'id': '275', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '276', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '277', 'type': 'for_in_clause', 'children': ['278', '281']}; {'id': '278', 'type': 'pattern_list', 'children': ['279', '280']}; {'id': '279', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '280', 'type': 'identifier', 'children': [], 'value': 'ridx'}; {'id': '281', 'type': 'call', 'children': ['282', '283']}; {'id': '282', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '283', 'type': 'argument_list', 'children': ['284']}; {'id': '284', 'type': 'identifier', 'children': [], 'value': 'internal'}; {'id': '285', 'type': 'if_clause', 'children': ['286']}; {'id': '286', 'type': 'comparison_operator', 'children': ['287', '293'], 'value': '>'}; {'id': '287', 'type': 'call', 'children': ['288', '289']}; {'id': '288', 'type': 'identifier', 'children': [], 'value': 'abs'}; {'id': '289', 'type': 'argument_list', 'children': ['290']}; {'id': '290', 'type': 'subscript', 'children': ['291', '292']}; {'id': '291', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '292', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '293', 'type': 'identifier', 'children': [], 'value': 'zero_cutoff'}; {'id': '294', 'type': 'expression_statement', 'children': ['295']}; {'id': '295', 'type': 'call', 'children': ['296', '303']}; {'id': '296', 'type': 'attribute', 'children': ['297', '302']}; {'id': '297', 'type': 'subscript', 'children': ['298', '301']}; {'id': '298', 'type': 'attribute', 'children': ['299', '300']}; {'id': '299', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '300', 'type': 'identifier', 'children': [], 'value': 'constraints'}; {'id': '301', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '302', 'type': 'identifier', 'children': [], 'value': 'set_linear_coefficients'}; {'id': '303', 'type': 'argument_list', 'children': ['304']}; {'id': '304', 'type': 'identifier', 'children': [], 'value': 'coefs'}
Modify a model so all feasible flux distributions are loopless. In most cases you probably want to use the much faster `loopless_solution`. May be used in cases where you want to add complex constraints and objecives (for instance quadratic objectives) to the model afterwards or use an approximation of Gibbs free energy directions in you model. Adds variables and constraints to a model which will disallow flux distributions with loops. The used formulation is described in [1]_. This function *will* modify your model. Parameters ---------- model : cobra.Model The model to which to add the constraints. zero_cutoff : positive float, optional Cutoff used for null space. Coefficients with an absolute value smaller than `zero_cutoff` are considered to be zero (default model.tolerance). Returns ------- Nothing References ---------- .. [1] Elimination of thermodynamically infeasible loops in steady-state metabolic models. Schellenberger J, Lewis NE, Palsson BO. Biophys J. 2011 Feb 2;100(3):544-53. doi: 10.1016/j.bpj.2010.12.3707. Erratum in: Biophys J. 2011 Mar 2;100(5):1381.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'many_to_one'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'clsname'}; {'id': '5', 'type': 'dictionary_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kw'}; {'id': '7', 'type': 'block', 'children': ['8', '34']}; {'id': '8', 'type': 'decorated_definition', 'children': ['9', '11']}; {'id': '9', 'type': 'decorator', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'declared_attr'}; {'id': '11', 'type': 'function_definition', 'children': ['12', '13', '15']}; {'id': '12', 'type': 'function_name', 'children': [], 'value': 'm2o'}; {'id': '13', 'type': 'parameters', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '15', 'type': 'block', 'children': ['16', '27']}; {'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': 'cls'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_references'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'tuple', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'clsname'}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'relationship'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'clsname'}; {'id': '32', 'type': 'dictionary_splat', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'kw'}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'm2o'}
Use an event to build a many-to-one relationship on a class. This makes use of the :meth:`.References._reference_table` method to generate a full foreign key relationship to the remote table.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'SyntheticRestaurant'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '6', 'type': 'integer', 'children': [], 'value': '20'}; {'id': '7', 'type': 'block', 'children': ['8', '10', '42']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"Generate a DataSet with n examples."'}; {'id': '10', 'type': 'function_definition', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'function_name', 'children': [], 'value': 'gen'}; {'id': '12', 'type': 'parameters', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14', '26', '40']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'choice'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'restaurant'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '33']}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'restaurant'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '33', 'type': 'call', 'children': ['34', '38']}; {'id': '34', 'type': 'subscript', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'Fig'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '18'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'RestaurantDataSet'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'list_comprehension', 'children': ['47', '50']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'gen'}; {'id': '49', 'type': 'argument_list', 'children': []}; {'id': '50', 'type': 'for_in_clause', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'n'}
Generate a DataSet with n examples.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge_to_one_seq'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'infile'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'seqname'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'union'"}; {'id': '9', 'type': 'block', 'children': ['10', '19', '23', '39', '54', '118', '127', '135']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'seq_reader'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'file_reader'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'infile'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '22', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '23', 'type': 'for_statement', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'seq_reader'}; {'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': 'seqs'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'new_seq'}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "''"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'list_comprehension', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '51', 'type': 'for_in_clause', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '65', '99']}; {'id': '55', 'type': 'comparison_operator', 'children': ['56', '62'], 'value': '=='}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'Fastq'}; {'id': '65', 'type': 'block', 'children': ['66', '81', '88']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'new_qual'}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'string', 'children': [], 'value': "''"}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'list_comprehension', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'qual'}; {'id': '78', 'type': 'for_in_clause', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '87']}; {'id': '83', 'type': 'subscript', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '85', 'type': 'slice', 'children': ['86']}; {'id': '86', 'type': 'colon', 'children': []}; {'id': '87', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'merged'}; {'id': '91', 'type': 'call', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'Fastq'}; {'id': '95', 'type': 'argument_list', 'children': ['96', '97', '98']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'seqname'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'new_seq'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'new_qual'}; {'id': '99', 'type': 'else_clause', 'children': ['100']}; {'id': '100', 'type': 'block', 'children': ['101', '111']}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'merged'}; {'id': '104', 'type': 'call', 'children': ['105', '108']}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'sequences'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'Fasta'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'seqname'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'new_seq'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '117']}; {'id': '113', 'type': 'subscript', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'seqs'}; {'id': '115', 'type': 'slice', 'children': ['116']}; {'id': '116', 'type': 'colon', 'children': []}; {'id': '117', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'assignment', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'open_file_write'}; {'id': '125', 'type': 'argument_list', 'children': ['126']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'outfile'}; {'id': '127', 'type': 'expression_statement', 'children': ['128']}; {'id': '128', 'type': 'call', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '130', 'type': 'argument_list', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'merged'}; {'id': '132', 'type': 'keyword_argument', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '135', 'type': 'expression_statement', 'children': ['136']}; {'id': '136', 'type': 'call', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '140', 'type': 'argument_list', 'children': ['141']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'f'}
Takes a multi fasta or fastq file and writes a new file that contains just one sequence, with the original sequences catted together, preserving their order
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'decorator'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'decorator_func'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '63']}; {'id': '6', 'type': 'assert_statement', 'children': ['7', '11']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '9', 'type': 'argument_list', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'decorator_func'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'decorator_func'}; {'id': '15', 'type': 'function_definition', 'children': ['16', '17', '23']}; {'id': '16', 'type': 'function_name', 'children': [], 'value': '_decorator'}; {'id': '17', 'type': 'parameters', 'children': ['18', '21']}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '20', 'type': 'None', 'children': []}; {'id': '21', 'type': 'dictionary_splat_pattern', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '23', 'type': 'block', 'children': ['24', '37']}; {'id': '24', 'type': 'assert_statement', 'children': ['25', '33']}; {'id': '25', 'type': 'boolean_operator', 'children': ['26', '29'], 'value': 'or'}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '28'], 'value': 'is'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '28', 'type': 'None', 'children': []}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '37', 'type': 'if_statement', 'children': ['38', '39', '47']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'decorator_func'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '45', 'type': 'dictionary_splat', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '47', 'type': 'else_clause', 'children': ['48']}; {'id': '48', 'type': 'block', 'children': ['49', '61']}; {'id': '49', 'type': 'function_definition', 'children': ['50', '51', '53']}; {'id': '50', 'type': 'function_name', 'children': [], 'value': '_decorator_helper'}; {'id': '51', 'type': 'parameters', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'decorator_func'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '59', 'type': 'dictionary_splat', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '61', 'type': 'return_statement', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': '_decorator_helper'}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': '_decorator'}
Allows a decorator to be called with or without keyword arguments.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_matrix2dict'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'etype'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '16', '29', '66']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'adj'}; {'id': '19', 'type': 'dictionary_comprehension', 'children': ['20', '23']}; {'id': '20', 'type': 'pair', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '22', 'type': 'dictionary', 'children': []}; {'id': '23', 'type': 'for_in_clause', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '29', 'type': 'for_statement', 'children': ['30', '31', '35']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'for_statement', 'children': ['37', '38', '42']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'if_statement', 'children': ['44', '50']}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '49'], 'value': '!='}; {'id': '45', 'type': 'subscript', 'children': ['46', '47', '48']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '58']}; {'id': '53', 'type': 'subscript', 'children': ['54', '57']}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'adj'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '58', 'type': 'conditional_expression', 'children': ['59', '60', '62'], 'value': 'if'}; {'id': '59', 'type': 'dictionary', 'children': []}; {'id': '60', 'type': 'not_operator', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'etype'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64', '65']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'matrix'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'adj'}
Takes an adjacency matrix and returns an adjacency list.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_or_default'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '59']}; {'id': '11', 'type': 'function_definition', 'children': ['12', '13', '15']}; {'id': '12', 'type': 'function_name', 'children': [], 'value': 'decorator'}; {'id': '13', 'type': 'parameters', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '15', 'type': 'block', 'children': ['16', '57']}; {'id': '16', 'type': 'decorated_definition', 'children': ['17', '22']}; {'id': '17', 'type': 'decorator', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'wraps'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '22', 'type': 'function_definition', 'children': ['23', '24', '29']}; {'id': '23', 'type': 'function_name', 'children': [], 'value': 'wrapper'}; {'id': '24', 'type': 'parameters', 'children': ['25', '27']}; {'id': '25', 'type': 'list_splat_pattern', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '27', 'type': 'dictionary_splat_pattern', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'try_statement', 'children': ['31', '40']}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '38']}; {'id': '36', 'type': 'list_splat', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '38', 'type': 'dictionary_splat', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '40', 'type': 'except_clause', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'ObjectDoesNotExist'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'if_statement', 'children': ['44', '48', '53']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'else_clause', 'children': ['54']}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'wrapper'}; {'id': '59', 'type': 'if_statement', 'children': ['60', '63', '66']}; {'id': '60', 'type': 'comparison_operator', 'children': ['61', '62'], 'value': 'is'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '62', 'type': 'None', 'children': []}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'return_statement', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'decorator'}; {'id': '66', 'type': 'else_clause', 'children': ['67']}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'return_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'decorator'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'func'}
Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called when ObjectDoesNotExist exception will be raised.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_expand_consumed_mesh'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'mesh'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'mesh_index'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'row_position'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'passed'}; {'id': '9', 'type': 'block', 'children': ['10', '19', '25', '45']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '17']}; {'id': '11', 'type': 'not_operator', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'mesh'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'is_produced'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'return_statement', 'children': []}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'mesh'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'producing_row'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'Point'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '40']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '39'], 'value': '-'}; {'id': '32', 'type': 'binary_operator', 'children': ['33', '36'], 'value': '+'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'row_position'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'mesh'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'index_in_producing_row'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'mesh_index'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '44'], 'value': '-'}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'row_position'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'INSTRUCTION_HEIGHT'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': '_expand'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52', '53']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'passed'}
expand the consumed meshes
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register_timer_task_in_sec'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'task'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'second'}; {'id': '7', 'type': 'block', 'children': ['8', '15', '25']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'second_in_float'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'second'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'expiration'}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '24'], 'value': '+'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'second_in_float'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'heappush'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'timer_tasks'}; {'id': '32', 'type': 'tuple', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'expiration'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'task'}
Registers a new timer task :param task: function to be run at a specified second from now :param second: how many seconds to wait before the timer is triggered
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fmt'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'binary_operator', 'children': ['9', '26'], 'value': '/'}; {'id': '9', 'type': 'binary_operator', 'children': ['10', '11'], 'value': '*'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '11', 'type': 'call', 'children': ['12', '25']}; {'id': '12', 'type': 'attribute', 'children': ['13', '24']}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '21']}; {'id': '18', 'type': 'list', 'children': ['19', '20'], 'value': '[a, b]'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '23', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'call', 'children': ['27', '40']}; {'id': '27', 'type': 'attribute', 'children': ['28', '39']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '36']}; {'id': '33', 'type': 'list', 'children': ['34', '35'], 'value': '[a, b]'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '40', 'type': 'argument_list', 'children': []}
Figure of merit in time
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'submit'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'course'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'pastebin'}; {'id': '10', 'type': 'False', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '13', 'type': 'False', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '19', '36']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': 'is not'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'submit_exercise'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '30', '33']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'Exercise'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'byid'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'tid'}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'pastebin'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'pastebin'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'request_review'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '36', 'type': 'else_clause', 'children': ['37']}; {'id': '37', 'type': 'block', 'children': ['38', '46', '54']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'sel'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'Exercise'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'get_selected'}; {'id': '45', 'type': 'argument_list', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '49']}; {'id': '47', 'type': 'not_operator', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'sel'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'raise_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'NoExerciseSelected'}; {'id': '53', 'type': 'argument_list', 'children': []}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'submit_exercise'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59', '62']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'sel'}; {'id': '59', 'type': 'keyword_argument', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'pastebin'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'pastebin'}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'request_review'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'review'}
Submit the selected exercise to the server.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '28']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_warped_array'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13', '16', '19', '22', '25']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'input_file'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'indexes'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'dst_bounds'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'dst_shape'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'default_parameter', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'dst_crs'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'default_parameter', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'resampling'}; {'id': '21', 'type': 'None', 'children': []}; {'id': '22', 'type': 'default_parameter', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'src_nodata'}; {'id': '24', 'type': 'None', 'children': []}; {'id': '25', 'type': 'default_parameter', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'dst_nodata'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'try_statement', 'children': ['30', '59']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_rasterio_read'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '38', '41', '44', '47', '50', '53', '56']}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'input_file'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'input_file'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'indexes'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'indexes'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'dst_bounds'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'dst_bounds'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'dst_shape'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'dst_shape'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'dst_crs'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'dst_crs'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'resampling'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'resampling'}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'src_nodata'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'src_nodata'}; {'id': '56', 'type': 'keyword_argument', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'dst_nodata'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'dst_nodata'}; {'id': '59', 'type': 'except_clause', 'children': ['60', '64']}; {'id': '60', 'type': 'as_pattern', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '62', 'type': 'as_pattern_target', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '64', 'type': 'block', 'children': ['65', '74']}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '70', 'type': 'argument_list', 'children': ['71', '72', '73']}; {'id': '71', 'type': 'string', 'children': [], 'value': '"error while reading file %s: %s"'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'input_file'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '74', 'type': 'raise_statement', 'children': []}
Extract a numpy array from a raster file.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fromordinal'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '6', 'type': 'block', 'children': ['7', '17']}; {'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': 'y'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_ord2ymd'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'd'}
Contruct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_own_ip'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '9', '17', '70']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'own_ip'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'interfaces'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'psutil'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'net_if_addrs'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'for_statement', 'children': ['18', '21', '26']}; {'id': '18', 'type': 'pattern_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'details'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'interfaces'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'for_statement', 'children': ['28', '29', '30']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'detail'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'details'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'if_statement', 'children': ['32', '39']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '36'], 'value': '=='}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'detail'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'family'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'socket'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'AF_INET'}; {'id': '39', 'type': 'block', 'children': ['40', '51']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ipaddress'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'detail'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '51', 'type': 'if_statement', 'children': ['52', '61']}; {'id': '52', 'type': 'not_operator', 'children': ['53']}; {'id': '53', 'type': '()', 'children': ['54']}; {'id': '54', 'type': 'boolean_operator', 'children': ['55', '58'], 'value': 'or'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'is_link_local'}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'is_loopback'}; {'id': '61', 'type': 'block', 'children': ['62', '69']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'own_ip'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '69', 'type': 'break_statement', 'children': []}; {'id': '70', 'type': 'return_statement', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'own_ip'}
Gets the IP from the inet interfaces.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dist_abs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '9', 'type': 'string', 'children': [], 'value': "'exponential'"}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '15', 'type': 'False', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17', '35', '70', '108', '135', '139', '143', '184', '191']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'xored'}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '28'], 'value': '^'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'eudex'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'eudex'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '32', 'type': 'keyword_argument', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '38']}; {'id': '36', 'type': 'not_operator', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '38', 'type': 'block', 'children': ['39', '46', '55', '68']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'binary'}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'bin'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'xored'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'binary'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'1'"}; {'id': '55', 'type': 'if_statement', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '57', 'type': 'block', 'children': ['58']}; {'id': '58', 'type': 'return_statement', 'children': ['59']}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '61'], 'value': '/'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '61', 'type': '()', 'children': ['62']}; {'id': '62', 'type': 'binary_operator', 'children': ['63', '67'], 'value': '-'}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'binary'}; {'id': '67', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '68', 'type': 'return_statement', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '70', 'type': 'if_statement', 'children': ['71', '75', '82', '95']}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'assignment', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '79', 'type': 'call', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '81', 'type': 'argument_list', 'children': []}; {'id': '82', 'type': 'elif_clause', 'children': ['83', '86']}; {'id': '83', 'type': 'comparison_operator', 'children': ['84', '85'], 'value': '=='}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '85', 'type': 'string', 'children': [], 'value': "'exponential'"}; {'id': '86', 'type': 'block', 'children': ['87']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'Eudex'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'gen_exponential'}; {'id': '94', 'type': 'argument_list', 'children': []}; {'id': '95', 'type': 'elif_clause', 'children': ['96', '99']}; {'id': '96', 'type': 'comparison_operator', 'children': ['97', '98'], 'value': '=='}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '98', 'type': 'string', 'children': [], 'value': "'fibonacci'"}; {'id': '99', 'type': 'block', 'children': ['100']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'Eudex'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'gen_fibonacci'}; {'id': '107', 'type': 'argument_list', 'children': []}; {'id': '108', 'type': 'if_statement', 'children': ['109', '114']}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '111', 'type': 'argument_list', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'GeneratorType'}; {'id': '114', 'type': 'block', 'children': ['115']}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '118', 'type': 'subscript', 'children': ['119', '130']}; {'id': '119', 'type': 'list_comprehension', 'children': ['120', '124']}; {'id': '120', 'type': 'call', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '122', 'type': 'argument_list', 'children': ['123']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '124', 'type': 'for_in_clause', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '126', 'type': 'call', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'max_length'}; {'id': '130', 'type': 'slice', 'children': ['131', '132', '133']}; {'id': '131', 'type': 'colon', 'children': []}; {'id': '132', 'type': 'colon', 'children': []}; {'id': '133', 'type': 'unary_operator', 'children': ['134'], 'value': '-'}; {'id': '134', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '135', 'type': 'expression_statement', 'children': ['136']}; {'id': '136', 'type': 'assignment', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '138', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'assignment', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'max_distance'}; {'id': '142', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '143', 'type': 'while_statement', 'children': ['144', '150']}; {'id': '144', 'type': 'boolean_operator', 'children': ['145', '149'], 'value': 'and'}; {'id': '145', 'type': '()', 'children': ['146']}; {'id': '146', 'type': 'boolean_operator', 'children': ['147', '148'], 'value': 'or'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'xored'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '150', 'type': 'block', 'children': ['151', '160', '180']}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'augmented_assignment', 'children': ['153', '154'], 'value': '+='}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'max_distance'}; {'id': '154', 'type': 'binary_operator', 'children': ['155', '156'], 'value': '*'}; {'id': '155', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '156', 'type': 'subscript', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '158', 'type': 'unary_operator', 'children': ['159'], 'value': '-'}; {'id': '159', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'augmented_assignment', 'children': ['162', '163'], 'value': '+='}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '163', 'type': 'binary_operator', 'children': ['164', '175'], 'value': '*'}; {'id': '164', 'type': 'call', 'children': ['165', '173']}; {'id': '165', 'type': 'attribute', 'children': ['166', '172']}; {'id': '166', 'type': 'call', 'children': ['167', '168']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'bin'}; {'id': '168', 'type': 'argument_list', 'children': ['169']}; {'id': '169', 'type': 'binary_operator', 'children': ['170', '171'], 'value': '&'}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'xored'}; {'id': '171', 'type': 'integer', 'children': [], 'value': '0xFF'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '173', 'type': 'argument_list', 'children': ['174']}; {'id': '174', 'type': 'string', 'children': [], 'value': "'1'"}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'weights'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '179', 'type': 'argument_list', 'children': []}; {'id': '180', 'type': 'expression_statement', 'children': ['181']}; {'id': '181', 'type': 'augmented_assignment', 'children': ['182', '183'], 'value': '>>='}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'xored'}; {'id': '183', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '184', 'type': 'if_statement', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '186', 'type': 'block', 'children': ['187']}; {'id': '187', 'type': 'expression_statement', 'children': ['188']}; {'id': '188', 'type': 'augmented_assignment', 'children': ['189', '190'], 'value': '/='}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'distance'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'max_distance'}; {'id': '191', 'type': 'return_statement', 'children': ['192']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'distance'}
Calculate the distance between the Eudex hashes of two terms. Parameters ---------- src : str Source string for comparison tar : str Target string for comparison weights : str, iterable, or generator function The weights or weights generator function - If set to ``None``, a simple Hamming distance is calculated. - If set to ``exponential``, weight decays by powers of 2, as proposed in the eudex specification: https://github.com/ticki/eudex. - If set to ``fibonacci``, weight decays through the Fibonacci series, as in the eudex reference implementation. - If set to a callable function, this assumes it creates a generator and the generator is used to populate a series of weights. - If set to an iterable, the iterable's values should be integers and will be used as the weights. max_length : int The number of characters to encode as a eudex hash normalized : bool Normalizes to [0, 1] if True Returns ------- int The Eudex Hamming distance Examples -------- >>> cmp = Eudex() >>> cmp.dist_abs('cat', 'hat') 128 >>> cmp.dist_abs('Niall', 'Neil') 2 >>> cmp.dist_abs('Colin', 'Cuilen') 10 >>> cmp.dist_abs('ATCG', 'TAGC') 403 >>> cmp.dist_abs('cat', 'hat', weights='fibonacci') 34 >>> cmp.dist_abs('Niall', 'Neil', weights='fibonacci') 2 >>> cmp.dist_abs('Colin', 'Cuilen', weights='fibonacci') 7 >>> cmp.dist_abs('ATCG', 'TAGC', weights='fibonacci') 117 >>> cmp.dist_abs('cat', 'hat', weights=None) 1 >>> cmp.dist_abs('Niall', 'Neil', weights=None) 1 >>> cmp.dist_abs('Colin', 'Cuilen', weights=None) 2 >>> cmp.dist_abs('ATCG', 'TAGC', weights=None) 9 >>> # Using the OEIS A000142: >>> cmp.dist_abs('cat', 'hat', [1, 1, 2, 6, 24, 120, 720, 5040]) 1 >>> cmp.dist_abs('Niall', 'Neil', [1, 1, 2, 6, 24, 120, 720, 5040]) 720 >>> cmp.dist_abs('Colin', 'Cuilen', ... [1, 1, 2, 6, 24, 120, 720, 5040]) 744 >>> cmp.dist_abs('ATCG', 'TAGC', [1, 1, 2, 6, 24, 120, 720, 5040]) 6243
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tradepile'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '14', '24', '46', '69', '78']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '9', 'type': 'string', 'children': [], 'value': "'GET'"}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '13', 'type': 'string', 'children': [], 'value': "'tradepile'"}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'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': '__request__'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '27', 'type': 'list', 'children': ['28', '37'], 'value': "[self.pin.event('page_view', 'Hub - Transfers'), self.pin.event('page_view', 'Transfer List - List View')]"}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'page_view'"}; {'id': '36', 'type': 'string', 'children': [], 'value': "'Hub - Transfers'"}; {'id': '37', 'type': 'call', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'page_view'"}; {'id': '45', 'type': 'string', 'children': [], 'value': "'Transfer List - List View'"}; {'id': '46', 'type': 'if_statement', 'children': ['47', '53']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'string', 'children': [], 'value': "'auctionInfo'"}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '66']}; {'id': '61', 'type': 'attribute', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '66', 'type': 'argument_list', 'children': ['67', '68']}; {'id': '67', 'type': 'string', 'children': [], 'value': "'page_view'"}; {'id': '68', 'type': 'string', 'children': [], 'value': "'Item - Detail View'"}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '76']}; {'id': '71', 'type': 'attribute', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'pin'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'send'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'list_comprehension', 'children': ['80', '84']}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'itemParse'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '84', 'type': 'for_in_clause', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'rc'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '90', 'type': 'argument_list', 'children': ['91', '92']}; {'id': '91', 'type': 'string', 'children': [], 'value': "'auctionInfo'"}; {'id': '92', 'type': 'tuple', 'children': []}
Return items in tradepile.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_all_certificates'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '21', '50']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_data'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'string', 'children': [], 'value': '"certificates"'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'certificates'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'for_statement', 'children': ['22', '23', '26']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'jsoned'}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'certificates'"}; {'id': '26', 'type': 'block', 'children': ['27', '35', '43']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'cert'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'Certificate'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'dictionary_splat', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'jsoned'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'cert'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'certificates'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'cert'}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'certificates'}
This function returns a list of Certificate objects.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_jwt'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'integration_id'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'private_key_path'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '34', '44', '57', '84']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'integration_id'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'integration_id'}; {'id': '14', 'type': 'with_statement', 'children': ['15', '25']}; {'id': '15', 'type': 'with_clause', 'children': ['16']}; {'id': '16', 'type': 'with_item', 'children': ['17']}; {'id': '17', 'type': 'as_pattern', 'children': ['18', '23']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'private_key_path'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'rb'"}; {'id': '23', 'type': 'as_pattern_target', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'cert_bytes'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'read'}; {'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': 'now'}; {'id': '37', 'type': 'call', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'now'}; {'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': 'expiration_time'}; {'id': '47', 'type': 'binary_operator', 'children': ['48', '49'], 'value': '+'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'now'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'timedelta'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'minutes'}; {'id': '56', 'type': 'integer', 'children': [], 'value': '9'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'payload'}; {'id': '60', 'type': 'dictionary', 'children': ['61', '71', '81']}; {'id': '61', 'type': 'pair', 'children': ['62', '63']}; {'id': '62', 'type': 'string', 'children': [], 'value': "'iat'"}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'now'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'timestamp'}; {'id': '70', 'type': 'argument_list', 'children': []}; {'id': '71', 'type': 'pair', 'children': ['72', '73']}; {'id': '72', 'type': 'string', 'children': [], 'value': "'exp'"}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'expiration_time'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'timestamp'}; {'id': '80', 'type': 'argument_list', 'children': []}; {'id': '81', 'type': 'pair', 'children': ['82', '83']}; {'id': '82', 'type': 'string', 'children': [], 'value': "'iss'"}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'integration_id'}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'jwt'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91', '92']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'payload'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'cert_bytes'}; {'id': '92', 'type': 'keyword_argument', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'algorithm'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'RS256'"}
Create a JSON Web Token to authenticate a GitHub Integration or installation. Parameters ---------- integration_id : `int` Integration ID. This is available from the GitHub integration's homepage. private_key_path : `str` Path to the integration's private key (a ``.pem`` file). Returns ------- jwt : `bytes` JSON Web Token that is good for 9 minutes. Notes ----- The JWT is encoded with the RS256 algorithm. It includes a payload with fields: - ``'iat'``: The current time, as an `int` timestamp. - ``'exp'``: Expiration time, as an `int timestamp. The expiration time is set of 9 minutes in the future (maximum allowance is 10 minutes). - ``'iss'``: The integration ID (`int`). For more information, see https://developer.github.com/early-access/integrations/authentication/.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'allow_request'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '7', 'type': 'block', 'children': ['8', '14', '29']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'service_users'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_service_usernames'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'if_statement', 'children': ['15', '22']}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '21'], 'value': 'in'}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'service_users'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'update_throttle_scope'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '38']}; {'id': '31', 'type': 'attribute', 'children': ['32', '37']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'ServiceUserThrottle'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'allow_request'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'view'}
Modify throttling for service users. Updates throttling rate if the request is coming from the service user, and defaults to UserRateThrottle's configured setting otherwise. Updated throttling rate comes from `DEFAULT_THROTTLE_RATES` key in `REST_FRAMEWORK` setting. service user throttling is specified in `DEFAULT_THROTTLE_RATES` by `service_user` key Example Setting: ``` REST_FRAMEWORK = { ... 'DEFAULT_THROTTLE_RATES': { ... 'service_user': '50/day' } } ```
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'map_function'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '23', '30']}; {'id': '7', 'type': 'import_from_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'dotted_name', 'children': ['9', '10', '11', '12']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'heronpy'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'streamlet'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'impl'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'mapbolt'}; {'id': '13', 'type': 'dotted_name', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'MapStreamlet'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'map_streamlet'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'MapStreamlet'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'map_function'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_add_child'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'map_streamlet'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'map_streamlet'}
Return a new Streamlet by applying map_function to each element of this Streamlet.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'connect'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '47']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '38']}; {'id': '7', 'type': 'block', 'children': ['8', '23']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '%'}; {'id': '15', 'type': 'string', 'children': [], 'value': "u'Connecting %s:%d'"}; {'id': '16', 'type': 'tuple', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sock'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'connect'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'tuple', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '38', 'type': 'except_clause', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'socket'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'raise_statement', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ConnectionError'}; {'id': '46', 'type': 'argument_list', 'children': []}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'CONNECTED'}
Connect to the server :raise ConnectionError: If socket cannot establish a connection
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_algorithm_info'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}; {'id': '6', 'type': 'block', 'children': ['7', '25', '35', '42']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '15']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '12'], 'value': 'not in'}; {'id': '9', 'type': 'subscript', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'algorithm'"}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ALGORITHMS'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'raise_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '22'], 'value': '%'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'Algorithm not supported: %s'"}; {'id': '22', 'type': 'subscript', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}; {'id': '24', 'type': 'string', 'children': [], 'value': "'algorithm'"}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'algorithm'}; {'id': '28', 'type': 'subscript', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ALGORITHMS'}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'algorithm'"}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'algorithm'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'algorithm_info'}
Get algorithm info
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'path_to_node'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '18', '30']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': 'is'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'return_statement', 'children': ['13']}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '18', 'type': 'for_statement', 'children': ['19', '20', '21']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'child_by_key'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'node'}
FST node located at the given path
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'INC'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '26', '37', '48', '64', '72', '83', '91']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'arg0'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'read'}; {'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': 'res'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'binary_operator', 'children': ['24', '25'], 'value': '+'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'arg0'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'augmented_assignment', 'children': ['28', '29'], 'value': '&='}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '36'], 'value': '-'}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '33'], 'value': '<<'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'SIGN_MASK'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '<<'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '42', 'type': '()', 'children': ['43']}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '47'], 'value': '-'}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '1'}; {'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': 'cpu'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'AF'}; {'id': '53', 'type': 'comparison_operator', 'children': ['54', '63'], 'value': '!='}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '62'], 'value': '&'}; {'id': '55', 'type': '()', 'children': ['56']}; {'id': '56', 'type': 'binary_operator', 'children': ['57', '61'], 'value': '^'}; {'id': '57', 'type': '()', 'children': ['58']}; {'id': '58', 'type': 'binary_operator', 'children': ['59', '60'], 'value': '^'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'arg0'}; {'id': '60', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '0x10'}; {'id': '63', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ZF'}; {'id': '69', 'type': 'comparison_operator', 'children': ['70', '71'], 'value': '=='}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '71', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'assignment', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'SF'}; {'id': '77', 'type': 'comparison_operator', 'children': ['78', '82'], 'value': '!='}; {'id': '78', 'type': '()', 'children': ['79']}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '81'], 'value': '&'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'SIGN_MASK'}; {'id': '82', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'OF'}; {'id': '88', 'type': 'comparison_operator', 'children': ['89', '90'], 'value': '=='}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'SIGN_MASK'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'PF'}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': '_calculate_parity_flag'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'res'}
Increments by 1. Adds 1 to the destination operand, while preserving the state of the CF flag. The destination operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF flag. (Use a ADD instruction with an immediate operand of 1 to perform an increment operation that does updates the CF flag.):: DEST = DEST +1; :param cpu: current CPU. :param dest: destination operand.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'i2c_stop_reading'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '6', 'type': 'block', 'children': ['7', '15']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '10', 'type': 'list', 'children': ['11', '12'], 'value': '[address, self.I2C_STOP_READING]'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'I2C_STOP_READING'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '22']}; {'id': '17', 'type': 'attribute', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_command_handler'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'send_sysex'}; {'id': '22', 'type': 'argument_list', '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': '_command_handler'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'I2C_REQUEST'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'data'}
This method stops an I2C_READ_CONTINUOUSLY operation for the i2c device address specified. :param address: address of i2c device
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_last_commit'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'git_path'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'block', 'children': ['8', '17', '24', '34']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'is'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'git_path'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'git_path'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'GIT_PATH'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'get_last_commit_line'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'git_path'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'revision_id'}; {'id': '27', 'type': 'subscript', 'children': ['28', '33']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'revision_id'}
Get the HEAD commit SHA1 of repository in current dir.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'file_serializer'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'dictionary', 'children': ['8', '16', '21', '28']}; {'id': '8', 'type': 'pair', 'children': ['9', '10']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"id"'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'file_id'}; {'id': '16', 'type': 'pair', 'children': ['17', '18']}; {'id': '17', 'type': 'string', 'children': [], 'value': '"filename"'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '21', 'type': 'pair', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': '"filesize"'}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '28', 'type': 'pair', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': '"checksum"'}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'checksum'}
Serialize a object. :param obj: A :class:`invenio_files_rest.models.ObjectVersion` instance. :returns: A dictionary with the fields to serialize.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_keywords'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '59']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'meta'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'find'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'string', 'children': [], 'value': '"meta"'}; {'id': '15', 'type': 'dictionary', 'children': ['16']}; {'id': '16', 'type': 'pair', 'children': ['17', '18']}; {'id': '17', 'type': 'string', 'children': [], 'value': '"name"'}; {'id': '18', 'type': 'string', 'children': [], 'value': '"keywords"'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '33', '53']}; {'id': '20', 'type': 'boolean_operator', 'children': ['21', '26', '27'], 'value': 'and'}; {'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': 'meta'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '26', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'meta'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'has_key'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'string', 'children': [], 'value': '"content"'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'keywords'}; {'id': '37', 'type': 'list_comprehension', 'children': ['38', '43']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'for_in_clause', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '45', 'type': 'call', 'children': ['46', '51']}; {'id': '46', 'type': 'attribute', 'children': ['47', '50']}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'meta'}; {'id': '49', 'type': 'string', 'children': [], 'value': '"content"'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'string', 'children': [], 'value': '","'}; {'id': '53', 'type': 'else_clause', 'children': ['54']}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'keywords'}; {'id': '58', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '59', 'type': 'return_statement', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'keywords'}
Returns the meta keywords in the page.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_throttle_scope'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '22']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'scope'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'SERVICE_USER_SCOPE'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'rate'}; {'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': 'get_rate'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '31']}; {'id': '24', 'type': 'pattern_list', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'num_requests'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'parse_rate'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'rate'}
Update throttle scope so that service user throttle rates are applied.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'predict_proba'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '21']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'check_is_fitted'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'list', 'children': ['13'], 'value': "['inverse_influence_matrix']"}; {'id': '13', 'type': 'string', 'children': [], 'value': "'inverse_influence_matrix'"}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'check_array'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '__find_leverages'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'inverse_influence_matrix'}
Predict the distances for X to center of the training set. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) The input samples. Internally, it will be converted to ``dtype=np.float32`` and if a sparse matrix is provided to a sparse ``csr_matrix``. Returns ------- leverages: array of shape = [n_samples] The objects distances to center of the training set.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getch'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '42']}; {'id': '5', 'type': 'try_statement', 'children': ['6', '29']}; {'id': '6', 'type': 'block', 'children': ['7', '18']}; {'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': 'termios'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'tcsetattr'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14', '17']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_fd'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'termios'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'TCSANOW'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_new_settings'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '21', 'type': 'call', 'children': ['22', '27']}; {'id': '22', 'type': 'attribute', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'stdin'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '29', 'type': 'finally_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'termios'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'tcsetattr'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38', '41']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_fd'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'termios'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'TCSADRAIN'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_old_settings'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ch'}
get character. waiting for key
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_in_git_repo'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '24']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'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': 'temple'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16', '21']}; {'id': '15', 'type': 'string', 'children': [], 'value': "'git rev-parse'"}; {'id': '16', 'type': 'keyword_argument', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'DEVNULL'}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'check'}; {'id': '23', 'type': 'False', 'children': []}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '29'], 'value': '=='}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'returncode'}; {'id': '29', 'type': 'integer', 'children': [], 'value': '0'}
Returns True if inside a git repo, False otherwise
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'smooth_fwhm'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fwhm'}; {'id': '6', 'type': 'block', 'children': ['7', '20']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': '!='}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'fwhm'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_smooth_fwhm'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': '_is_data_smooth'}; {'id': '19', 'type': 'False', 'children': []}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_smooth_fwhm'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'fwhm'}
Set a smoothing Gaussian kernel given its FWHM in mm.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'record_delete_subfield'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'subfield_code'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'ind1'}; {'id': '9', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'ind2'}; {'id': '12', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '13', 'type': 'block', 'children': ['14', '24']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '19']}; {'id': '16', 'type': 'pattern_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'ind1'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ind2'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_wash_indicators'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ind1'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ind2'}; {'id': '24', 'type': 'for_statement', 'children': ['25', '26', '33']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'rec'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '32', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'if_statement', 'children': ['35', '46']}; {'id': '35', 'type': 'boolean_operator', 'children': ['36', '41'], 'value': 'and'}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '40'], 'value': '=='}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ind1'}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '45'], 'value': '=='}; {'id': '42', 'type': 'subscript', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ind2'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '55']}; {'id': '49', 'type': 'subscript', 'children': ['50', '53']}; {'id': '50', 'type': 'subscript', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '52', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '53', 'type': 'slice', 'children': ['54']}; {'id': '54', 'type': 'colon', 'children': []}; {'id': '55', 'type': 'list_comprehension', 'children': ['56', '57', '62']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '57', 'type': 'for_in_clause', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'if_clause', 'children': ['63']}; {'id': '63', 'type': 'comparison_operator', 'children': ['64', '65'], 'value': '!='}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'subfield_code'}; {'id': '65', 'type': 'subscript', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'subfield'}; {'id': '67', 'type': 'integer', 'children': [], 'value': '0'}
Delete all subfields with subfield_code in the record.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sendCommands'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'comPort'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'commands'}; {'id': '6', 'type': 'block', 'children': ['7', '13']}; {'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': 'mutex'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'acquire'}; {'id': '12', 'type': 'argument_list', 'children': []}; {'id': '13', 'type': 'try_statement', 'children': ['14', '71']}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'try_statement', 'children': ['16', '53']}; {'id': '16', 'type': 'block', 'children': ['17', '28', '32', '36']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'serial'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'Serial'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'comPort'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '31', 'type': 'string', 'children': [], 'value': "'11010101 10101010'"}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'footer'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'10101101'"}; {'id': '36', 'type': 'for_statement', 'children': ['37', '38', '42']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': '_translateCommands'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'commands'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': '_sendBinaryData'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '48', 'type': 'binary_operator', 'children': ['49', '52'], 'value': '+'}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '51'], 'value': '+'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'footer'}; {'id': '53', 'type': 'except_clause', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'serial'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'SerialException'}; {'id': '57', 'type': 'block', 'children': ['58', '65', '70']}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'binary_operator', 'children': ['63', '64'], 'value': '%'}; {'id': '63', 'type': 'string', 'children': [], 'value': "'Unable to open serial port %s'"}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'comPort'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'string', 'children': [], 'value': "''"}; {'id': '70', 'type': 'raise_statement', 'children': []}; {'id': '71', 'type': 'finally_clause', 'children': ['72']}; {'id': '72', 'type': 'block', 'children': ['73']}; {'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': 'mutex'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'release'}; {'id': '78', 'type': 'argument_list', 'children': []}
Send X10 commands using the FireCracker on comPort comPort should be the name of a serial port on the host platform. On Windows, for example, 'com1'. commands should be a string consisting of X10 commands separated by commas. For example. 'A1 On, A Dim, A Dim, A Dim, A Lamps Off'. The letter is a house code (A-P) and the number is the device number (1-16). Possible commands for a house code / device number combination are 'On' and 'Off'. The commands 'Bright' and 'Dim' should be used with a house code alone after sending an On command to a specific device. The 'All On', 'All Off', 'Lamps On', and 'Lamps Off' commands should also be used with a house code alone. # Turn on module A1 >>> sendCommands('com1', 'A1 On') # Turn all modules with house code A off >>> sendCommands('com1', 'A All Off') # Turn all lamp modules with house code B on >>> sendCommands('com1', 'B Lamps On') # Turn on module A1 and dim it 3 steps, then brighten it 1 step >>> sendCommands('com1', 'A1 On, A Dim, A Dim, A Dim, A Bright')
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'save_traceback'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '5', 'type': 'block', 'children': ['6', '33', '51', '68', '89', '101', '106', '117']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'safe_path'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '18']}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'expanduser'}; {'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': 'os'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'~'"}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'.{0}'"}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '__script__'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '43']}; {'id': '34', 'type': 'not_operator', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '41']}; {'id': '36', 'type': 'attribute', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'isdir'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'mkdir'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '54', 'type': 'call', 'children': ['55', '60']}; {'id': '55', 'type': 'attribute', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'string', 'children': [], 'value': "'{0}.log'"}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': '__script__'}; {'id': '68', 'type': 'with_statement', 'children': ['69', '79']}; {'id': '69', 'type': 'with_clause', 'children': ['70']}; {'id': '70', 'type': 'with_item', 'children': ['71']}; {'id': '71', 'type': 'as_pattern', 'children': ['72', '77']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'a+'"}; {'id': '77', 'type': 'as_pattern_target', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'traceback'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'print_exc'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'keyword_argument', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'assignment', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '92', 'type': '()', 'children': ['93']}; {'id': '93', 'type': 'conditional_expression', 'children': ['94', '95', '100'], 'value': 'if'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'User aborted workflow'"}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'KeyboardInterrupt'}; {'id': '100', 'type': 'string', 'children': [], 'value': "'Unexpected error catched'"}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'print_error'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'call', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'print_error'}; {'id': '109', 'type': 'argument_list', 'children': ['110', '116']}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'string', 'children': [], 'value': "'Full log stored to {0}'"}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '114', 'type': 'argument_list', 'children': ['115']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '116', 'type': 'False', 'children': []}; {'id': '117', 'type': 'return_statement', 'children': ['118']}; {'id': '118', 'type': 'True', 'children': []}
Save error traceback to bootstrapper log file. :param err: Catched exception.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'configure_modrpaf'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'local_renderer'}; {'id': '12', 'type': 'if_statement', 'children': ['13', '18', '32']}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'modrpaf_enabled'}; {'id': '18', 'type': 'block', 'children': ['19', '25']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'install_packages'}; {'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': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'enable_mod'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'rpaf'"}; {'id': '32', 'type': 'else_clause', 'children': ['33']}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'if_statement', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'last_manifest'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'modrpaf_enabled'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'disable_mod'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'mod_rpaf'"}
Installs the mod-rpaf Apache module. https://github.com/gnif/mod_rpaf
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_plugin_endpoint_rename'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fn_name'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '6', 'type': 'block', 'children': ['7', '30']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'boolean_operator', 'children': ['9', '10'], 'value': 'and'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'namespaced'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'fn_name'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"r_{0}_{1}"'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'fn_name'}; {'id': '27', 'type': 'slice', 'children': ['28', '29']}; {'id': '28', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '29', 'type': 'colon', 'children': []}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'fn_name'}
Rename endpoint function name to avoid conflict when namespacing is set to true :param fn_name: Name of the route function :param instance: Instance bound to the function :return: Name of the new namespaced function name
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_directory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path_to_directory'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '30'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'backoff'}; {'id': '11', 'type': 'float', 'children': [], 'value': '0.4'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'max_wait'}; {'id': '14', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '15', 'type': 'block', 'children': ['16', '20', '24', '28', '32', '100']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'started_at'}; {'id': '23', 'type': 'None', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'time_elapsed'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '32', 'type': 'while_statement', 'children': ['33', '36']}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '35'], 'value': '<'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'time_elapsed'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '36', 'type': 'block', 'children': ['37', '51']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_get'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'{0}.zip'"}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'path_to_directory'}; {'id': '51', 'type': 'if_statement', 'children': ['52', '53', '55']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'break_statement', 'children': []}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57', '70', '86', '90']}; {'id': '57', 'type': 'if_statement', 'children': ['58', '61']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '60'], 'value': 'is'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'started_at'}; {'id': '60', 'type': 'None', 'children': []}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'started_at'}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '69', 'type': 'argument_list', 'children': []}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '85']}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '81'], 'value': '*'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'backoff'}; {'id': '81', 'type': '()', 'children': ['82']}; {'id': '82', 'type': 'binary_operator', 'children': ['83', '84'], 'value': '**'}; {'id': '83', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'max_wait'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'augmented_assignment', 'children': ['88', '89'], 'value': '+='}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '89', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'assignment', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'time_elapsed'}; {'id': '93', 'type': 'binary_operator', 'children': ['94', '99'], 'value': '-'}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '98', 'type': 'argument_list', 'children': []}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'started_at'}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'response'}
Gets an artifact directory by its path. See the `Go artifact directory documentation`__ for example responses. .. __: http://api.go.cd/current/#get-artifact-directory .. note:: Getting a directory relies on Go creating a zip file of the directory in question. Because of this Go will zip the file in the background and return a 202 Accepted response. It's then up to the client to check again later and get the final file. To work with normal assumptions this :meth:`get_directory` will retry itself up to ``timeout`` seconds to get a 200 response to return. At that point it will then return the response as is, no matter whether it's still 202 or 200. The retry is done with an exponential backoff with a max value between retries. See the ``backoff`` and ``max_wait`` variables. If you want to handle the retry logic yourself then use :meth:`get` and add '.zip' as a suffix on the directory. Args: path_to_directory (str): The path to the directory to get. It can be nested eg ``target/dist.zip`` timeout (int): How many seconds we will wait in total for a successful response from Go when we're receiving 202 backoff (float): The initial value used for backoff, raises exponentially until it reaches ``max_wait`` max_wait (int): The max time between retries Returns: Response: :class:`gocd.api.response.Response` object A successful response is a zip-file.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'dst'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '25', '95']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '10', 'type': 'list', 'children': ['11'], 'value': '[(dst, src)]'}; {'id': '11', 'type': 'tuple', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'dst'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '14', 'type': 'function_definition', 'children': ['15', '16', '18']}; {'id': '15', 'type': 'function_name', 'children': [], 'value': 'isdict'}; {'id': '16', 'type': 'parameters', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '24', 'type': 'string', 'children': [], 'value': "'keys'"}; {'id': '25', 'type': 'while_statement', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '27', 'type': 'block', 'children': ['28', '38']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '33']}; {'id': '30', 'type': 'pattern_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '37', 'type': 'argument_list', 'children': []}; {'id': '38', 'type': 'for_statement', 'children': ['39', '40', '41']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46', '55']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': 'not in'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '52']}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '52', 'type': 'subscript', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'if_statement', 'children': ['58', '71', '85']}; {'id': '58', 'type': 'boolean_operator', 'children': ['59', '65'], 'value': 'and'}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'isdict'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'isdict'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'subscript', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '71', 'type': 'block', 'children': ['72']}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'tuple', 'children': ['79', '82']}; {'id': '79', 'type': 'subscript', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '82', 'type': 'subscript', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '85', 'type': 'else_clause', 'children': ['86']}; {'id': '86', 'type': 'block', 'children': ['87']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '92']}; {'id': '89', 'type': 'subscript', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'current_dst'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '92', 'type': 'subscript', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'current_src'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'dst'}
Recursively update the destination dict-like object with the source dict-like object. Useful for merging options and Bunches together! Based on: http://code.activestate.com/recipes/499335-recursively-update-a-dictionary-without-hitting-py/#c1
{'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': 'name_or_path'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '39', '47', '65', '76', '82', '94']}; {'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': 'click'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'try_statement', 'children': ['13', '23']}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'cpenv'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'resolve'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'name_or_path'}; {'id': '23', 'type': 'except_clause', 'children': ['24', '30']}; {'id': '24', 'type': 'as_pattern', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cpenv'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ResolveError'}; {'id': '28', 'type': 'as_pattern_target', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '30', 'type': 'block', 'children': ['31', '38']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '38', 'type': 'return_statement', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '42', 'type': 'subscript', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'resolved'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '47', 'type': 'if_statement', 'children': ['48', '56']}; {'id': '48', 'type': 'not_operator', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'cpenv'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'VirtualEnvironment'}; {'id': '56', 'type': 'block', 'children': ['57', '64']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'string', 'children': [], 'value': "'{} is a module. Use `cpenv module remove` instead.'"}; {'id': '64', 'type': 'return_statement', 'children': []}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'format_objects'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'list', 'children': ['75'], 'value': '[obj]'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'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': 'click'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '81', 'type': 'argument_list', 'children': []}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'user_confirmed'}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'confirm'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'red'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'string', 'children': [], 'value': "'Are you sure you want to remove this environment?'"}; {'id': '94', 'type': 'if_statement', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'user_confirmed'}; {'id': '96', 'type': 'block', 'children': ['97', '107']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'call', 'children': ['99', '102']}; {'id': '99', 'type': 'attribute', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '102', 'type': 'argument_list', 'children': ['103', '104']}; {'id': '103', 'type': 'string', 'children': [], 'value': "'Attempting to remove...'"}; {'id': '104', 'type': 'keyword_argument', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'nl'}; {'id': '106', 'type': 'False', 'children': []}; {'id': '107', 'type': 'try_statement', 'children': ['108', '115', '138']}; {'id': '108', 'type': 'block', 'children': ['109']}; {'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': 'obj'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '114', 'type': 'argument_list', 'children': []}; {'id': '115', 'type': 'except_clause', 'children': ['116', '120']}; {'id': '116', 'type': 'as_pattern', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '118', 'type': 'as_pattern_target', 'children': ['119']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '120', 'type': 'block', 'children': ['121', '131']}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'call', 'children': ['123', '126']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '126', 'type': 'argument_list', 'children': ['127']}; {'id': '127', 'type': 'call', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'bold_red'}; {'id': '129', 'type': 'argument_list', 'children': ['130']}; {'id': '130', 'type': 'string', 'children': [], 'value': "'FAIL'"}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'call', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '136', 'type': 'argument_list', 'children': ['137']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '138', 'type': 'else_clause', 'children': ['139']}; {'id': '139', 'type': 'block', 'children': ['140']}; {'id': '140', 'type': 'expression_statement', 'children': ['141']}; {'id': '141', 'type': 'call', 'children': ['142', '145']}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'echo'}; {'id': '145', 'type': 'argument_list', 'children': ['146']}; {'id': '146', 'type': 'call', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'bold_green'}; {'id': '148', 'type': 'argument_list', 'children': ['149']}; {'id': '149', 'type': 'string', 'children': [], 'value': "'OK!'"}
Remove an environment
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'retrieve_descriptor'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '19', '150', '190', '219']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'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': 'the_descriptor'}; {'id': '18', 'type': 'dictionary', 'children': []}; {'id': '19', 'type': 'if_statement', 'children': ['20', '27']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'string_types'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'try_statement', 'children': ['29', '92', '123']}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '39', '61']}; {'id': '31', 'type': 'call', 'children': ['32', '37']}; {'id': '32', 'type': 'attribute', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'with_statement', 'children': ['41', '51']}; {'id': '41', 'type': 'with_clause', 'children': ['42']}; {'id': '42', 'type': 'with_item', 'children': ['43']}; {'id': '43', 'type': 'as_pattern', 'children': ['44', '49']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '48', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '49', 'type': 'as_pattern_target', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'f'}; {'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': 'the_descriptor'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '61', 'type': 'else_clause', 'children': ['62']}; {'id': '62', 'type': 'block', 'children': ['63', '72', '78', '84']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '72', 'type': 'expression_statement', 'children': ['73']}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'raise_for_status'}; {'id': '77', 'type': 'argument_list', 'children': []}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '83', 'type': 'string', 'children': [], 'value': "'utf8'"}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '91', 'type': 'argument_list', 'children': []}; {'id': '92', 'type': 'except_clause', 'children': ['93', '103']}; {'id': '93', 'type': 'as_pattern', 'children': ['94', '101']}; {'id': '94', 'type': 'tuple', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'IOError'}; {'id': '96', 'type': 'attribute', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'RequestException'}; {'id': '101', 'type': 'as_pattern_target', 'children': ['102']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '103', 'type': 'block', 'children': ['104', '110']}; {'id': '104', 'type': 'expression_statement', 'children': ['105']}; {'id': '105', 'type': 'assignment', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '107', 'type': 'binary_operator', 'children': ['108', '109'], 'value': '%'}; {'id': '108', 'type': 'string', 'children': [], 'value': '\'Unable to load JSON at "%s"\''}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'call', 'children': ['112', '115']}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'raise_from'}; {'id': '115', 'type': 'argument_list', 'children': ['116', '122']}; {'id': '116', 'type': 'call', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'DataPackageException'}; {'id': '120', 'type': 'argument_list', 'children': ['121']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '123', 'type': 'except_clause', 'children': ['124', '128']}; {'id': '124', 'type': 'as_pattern', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '126', 'type': 'as_pattern_target', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '128', 'type': 'block', 'children': ['129', '137']}; {'id': '129', 'type': 'expression_statement', 'children': ['130']}; {'id': '130', 'type': 'assignment', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '132', 'type': 'binary_operator', 'children': ['133', '134'], 'value': '%'}; {'id': '133', 'type': 'string', 'children': [], 'value': '\'Unable to parse JSON at "%s". %s\''}; {'id': '134', 'type': 'tuple', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '137', 'type': 'expression_statement', 'children': ['138']}; {'id': '138', 'type': 'call', 'children': ['139', '142']}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'raise_from'}; {'id': '142', 'type': 'argument_list', 'children': ['143', '149']}; {'id': '143', 'type': 'call', 'children': ['144', '147']}; {'id': '144', 'type': 'attribute', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'DataPackageException'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '150', 'type': 'if_statement', 'children': ['151', '156']}; {'id': '151', 'type': 'call', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '153', 'type': 'argument_list', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '155', 'type': 'string', 'children': [], 'value': "'read'"}; {'id': '156', 'type': 'block', 'children': ['157']}; {'id': '157', 'type': 'try_statement', 'children': ['158', '168']}; {'id': '158', 'type': 'block', 'children': ['159']}; {'id': '159', 'type': 'expression_statement', 'children': ['160']}; {'id': '160', 'type': 'assignment', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '162', 'type': 'call', 'children': ['163', '166']}; {'id': '163', 'type': 'attribute', 'children': ['164', '165']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '166', 'type': 'argument_list', 'children': ['167']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '168', 'type': 'except_clause', 'children': ['169', '173']}; {'id': '169', 'type': 'as_pattern', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '171', 'type': 'as_pattern_target', 'children': ['172']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '173', 'type': 'block', 'children': ['174']}; {'id': '174', 'type': 'expression_statement', 'children': ['175']}; {'id': '175', 'type': 'call', 'children': ['176', '179']}; {'id': '176', 'type': 'attribute', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'raise_from'}; {'id': '179', 'type': 'argument_list', 'children': ['180', '189']}; {'id': '180', 'type': 'call', 'children': ['181', '184']}; {'id': '181', 'type': 'attribute', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'DataPackageException'}; {'id': '184', 'type': 'argument_list', 'children': ['185']}; {'id': '185', 'type': 'call', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '187', 'type': 'argument_list', 'children': ['188']}; {'id': '188', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '190', 'type': 'if_statement', 'children': ['191', '197']}; {'id': '191', 'type': 'not_operator', 'children': ['192']}; {'id': '192', 'type': 'call', 'children': ['193', '194']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '194', 'type': 'argument_list', 'children': ['195', '196']}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '197', 'type': 'block', 'children': ['198', '202']}; {'id': '198', 'type': 'expression_statement', 'children': ['199']}; {'id': '199', 'type': 'assignment', 'children': ['200', '201']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '201', 'type': 'string', 'children': [], 'value': "'Data must be a \\'dict\\', but was a \\'{0}\\''"}; {'id': '202', 'type': 'raise_statement', 'children': ['203']}; {'id': '203', 'type': 'call', 'children': ['204', '207']}; {'id': '204', 'type': 'attribute', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'DataPackageException'}; {'id': '207', 'type': 'argument_list', 'children': ['208']}; {'id': '208', 'type': 'call', 'children': ['209', '212']}; {'id': '209', 'type': 'attribute', 'children': ['210', '211']}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '212', 'type': 'argument_list', 'children': ['213']}; {'id': '213', 'type': 'attribute', 'children': ['214', '218']}; {'id': '214', 'type': 'call', 'children': ['215', '216']}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '216', 'type': 'argument_list', 'children': ['217']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}; {'id': '218', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '219', 'type': 'return_statement', 'children': ['220']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'the_descriptor'}
Retrieve descriptor.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'decode'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'geohash'}; {'id': '5', 'type': 'block', 'children': ['6', '17', '41', '65', '79', '93']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '13']}; {'id': '8', 'type': 'pattern_list', 'children': ['9', '10', '11', '12']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'lat'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'lon'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'lat_err'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'lon_err'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'decode_exactly'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'geohash'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'lats'}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '22'], 'value': '%'}; {'id': '21', 'type': 'string', 'children': [], 'value': '"%.*f"'}; {'id': '22', 'type': 'tuple', 'children': ['23', '40']}; {'id': '23', 'type': 'binary_operator', 'children': ['24', '39'], 'value': '-'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'unary_operator', 'children': ['35'], 'value': '-'}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'log10'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'lat_err'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'lat'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'lons'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '46'], 'value': '%'}; {'id': '45', 'type': 'string', 'children': [], 'value': '"%.*f"'}; {'id': '46', 'type': 'tuple', 'children': ['47', '64']}; {'id': '47', 'type': 'binary_operator', 'children': ['48', '63'], 'value': '-'}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'unary_operator', 'children': ['59'], 'value': '-'}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'log10'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'lon_err'}; {'id': '63', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'lon'}; {'id': '65', 'type': 'if_statement', 'children': ['66', '69']}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '68'], 'value': 'in'}; {'id': '67', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'lats'}; {'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': 'lats'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'lats'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'rstrip'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'string', 'children': [], 'value': "'0'"}; {'id': '79', 'type': 'if_statement', 'children': ['80', '83']}; {'id': '80', 'type': 'comparison_operator', 'children': ['81', '82'], 'value': 'in'}; {'id': '81', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'lons'}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'lons'}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'lons'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'rstrip'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'string', 'children': [], 'value': "'0'"}; {'id': '93', 'type': 'return_statement', 'children': ['94']}; {'id': '94', 'type': 'expression_list', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'lats'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'lons'}
Decode geohash, returning two strings with latitude and longitude containing only relevant digits and with trailing zeroes removed.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'validate'}; {'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': 'strict'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '13', '62']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'valid'}; {'id': '12', 'type': 'True', 'children': []}; {'id': '13', 'type': 'try_statement', 'children': ['14', '27']}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'jsonschema'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'validate'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '__json__'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '__schema__'}; {'id': '27', 'type': 'except_clause', 'children': ['28', '34']}; {'id': '28', 'type': 'as_pattern', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'jsonschema'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ValidationError'}; {'id': '32', 'type': 'as_pattern_target', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'invalid'}; {'id': '34', 'type': 'block', 'children': ['35', '58']}; {'id': '35', 'type': 'if_statement', 'children': ['36', '37', '46']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'strict'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'raise_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'SchemaError'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'invalid'}; {'id': '46', 'type': 'else_clause', 'children': ['47']}; {'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': 'warnings'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'invalid'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'valid'}; {'id': '61', 'type': 'False', 'children': []}; {'id': '62', 'type': 'return_statement', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'valid'}
Validate a JObject against its schema Parameters ---------- strict : bool Enforce strict schema validation Returns ------- valid : bool True if the jam validates False if not, and `strict==False` Raises ------ SchemaError If `strict==True` and `jam` fails validation
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_tag'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'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': 'tags'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'binary_operator', 'children': ['16', '24'], 'value': '|'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'boolean_operator', 'children': ['20', '23'], 'value': 'or'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'tags'}; {'id': '23', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'list', 'children': ['28'], 'value': '[tag]'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'tag'}
Adds a tag to the list of tags and makes sure the result list contains only unique results.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'list_'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '24']}; {'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': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'osf'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '24', 'type': 'for_statement', 'children': ['25', '26', '29']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'storages'}; {'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': 'prefix'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '36', 'type': 'for_statement', 'children': ['37', '38', '41']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'file_'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '41', 'type': 'block', 'children': ['42', '48', '64']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'file_'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '48', 'type': 'if_statement', 'children': ['49', '55']}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '61', 'type': 'slice', 'children': ['62', '63']}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'colon', 'children': []}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '74']}; {'id': '69', 'type': 'attribute', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'path'}
List all files from all storages for project. If the project is private you need to specify a username.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'filter_config'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'deploy_config'}; {'id': '6', 'type': 'block', 'children': ['7', '22', '29']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '17']}; {'id': '8', 'type': 'not_operator', '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': 'os'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'deploy_config'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'DotDict'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'config_module'}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'get_config_module'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'deploy_config'}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'config_module'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'config'}
Return a config subset using the filter defined in the deploy config.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_session'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '211']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'if_statement', 'children': ['11', '16', '139', '180']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '15'], 'value': 'is not'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'key_file'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17', '37', '108', '122']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'credfile'}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'expandvars'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '33']}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'expanduser'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'key_file'}; {'id': '37', 'type': 'try_statement', 'children': ['38', '60', '85']}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'with_statement', 'children': ['40', '50']}; {'id': '40', 'type': 'with_clause', 'children': ['41']}; {'id': '41', 'type': 'with_item', 'children': ['42']}; {'id': '42', 'type': 'as_pattern', 'children': ['43', '48']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'credfile'}; {'id': '47', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '48', 'type': 'as_pattern_target', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'creds'}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '60', 'type': 'except_clause', 'children': ['61', '67']}; {'id': '61', 'type': 'as_pattern', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'JSONDecodeError'}; {'id': '65', 'type': 'as_pattern_target', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '67', 'type': 'block', 'children': ['68', '83']}; {'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': 'logger'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'string', 'children': [], 'value': '"EC2Provider \'{}\': json decode error in credential file {}"'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'credfile'}; {'id': '83', 'type': 'raise_statement', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '85', 'type': 'except_clause', 'children': ['86', '90']}; {'id': '86', 'type': 'as_pattern', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '88', 'type': 'as_pattern_target', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '90', 'type': 'block', 'children': ['91', '106']}; {'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': 'logger'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '96', 'type': 'argument_list', 'children': ['97']}; {'id': '97', 'type': 'call', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'string', 'children': [], 'value': '"EC2Provider \'{0}\' caught exception while reading credential file: {1}"'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '101', 'type': 'argument_list', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'credfile'}; {'id': '106', 'type': 'raise_statement', 'children': ['107']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'e'}; {'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': 'logger'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '113', 'type': 'argument_list', 'children': ['114']}; {'id': '114', 'type': 'call', 'children': ['115', '118']}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'string', 'children': [], 'value': '"EC2Provider \'{}\': Using credential file to create session"'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '125', 'type': 'call', 'children': ['126', '131']}; {'id': '126', 'type': 'attribute', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'boto3'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'Session'}; {'id': '131', 'type': 'argument_list', 'children': ['132', '137']}; {'id': '132', 'type': 'keyword_argument', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'region_name'}; {'id': '134', 'type': 'attribute', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '137', 'type': 'dictionary_splat', 'children': ['138']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'creds'}; {'id': '139', 'type': 'elif_clause', 'children': ['140', '145']}; {'id': '140', 'type': 'comparison_operator', 'children': ['141', '144'], 'value': 'is not'}; {'id': '141', 'type': 'attribute', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'profile'}; {'id': '144', 'type': 'None', 'children': []}; {'id': '145', 'type': 'block', 'children': ['146', '160']}; {'id': '146', 'type': 'expression_statement', 'children': ['147']}; {'id': '147', 'type': 'call', 'children': ['148', '151']}; {'id': '148', 'type': 'attribute', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '151', 'type': 'argument_list', 'children': ['152']}; {'id': '152', 'type': 'call', 'children': ['153', '156']}; {'id': '153', 'type': 'attribute', 'children': ['154', '155']}; {'id': '154', 'type': 'string', 'children': [], 'value': '"EC2Provider \'{}\': Using profile name to create session"'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '156', 'type': 'argument_list', 'children': ['157']}; {'id': '157', 'type': 'attribute', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'assignment', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '163', 'type': 'call', 'children': ['164', '169']}; {'id': '164', 'type': 'attribute', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'boto3'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'Session'}; {'id': '169', 'type': 'argument_list', 'children': ['170', '175']}; {'id': '170', 'type': 'keyword_argument', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'profile_name'}; {'id': '172', 'type': 'attribute', 'children': ['173', '174']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'profile'}; {'id': '175', 'type': 'keyword_argument', 'children': ['176', '177']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'region_name'}; {'id': '177', 'type': 'attribute', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '180', 'type': 'else_clause', 'children': ['181']}; {'id': '181', 'type': 'block', 'children': ['182', '196']}; {'id': '182', 'type': 'expression_statement', 'children': ['183']}; {'id': '183', 'type': 'call', 'children': ['184', '187']}; {'id': '184', 'type': 'attribute', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '187', 'type': 'argument_list', 'children': ['188']}; {'id': '188', 'type': 'call', 'children': ['189', '192']}; {'id': '189', 'type': 'attribute', 'children': ['190', '191']}; {'id': '190', 'type': 'string', 'children': [], 'value': '"EC2Provider \'{}\': Using environment variables to create session"'}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '192', 'type': 'argument_list', 'children': ['193']}; {'id': '193', 'type': 'attribute', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '196', 'type': 'expression_statement', 'children': ['197']}; {'id': '197', 'type': 'assignment', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '199', 'type': 'call', 'children': ['200', '205']}; {'id': '200', 'type': 'attribute', 'children': ['201', '204']}; {'id': '201', 'type': 'attribute', 'children': ['202', '203']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'boto3'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'Session'}; {'id': '205', 'type': 'argument_list', 'children': ['206']}; {'id': '206', 'type': 'keyword_argument', 'children': ['207', '208']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'region_name'}; {'id': '208', 'type': 'attribute', 'children': ['209', '210']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '211', 'type': 'return_statement', 'children': ['212']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'session'}
Create a session. First we look in self.key_file for a path to a json file with the credentials. The key file should have 'AWSAccessKeyId' and 'AWSSecretKey'. Next we look at self.profile for a profile name and try to use the Session call to automatically pick up the keys for the profile from the user default keys file ~/.aws/config. Finally, boto3 will look for the keys in environment variables: AWS_ACCESS_KEY_ID: The access key for your AWS account. AWS_SECRET_ACCESS_KEY: The secret key for your AWS account. AWS_SESSION_TOKEN: The session key for your AWS account. This is only needed when you are using temporary credentials. The AWS_SECURITY_TOKEN environment variable can also be used, but is only supported for backwards compatibility purposes. AWS_SESSION_TOKEN is supported by multiple AWS SDKs besides python.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dispatch_downstream'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'steam_name'}; {'id': '7', 'type': 'block', 'children': ['8', '20']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15', '19']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_handler_name'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'if_statement', 'children': ['21', '22', '32']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'await', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'stream_name'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'steam_name'}; {'id': '32', 'type': 'else_clause', 'children': ['33']}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'await', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'base_send'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'message'}
Handle a downstream message coming from an upstream steam. if there is not handling method set for this method type it will propagate the message further downstream. This is called as part of the co-routine of an upstream steam, not the same loop as used for upstream messages in the de-multiplexer.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clicky'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '32']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'split_contents'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'if_statement', 'children': ['16', '22']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '21'], 'value': '>'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '21', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'raise_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'TemplateSyntaxError'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '29'], 'value': '%'}; {'id': '28', 'type': 'string', 'children': [], 'value': '"\'%s\' takes no arguments"'}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ClickyNode'}; {'id': '35', 'type': 'argument_list', 'children': []}
Clicky tracking template tag. Renders Javascript code to track page visits. You must supply your Clicky Site ID (as a string) in the ``CLICKY_SITE_ID`` setting.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'call_dcm2nii'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'work_dir'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'arguments'}; {'id': '7', 'type': 'string', 'children': [], 'value': "''"}; {'id': '8', 'type': 'block', 'children': ['9', '28', '38', '45']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '17']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'op'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'work_dir'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'raise_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'IOError'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'Folder {} not found.'"}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'work_dir'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'cmd_line'}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': '\'dcm2nii {0} "{1}"\''}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'arguments'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'work_dir'}; {'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': 'log'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'cmd_line'}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'check_call'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'cmd_line'}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '54', 'type': 'True', 'children': []}
Converts all DICOM files within `work_dir` into one or more NifTi files by calling dcm2nii on this folder. Parameters ---------- work_dir: str Path to the folder that contain the DICOM files arguments: str String containing all the flag arguments for `dcm2nii` CLI. Returns ------- sys_code: int dcm2nii execution return code
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_float'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'option'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '28']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '14']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '13'], 'value': 'is'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'try_statement', 'children': ['16', '24']}; {'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': 'value'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '24', 'type': 'except_clause', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'pass_statement', 'children': []}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'tuple', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'option'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'value'}
Converts string values to floats when appropriate
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'print_boggle'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'board'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '15', '22', '62']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'string', 'children': [], 'value': '"Print the board in a 2-d array."'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'n2'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'board'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'exact_sqrt'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'n2'}; {'id': '22', 'type': 'for_statement', 'children': ['23', '24', '28']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'n2'}; {'id': '28', 'type': 'block', 'children': ['29', '42']}; {'id': '29', 'type': 'if_statement', 'children': ['30', '39']}; {'id': '30', 'type': 'boolean_operator', 'children': ['31', '36'], 'value': 'and'}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '=='}; {'id': '32', 'type': 'binary_operator', 'children': ['33', '34'], 'value': '%'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': '>'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '48', '51']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '47'], 'value': '=='}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'board'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '47', 'type': 'string', 'children': [], 'value': "'Q'"}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'print_statement', 'children': ['50']}; {'id': '50', 'type': 'string', 'children': [], 'value': "'Qu'"}; {'id': '51', 'type': 'else_clause', 'children': ['52']}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'print_statement', 'children': ['54']}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '61'], 'value': '+'}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'board'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '61', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'print'}
Print the board in a 2-d array.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'backend_version'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'childprocess'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '20']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': 'is'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'childprocess'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'childprocess'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'childprocess_default_value'}; {'id': '19', 'type': 'argument_list', 'children': []}; {'id': '20', 'type': 'if_statement', 'children': ['21', '23', '29']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'childprocess'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_backend_version'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '29', 'type': 'else_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'run_in_childprocess'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_backend_version'}; {'id': '36', 'type': 'None', 'children': []}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'backend'}
Back-end version. :param backend: back-end (examples:scrot, wx,..) :param childprocess: see :py:func:`grab` :return: version as string
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_present_participles'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'verbs'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '71']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '13']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'verb'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'verbs'}; {'id': '13', 'type': 'block', 'children': ['14', '22', '59']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'verb'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'if_statement', 'children': ['23', '31', '47']}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'string', 'children': [], 'value': '"e"'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '37']}; {'id': '34', 'type': 'subscript', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '46'], 'value': '+'}; {'id': '38', 'type': 'subscript', 'children': ['39', '42']}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '42', 'type': 'slice', 'children': ['43', '44']}; {'id': '43', 'type': 'colon', 'children': []}; {'id': '44', 'type': 'unary_operator', 'children': ['45'], 'value': '-'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '46', 'type': 'string', 'children': [], 'value': '"ing"'}; {'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', '54']}; {'id': '51', 'type': 'subscript', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '53', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '58'], 'value': '+'}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '58', 'type': 'string', 'children': [], 'value': '"ing"'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'string', 'children': [], 'value': '" "'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'parts'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'res'}
Make the list of verbs into present participles E.g.: empower -> empowering drive -> driving
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'active_env_module_resolver'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'resolver'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '20', '26', '35', '41']}; {'id': '7', 'type': 'import_from_statement', 'children': ['8', '12']}; {'id': '8', 'type': 'relative_import', 'children': ['9', '10']}; {'id': '9', 'type': 'import_prefix', 'children': []}; {'id': '10', 'type': 'dotted_name', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'api'}; {'id': '12', 'type': 'dotted_name', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'get_active_env'}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'get_active_env'}; {'id': '19', 'type': 'argument_list', 'children': []}; {'id': '20', 'type': 'if_statement', 'children': ['21', '23']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ResolveError'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'mod'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'get_module'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '38']}; {'id': '36', 'type': 'not_operator', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'mod'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'raise_statement', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ResolveError'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'mod'}
Resolves modules in currently active environment.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'execute_sync'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '6', 'type': 'block', 'children': ['7', '12', '41']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'string', 'children': [], 'value': '"synchronizing message: {message}"'}; {'id': '12', 'type': 'with_statement', 'children': ['13', '22']}; {'id': '13', 'type': 'with_clause', 'children': ['14']}; {'id': '14', 'type': 'with_item', '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': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'world'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_unlock_temporarily'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23', '32']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_sync'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'world'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '39']}; {'id': '34', 'type': 'attribute', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'world'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_react_to_sync_response'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '41', 'type': 'for_statement', 'children': ['42', '43', '46']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'actor'}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'actors'}; {'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': 'actor'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_react_to_sync_response'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'message'}
Respond when the server indicates that the client is out of sync. The server can request a sync when this client sends a message that fails the check() on the server. If the reason for the failure isn't very serious, then the server can decide to send it as usual in the interest of a smooth gameplay experience. When this happens, the server sends out an extra response providing the clients with the information they need to resync themselves.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_concat_queries'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '7', 'type': 'string', 'children': [], 'value': "'__and__'"}; {'id': '8', 'type': 'block', 'children': ['9', '23', '35', '55', '84', '109', '119', '141']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '12']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'raise_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'Expected some `queries`, got {}.'"}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '23', 'type': 'if_statement', 'children': ['24', '30']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '29'], 'value': '=='}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '29', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '41']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '45', 'type': 'binary_operator', 'children': ['46', '48'], 'value': '*'}; {'id': '46', 'type': 'list', 'children': ['47'], 'value': '[operators]'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '48', 'type': '()', 'children': ['49']}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '54'], 'value': '-'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '54', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '55', 'type': 'if_statement', 'children': ['56', '67']}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '63'], 'value': '!='}; {'id': '57', 'type': 'binary_operator', 'children': ['58', '62'], 'value': '-'}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'raise_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '78']}; {'id': '73', 'type': 'attribute', 'children': ['74', '77']}; {'id': '74', 'type': 'concatenated_string', 'children': ['75', '76']}; {'id': '75', 'type': 'string', 'children': [], 'value': "'Expected `operators` to be a string or a list with the same'"}; {'id': '76', 'type': 'string', 'children': [], 'value': "' length as `field_names` ({}), got {}.'"}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '83']}; {'id': '79', 'type': 'call', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'assignment', 'children': ['86', '90']}; {'id': '86', 'type': 'pattern_list', 'children': ['87', '88', '89']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'first'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'rest'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '90', 'type': 'expression_list', 'children': ['91', '94', '101']}; {'id': '91', 'type': 'subscript', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '93', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '94', 'type': 'subscript', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '96', 'type': 'slice', 'children': ['97', '98', '99']}; {'id': '97', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '98', 'type': 'colon', 'children': []}; {'id': '99', 'type': 'unary_operator', 'children': ['100'], 'value': '-'}; {'id': '100', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '101', 'type': 'subscript', 'children': ['102', '108']}; {'id': '102', 'type': 'subscript', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'queries'}; {'id': '104', 'type': 'slice', 'children': ['105', '107']}; {'id': '105', 'type': 'unary_operator', 'children': ['106'], 'value': '-'}; {'id': '106', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '107', 'type': 'colon', 'children': []}; {'id': '108', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '109', 'type': 'expression_statement', 'children': ['110']}; {'id': '110', 'type': 'assignment', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'bigop'}; {'id': '112', 'type': 'call', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '114', 'type': 'argument_list', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'first'}; {'id': '116', 'type': 'subscript', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '118', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '119', 'type': 'for_statement', 'children': ['120', '123', '127']}; {'id': '120', 'type': 'pattern_list', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '123', 'type': 'call', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '125', 'type': 'argument_list', 'children': ['126']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'rest'}; {'id': '127', 'type': 'block', 'children': ['128']}; {'id': '128', 'type': 'expression_statement', 'children': ['129']}; {'id': '129', 'type': 'assignment', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'bigop'}; {'id': '131', 'type': 'call', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '133', 'type': 'argument_list', 'children': ['134', '138']}; {'id': '134', 'type': 'call', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'bigop'}; {'id': '136', 'type': 'argument_list', 'children': ['137']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'q'}; {'id': '138', 'type': 'subscript', 'children': ['139', '140']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'operators'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '141', 'type': 'return_statement', 'children': ['142']}; {'id': '142', 'type': 'call', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'bigop'}; {'id': '144', 'type': 'argument_list', 'children': ['145']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'end'}
Create a tinyDB Query object that is the concatenation of each query in `queries`. The concatenation operator is taken from `operators`. Parameters ---------- queries: list of tinydb.Query The list of tinydb.Query to be joined. operators: str or list of str List of binary operators to join `queries` into one query. Check TinyDB.Query class for possible choices. Returns ------- query: tinydb.database.Query
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'file_supported'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '6', 'type': 'block', 'children': ['7', '17', '30']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '14']}; {'id': '8', 'type': 'not_operator', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'False', 'children': []}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '22']}; {'id': '19', 'type': 'tuple_pattern', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'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': 'splitext'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '36', '39']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': 'not in'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'extensions'}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'False', 'children': []}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'True', 'children': []}
Returns a boolean indicating whether the filename has an appropriate extension for this class.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'invoke_hook_spout_fail'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'fail_latency_ns'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '17']}; {'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': 'task_hooks'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '17', 'type': 'block', 'children': ['18', '41']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'spout_fail_info'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'SpoutFailInfo'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '27', '34']}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'message_id'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'message_id'}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'spout_task_id'}; {'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': 'get_task_id'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'fail_latency_ms'}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '*'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'fail_latency_ns'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'system_constants'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'NS_TO_MS'}; {'id': '41', 'type': 'for_statement', 'children': ['42', '43', '46']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'task_hook'}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'task_hooks'}; {'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': 'task_hook'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'spout_fail'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'spout_fail_info'}
invoke task hooks for every time spout fails a tuple :type message_id: str :param message_id: message id to which a failed tuple was anchored :type fail_latency_ns: float :param fail_latency_ns: fail latency in nano seconds
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_extracted_licenses'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '32', '48', '64']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'write_value'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12', '15']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'LicenseID'"}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'identifier'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '16', 'type': 'if_statement', 'children': ['17', '22']}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '21'], 'value': 'is not'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'full_name'}; {'id': '21', 'type': 'None', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'write_value'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28', '31']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'LicenseName'"}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'full_name'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '32', 'type': 'if_statement', 'children': ['33', '38']}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '37'], 'value': 'is not'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '37', 'type': 'None', 'children': []}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'write_text_value'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44', '47']}; {'id': '43', 'type': 'string', 'children': [], 'value': "'LicenseComment'"}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '48', 'type': 'for_statement', 'children': ['49', '50', '56']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'xref'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'cross_ref'}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'write_value'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '62', '63']}; {'id': '61', 'type': 'string', 'children': [], 'value': "'LicenseCrossReference'"}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'xref'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'write_text_value'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69', '72']}; {'id': '68', 'type': 'string', 'children': [], 'value': "'ExtractedText'"}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'lics'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'out'}
Write extracted licenses fields to out.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run_splitted_processing'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'max_simultaneous_processes'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'process_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'filenames'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '84']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '11', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '12', 'type': 'while_statement', 'children': ['13', '19']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '18'], 'value': '>'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'filenames'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '19', 'type': 'block', 'children': ['20', '62']}; {'id': '20', 'type': 'while_statement', 'children': ['21', '34']}; {'id': '21', 'type': 'boolean_operator', 'children': ['22', '28'], 'value': 'and'}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '27'], 'value': '>'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'filenames'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '33'], 'value': '<'}; {'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': 'pids'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'max_simultaneous_processes'}; {'id': '34', 'type': 'block', 'children': ['35', '43']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'filenames'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'service_start'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '55']}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'service'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'process_name'}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'param'}; {'id': '57', 'type': 'list', 'children': ['58', '59', '60', '61'], 'value': "['-f', filename, '-d',\n imported_day]"}; {'id': '58', 'type': 'string', 'children': [], 'value': "'-f'"}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '60', 'type': 'string', 'children': [], 'value': "'-d'"}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'imported_day'}; {'id': '62', 'type': 'while_statement', 'children': ['63', '69']}; {'id': '63', 'type': 'comparison_operator', 'children': ['64', '68'], 'value': '=='}; {'id': '64', 'type': 'call', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'max_simultaneous_processes'}; {'id': '69', 'type': 'block', 'children': ['70', '77']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'sleep_timer'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'update_running_pids'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '84', 'type': 'while_statement', 'children': ['85', '91']}; {'id': '85', 'type': 'comparison_operator', 'children': ['86', '90'], 'value': '>'}; {'id': '86', 'type': 'call', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '90', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '91', 'type': 'block', 'children': ['92', '99']}; {'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': 'time'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'sleep_timer'}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'pids'}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'update_running_pids'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'pids'}
Run processes which push the routing dump of the RIPE in a redis database. The dump has been splitted in multiple files and each process run on one of this files.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bdp'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'tickers'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'flds'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '8', 'type': 'block', 'children': ['9', '29', '37', '47', '56', '73', '86', '90', '172']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'logs'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get_logger'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'bdp'}; {'id': '18', 'type': 'keyword_argument', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'log'"}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'logs'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'LOG_LEVEL'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '34']}; {'id': '31', 'type': 'pattern_list', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'con'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'create_connection'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'ovrds'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'assist'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'proc_ovrds'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'dictionary_splat', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'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': 'logger'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'concatenated_string', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': "f'loading reference data from Bloomberg:\\n'"}; {'id': '55', 'type': 'string', 'children': [], 'value': "f'{assist.info_qry(tickers=tickers, flds=flds)}'"}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'con'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'ref'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '67', '70']}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'tickers'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'tickers'}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'flds'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'flds'}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'ovrds'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'ovrds'}; {'id': '73', 'type': 'if_statement', 'children': ['74', '82']}; {'id': '74', 'type': 'not_operator', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81']}; {'id': '80', 'type': 'string', 'children': [], 'value': "'cache'"}; {'id': '81', 'type': 'False', 'children': []}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'return_statement', 'children': ['84']}; {'id': '84', 'type': 'list', 'children': ['85'], 'value': '[data]'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'qry_data'}; {'id': '89', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '90', 'type': 'for_statement', 'children': ['91', '94', '99']}; {'id': '91', 'type': 'pattern_list', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'snap'}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'iterrows'}; {'id': '98', 'type': 'argument_list', 'children': []}; {'id': '99', 'type': 'block', 'children': ['100', '105', '128']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '103', 'type': 'list', 'children': ['104'], 'value': '[r]'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'data_file'}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'ref_file'}; {'id': '112', 'type': 'argument_list', 'children': ['113', '118', '123', '126']}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'ticker'}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'snap'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'ticker'}; {'id': '118', 'type': 'keyword_argument', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'fld'}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'snap'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '123', 'type': 'keyword_argument', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '125', 'type': 'string', 'children': [], 'value': "'pkl'"}; {'id': '126', 'type': 'dictionary_splat', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '128', 'type': 'if_statement', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'data_file'}; {'id': '130', 'type': 'block', 'children': ['131', '151', '161']}; {'id': '131', 'type': 'if_statement', 'children': ['132', '139']}; {'id': '132', 'type': 'not_operator', 'children': ['133']}; {'id': '133', 'type': 'call', 'children': ['134', '137']}; {'id': '134', 'type': 'attribute', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '137', 'type': 'argument_list', 'children': ['138']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'data_file'}; {'id': '139', 'type': 'block', 'children': ['140']}; {'id': '140', 'type': 'expression_statement', 'children': ['141']}; {'id': '141', 'type': 'call', 'children': ['142', '145']}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'qry_data'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '145', 'type': 'argument_list', 'children': ['146']}; {'id': '146', 'type': 'subscript', 'children': ['147', '150']}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'iloc'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'call', 'children': ['153', '156']}; {'id': '153', 'type': 'attribute', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'create_folder'}; {'id': '156', 'type': 'argument_list', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'data_file'}; {'id': '158', 'type': 'keyword_argument', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '160', 'type': 'True', 'children': []}; {'id': '161', 'type': 'expression_statement', 'children': ['162']}; {'id': '162', 'type': 'call', 'children': ['163', '170']}; {'id': '163', 'type': 'attribute', 'children': ['164', '169']}; {'id': '164', 'type': 'subscript', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'iloc'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'to_pickle'}; {'id': '170', 'type': 'argument_list', 'children': ['171']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'data_file'}; {'id': '172', 'type': 'return_statement', 'children': ['173']}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'qry_data'}
Bloomberg reference data Args: tickers: tickers flds: fields to query **kwargs: bbg overrides Returns: pd.DataFrame Examples: >>> bdp('IQ US Equity', 'Crncy', raw=True) ticker field value 0 IQ US Equity Crncy USD >>> bdp('IQ US Equity', 'Crncy').reset_index() ticker crncy 0 IQ US Equity USD
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'next_item'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'queue'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'queue'}; {'id': '12', 'type': 'try_statement', 'children': ['13', '30']}; {'id': '13', 'type': 'block', 'children': ['14', '28']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'queue'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '25']}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'block'}; {'id': '24', 'type': 'True', 'children': []}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '30', 'type': 'except_clause', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'None', 'children': []}
Get a single item from the queue.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_run_gevent'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '7', 'type': 'block', 'children': ['8', '11', '15', '23', '29', '51', '55', '68', '78', '90', '108', '131']}; {'id': '8', 'type': 'import_statement', 'children': ['9']}; {'id': '9', 'type': 'dotted_name', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'gevent'}; {'id': '11', 'type': 'import_statement', 'children': ['12']}; {'id': '12', 'type': 'dotted_name', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'gevent'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'monkey'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '22']}; {'id': '17', 'type': 'attribute', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'gevent'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'monkey'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'patch_all'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'import_from_statement', 'children': ['24', '27']}; {'id': '24', 'type': 'dotted_name', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'gevent'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'pywsgi'}; {'id': '27', 'type': 'dotted_name', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'WSGIServer'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'server_args'}; {'id': '32', 'type': 'dictionary', 'children': ['33', '42', '45', '48']}; {'id': '33', 'type': 'pair', 'children': ['34', '35']}; {'id': '34', 'type': 'string', 'children': [], 'value': '"bind_addr"'}; {'id': '35', 'type': 'tuple', 'children': ['36', '39']}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"host"'}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '41', 'type': 'string', 'children': [], 'value': '"port"'}; {'id': '42', 'type': 'pair', 'children': ['43', '44']}; {'id': '43', 'type': 'string', 'children': [], 'value': '"wsgi_app"'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '45', 'type': 'pair', 'children': ['46', '47']}; {'id': '46', 'type': 'string', 'children': [], 'value': '"keyfile"'}; {'id': '47', 'type': 'None', 'children': []}; {'id': '48', 'type': 'pair', 'children': ['49', '50']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"certfile"'}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'protocol'}; {'id': '54', 'type': 'string', 'children': [], 'value': '"http"'}; {'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': 'server_args'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67']}; {'id': '66', 'type': 'string', 'children': [], 'value': '"server_args"'}; {'id': '67', 'type': 'dictionary', 'children': []}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'dav_server'}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'WSGIServer'}; {'id': '73', 'type': 'argument_list', 'children': ['74', '77']}; {'id': '74', 'type': 'subscript', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'server_args'}; {'id': '76', 'type': 'string', 'children': [], 'value': '"bind_addr"'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'string', 'children': [], 'value': '"Running {}"'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'dav_server'}; {'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': '_logger'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'string', 'children': [], 'value': '"Serving on {}://{}:{} ..."'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '100', 'type': 'argument_list', 'children': ['101', '102', '105']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'protocol'}; {'id': '102', 'type': 'subscript', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '104', 'type': 'string', 'children': [], 'value': '"host"'}; {'id': '105', 'type': 'subscript', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '107', 'type': 'string', 'children': [], 'value': '"port"'}; {'id': '108', 'type': 'try_statement', 'children': ['109', '121']}; {'id': '109', 'type': 'block', 'children': ['110']}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'call', 'children': ['112', '115']}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'gevent'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'spawn'}; {'id': '115', 'type': 'argument_list', 'children': ['116']}; {'id': '116', 'type': 'call', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'dav_server'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'serve_forever'}; {'id': '120', 'type': 'argument_list', 'children': []}; {'id': '121', 'type': 'except_clause', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'KeyboardInterrupt'}; {'id': '123', 'type': 'block', 'children': ['124']}; {'id': '124', 'type': 'expression_statement', 'children': ['125']}; {'id': '125', 'type': 'call', 'children': ['126', '129']}; {'id': '126', 'type': 'attribute', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '129', 'type': 'argument_list', 'children': ['130']}; {'id': '130', 'type': 'string', 'children': [], 'value': '"Caught Ctrl-C, shutting down..."'}; {'id': '131', 'type': 'return_statement', 'children': []}
Run WsgiDAV using gevent if gevent is installed. See https://github.com/gevent/gevent/blob/master/src/gevent/pywsgi.py#L1356 https://github.com/gevent/gevent/blob/master/src/gevent/server.py#L38 for more options
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'on_exit_stage'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '26']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '13']}; {'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': 'forum'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'on_finish_game'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'for_statement', 'children': ['15', '16', '19']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'actor'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'actors'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'actor'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'on_finish_game'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'with_statement', 'children': ['27', '36']}; {'id': '27', 'type': 'with_clause', 'children': ['28']}; {'id': '28', 'type': 'with_item', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'world'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_unlock_temporarily'}; {'id': '35', 'type': 'argument_list', 'children': []}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'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': 'world'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'on_finish_game'}; {'id': '44', 'type': 'argument_list', 'children': []}
Give the actors, the world, and the messaging system a chance to react to the end of the game.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'spin_up_instance'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'job_name'}; {'id': '7', 'type': 'block', 'children': ['8', '42', '48', '56', '62', '71', '111', '135', '255', '268', '285']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '11', 'type': 'call', 'children': ['12', '18']}; {'id': '12', 'type': 'attribute', 'children': ['13', '17']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Template'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'template_string'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'substitute'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '22', '25', '37']}; {'id': '19', 'type': 'keyword_argument', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'jobname'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'job_name'}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'user_script'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'linger'}; {'id': '27', 'type': 'call', 'children': ['28', '36']}; {'id': '28', 'type': 'attribute', 'children': ['29', '35']}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'str'}; {'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': 'linger'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'worker_init'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'worker_init'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'instance_type'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'instance_type'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'subnet'}; {'id': '51', 'type': 'subscript', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'sn_ids'}; {'id': '55', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ami_id'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'image_id'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'total_instances'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'instances'}; {'id': '71', 'type': 'if_statement', 'children': ['72', '80', '105']}; {'id': '72', 'type': 'comparison_operator', 'children': ['73', '79'], 'value': '>'}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'spot_max_bid'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '80', 'type': 'block', 'children': ['81']}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'spot_options'}; {'id': '84', 'type': 'dictionary', 'children': ['85', '88']}; {'id': '85', 'type': 'pair', 'children': ['86', '87']}; {'id': '86', 'type': 'string', 'children': [], 'value': "'MarketType'"}; {'id': '87', 'type': 'string', 'children': [], 'value': "'spot'"}; {'id': '88', 'type': 'pair', 'children': ['89', '90']}; {'id': '89', 'type': 'string', 'children': [], 'value': "'SpotOptions'"}; {'id': '90', 'type': 'dictionary', 'children': ['91', '99', '102']}; {'id': '91', 'type': 'pair', 'children': ['92', '93']}; {'id': '92', 'type': 'string', 'children': [], 'value': "'MaxPrice'"}; {'id': '93', 'type': 'call', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'spot_max_bid'}; {'id': '99', 'type': 'pair', 'children': ['100', '101']}; {'id': '100', 'type': 'string', 'children': [], 'value': "'SpotInstanceType'"}; {'id': '101', 'type': 'string', 'children': [], 'value': "'one-time'"}; {'id': '102', 'type': 'pair', 'children': ['103', '104']}; {'id': '103', 'type': 'string', 'children': [], 'value': "'InstanceInterruptionBehavior'"}; {'id': '104', 'type': 'string', 'children': [], 'value': "'terminate'"}; {'id': '105', 'type': 'else_clause', 'children': ['106']}; {'id': '106', 'type': 'block', 'children': ['107']}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'spot_options'}; {'id': '110', 'type': 'dictionary', 'children': []}; {'id': '111', 'type': 'if_statement', 'children': ['112', '117']}; {'id': '112', 'type': 'comparison_operator', 'children': ['113', '114'], 'value': '>'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'total_instances'}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'max_nodes'}; {'id': '117', 'type': 'block', 'children': ['118', '132']}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'call', 'children': ['120', '123']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '123', 'type': 'argument_list', 'children': ['124']}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'string', 'children': [], 'value': '"Exceeded instance limit ({}). Cannot continue\\n"'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'attribute', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'max_nodes'}; {'id': '132', 'type': 'return_statement', 'children': ['133']}; {'id': '133', 'type': 'list', 'children': ['134'], 'value': '[None]'}; {'id': '134', 'type': 'None', 'children': []}; {'id': '135', 'type': 'try_statement', 'children': ['136', '211', '234']}; {'id': '136', 'type': 'block', 'children': ['137', '155']}; {'id': '137', 'type': 'expression_statement', 'children': ['138']}; {'id': '138', 'type': 'assignment', 'children': ['139', '140']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'tag_spec'}; {'id': '140', 'type': 'list', 'children': ['141'], 'value': '[{"ResourceType": "instance", "Tags": [{\'Key\': \'Name\', \'Value\': job_name}]}]'}; {'id': '141', 'type': 'dictionary', 'children': ['142', '145']}; {'id': '142', 'type': 'pair', 'children': ['143', '144']}; {'id': '143', 'type': 'string', 'children': [], 'value': '"ResourceType"'}; {'id': '144', 'type': 'string', 'children': [], 'value': '"instance"'}; {'id': '145', 'type': 'pair', 'children': ['146', '147']}; {'id': '146', 'type': 'string', 'children': [], 'value': '"Tags"'}; {'id': '147', 'type': 'list', 'children': ['148'], 'value': "[{'Key': 'Name', 'Value': job_name}]"}; {'id': '148', 'type': 'dictionary', 'children': ['149', '152']}; {'id': '149', 'type': 'pair', 'children': ['150', '151']}; {'id': '150', 'type': 'string', 'children': [], 'value': "'Key'"}; {'id': '151', 'type': 'string', 'children': [], 'value': "'Name'"}; {'id': '152', 'type': 'pair', 'children': ['153', '154']}; {'id': '153', 'type': 'string', 'children': [], 'value': "'Value'"}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'job_name'}; {'id': '155', 'type': 'expression_statement', 'children': ['156']}; {'id': '156', 'type': 'assignment', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '158', 'type': 'call', 'children': ['159', '164']}; {'id': '159', 'type': 'attribute', 'children': ['160', '163']}; {'id': '160', 'type': 'attribute', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'ec2'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'create_instances'}; {'id': '164', 'type': 'argument_list', 'children': ['165', '168', '171', '174', '177', '182', '185', '191', '194', '197', '200', '208']}; {'id': '165', 'type': 'keyword_argument', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'MinCount'}; {'id': '167', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '168', 'type': 'keyword_argument', 'children': ['169', '170']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'MaxCount'}; {'id': '170', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '171', 'type': 'keyword_argument', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'InstanceType'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'instance_type'}; {'id': '174', 'type': 'keyword_argument', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'ImageId'}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'ami_id'}; {'id': '177', 'type': 'keyword_argument', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'KeyName'}; {'id': '179', 'type': 'attribute', 'children': ['180', '181']}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'key_name'}; {'id': '182', 'type': 'keyword_argument', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'SubnetId'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'subnet'}; {'id': '185', 'type': 'keyword_argument', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'SecurityGroupIds'}; {'id': '187', 'type': 'list', 'children': ['188'], 'value': '[self.sg_id]'}; {'id': '188', 'type': 'attribute', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'sg_id'}; {'id': '191', 'type': 'keyword_argument', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'TagSpecifications'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'tag_spec'}; {'id': '194', 'type': 'keyword_argument', 'children': ['195', '196']}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'InstanceMarketOptions'}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'spot_options'}; {'id': '197', 'type': 'keyword_argument', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'InstanceInitiatedShutdownBehavior'}; {'id': '199', 'type': 'string', 'children': [], 'value': "'terminate'"}; {'id': '200', 'type': 'keyword_argument', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'IamInstanceProfile'}; {'id': '202', 'type': 'dictionary', 'children': ['203']}; {'id': '203', 'type': 'pair', 'children': ['204', '205']}; {'id': '204', 'type': 'string', 'children': [], 'value': "'Arn'"}; {'id': '205', 'type': 'attribute', 'children': ['206', '207']}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'iam_instance_profile_arn'}; {'id': '208', 'type': 'keyword_argument', 'children': ['209', '210']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'UserData'}; {'id': '210', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '211', 'type': 'except_clause', 'children': ['212', '216']}; {'id': '212', 'type': 'as_pattern', 'children': ['213', '214']}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'ClientError'}; {'id': '214', 'type': 'as_pattern_target', 'children': ['215']}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '216', 'type': 'block', 'children': ['217', '222', '231']}; {'id': '217', 'type': 'expression_statement', 'children': ['218']}; {'id': '218', 'type': 'call', 'children': ['219', '220']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '220', 'type': 'argument_list', 'children': ['221']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'e'}; {'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': 'logger'}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '227', 'type': 'argument_list', 'children': ['228']}; {'id': '228', 'type': 'attribute', 'children': ['229', '230']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '231', 'type': 'return_statement', 'children': ['232']}; {'id': '232', 'type': 'list', 'children': ['233'], 'value': '[None]'}; {'id': '233', 'type': 'None', 'children': []}; {'id': '234', 'type': 'except_clause', 'children': ['235', '239']}; {'id': '235', 'type': 'as_pattern', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '237', 'type': 'as_pattern_target', 'children': ['238']}; {'id': '238', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '239', 'type': 'block', 'children': ['240', '252']}; {'id': '240', 'type': 'expression_statement', 'children': ['241']}; {'id': '241', 'type': 'call', 'children': ['242', '245']}; {'id': '242', 'type': 'attribute', 'children': ['243', '244']}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '244', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '245', 'type': 'argument_list', 'children': ['246']}; {'id': '246', 'type': 'call', 'children': ['247', '250']}; {'id': '247', 'type': 'attribute', 'children': ['248', '249']}; {'id': '248', 'type': 'string', 'children': [], 'value': '"Request for EC2 resources failed : {0}"'}; {'id': '249', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '250', 'type': 'argument_list', 'children': ['251']}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '252', 'type': 'return_statement', 'children': ['253']}; {'id': '253', 'type': 'list', 'children': ['254'], 'value': '[None]'}; {'id': '254', 'type': 'None', 'children': []}; {'id': '255', 'type': 'expression_statement', 'children': ['256']}; {'id': '256', 'type': 'call', 'children': ['257', '262']}; {'id': '257', 'type': 'attribute', 'children': ['258', '261']}; {'id': '258', 'type': 'attribute', 'children': ['259', '260']}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '260', 'type': 'identifier', 'children': [], 'value': 'instances'}; {'id': '261', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '262', 'type': 'argument_list', 'children': ['263']}; {'id': '263', 'type': 'attribute', 'children': ['264', '267']}; {'id': '264', 'type': 'subscript', 'children': ['265', '266']}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '266', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '267', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '268', 'type': 'expression_statement', 'children': ['269']}; {'id': '269', 'type': 'call', 'children': ['270', '273']}; {'id': '270', 'type': 'attribute', 'children': ['271', '272']}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '272', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '273', 'type': 'argument_list', 'children': ['274']}; {'id': '274', 'type': 'call', 'children': ['275', '278']}; {'id': '275', 'type': 'attribute', 'children': ['276', '277']}; {'id': '276', 'type': 'string', 'children': [], 'value': '"Started up 1 instance {} . Instance type:{}"'}; {'id': '277', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '278', 'type': 'argument_list', 'children': ['279', '284']}; {'id': '279', 'type': 'attribute', 'children': ['280', '283']}; {'id': '280', 'type': 'subscript', 'children': ['281', '282']}; {'id': '281', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '282', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '283', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '284', 'type': 'identifier', 'children': [], 'value': 'instance_type'}; {'id': '285', 'type': 'return_statement', 'children': ['286']}; {'id': '286', 'type': 'identifier', 'children': [], 'value': 'instance'}
Start an instance in the VPC in the first available subnet. N instances will be started if nodes_per_block > 1. Not supported. We only do 1 node per block. Parameters ---------- command : str Command string to execute on the node. job_name : str Name associated with the instances.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sort_by_modified'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'typed_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'files_or_folders'}; {'id': '6', 'type': 'type', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '8', 'type': 'type', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16', '23']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'files_or_folders'}; {'id': '16', 'type': 'keyword_argument', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'getmtime'}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '25', 'type': 'True', 'children': []}
Sort files or folders by modified time Args: files_or_folders: list of files or folders Returns: list
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'contains_ignoring_case'}; {'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': 'items'}; {'id': '7', 'type': 'block', 'children': ['8', '21', '273']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '15']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '14'], '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': 'identifier', 'children': [], 'value': 'items'}; {'id': '14', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'raise_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'one or more args must be given'"}; {'id': '21', 'type': 'if_statement', 'children': ['22', '29', '157', '266']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'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': 'val'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'str_types'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '37', '85']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '36'], 'value': '=='}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'block', 'children': ['38', '53']}; {'id': '38', 'type': 'if_statement', 'children': ['39', '47']}; {'id': '39', 'type': 'not_operator', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '46']}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'str_types'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'raise_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'string', 'children': [], 'value': "'given arg must be a string'"}; {'id': '53', 'type': 'if_statement', 'children': ['54', '69']}; {'id': '54', 'type': 'comparison_operator', 'children': ['55', '62'], 'value': 'not in'}; {'id': '55', 'type': 'call', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '59', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '61', 'type': 'argument_list', 'children': []}; {'id': '62', 'type': 'call', 'children': ['63', '68']}; {'id': '63', 'type': 'attribute', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': '_err'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '%'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'Expected <%s> to case-insensitive contain item <%s>, but did not.'"}; {'id': '78', 'type': 'tuple', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '82', 'type': 'subscript', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '84', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '85', 'type': 'else_clause', 'children': ['86']}; {'id': '86', 'type': 'block', 'children': ['87', '91', '130']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '90', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '91', 'type': 'for_statement', 'children': ['92', '93', '94']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '94', 'type': 'block', 'children': ['95', '108']}; {'id': '95', 'type': 'if_statement', 'children': ['96', '102']}; {'id': '96', 'type': 'not_operator', 'children': ['97']}; {'id': '97', 'type': 'call', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '99', 'type': 'argument_list', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'str_types'}; {'id': '102', 'type': 'block', 'children': ['103']}; {'id': '103', 'type': 'raise_statement', 'children': ['104']}; {'id': '104', 'type': 'call', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '106', 'type': 'argument_list', 'children': ['107']}; {'id': '107', 'type': 'string', 'children': [], 'value': "'given args must all be strings'"}; {'id': '108', 'type': 'if_statement', 'children': ['109', '122']}; {'id': '109', 'type': 'comparison_operator', 'children': ['110', '115'], 'value': 'not in'}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '114', 'type': 'argument_list', 'children': []}; {'id': '115', 'type': 'call', 'children': ['116', '121']}; {'id': '116', 'type': 'attribute', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '121', 'type': 'argument_list', 'children': []}; {'id': '122', 'type': 'block', 'children': ['123']}; {'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': 'missing'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '130', 'type': 'if_statement', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '132', 'type': 'block', 'children': ['133']}; {'id': '133', 'type': 'expression_statement', 'children': ['134']}; {'id': '134', 'type': 'call', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': '_err'}; {'id': '138', 'type': 'argument_list', 'children': ['139']}; {'id': '139', 'type': 'binary_operator', 'children': ['140', '141'], 'value': '%'}; {'id': '140', 'type': 'string', 'children': [], 'value': "'Expected <%s> to case-insensitive contain items %s, but did not contain %s.'"}; {'id': '141', 'type': 'tuple', 'children': ['142', '145', '151']}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '145', 'type': 'call', 'children': ['146', '149']}; {'id': '146', 'type': 'attribute', 'children': ['147', '148']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': '_fmt_items'}; {'id': '149', 'type': 'argument_list', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '151', 'type': 'call', 'children': ['152', '155']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': '_fmt_items'}; {'id': '155', 'type': 'argument_list', 'children': ['156']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '157', 'type': 'elif_clause', 'children': ['158', '165']}; {'id': '158', 'type': 'call', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '160', 'type': 'argument_list', 'children': ['161', '164']}; {'id': '161', 'type': 'attribute', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'Iterable'}; {'id': '165', 'type': 'block', 'children': ['166', '170', '239']}; {'id': '166', 'type': 'expression_statement', 'children': ['167']}; {'id': '167', 'type': 'assignment', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '169', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '170', 'type': 'for_statement', 'children': ['171', '172', '173']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '173', 'type': 'block', 'children': ['174', '187', '191', '228']}; {'id': '174', 'type': 'if_statement', 'children': ['175', '181']}; {'id': '175', 'type': 'not_operator', 'children': ['176']}; {'id': '176', 'type': 'call', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '178', 'type': 'argument_list', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'str_types'}; {'id': '181', 'type': 'block', 'children': ['182']}; {'id': '182', 'type': 'raise_statement', 'children': ['183']}; {'id': '183', 'type': 'call', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '185', 'type': 'argument_list', 'children': ['186']}; {'id': '186', 'type': 'string', 'children': [], 'value': "'given args must all be strings'"}; {'id': '187', 'type': 'expression_statement', 'children': ['188']}; {'id': '188', 'type': 'assignment', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '190', 'type': 'False', 'children': []}; {'id': '191', 'type': 'for_statement', 'children': ['192', '193', '196']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '193', 'type': 'attribute', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '196', 'type': 'block', 'children': ['197', '210']}; {'id': '197', 'type': 'if_statement', 'children': ['198', '204']}; {'id': '198', 'type': 'not_operator', 'children': ['199']}; {'id': '199', 'type': 'call', 'children': ['200', '201']}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '201', 'type': 'argument_list', 'children': ['202', '203']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'str_types'}; {'id': '204', 'type': 'block', 'children': ['205']}; {'id': '205', 'type': 'raise_statement', 'children': ['206']}; {'id': '206', 'type': 'call', 'children': ['207', '208']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '208', 'type': 'argument_list', 'children': ['209']}; {'id': '209', 'type': 'string', 'children': [], 'value': "'val items must all be strings'"}; {'id': '210', 'type': 'if_statement', 'children': ['211', '222']}; {'id': '211', 'type': 'comparison_operator', 'children': ['212', '217'], 'value': '=='}; {'id': '212', 'type': 'call', 'children': ['213', '216']}; {'id': '213', 'type': 'attribute', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '216', 'type': 'argument_list', 'children': []}; {'id': '217', 'type': 'call', 'children': ['218', '221']}; {'id': '218', 'type': 'attribute', 'children': ['219', '220']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '221', 'type': 'argument_list', 'children': []}; {'id': '222', 'type': 'block', 'children': ['223', '227']}; {'id': '223', 'type': 'expression_statement', 'children': ['224']}; {'id': '224', 'type': 'assignment', 'children': ['225', '226']}; {'id': '225', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '226', 'type': 'True', 'children': []}; {'id': '227', 'type': 'break_statement', 'children': []}; {'id': '228', 'type': 'if_statement', 'children': ['229', '231']}; {'id': '229', 'type': 'not_operator', 'children': ['230']}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '231', 'type': 'block', 'children': ['232']}; {'id': '232', 'type': 'expression_statement', 'children': ['233']}; {'id': '233', 'type': 'call', 'children': ['234', '237']}; {'id': '234', 'type': 'attribute', 'children': ['235', '236']}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '237', 'type': 'argument_list', 'children': ['238']}; {'id': '238', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '239', 'type': 'if_statement', 'children': ['240', '241']}; {'id': '240', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '241', 'type': 'block', 'children': ['242']}; {'id': '242', 'type': 'expression_statement', 'children': ['243']}; {'id': '243', 'type': 'call', 'children': ['244', '247']}; {'id': '244', 'type': 'attribute', 'children': ['245', '246']}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '246', 'type': 'identifier', 'children': [], 'value': '_err'}; {'id': '247', 'type': 'argument_list', 'children': ['248']}; {'id': '248', 'type': 'binary_operator', 'children': ['249', '250'], 'value': '%'}; {'id': '249', 'type': 'string', 'children': [], 'value': "'Expected <%s> to case-insensitive contain items %s, but did not contain %s.'"}; {'id': '250', 'type': 'tuple', 'children': ['251', '254', '260']}; {'id': '251', 'type': 'attribute', 'children': ['252', '253']}; {'id': '252', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '254', 'type': 'call', 'children': ['255', '258']}; {'id': '255', 'type': 'attribute', 'children': ['256', '257']}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '257', 'type': 'identifier', 'children': [], 'value': '_fmt_items'}; {'id': '258', 'type': 'argument_list', 'children': ['259']}; {'id': '259', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '260', 'type': 'call', 'children': ['261', '264']}; {'id': '261', 'type': 'attribute', 'children': ['262', '263']}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '263', 'type': 'identifier', 'children': [], 'value': '_fmt_items'}; {'id': '264', 'type': 'argument_list', 'children': ['265']}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'missing'}; {'id': '266', 'type': 'else_clause', 'children': ['267']}; {'id': '267', 'type': 'block', 'children': ['268']}; {'id': '268', 'type': 'raise_statement', 'children': ['269']}; {'id': '269', 'type': 'call', 'children': ['270', '271']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '271', 'type': 'argument_list', 'children': ['272']}; {'id': '272', 'type': 'string', 'children': [], 'value': "'val is not a string or iterable'"}; {'id': '273', 'type': 'return_statement', 'children': ['274']}; {'id': '274', 'type': 'identifier', 'children': [], 'value': 'self'}
Asserts that val is string and contains the given item or items.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'expose_ancestors_or_children'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '63', '81']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '14', 'type': 'dictionary', 'children': ['15', '20', '31', '39', '47', '52']}; {'id': '15', 'type': 'pair', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': '"id"'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '20', 'type': 'pair', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': '"label"'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get_label'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '31', 'type': 'pair', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': '"model"'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'model'}; {'id': '39', 'type': 'pair', 'children': ['40', '41']}; {'id': '40', 'type': 'string', 'children': [], 'value': '"type"'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': '"size"'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '52', 'type': 'pair', 'children': ['53', '54']}; {'id': '53', 'type': 'string', 'children': [], 'value': '"semantic"'}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'semantic'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'collection'}; {'id': '63', 'type': 'if_statement', 'children': ['64', '69']}; {'id': '64', 'type': 'call', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '66', 'type': 'argument_list', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ResourceCollection'}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '75']}; {'id': '72', 'type': 'subscript', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '74', 'type': 'string', 'children': [], 'value': '"lang"'}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'member'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '81', 'type': 'return_statement', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'x'}
Build an ancestor or descendant dict view based on selected information :param member: Current Member to build for :param collection: Collection from which we retrieved it :param lang: Language to express data in :return:
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_mongoadmins'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '76']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'apps'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '15']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'app_name'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'INSTALLED_APPS'}; {'id': '15', 'type': 'block', 'children': ['16', '25', '54', '61']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'mongoadmin'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': '"{0}.mongoadmin"'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'app_name'}; {'id': '25', 'type': 'try_statement', 'children': ['26', '34']}; {'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': 'module'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'import_module'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'mongoadmin'}; {'id': '34', 'type': 'except_clause', 'children': ['35', '39']}; {'id': '35', 'type': 'as_pattern', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'ImportError'}; {'id': '37', 'type': 'as_pattern_target', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '39', 'type': 'block', 'children': ['40', '52']}; {'id': '40', 'type': 'if_statement', 'children': ['41', '50']}; {'id': '41', 'type': 'call', 'children': ['42', '48']}; {'id': '42', 'type': 'attribute', 'children': ['43', '47']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"No module named"'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'continue_statement', 'children': []}; {'id': '52', 'type': 'raise_statement', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'app_store'}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'AppStore'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'apps'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '73']}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'app_name'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'app_name'}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'app_store'}; {'id': '76', 'type': 'return_statement', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'apps'}
Returns a list of all mongoadmin implementations for the site
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'move_next_to'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'body_a'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'body_b'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'offset_a'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'offset_b'}; {'id': '9', 'type': 'block', 'children': ['10', '19', '28', '40', '52', '61', '70', '82']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'ba'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_body'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'body_a'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'get_body'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'body_b'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '32']}; {'id': '29', 'type': 'comparison_operator', 'children': ['30', '31'], 'value': 'is'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'ba'}; {'id': '31', 'type': 'None', 'children': []}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'relative_offset_to_world'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'offset_b'}; {'id': '40', 'type': 'if_statement', 'children': ['41', '44']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'is'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '43', 'type': 'None', 'children': []}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'ba'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'relative_offset_to_world'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'offset_a'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'anchor'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'ba'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'relative_offset_to_world'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'offset_a'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'relative_offset_to_world'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'offset_b'}; {'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': 'bb'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '81'], 'value': '-'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '80'], 'value': '+'}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'anchor'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '82', 'type': 'return_statement', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'anchor'}
Move one body to be near another one. After moving, the location described by ``offset_a`` on ``body_a`` will be coincident with the location described by ``offset_b`` on ``body_b``. Parameters ---------- body_a : str or :class:`Body` The body to use as a reference for moving the other body. If this is a string, it is treated as the name of a body to look up in the world. body_b : str or :class:`Body` The body to move next to ``body_a``. If this is a string, it is treated as the name of a body to look up in the world. offset_a : 3-tuple of float The offset of the anchor point, given as a relative fraction of the size of ``body_a``. See :func:`Body.relative_offset_to_world`. offset_b : 3-tuple of float The offset of the anchor point, given as a relative fraction of the size of ``body_b``. Returns ------- anchor : 3-tuple of float The location of the shared point, which is often useful to use as a joint anchor.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_exception_from_status_and_error_codes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '7', 'type': 'block', 'children': ['8', '119', '210']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '16', '24', '40', '56', '78', '94', '110']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': '=='}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'bad_request'}; {'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': 'exception'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'BadRequest'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '24', 'type': 'elif_clause', 'children': ['25', '32']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': '=='}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'unauthorized'}; {'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': 'exception'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'Unauthorized'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '40', 'type': 'elif_clause', 'children': ['41', '48']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': '=='}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'forbidden'}; {'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': 'exception'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'Unauthorized'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '56', 'type': 'elif_clause', 'children': ['57', '70']}; {'id': '57', 'type': 'comparison_operator', 'children': ['58', '59'], 'value': 'in'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '59', 'type': 'list', 'children': ['60', '65'], 'value': '[requests.codes.not_found, requests.codes.gone]'}; {'id': '60', 'type': 'attribute', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'not_found'}; {'id': '65', 'type': 'attribute', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'gone'}; {'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': 'exception'}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'NotFound'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '78', 'type': 'elif_clause', 'children': ['79', '86']}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': '=='}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '81', 'type': 'attribute', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'method_not_allowed'}; {'id': '86', 'type': 'block', 'children': ['87']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'MethodNotAllowed'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '94', 'type': 'elif_clause', 'children': ['95', '102']}; {'id': '95', 'type': 'comparison_operator', 'children': ['96', '97'], 'value': '>='}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '97', 'type': 'attribute', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'bad_request'}; {'id': '102', 'type': 'block', 'children': ['103']}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'assignment', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '106', 'type': 'call', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'HTTPError'}; {'id': '108', 'type': 'argument_list', 'children': ['109']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '110', 'type': 'else_clause', 'children': ['111']}; {'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': 'exception'}; {'id': '115', 'type': 'call', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'ResponseError'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '119', 'type': 'if_statement', 'children': ['120', '124', '132', '145', '158', '171', '184', '197']}; {'id': '120', 'type': 'comparison_operator', 'children': ['121', '122'], 'value': '=='}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '122', 'type': 'unary_operator', 'children': ['123'], 'value': '-'}; {'id': '123', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '124', 'type': 'block', 'children': ['125']}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'assignment', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '128', 'type': 'call', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'InternalError'}; {'id': '130', 'type': 'argument_list', 'children': ['131']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '132', 'type': 'elif_clause', 'children': ['133', '137']}; {'id': '133', 'type': 'comparison_operator', 'children': ['134', '135'], 'value': '=='}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '135', 'type': 'unary_operator', 'children': ['136'], 'value': '-'}; {'id': '136', 'type': 'integer', 'children': [], 'value': '101'}; {'id': '137', 'type': 'block', 'children': ['138']}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'assignment', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '141', 'type': 'call', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'InvalidToken'}; {'id': '143', 'type': 'argument_list', 'children': ['144']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '145', 'type': 'elif_clause', 'children': ['146', '150']}; {'id': '146', 'type': 'comparison_operator', 'children': ['147', '148'], 'value': '=='}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '148', 'type': 'unary_operator', 'children': ['149'], 'value': '-'}; {'id': '149', 'type': 'integer', 'children': [], 'value': '105'}; {'id': '150', 'type': 'block', 'children': ['151']}; {'id': '151', 'type': 'expression_statement', 'children': ['152']}; {'id': '152', 'type': 'assignment', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '154', 'type': 'call', 'children': ['155', '156']}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'UploadFailed'}; {'id': '156', 'type': 'argument_list', 'children': ['157']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '158', 'type': 'elif_clause', 'children': ['159', '163']}; {'id': '159', 'type': 'comparison_operator', 'children': ['160', '161'], 'value': '=='}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '161', 'type': 'unary_operator', 'children': ['162'], 'value': '-'}; {'id': '162', 'type': 'integer', 'children': [], 'value': '140'}; {'id': '163', 'type': 'block', 'children': ['164']}; {'id': '164', 'type': 'expression_statement', 'children': ['165']}; {'id': '165', 'type': 'assignment', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '167', 'type': 'call', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'UploadTokenGenerationFailed'}; {'id': '169', 'type': 'argument_list', 'children': ['170']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '171', 'type': 'elif_clause', 'children': ['172', '176']}; {'id': '172', 'type': 'comparison_operator', 'children': ['173', '174'], 'value': '=='}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '174', 'type': 'unary_operator', 'children': ['175'], 'value': '-'}; {'id': '175', 'type': 'integer', 'children': [], 'value': '141'}; {'id': '176', 'type': 'block', 'children': ['177']}; {'id': '177', 'type': 'expression_statement', 'children': ['178']}; {'id': '178', 'type': 'assignment', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '180', 'type': 'call', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'InvalidUploadToken'}; {'id': '182', 'type': 'argument_list', 'children': ['183']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '184', 'type': 'elif_clause', 'children': ['185', '189']}; {'id': '185', 'type': 'comparison_operator', 'children': ['186', '187'], 'value': '=='}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '187', 'type': 'unary_operator', 'children': ['188'], 'value': '-'}; {'id': '188', 'type': 'integer', 'children': [], 'value': '150'}; {'id': '189', 'type': 'block', 'children': ['190']}; {'id': '190', 'type': 'expression_statement', 'children': ['191']}; {'id': '191', 'type': 'assignment', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '193', 'type': 'call', 'children': ['194', '195']}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'InvalidParameter'}; {'id': '195', 'type': 'argument_list', 'children': ['196']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '197', 'type': 'elif_clause', 'children': ['198', '202']}; {'id': '198', 'type': 'comparison_operator', 'children': ['199', '200'], 'value': '=='}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '200', 'type': 'unary_operator', 'children': ['201'], 'value': '-'}; {'id': '201', 'type': 'integer', 'children': [], 'value': '151'}; {'id': '202', 'type': 'block', 'children': ['203']}; {'id': '203', 'type': 'expression_statement', 'children': ['204']}; {'id': '204', 'type': 'assignment', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '206', 'type': 'call', 'children': ['207', '208']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'InvalidPolicy'}; {'id': '208', 'type': 'argument_list', 'children': ['209']}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '210', 'type': 'return_statement', 'children': ['211']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'exception'}
Return an exception given status and error codes. :param status_code: HTTP status code. :type status_code: None | int :param error_code: Midas Server error code. :type error_code: None | int :param value: Message to display. :type value: string :returns: Exception. :rtype : pydas.exceptions.ResponseError
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_example'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '6', 'type': 'block', 'children': ['7', '9', '16']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'string', 'children': [], 'value': '"Add an example to the list of examples, checking it first."'}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'check_example'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'example'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'examples'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'example'}
Add an example to the list of examples, checking it first.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'removeAllRecords'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'for_statement', 'children': ['7', '8', '11']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '11', 'type': 'block', 'children': ['12', '24']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '21']}; {'id': '14', 'type': 'pattern_list', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'encodings'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '21', 'type': 'expression_list', 'children': ['22', '23']}; {'id': '22', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '23', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '33']}; {'id': '26', 'type': 'pattern_list', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'numRecords'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'numEncodings'}; {'id': '33', 'type': 'tuple', 'children': ['34', '35']}; {'id': '34', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '0'}
Deletes all the values in the dataset
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_size'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '5', 'type': 'block', 'children': ['6', '95', '104']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12', '50', '68', '82']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '9', 'type': 'argument_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'seek'"}; {'id': '12', 'type': 'block', 'children': ['13', '27', '39']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'await', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'seek'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'SEEK_END'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '30', 'type': 'await', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'tell'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'await', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'seek'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '50', 'type': 'elif_clause', 'children': ['51', '56']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'headers'"}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'subscript', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '67', 'type': 'string', 'children': [], 'value': "'Content-Length'"}; {'id': '68', 'type': 'elif_clause', 'children': ['69', '74']}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '74', 'type': 'block', 'children': ['75']}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '82', 'type': 'else_clause', 'children': ['83']}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'raise_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '89']}; {'id': '88', 'type': 'string', 'children': [], 'value': '"Can\'t get size of media of type:"'}; {'id': '89', 'type': 'attribute', 'children': ['90', '94']}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'media'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'binary_operator', 'children': ['102', '103'], 'value': '%'}; {'id': '102', 'type': 'string', 'children': [], 'value': '"media size: %dB"'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '104', 'type': 'return_statement', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'size'}
Get the size of a file Parameters ---------- media : file object The file object of the media Returns ------- int The size of the file
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_color_list'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '9', 'type': 'block', 'children': ['10', '18', '27', '38', '54']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '16']}; {'id': '11', 'type': 'not_operator', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'return_statement', 'children': []}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'make'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'colors'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '30', 'type': 'binary_operator', 'children': ['31', '37'], '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': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': '_colors'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '38', 'type': 'if_statement', 'children': ['39', '45']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '44'], 'value': '>'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '51', 'type': 'slice', 'children': ['52', '53']}; {'id': '52', 'type': 'colon', 'children': []}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '69']}; {'id': '56', 'type': 'subscript', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': '_colors'}; {'id': '60', 'type': 'slice', 'children': ['61', '62', '63']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '62', 'type': 'colon', 'children': []}; {'id': '63', 'type': 'binary_operator', 'children': ['64', '65'], 'value': '+'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'color_list'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'color_list'}
Set the internal colors starting at an optional offset. If `color_list` is a list or other 1-dimensional array, it is reshaped into an N x 3 list. If `color_list` too long it is truncated; if it is too short then only the initial colors are set.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'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': 'identifier', 'children': [], 'value': 'y'}; {'id': '6', 'type': 'block', 'children': ['7', '13']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '13', 'type': 'while_statement', 'children': ['14', '15']}; {'id': '14', 'type': 'True', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16', '28', '40', '44', '73', '96', '107']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'edge'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_edgeLabel'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '35']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'edge'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '44', 'type': 'while_statement', 'children': ['45', '60']}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'boolean_operator', 'children': ['47', '53'], 'value': 'and'}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '49'], 'value': '<'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'edge'}; {'id': '53', 'type': 'comparison_operator', 'children': ['54', '57'], 'value': '=='}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'edge'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '59', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '60', 'type': 'block', 'children': ['61', '69']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '66', 'type': 'slice', 'children': ['67', '68']}; {'id': '67', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '68', 'type': 'colon', 'children': []}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'augmented_assignment', 'children': ['71', '72'], 'value': '+='}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '72', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '73', 'type': 'if_statement', 'children': ['74', '77']}; {'id': '74', 'type': 'comparison_operator', 'children': ['75', '76'], 'value': '!='}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '76', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'if_statement', 'children': ['79', '89', '91']}; {'id': '79', 'type': 'boolean_operator', 'children': ['80', '86'], 'value': 'and'}; {'id': '80', 'type': 'comparison_operator', 'children': ['81', '82'], 'value': '=='}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '82', 'type': 'call', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'edge'}; {'id': '86', 'type': 'comparison_operator', 'children': ['87', '88'], 'value': '!='}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '88', 'type': 'string', 'children': [], 'value': "''"}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'pass_statement', 'children': []}; {'id': '91', 'type': 'else_clause', 'children': ['92']}; {'id': '92', 'type': 'block', 'children': ['93']}; {'id': '93', 'type': 'return_statement', 'children': ['94']}; {'id': '94', 'type': 'unary_operator', 'children': ['95'], 'value': '-'}; {'id': '95', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': '_get_transition_link'}; {'id': '103', 'type': 'argument_list', 'children': ['104']}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '106', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '107', 'type': 'if_statement', 'children': ['108', '110']}; {'id': '108', 'type': 'not_operator', 'children': ['109']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '110', 'type': 'block', 'children': ['111']}; {'id': '111', 'type': 'return_statement', 'children': ['112']}; {'id': '112', 'type': 'unary_operator', 'children': ['113'], 'value': '-'}; {'id': '113', 'type': 'integer', 'children': [], 'value': '1'}
Returns starting position of the substring y in the string used for building the Suffix tree. :param y: String :return: Index of the starting position of string y in the string used for building the Suffix tree -1 if y is not a substring.
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_item'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'jid'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'DiscoItem'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21', '22', '23', '24']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'jid'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'action'}
Add a new item to the `DiscoItems` object. :Parameters: - `jid`: item JID. - `node`: item node name. - `name`: item name. - `action`: action for a "disco push". :Types: - `jid`: `pyxmpp.JID` - `node`: `unicode` - `name`: `unicode` - `action`: `unicode` :returns: the item created. :returntype: `DiscoItem`.