sequence
stringlengths 902
12k
| docstring
stringlengths 4
15.2k
|
---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_branding'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'branding_id'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '30']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'Connection'}; {'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': 'token'}; {'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': 'connection'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'set_url'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'production'}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '29'], 'value': '%'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'BRANDINGS_ID_URL'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'branding_id'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'get_request'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
Get a concrete branding
@branding_id: Id of the branding to fetch
@return Branding
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_event_funcs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'type', 'children': ['10']}; {'id': '10', 'type': 'generic_type', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'Iterable'}; {'id': '12', 'type': 'type_parameter', 'children': ['13']}; {'id': '13', 'type': 'type', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Callable'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'for_statement', 'children': ['17', '18', '23']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '18', 'type': 'subscript', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_events'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'yield', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'func'}
|
Returns an Iterable of the functions subscribed to a event.
:param event: Name of the event.
:type event: str
:return: A iterable to do things with.
:rtype: Iterable
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_api_itemvalue'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'history'}; {'id': '12', 'type': 'False', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'nb'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '16', 'type': 'block', 'children': ['17', '23', '42', '48', '163']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'content_type'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'application/json; charset=utf-8'"}; {'id': '23', 'type': 'if_statement', 'children': ['24', '29']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': 'not in'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'plugins_list'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'abort'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'integer', 'children': [], 'value': '400'}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '%'}; {'id': '36', 'type': 'string', 'children': [], 'value': '"Unknown plugin %s (available plugins: %s)"'}; {'id': '37', 'type': 'tuple', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'plugins_list'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': '__update__'}; {'id': '47', 'type': 'argument_list', 'children': []}; {'id': '48', 'type': 'if_statement', 'children': ['49', '52', '115']}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': 'is'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '51', 'type': 'None', 'children': []}; {'id': '52', 'type': 'block', 'children': ['53', '96']}; {'id': '53', 'type': 'if_statement', 'children': ['54', '55', '78']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'history'}; {'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': 'ret'}; {'id': '59', 'type': 'call', 'children': ['60', '70']}; {'id': '60', 'type': 'attribute', 'children': ['61', '69']}; {'id': '61', 'type': 'call', 'children': ['62', '67']}; {'id': '62', 'type': 'attribute', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'get_plugin'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'get_stats_history'}; {'id': '70', 'type': 'argument_list', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'nb'}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'nb'}; {'id': '78', 'type': 'else_clause', 'children': ['79']}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '83', 'type': 'call', 'children': ['84', '94']}; {'id': '84', 'type': 'attribute', 'children': ['85', '93']}; {'id': '85', 'type': 'call', 'children': ['86', '91']}; {'id': '86', 'type': 'attribute', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'get_plugin'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'get_stats_item'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '96', 'type': 'if_statement', 'children': ['97', '100']}; {'id': '97', 'type': 'comparison_operator', 'children': ['98', '99'], 'value': 'is'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '99', 'type': 'None', 'children': []}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'abort'}; {'id': '104', 'type': 'argument_list', 'children': ['105', '106']}; {'id': '105', 'type': 'integer', 'children': [], 'value': '404'}; {'id': '106', 'type': 'binary_operator', 'children': ['107', '108'], 'value': '%'}; {'id': '107', 'type': 'string', 'children': [], 'value': '"Cannot get item %s%s in plugin %s"'}; {'id': '108', 'type': 'tuple', 'children': ['109', '110', '114']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '110', 'type': 'conditional_expression', 'children': ['111', '112', '113'], 'value': 'if'}; {'id': '111', 'type': 'string', 'children': [], 'value': "'history '"}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'history'}; {'id': '113', 'type': 'string', 'children': [], 'value': "''"}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '115', 'type': 'else_clause', 'children': ['116']}; {'id': '116', 'type': 'block', 'children': ['117', '143']}; {'id': '117', 'type': 'if_statement', 'children': ['118', '119', '124']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'history'}; {'id': '119', 'type': 'block', 'children': ['120']}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '123', 'type': 'None', 'children': []}; {'id': '124', 'type': 'else_clause', 'children': ['125']}; {'id': '125', 'type': 'block', 'children': ['126']}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'assignment', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '129', 'type': 'call', 'children': ['130', '140']}; {'id': '130', 'type': 'attribute', 'children': ['131', '139']}; {'id': '131', 'type': 'call', 'children': ['132', '137']}; {'id': '132', 'type': 'attribute', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'get_plugin'}; {'id': '137', 'type': 'argument_list', 'children': ['138']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'get_stats_value'}; {'id': '140', 'type': 'argument_list', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '143', 'type': 'if_statement', 'children': ['144', '147']}; {'id': '144', 'type': 'comparison_operator', 'children': ['145', '146'], 'value': 'is'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '146', 'type': 'None', 'children': []}; {'id': '147', 'type': 'block', 'children': ['148']}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'call', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'abort'}; {'id': '151', 'type': 'argument_list', 'children': ['152', '153']}; {'id': '152', 'type': 'integer', 'children': [], 'value': '404'}; {'id': '153', 'type': 'binary_operator', 'children': ['154', '155'], 'value': '%'}; {'id': '154', 'type': 'string', 'children': [], 'value': '"Cannot get item %s(%s=%s) in plugin %s"'}; {'id': '155', 'type': 'tuple', 'children': ['156', '160', '161', '162']}; {'id': '156', 'type': 'conditional_expression', 'children': ['157', '158', '159'], 'value': 'if'}; {'id': '157', 'type': 'string', 'children': [], 'value': "'history '"}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'history'}; {'id': '159', 'type': 'string', 'children': [], 'value': "''"}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '163', 'type': 'return_statement', 'children': ['164']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Father method for _api_item and _api_value.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'nonoverlap'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'item_a'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'time_a'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'item_b'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'time_b'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'max_value'}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'return_statement', 'children': ['11']}; {'id': '11', 'type': 'binary_operator', 'children': ['12', '28'], 'value': '/'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '27']}; {'id': '17', 'type': 'binary_operator', 'children': ['18', '19'], 'value': '-'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'item_a'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'count_overlap'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'time_a'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'item_b'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'time_b'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'max_value'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'max_value'}
|
Percentage of pixels in each object that do not overlap with the other object
Args:
item_a: STObject from the first set in ObjectMatcher
time_a: Time integer being evaluated
item_b: STObject from the second set in ObjectMatcher
time_b: Time integer being evaluated
max_value: Maximum distance value used as scaling value and upper constraint.
Returns:
Distance value between 0 and 1.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'focus_first_child'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '27']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '11']}; {'id': '8', 'type': 'pattern_list', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'w'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'focuspos'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'get_focus'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '19', 'type': 'call', 'children': ['20', '25']}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_tree'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'first_child_position'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'focuspos'}; {'id': '27', 'type': 'if_statement', 'children': ['28', '31']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '30'], 'value': 'is not'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '30', 'type': 'None', 'children': []}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'set_focus'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'child'}
|
move focus to first child of currently focussed one
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'languages'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '7', 'type': 'block', 'children': ['8', '18', '30', '79']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'languages'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'languages'"}; {'id': '17', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'force_list'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'a'"}; {'id': '30', 'type': 'for_statement', 'children': ['31', '32', '33']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'for_statement', 'children': ['35', '36', '42']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'RE_LANGUAGE'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'try_statement', 'children': ['44', '75']}; {'id': '44', 'type': 'block', 'children': ['45', '57']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '48', 'type': 'call', 'children': ['49', '56']}; {'id': '49', 'type': 'attribute', 'children': ['50', '55']}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '54', 'type': 'argument_list', 'children': []}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'capitalize'}; {'id': '56', 'type': 'argument_list', 'children': []}; {'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': 'languages'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'attribute', 'children': ['64', '74']}; {'id': '64', 'type': 'call', 'children': ['65', '70']}; {'id': '65', 'type': 'attribute', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'pycountry'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'languages'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'keyword_argument', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'alpha_2'}; {'id': '75', 'type': 'except_clause', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'pass_statement', 'children': []}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'languages'}
|
Populate the ``languages`` key.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'rightStatus'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '6', 'type': 'block', 'children': ['7', '9', '61']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'string', 'children': [], 'value': "'Compose right side of status bar.'"}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13', '46']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'currentThreads'}; {'id': '13', 'type': 'block', 'children': ['14', '32']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'gerund'}; {'id': '17', 'type': 'conditional_expression', 'children': ['18', '28', '31'], 'value': 'if'}; {'id': '18', 'type': '()', 'children': ['19']}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '21'], 'value': '+'}; {'id': '20', 'type': 'string', 'children': [], 'value': "' '"}; {'id': '21', 'type': 'attribute', 'children': ['22', '27']}; {'id': '22', 'type': 'subscript', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'progresses'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'gerund'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'progresses'}; {'id': '31', 'type': 'string', 'children': [], 'value': "''"}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '%'}; {'id': '36', 'type': 'string', 'children': [], 'value': "'%9d %2d%%%s'"}; {'id': '37', 'type': 'tuple', 'children': ['38', '42', '45']}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'progressPct'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'gerund'}; {'id': '46', 'type': 'else_clause', 'children': ['47']}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '53'], 'value': '%'}; {'id': '52', 'type': 'string', 'children': [], 'value': "'%9d %s'"}; {'id': '53', 'type': 'tuple', 'children': ['54', '58']}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'sheet'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'rowtype'}; {'id': '61', 'type': 'return_statement', 'children': ['62']}; {'id': '62', 'type': 'expression_list', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'status'}; {'id': '64', 'type': 'string', 'children': [], 'value': "'color_status'"}
|
Compose right side of status bar.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_consensus_at'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'block_id'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '16', '30', '44', '48', '58', '64']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '10', 'type': 'string', 'children': [], 'value': "'SELECT consensus_hash FROM snapshots WHERE block_id = ?;'"}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '14', 'type': 'tuple', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'block_id'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'con'}; {'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': 'db_open'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'impl'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'working_dir'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'db_query_execute'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39', '40', '41']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'con'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '43', 'type': 'False', 'children': []}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '47', 'type': 'None', 'children': []}; {'id': '48', 'type': 'for_statement', 'children': ['49', '50', '51']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'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': 'res'}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '57', 'type': 'string', 'children': [], 'value': "'consensus_hash'"}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'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': 'close'}; {'id': '63', 'type': 'argument_list', 'children': []}; {'id': '64', 'type': 'return_statement', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'res'}
|
Get the consensus hash at a given block.
Return the consensus hash if we have one for this block.
Return None if we don't
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'standardize'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '22', '28', '43']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'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': '_request'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '21']}; {'id': '18', 'type': 'subscript', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ENDPOINTS'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'SEARCH'"}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '22', 'type': 'if_statement', 'children': ['23', '25']}; {'id': '23', 'type': 'not_operator', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'standardize'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '28', 'type': 'for_statement', 'children': ['29', '30', '33']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'result_data'"}; {'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': 'res'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'standardize'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '43', 'type': 'return_statement', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'resp'}
|
Get a list of person objects for the given search params.
:param params: Dictionary specifying the query parameters
:param standardize: Whether to standardize names and other features,
currently disabled for backwards compatibility. Currently
standardizes names, lowercases emails, and removes faculty label
from affiliation.
>>> people = d.search({'first_name': 'tobias', 'last_name': 'funke'})
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bs_values_df'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'run_list'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'estimator_list'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'estimator_names'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'n_simulate'}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11', '24', '48', '77', '85', '108', '149']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'tqdm_kwargs'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'tqdm_kwargs'"}; {'id': '20', 'type': 'dictionary', 'children': ['21']}; {'id': '21', 'type': 'pair', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'desc'"}; {'id': '23', 'type': 'string', 'children': [], 'value': "'bs values'"}; {'id': '24', 'type': 'assert_statement', 'children': ['25', '34']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '30'], 'value': '=='}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'estimator_list'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'estimator_names'}; {'id': '34', 'type': '()', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'len(estimator_list) = {0} != len(estimator_names = {1}'"}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '44']}; {'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': 'estimator_list'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'estimator_names'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'bs_values_list'}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'pu'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'parallel_apply'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '61', '62', '66', '72', '75']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'nestcheck'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'error_analysis'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'run_bootstrap_values'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'run_list'}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'func_args'}; {'id': '64', 'type': 'tuple', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'estimator_list'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'func_kwargs'}; {'id': '68', 'type': 'dictionary', 'children': ['69']}; {'id': '69', 'type': 'pair', 'children': ['70', '71']}; {'id': '70', 'type': 'string', 'children': [], 'value': "'n_simulate'"}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'n_simulate'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'tqdm_kwargs'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'tqdm_kwargs'}; {'id': '75', 'type': 'dictionary_splat', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '84', 'type': 'argument_list', 'children': []}; {'id': '85', 'type': 'for_statement', 'children': ['86', '89', '93']}; {'id': '86', 'type': 'pattern_list', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '89', 'type': 'call', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'estimator_names'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '99']}; {'id': '96', 'type': 'subscript', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '99', 'type': 'list_comprehension', 'children': ['100', '105']}; {'id': '100', 'type': 'subscript', 'children': ['101', '102', '103']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '103', 'type': 'slice', 'children': ['104']}; {'id': '104', 'type': 'colon', 'children': []}; {'id': '105', 'type': 'for_in_clause', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'bs_values_list'}; {'id': '108', 'type': 'for_statement', 'children': ['109', '110', '127']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'vals_shape'}; {'id': '110', 'type': 'attribute', 'children': ['111', '126']}; {'id': '111', 'type': 'call', 'children': ['112', '119']}; {'id': '112', 'type': 'attribute', 'children': ['113', '118']}; {'id': '113', 'type': 'subscript', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'loc'}; {'id': '117', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'apply'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'lambda', 'children': ['121', '123']}; {'id': '121', 'type': 'lambda_parameters', 'children': ['122']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '127', 'type': 'block', 'children': ['128']}; {'id': '128', 'type': 'assert_statement', 'children': ['129', '133']}; {'id': '129', 'type': 'comparison_operator', 'children': ['130', '131'], 'value': '=='}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'vals_shape'}; {'id': '131', 'type': 'tuple', 'children': ['132']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'n_simulate'}; {'id': '133', 'type': '()', 'children': ['134']}; {'id': '134', 'type': 'binary_operator', 'children': ['135', '145'], 'value': '+'}; {'id': '135', 'type': 'binary_operator', 'children': ['136', '144'], 'value': '+'}; {'id': '136', 'type': 'binary_operator', 'children': ['137', '143'], 'value': '+'}; {'id': '137', 'type': 'binary_operator', 'children': ['138', '139'], 'value': '+'}; {'id': '138', 'type': 'string', 'children': [], 'value': "'Should be n_simulate='"}; {'id': '139', 'type': 'call', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '141', 'type': 'argument_list', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'n_simulate'}; {'id': '143', 'type': 'string', 'children': [], 'value': "' values in '"}; {'id': '144', 'type': 'string', 'children': [], 'value': "'each cell. The cell contains array with shape '"}; {'id': '145', 'type': 'call', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'vals_shape'}; {'id': '149', 'type': 'return_statement', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'df'}
|
Computes a data frame of bootstrap resampled values.
Parameters
----------
run_list: list of dicts
List of nested sampling run dicts.
estimator_list: list of functions
Estimators to apply to runs.
estimator_names: list of strs
Name of each func in estimator_list.
n_simulate: int
Number of bootstrap replications to use on each run.
kwargs:
Kwargs to pass to parallel_apply.
Returns
-------
bs_values_df: pandas data frame
Columns represent estimators and rows represent runs.
Each cell contains a 1d array of bootstrap resampled values for the run
and estimator.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'createThreeObjects'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '19', '41', '57']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'objectA'}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '15']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'integer', 'children': [], 'value': '10'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'objectB'}; {'id': '22', 'type': 'list', 'children': ['23', '26', '29', '32', '35', '38'], 'value': '[(0, 0), (2, 2), (1, 1), (1, 4), (4, 2), (4, 1)]'}; {'id': '23', 'type': 'tuple', 'children': ['24', '25']}; {'id': '24', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '26', 'type': 'tuple', 'children': ['27', '28']}; {'id': '27', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '29', 'type': 'tuple', 'children': ['30', '31']}; {'id': '30', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '32', 'type': 'tuple', 'children': ['33', '34']}; {'id': '33', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '35', 'type': 'tuple', 'children': ['36', '37']}; {'id': '36', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '38', 'type': 'tuple', 'children': ['39', '40']}; {'id': '39', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'objectC'}; {'id': '44', 'type': 'list', 'children': ['45', '48', '51', '54'], 'value': '[(0, 0), (1, 1), (3, 1), (0, 1)]'}; {'id': '45', 'type': 'tuple', 'children': ['46', '47']}; {'id': '46', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '48', 'type': 'tuple', 'children': ['49', '50']}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '51', 'type': 'tuple', 'children': ['52', '53']}; {'id': '52', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '53', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '54', 'type': 'tuple', 'children': ['55', '56']}; {'id': '55', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '56', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'list', 'children': ['59', '60', '61'], 'value': '[objectA, objectB, objectC]'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'objectA'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'objectB'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'objectC'}
|
Helper function that creates a set of three objects used for basic
experiments.
:return: (list(list(tuple)) List of lists of feature / location pairs.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update_quoting_state'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '35', '42', '71', '112']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'is_escaped'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'escaped'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'escaped'}; {'id': '18', 'type': '()', 'children': ['19']}; {'id': '19', 'type': 'boolean_operator', 'children': ['20', '28'], 'value': 'and'}; {'id': '20', 'type': 'boolean_operator', 'children': ['21', '25'], 'value': 'and'}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'escaped'}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': '=='}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'\\\\'"}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '32'], 'value': '!='}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'SQUOTE'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'escaped'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'string', 'children': [], 'value': "''"}; {'id': '42', 'type': 'if_statement', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'is_escaped'}; {'id': '44', 'type': 'block', 'children': ['45', '69']}; {'id': '45', 'type': 'if_statement', 'children': ['46', '53']}; {'id': '46', 'type': 'comparison_operator', 'children': ['47', '50'], 'value': '=='}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'DQUOTE'}; {'id': '53', 'type': 'block', 'children': ['54', '61']}; {'id': '54', 'type': 'if_statement', 'children': ['55', '58']}; {'id': '55', 'type': 'comparison_operator', 'children': ['56', '57'], 'value': '=='}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '57', 'type': 'string', 'children': [], 'value': '\'"\''}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'return_statement', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '61', 'type': 'return_statement', 'children': ['62']}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'string', 'children': [], 'value': '"{0}{1}"'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '66', 'type': 'argument_list', 'children': ['67', '68']}; {'id': '67', 'type': 'string', 'children': [], 'value': "'\\\\'"}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '69', 'type': 'return_statement', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '71', 'type': 'if_statement', 'children': ['72', '77', '97']}; {'id': '72', 'type': 'comparison_operator', 'children': ['73', '76'], 'value': 'is'}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '76', 'type': 'None', 'children': []}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'if_statement', 'children': ['79', '88']}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': 'in'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '81', 'type': 'tuple', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'SQUOTE'}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'DQUOTE'}; {'id': '88', 'type': 'block', 'children': ['89', '95']}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'assignment', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'string', 'children': [], 'value': "''"}; {'id': '97', 'type': 'elif_clause', 'children': ['98', '103']}; {'id': '98', 'type': 'comparison_operator', 'children': ['99', '102'], 'value': '=='}; {'id': '99', 'type': 'attribute', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'ch'}; {'id': '103', 'type': 'block', 'children': ['104', '110']}; {'id': '104', 'type': 'expression_statement', 'children': ['105']}; {'id': '105', 'type': 'assignment', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'quotes'}; {'id': '109', 'type': 'None', 'children': []}; {'id': '110', 'type': 'return_statement', 'children': ['111']}; {'id': '111', 'type': 'string', 'children': [], 'value': "''"}; {'id': '112', 'type': 'return_statement', 'children': ['113']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'ch'}
|
Update self.quotes and self.escaped
:param ch: str, current character
:return: ch if it was not used to update quoting state, else ''
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'handle'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'try_statement', 'children': ['10', '77']}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'if_statement', 'children': ['12', '15', '43']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'many'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '36']}; {'id': '18', 'type': 'attribute', 'children': ['19', '35']}; {'id': '19', 'type': 'call', 'children': ['20', '25']}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'mapper'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'many'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '31']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'raw'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'raw'}; {'id': '31', 'type': 'dictionary_splat', 'children': ['32']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'mapper_kwargs'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'marshal'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '71']}; {'id': '47', 'type': 'attribute', 'children': ['48', '70']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'mapper'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '56', '61', '66']}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '56', 'type': 'keyword_argument', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'partial'}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'partial'}; {'id': '66', 'type': 'dictionary_splat', 'children': ['67']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'mapper_kwargs'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'marshal'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '77', 'type': 'except_clause', 'children': ['78', '82']}; {'id': '78', 'type': 'as_pattern', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'MappingInvalid'}; {'id': '80', 'type': 'as_pattern_target', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'handle_error'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'e'}
|
Run marshalling for the specified mapper_class.
Supports both .marshal and .many().marshal Kim interfaces. Handles errors raised
during marshalling and automatically returns a HTTP error response.
:param data: Data to be marshaled.
:returns: Marshaled object according to mapper configuration
:raises: :class:`werkzeug.exceptions.UnprocessableEntity`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'path_from_row_pks'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'pks'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'use_rowid'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '9', 'type': 'True', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '46', '80']}; {'id': '11', 'type': 'if_statement', 'children': ['12', '13', '21']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'use_rowid'}; {'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': 'bits'}; {'id': '17', 'type': 'list', 'children': ['18'], 'value': "[row['rowid']]"}; {'id': '18', 'type': 'subscript', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'rowid'"}; {'id': '21', 'type': 'else_clause', 'children': ['22']}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '26', 'type': 'list_comprehension', 'children': ['27', '43']}; {'id': '27', 'type': 'conditional_expression', 'children': ['28', '33', '40'], 'value': 'if'}; {'id': '28', 'type': 'subscript', 'children': ['29', '32']}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'pk'}; {'id': '32', 'type': 'string', 'children': [], 'value': '"value"'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '39']}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'pk'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'pk'}; {'id': '43', 'type': 'for_in_clause', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'pk'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'pks'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '48', '67']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'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': 'bits'}; {'id': '52', 'type': 'list_comprehension', 'children': ['53', '64']}; {'id': '53', 'type': 'call', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'quote_plus'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'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': 'bit'}; {'id': '64', 'type': 'for_in_clause', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'bit'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '67', 'type': 'else_clause', 'children': ['68']}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '72', 'type': 'list_comprehension', 'children': ['73', '77']}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'bit'}; {'id': '77', 'type': 'for_in_clause', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'bit'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'bits'}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'string', 'children': [], 'value': "','"}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'bits'}
|
Generate an optionally URL-quoted unique identifier
for a row from its primary keys.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_int'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '18', '35', '54']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '9', 'type': 'call', 'children': ['10', '17']}; {'id': '10', 'type': 'attribute', 'children': ['11', '16']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'unescape'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'if_statement', 'children': ['19', '25']}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'is_identifier'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'raise_statement', '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': 'dns'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'SyntaxError'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'string', 'children': [], 'value': "'expecting an identifier'"}; {'id': '35', 'type': 'if_statement', 'children': ['36', '44']}; {'id': '36', 'type': 'not_operator', 'children': ['37']}; {'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': 'token'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'isdigit'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'raise_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'dns'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'SyntaxError'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'expecting an integer'"}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'value'}
|
Read the next token and interpret it as an integer.
@raises dns.exception.SyntaxError:
@rtype: int
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'watch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'on_watch'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'filters'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'start_revision'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'return_previous'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17', '30', '67', '74']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'd'}; {'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': '_start_watching'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26', '27', '28', '29']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'on_watch'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'filters'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'start_revision'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'return_previous'}; {'id': '30', 'type': 'function_definition', 'children': ['31', '32', '35']}; {'id': '31', 'type': 'function_name', 'children': [], 'value': 'on_err'}; {'id': '32', 'type': 'parameters', 'children': ['33']}; {'id': '33', 'type': 'list_splat_pattern', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'if_statement', 'children': ['37', '46']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '43'], 'value': 'not in'}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '43', 'type': 'list', 'children': ['44', '45'], 'value': '[CancelledError, ResponseFailed]'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'CancelledError'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ResponseFailed'}; {'id': '46', 'type': 'block', 'children': ['47', '63']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '54']}; {'id': '49', 'type': 'attribute', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '54', 'type': 'argument_list', 'children': ['55', '56']}; {'id': '55', 'type': 'string', 'children': [], 'value': '\'etcd watch terminated with "{error}"\''}; {'id': '56', 'type': 'keyword_argument', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '58', 'type': 'attribute', 'children': ['59', '62']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'addErrback'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'on_err'}; {'id': '74', 'type': 'return_statement', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'd'}
|
Watch one or more keys or key sets and invoke a callback.
Watch watches for events happening or that have happened. The entire event history
can be watched starting from the last compaction revision.
:param keys: Watch these keys / key sets.
:type keys: list of bytes or list of instance of :class:`txaioetcd.KeySet`
:param on_watch: The callback to invoke upon receiving
a watch event.
:type on_watch: callable
:param filters: Any filters to apply.
:param start_revision: start_revision is an optional
revision to watch from (inclusive). No start_revision is "now".
:type start_revision: int
:param return_previous: Flag to request returning previous values.
:returns: A deferred that just fires when watching has started successfully,
or which fires with an error in case the watching could not be started.
:rtype: twisted.internet.Deferred
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_checkReturnTo'}; {'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': 'return_to'}; {'id': '7', 'type': 'block', 'children': ['8', '39', '49', '61', '73', '92']}; {'id': '8', 'type': 'try_statement', 'children': ['9', '21']}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_verifyReturnToArgs'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'toPostArgs'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'except_clause', 'children': ['22', '26']}; {'id': '22', 'type': 'as_pattern', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ProtocolError'}; {'id': '24', 'type': 'as_pattern_target', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'why'}; {'id': '26', 'type': 'block', 'children': ['27', '37']}; {'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': 'logging'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '%'}; {'id': '34', 'type': 'string', 'children': [], 'value': '"Verifying return_to arguments: %s"'}; {'id': '35', 'type': 'tuple', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'why'}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'False', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'msg_return_to'}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'getArg'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'OPENID_NS'}; {'id': '48', 'type': 'string', 'children': [], 'value': "'return_to'"}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'app_parts'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'urlparse'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'urinorm'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'urinorm'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'return_to'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'msg_parts'}; {'id': '64', 'type': 'call', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'urlparse'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'urinorm'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'urinorm'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'msg_return_to'}; {'id': '73', 'type': 'for_statement', 'children': ['74', '75', '80']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'part'}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '77', 'type': 'argument_list', 'children': ['78', '79']}; {'id': '78', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '80', 'type': 'block', 'children': ['81']}; {'id': '81', 'type': 'if_statement', 'children': ['82', '89']}; {'id': '82', 'type': 'comparison_operator', 'children': ['83', '86'], 'value': '!='}; {'id': '83', 'type': 'subscript', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'app_parts'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'part'}; {'id': '86', 'type': 'subscript', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'msg_parts'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'part'}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'return_statement', 'children': ['91']}; {'id': '91', 'type': 'False', 'children': []}; {'id': '92', 'type': 'return_statement', 'children': ['93']}; {'id': '93', 'type': 'True', 'children': []}
|
Check an OpenID message and its openid.return_to value
against a return_to URL from an application. Return True on
success, False on failure.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'structure_repr'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '26']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '9', 'type': 'binary_operator', 'children': ['10', '11'], 'value': '%'}; {'id': '10', 'type': 'string', 'children': [], 'value': "'{%s}'"}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'string', 'children': [], 'value': "', '"}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'list_comprehension', 'children': ['17', '21']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '21', 'type': 'for_in_clause', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': '_wrap_packed'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Return the LLVM IR for the structure representation
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'in_group'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'dn'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '21']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'dn'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': 'in'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'groups'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'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': 'group'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'check_member'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Get whether or not the bound CSH LDAP member object is part of a
group.
Arguments:
group -- the CSHGroup object (or distinguished name) of the group to
check membership for
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_pending_symbol'}; {'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': 'pending_symbol'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '20', '28', '34', '40']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': 'is'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'pending_symbol'}; {'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': 'pending_symbol'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'CodePointArray'}; {'id': '19', 'type': 'argument_list', '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': 'value'}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'bytearray'}; {'id': '27', 'type': 'argument_list', 'children': []}; {'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': 'pending_symbol'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'pending_symbol'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'line_comment'}; {'id': '39', 'type': 'False', 'children': []}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Sets the context's ``pending_symbol`` with the given unicode sequence and resets the context's ``value``.
If the input is None, an empty :class:`CodePointArray` is used.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_params'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'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': 'dicts'}; {'id': '9', 'type': 'block', 'children': ['10', '17', '38']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Path'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '17', 'type': 'if_statement', 'children': ['18', '26']}; {'id': '18', 'type': 'not_operator', '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': 'path'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'is_dir'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'mkdir'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'parents'}; {'id': '37', 'type': 'True', 'children': []}; {'id': '38', 'type': 'if_statement', 'children': ['39', '45', '87']}; {'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': 'args'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '45', 'type': 'block', 'children': ['46', '52']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '52', 'type': 'with_statement', 'children': ['53', '64']}; {'id': '53', 'type': 'with_clause', 'children': ['54']}; {'id': '54', 'type': 'with_item', 'children': ['55']}; {'id': '55', 'type': 'as_pattern', 'children': ['56', '62']}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '62', 'type': 'as_pattern_target', 'children': ['63']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '64', 'type': 'block', 'children': ['65']}; {'id': '65', 'type': 'for_statement', 'children': ['66', '67', '68']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '86'], 'value': '+'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '80'], 'value': '+'}; {'id': '77', 'type': 'binary_operator', 'children': ['78', '79'], 'value': '+'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '79', 'type': 'string', 'children': [], 'value': "' = '"}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'subscript', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '86', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '87', 'type': 'else_clause', 'children': ['88']}; {'id': '88', 'type': 'block', 'children': ['89']}; {'id': '89', 'type': 'with_statement', 'children': ['90', '101']}; {'id': '90', 'type': 'with_clause', 'children': ['91']}; {'id': '91', 'type': 'with_item', 'children': ['92']}; {'id': '92', 'type': 'as_pattern', 'children': ['93', '99']}; {'id': '93', 'type': 'call', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '99', 'type': 'as_pattern_target', 'children': ['100']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '101', 'type': 'block', 'children': ['102']}; {'id': '102', 'type': 'for_statement', 'children': ['103', '106', '111']}; {'id': '103', 'type': 'pattern_list', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '106', 'type': 'call', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'dicts'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '110', 'type': 'argument_list', 'children': []}; {'id': '111', 'type': 'block', 'children': ['112', '123']}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'binary_operator', 'children': ['119', '122'], 'value': '+'}; {'id': '119', 'type': 'binary_operator', 'children': ['120', '121'], 'value': '+'}; {'id': '120', 'type': 'string', 'children': [], 'value': "'['"}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '122', 'type': 'string', 'children': [], 'value': "']\\n'"}; {'id': '123', 'type': 'for_statement', 'children': ['124', '127', '132']}; {'id': '124', 'type': 'pattern_list', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '127', 'type': 'call', 'children': ['128', '131']}; {'id': '128', 'type': 'attribute', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'd'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '131', 'type': 'argument_list', 'children': []}; {'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': 'f'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '138', 'type': 'argument_list', 'children': ['139']}; {'id': '139', 'type': 'binary_operator', 'children': ['140', '148'], 'value': '+'}; {'id': '140', 'type': 'binary_operator', 'children': ['141', '144'], 'value': '+'}; {'id': '141', 'type': 'binary_operator', 'children': ['142', '143'], 'value': '+'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '143', 'type': 'string', 'children': [], 'value': "' = '"}; {'id': '144', 'type': 'call', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '146', 'type': 'argument_list', 'children': ['147']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '148', 'type': 'string', 'children': [], 'value': "'\\n'"}
|
Write parameters to file, so that it's readable by read_params.
Uses INI file format.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_for_stalled_tasks'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12']}; {'id': '5', 'type': 'import_from_statement', 'children': ['6', '10']}; {'id': '6', 'type': 'dotted_name', 'children': ['7', '8', '9']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'api'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'models'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'tasks'}; {'id': '10', 'type': 'dotted_name', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'Task'}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '24']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'task'}; {'id': '14', 'type': 'call', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'Task'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'status_is_running'}; {'id': '23', 'type': 'True', 'children': []}; {'id': '24', 'type': 'block', 'children': ['25', '39']}; {'id': '25', 'type': 'if_statement', 'children': ['26', '32']}; {'id': '26', 'type': 'not_operator', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'task'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'is_responsive'}; {'id': '31', 'type': 'argument_list', 'children': []}; {'id': '32', 'type': 'block', 'children': ['33']}; {'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': 'task'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'system_error'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'if_statement', 'children': ['40', '45']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'task'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'is_timed_out'}; {'id': '44', 'type': 'argument_list', 'children': []}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'task'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'timeout_error'}; {'id': '51', 'type': 'argument_list', 'children': []}
|
Check for tasks that are no longer sending a heartbeat
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'all'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'paths'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'access'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '30']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'failures'}; {'id': '15', 'type': 'list_comprehension', 'children': ['16', '17', '20']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '17', 'type': 'for_in_clause', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'paths'}; {'id': '20', 'type': 'if_clause', 'children': ['21']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'isvalid'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26', '27']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'access'}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'filetype'}; {'id': '29', 'type': 'string', 'children': [], 'value': "'all'"}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'not_operator', 'children': ['32']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'failures'}
|
Verify list of paths
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'expanduser'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'block', 'children': ['6', '22', '32', '39', '53']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'hdfs_fs'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'default_is_local'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '20']}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'expanduser'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'string', 'children': [], 'value': "r'^~([^/]*)'"}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'if_statement', 'children': ['33', '36']}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '35'], 'value': 'is'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '35', 'type': 'None', 'children': []}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '42', 'type': 'boolean_operator', 'children': ['43', '50'], 'value': 'or'}; {'id': '43', 'type': 'subscript', 'children': ['44', '49']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'groups'}; {'id': '48', 'type': 'argument_list', 'children': []}; {'id': '49', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'common'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_USER'}; {'id': '53', 'type': 'return_statement', 'children': ['54']}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '56'], 'value': '%'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'/user/%s%s'"}; {'id': '56', 'type': 'tuple', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '60', 'type': 'slice', 'children': ['61', '67']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '67', 'type': 'colon', 'children': []}
|
Replace initial ``~`` or ``~user`` with the user's home directory.
**NOTE:** if the default file system is HDFS, the ``~user`` form is
expanded regardless of the user's existence.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_dict'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '42']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '9', 'type': 'dictionary', 'children': ['10']}; {'id': '10', 'type': 'pair', 'children': ['11', '12']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'type'"}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'repr'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '16', 'type': 'if_statement', 'children': ['17', '20', '29']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'is_failed'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '26']}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'errors'"}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'errors'}; {'id': '29', 'type': 'elif_clause', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'is_success'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '39']}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'json_obj'}; {'id': '38', 'type': 'string', 'children': [], 'value': "'modelOutput'"}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'model_output'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'json_obj'}
|
Generate a JSON serialization for the run state object.
Returns
-------
Json-like object
Json serialization of model run state object
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_has_argument'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12', '29']}; {'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': 'inspect'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'signature'"}; {'id': '12', 'type': 'block', 'children': ['13', '22']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sig'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'inspect'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'sig'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'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': 'bool'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'attribute', 'children': ['36', '42']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'inspect'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'getargspec'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'args'}
|
Test whether a function expects an argument.
:param func:
The function to be tested for existence of an argument.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'authInsert'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'site'}; {'id': '8', 'type': 'block', 'children': ['9', '15', '51']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '12']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'True', 'children': []}; {'id': '15', 'type': 'for_statement', 'children': ['16', '19', '26']}; {'id': '16', 'type': 'pattern_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '19', 'type': 'call', 'children': ['20', '25']}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '23', 'type': 'string', 'children': [], 'value': "'roles'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'iteritems'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'for_statement', 'children': ['28', '29', '32']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'g'}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '31', 'type': 'string', 'children': [], 'value': "'group'"}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'if_statement', 'children': ['34', '48']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': 'in'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '36', 'type': 'call', 'children': ['37', '46']}; {'id': '37', 'type': 'attribute', 'children': ['38', '45']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'g'}; {'id': '44', 'type': 'string', 'children': [], 'value': "''"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'string', 'children': [], 'value': "':'"}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'True', 'children': []}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'False', 'children': []}
|
Authorization function for general insert
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register_metric_descriptor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'oc_md'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '36', '45', '60', '72', '87']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'metric_type'}; {'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': 'get_metric_type'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'oc_md'}; {'id': '16', 'type': 'with_statement', 'children': ['17', '22']}; {'id': '17', 'type': 'with_clause', 'children': ['18']}; {'id': '18', 'type': 'with_item', 'children': ['19']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_md_lock'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'if_statement', 'children': ['24', '29']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': 'in'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'metric_type'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_md_cache'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'subscript', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_md_cache'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'metric_type'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get_metric_descriptor'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'oc_md'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'project_name'}; {'id': '48', 'type': 'call', 'children': ['49', '54']}; {'id': '49', 'type': 'attribute', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'project_path'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'attribute', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'project_id'}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'sd_md'}; {'id': '63', 'type': 'call', 'children': ['64', '69']}; {'id': '64', 'type': 'attribute', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'create_metric_descriptor'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'project_name'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'descriptor'}; {'id': '72', 'type': 'with_statement', 'children': ['73', '78']}; {'id': '73', 'type': 'with_clause', 'children': ['74']}; {'id': '74', 'type': 'with_item', 'children': ['75']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': '_md_lock'}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'expression_statement', 'children': ['80']}; {'id': '80', 'type': 'assignment', 'children': ['81', '86']}; {'id': '81', 'type': 'subscript', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': '_md_cache'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'metric_type'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'sd_md'}; {'id': '87', 'type': 'return_statement', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'sd_md'}
|
Register a metric descriptor with stackdriver.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'group'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '17', '31', '43']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'string', 'children': [], 'value': '"Group inherited from items"'}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_group'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_group'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '20', 'type': 'conditional_expression', 'children': ['21', '26', '30'], 'value': 'if'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'get_ndmapping_label'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'group'"}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'None', 'children': []}; {'id': '31', 'type': 'if_statement', 'children': ['32', '35']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '34'], 'value': 'is'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '34', 'type': 'None', 'children': []}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'attribute', 'children': ['38', '42']}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '43', 'type': 'return_statement', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'group'}
|
Group inherited from items
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'triads'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '5', 'type': 'block', 'children': ['6', '18', '38', '44']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_triads_cache'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'has_key'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'return_statement', 'children': ['15']}; {'id': '15', 'type': 'subscript', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_triads_cache'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '32']}; {'id': '24', 'type': 'lambda', 'children': ['25', '27']}; {'id': '25', 'type': 'lambda_parameters', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'triad'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'get_notes'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_triads_cache'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'res'}
|
Return all the triads in key.
Implemented using a cache.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_create_storage_profile'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '92']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10', '38']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'image_publisher'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'storage_profile'}; {'id': '14', 'type': 'dictionary', 'children': ['15']}; {'id': '15', 'type': 'pair', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'image_reference'"}; {'id': '17', 'type': 'dictionary', 'children': ['18', '23', '28', '33']}; {'id': '18', 'type': 'pair', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'publisher'"}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'image_publisher'}; {'id': '23', 'type': 'pair', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'offer'"}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'image_offer'}; {'id': '28', 'type': 'pair', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'sku'"}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'image_sku'}; {'id': '33', 'type': 'pair', 'children': ['34', '35']}; {'id': '34', 'type': 'string', 'children': [], 'value': "'version'"}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'image_version'}; {'id': '38', 'type': 'else_clause', 'children': ['39']}; {'id': '39', 'type': 'block', 'children': ['40', '82']}; {'id': '40', 'type': 'for_statement', 'children': ['41', '42', '51', '68']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '42', 'type': 'call', 'children': ['43', '50']}; {'id': '43', 'type': 'attribute', 'children': ['44', '49']}; {'id': '44', 'type': 'attribute', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'compute'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '50', 'type': 'argument_list', 'children': []}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'if_statement', 'children': ['53', '60']}; {'id': '53', 'type': 'comparison_operator', 'children': ['54', '57'], 'value': '=='}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'image_id'}; {'id': '60', 'type': 'block', 'children': ['61', '67']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'image_id'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '67', 'type': 'break_statement', 'children': []}; {'id': '68', 'type': 'else_clause', 'children': ['69']}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'raise_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'AzureCloudException'}; {'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': "'Image with name {0} not found.'"}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'image_id'}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'storage_profile'}; {'id': '85', 'type': 'dictionary', 'children': ['86']}; {'id': '86', 'type': 'pair', 'children': ['87', '88']}; {'id': '87', 'type': 'string', 'children': [], 'value': "'image_reference'"}; {'id': '88', 'type': 'dictionary', 'children': ['89']}; {'id': '89', 'type': 'pair', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'image_id'}; {'id': '92', 'type': 'return_statement', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'storage_profile'}
|
Create the storage profile for the instance.
Image reference can be a custom image name or a published urn.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'install_extension'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '9', 'type': 'block', 'children': ['10', '14', '38', '46']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '13', 'type': 'string', 'children': [], 'value': '\'CREATE EXTENSION IF NOT EXISTS "%s";\''}; {'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', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'as_pattern_target', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'cursor'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '33', 'type': 'tuple', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'AsIs'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'installed'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'check_extension'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '49']}; {'id': '47', 'type': 'not_operator', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'installed'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'raise_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'psycopg2'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'ProgrammingError'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'string', 'children': [], 'value': "'Postgres extension failed installation.'"}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'extension'}
|
Install Postgres extension.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__get_jp'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'extractor_processor'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'sub_output'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '26']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '20']}; {'id': '11', 'type': 'boolean_operator', 'children': ['12', '15'], 'value': 'and'}; {'id': '12', 'type': 'comparison_operator', 'children': ['13', '14'], 'value': 'is'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'sub_output'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '19'], 'value': 'is'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'extractor_processor'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'output_field'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'raise_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': '"ExtractorProcessors input paths cannot be unioned across fields. Please specify either a sub_output or use a single scalar output_field"'}; {'id': '26', 'type': 'if_statement', 'children': ['27', '35', '43']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '34'], 'value': 'is not'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'extractor_processor'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'get_output_jsonpath_with_name'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'sub_output'}; {'id': '34', 'type': 'None', 'children': []}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'extractor_processor'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'get_output_jsonpath_with_name'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sub_output'}; {'id': '43', 'type': 'else_clause', 'children': ['44']}; {'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': 'extractor_processor'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'get_output_jsonpath'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sub_output'}
|
Tries to get name from ExtractorProcessor to filter on first.
Otherwise falls back to filtering based on its metadata
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'roll'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'shifts'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'roll_coords'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'dictionary_splat_pattern', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'shifts_kwargs'}; {'id': '13', 'type': 'block', 'children': ['14', '34']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ds'}; {'id': '17', 'type': 'call', 'children': ['18', '25']}; {'id': '18', 'type': 'attribute', 'children': ['19', '24']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_to_temp_dataset'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'roll'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '29', '32']}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'shifts'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'shifts'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'roll_coords'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'roll_coords'}; {'id': '32', 'type': 'dictionary_splat', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'shifts_kwargs'}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_from_temp_dataset'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ds'}
|
Roll this array by an offset along one or more dimensions.
Unlike shift, roll may rotate all variables, including coordinates
if specified. The direction of rotation is consistent with
:py:func:`numpy.roll`.
Parameters
----------
roll_coords : bool
Indicates whether to roll the coordinates by the offset
The current default of roll_coords (None, equivalent to True) is
deprecated and will change to False in a future version.
Explicitly pass roll_coords to silence the warning.
**shifts : keyword arguments of the form {dim: offset}
Integer offset to rotate each of the given dimensions. Positive
offsets roll to the right; negative offsets roll to the left.
Returns
-------
rolled : DataArray
DataArray with the same attributes but rolled data and coordinates.
See also
--------
shift
Examples
--------
>>> arr = xr.DataArray([5, 6, 7], dims='x')
>>> arr.roll(x=1)
<xarray.DataArray (x: 3)>
array([7, 5, 6])
Coordinates:
* x (x) int64 2 0 1
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'append_surface'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'surface'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '9', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'insert_surface'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '28', '31', '34']}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '19', 'type': 'subscript', 'children': ['20', '27']}; {'id': '20', 'type': 'attribute', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'df_surfaces'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'keyword_argument', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'surface'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'surface'}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'alpha'}
|
Append Cairo surface as new layer on top of existing layers.
Args
----
name (str) : Name of layer.
surface (cairo.ImageSurface) : Surface to render.
alpha (float) : Alpha/transparency level in the range `[0, 1]`.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'resize'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'targ_sz'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'tmp'"}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'resume'}; {'id': '11', 'type': 'True', 'children': []}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'fn'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16', '20', '36', '59', '66', '86', '92']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'new_ds'}; {'id': '19', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'dls'}; {'id': '23', 'type': 'list', 'children': ['24', '27', '30', '33'], 'value': '[self.trn_dl,self.val_dl,self.fix_dl,self.aug_dl]'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'trn_dl'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'val_dl'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'fix_dl'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'aug_dl'}; {'id': '36', 'type': 'if_statement', 'children': ['37', '40', '51']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'test_dl'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'augmented_assignment', 'children': ['43', '44'], 'value': '+='}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'dls'}; {'id': '44', 'type': 'list', 'children': ['45', '48'], 'value': '[self.test_dl, self.test_aug_dl]'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'test_dl'}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'test_aug_dl'}; {'id': '51', 'type': 'else_clause', 'children': ['52']}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'augmented_assignment', 'children': ['55', '56'], 'value': '+='}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'dls'}; {'id': '56', 'type': 'list', 'children': ['57', '58'], 'value': '[None,None]'}; {'id': '57', 'type': 'None', 'children': []}; {'id': '58', 'type': 'None', 'children': []}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'tqdm_notebook'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'dls'}; {'id': '66', 'type': 'for_statement', 'children': ['67', '68', '69']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'dl'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 't'}; {'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': 'new_ds'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'append'}; {'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': 'self'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'resized'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '82', '83', '84', '85']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'dl'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'targ_sz'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'resume'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'fn'}; {'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': 't'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '91', 'type': 'argument_list', 'children': []}; {'id': '92', 'type': 'return_statement', 'children': ['93']}; {'id': '93', 'type': 'call', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': '__class__'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '103', '104', '107', '110']}; {'id': '98', 'type': 'attribute', 'children': ['99', '102']}; {'id': '99', 'type': 'subscript', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'new_ds'}; {'id': '101', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'new_ds'}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'bs'}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'num_workers'}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'classes'}
|
Resizes all the images in the train, valid, test folders to a given size.
Arguments:
targ_sz (int): the target size
new_path (str): the path to save the resized images (default tmp)
resume (bool): if True, check for images in the DataSet that haven't been resized yet (useful if a previous resize
operation was aborted)
fn (function): optional custom resizing function
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'deploy'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'machine'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '24', '38', '47', '54']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'binary_operator', 'children': ['14', '15'], 'value': '%'}; {'id': '14', 'type': 'string', 'children': [], 'value': '"machine id: %s."'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'machine'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '23'], 'value': '+'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '23', 'type': 'string', 'children': [], 'value': '"/machines"'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'pattern_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '29', 'type': 'yield', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'machines'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'loads'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'value'}; {'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': 'machines'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'machine'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'yield', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '62']}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'machines'}
|
Deploy service.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'query_all'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '6', 'type': 'string', 'children': [], 'value': "'1'"}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'by_count'}; {'id': '9', 'type': 'False', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'by_order'}; {'id': '12', 'type': 'True', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14', '98']}; {'id': '14', 'type': 'if_statement', 'children': ['15', '16', '45', '72']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'by_count'}; {'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': 'recs'}; {'id': '20', 'type': 'call', 'children': ['21', '37']}; {'id': '21', 'type': 'attribute', 'children': ['22', '36']}; {'id': '22', 'type': 'call', 'children': ['23', '30']}; {'id': '23', 'type': 'attribute', 'children': ['24', '29']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '=='}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'order_by'}; {'id': '37', 'type': 'argument_list', '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': 'TabTag'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '44', 'type': 'argument_list', 'children': []}; {'id': '45', 'type': 'elif_clause', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'by_order'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'recs'}; {'id': '51', 'type': 'call', 'children': ['52', '68']}; {'id': '52', 'type': 'attribute', 'children': ['53', '67']}; {'id': '53', 'type': 'call', 'children': ['54', '61']}; {'id': '54', 'type': 'attribute', 'children': ['55', '60']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '66'], 'value': '=='}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'order_by'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'order'}; {'id': '72', 'type': 'else_clause', 'children': ['73']}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'recs'}; {'id': '77', 'type': 'call', 'children': ['78', '94']}; {'id': '78', 'type': 'attribute', 'children': ['79', '93']}; {'id': '79', 'type': 'call', 'children': ['80', '87']}; {'id': '80', 'type': 'attribute', 'children': ['81', '86']}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'select'}; {'id': '85', 'type': 'argument_list', 'children': []}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'comparison_operator', 'children': ['89', '92'], 'value': '=='}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'order_by'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'TabTag'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'uid'}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'recs'}
|
Qeury all the categories, order by count or defined order.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sample'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fraction'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'seed'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'exact'}; {'id': '11', 'type': 'False', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '33', '46', '72']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '22']}; {'id': '14', 'type': '()', 'children': ['15']}; {'id': '15', 'type': 'boolean_operator', 'children': ['16', '19'], 'value': 'or'}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': '>'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'fraction'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '19', 'type': 'comparison_operator', 'children': ['20', '21'], 'value': '<'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'fraction'}; {'id': '21', 'type': 'integer', 'children': [], 'value': '0'}; {'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': 'ValueError'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '29'], 'value': '+'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'Invalid sampling rate: '"}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'fraction'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '41']}; {'id': '34', 'type': '()', 'children': ['35']}; {'id': '35', 'type': 'comparison_operator', 'children': ['36', '40'], 'value': '=='}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'SArray'}; {'id': '45', 'type': 'argument_list', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '49'], 'value': 'is'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'seed'}; {'id': '49', 'type': 'None', 'children': []}; {'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': 'seed'}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '68'], 'value': '%'}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'abs'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'hash'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '%'}; {'id': '62', 'type': 'string', 'children': [], 'value': '"%0.20f"'}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '67', 'type': 'argument_list', 'children': []}; {'id': '68', 'type': '()', 'children': ['69']}; {'id': '69', 'type': 'binary_operator', 'children': ['70', '71'], 'value': '**'}; {'id': '70', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '71', 'type': 'integer', 'children': [], 'value': '31'}; {'id': '72', 'type': 'with_statement', 'children': ['73', '78']}; {'id': '73', 'type': 'with_clause', 'children': ['74']}; {'id': '74', 'type': 'with_item', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'cython_context'}; {'id': '77', 'type': 'argument_list', 'children': []}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'SArray'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'keyword_argument', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': '_proxy'}; {'id': '85', 'type': 'call', 'children': ['86', '91']}; {'id': '86', 'type': 'attribute', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': '__proxy__'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'sample'}; {'id': '91', 'type': 'argument_list', 'children': ['92', '93', '94']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'fraction'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'seed'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'exact'}
|
Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the number of rows returned is
approximately the fraction times the number of rows.
seed : int, optional
The random seed for the random number generator.
exact: bool, optional
Defaults to False. If exact=True, an exact fraction is returned,
but at a performance penalty.
Returns
-------
out : SArray
The new SArray which contains the subsampled rows.
Examples
--------
>>> sa = turicreate.SArray(range(10))
>>> sa.sample(.3)
dtype: int
Rows: 3
[2, 6, 9]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'unique_name'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'domain_suffix'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'unset'}; {'id': '11', 'type': 'block', 'children': ['12', '27', '44']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'of'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'dictionary', 'children': ['21', '24']}; {'id': '21', 'type': 'pair', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'UniqueName'"}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'unique_name'}; {'id': '24', 'type': 'pair', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'DomainSuffix'"}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'domain_suffix'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'payload'}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_version'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38', '41']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'POST'"}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_uri'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'EnvironmentInstance'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '51', '52']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': '_version'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'payload'}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'service_sid'}; {'id': '54', 'type': 'subscript', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '_solution'}; {'id': '58', 'type': 'string', 'children': [], 'value': "'service_sid'"}
|
Create a new EnvironmentInstance
:param unicode unique_name: The unique_name
:param unicode domain_suffix: The domain_suffix
:returns: Newly created EnvironmentInstance
:rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'findCampaigns'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ra'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '17', '49', '55']}; {'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': 'logger'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'disabled'}; {'id': '12', 'type': 'True', 'children': []}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'campaigns_visible'}; {'id': '16', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '17', 'type': 'for_statement', 'children': ['18', '19', '24']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'getFieldNumbers'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'block', 'children': ['25', '34']}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'fovobj'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'getKeplerFov'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '34', 'type': 'if_statement', 'children': ['35', '41']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'onSiliconCheck'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39', '40']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'ra'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'dec'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'fovobj'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'campaigns_visible'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'disabled'}; {'id': '54', 'type': 'True', 'children': []}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'campaigns_visible'}
|
Returns a list of the campaigns that cover a given position.
Parameters
----------
ra, dec : float, float
Position in decimal degrees (J2000).
Returns
-------
campaigns : list of int
A list of the campaigns that cover the given position.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_aa_code'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'aa_letter'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '34']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'aa_code'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': '!='}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'aa_letter'}; {'id': '13', 'type': 'string', 'children': [], 'value': "'X'"}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'for_statement', 'children': ['16', '19', '24']}; {'id': '16', 'type': 'pattern_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'standard_amino_acids'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'block', 'children': ['25']}; {'id': '25', 'type': 'if_statement', 'children': ['26', '29']}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '28'], 'value': '=='}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'aa_letter'}; {'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': 'aa_code'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'aa_code'}
|
Get three-letter aa code if possible. If not, return None.
If three-letter code is None, will have to find this later from the filesystem.
Parameters
----------
aa_letter : str
One-letter amino acid code.
Returns
-------
aa_code : str, or None
Three-letter aa code.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_bubble_surface'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dims'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_DIMS'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'repeat'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '10', 'type': 'block', 'children': ['11', '18']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'gradients'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'make_gradients'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'dims'}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'id': '19', 'type': '()', 'children': ['20']}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '38'], 'value': '*'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'sin'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'binary_operator', 'children': ['27', '35'], 'value': '*'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '34'], 'value': '*'}; {'id': '28', 'type': '()', 'children': ['29']}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '33'], 'value': '-'}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'gradients'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'float', 'children': [], 'value': '0.5'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'repeat'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sin'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '52'], 'value': '*'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '51'], 'value': '*'}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '50'], 'value': '-'}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'gradients'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'float', 'children': [], 'value': '0.5'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'repeat'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'pi'}
|
Makes a surface from the product of sine functions on each axis.
Args:
dims (pair): the dimensions of the surface to create
repeat (int): the frequency of the waves is set to ensure this many
repetitions of the function
Returns:
surface: A surface.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'relpath'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'cwd'}; {'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': '__class__'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'getcwd'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'cwd'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'relpathto'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Return this path as a relative path,
based from the current working directory.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'process_template'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'sql'}; {'id': '6', 'type': 'dictionary_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '8', 'type': 'block', 'children': ['9', '20', '29']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'template'}; {'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': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'from_string'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sql'}; {'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': 'kwargs'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'context'}; {'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': 'template'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'render'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Processes a sql template
>>> sql = "SELECT '{{ datetime(2017, 1, 1).isoformat() }}'"
>>> process_template(sql)
"SELECT '2017-01-01T00:00:00'"
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update_feature_log_prob'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '25']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'smoothed_fc'}; {'id': '10', 'type': 'binary_operator', 'children': ['11', '14'], 'value': '+'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'feature_count_'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'smoothed_cc'}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '22'], 'value': '+'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'class_count_'}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '24'], 'value': '*'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'feature_log_prob_'}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '38'], 'value': '-'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'smoothed_fc'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'smoothed_cc'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'reshape'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '50']}; {'id': '48', 'type': 'unary_operator', 'children': ['49'], 'value': '-'}; {'id': '49', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '1'}
|
Apply smoothing to raw counts and recompute log probabilities
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_options'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '50']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '11'], 'value': 'is'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_options_cache'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '28', '40']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'target_url'}; {'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': 'client'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'get_url'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '26', '27']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_URL_KEY'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'OPTIONS'"}; {'id': '27', 'type': 'string', 'children': [], 'value': "'options'"}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'r'}; {'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': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': "'OPTIONS'"}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'target_url'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_options_cache'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '49', 'type': 'argument_list', 'children': []}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': '_options_cache'}
|
Returns a raw options object
:rtype: dict
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_output'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '18', '29']}; {'id': '8', 'type': 'call', 'children': ['9', '16']}; {'id': '9', 'type': 'attribute', 'children': ['10', '15']}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "b'host: '"}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_buffer'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'insert'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '29', 'type': 'else_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '38']}; {'id': '33', 'type': 'attribute', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': '_buffer'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 's'}
|
Host header should always be first
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_explanation'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'explanation'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'original_msg'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '21', '28', '35', '42']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '18']}; {'id': '10', 'type': 'boolean_operator', 'children': ['11', '17'], 'value': 'and'}; {'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': 'conf'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'is_message_introspection_enabled'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'original_msg'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'original_msg'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'explanation'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ecu'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'explanation'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'lines'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_split_explanation'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'explanation'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': '_format_lines'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'lines'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '50']}; {'id': '44', 'type': 'attribute', 'children': ['45', '49']}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'result'}
|
This formats an explanation
Normally all embedded newlines are escaped, however there are
three exceptions: \n{, \n} and \n~. The first two are intended
cover nested explanations, see function and attribute explanations
for examples (.visit_Call(), visit_Attribute()). The last one is
for when one explanation needs to span multiple lines, e.g. when
displaying diffs.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'packageGraph'}; {'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': 'packagelevel'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '13', '99', '105', '111']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '12', 'type': 'dictionary', 'children': []}; {'id': '13', 'type': 'for_statement', 'children': ['14', '15', '20']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'listModules'}; {'id': '19', 'type': 'argument_list', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21', '33', '61', '67']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'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': 'packageOf'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'modname'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'packagelevel'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '37']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': 'not in'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '37', 'type': 'block', 'children': ['38', '51']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '41', 'type': 'call', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '56']}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'Module'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'package'}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '67', 'type': 'for_statement', 'children': ['68', '69', '72']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'imports'}; {'id': '72', 'type': 'block', 'children': ['73', '83']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'packageOf'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'packagelevel'}; {'id': '83', 'type': 'if_statement', 'children': ['84', '89']}; {'id': '84', 'type': 'comparison_operator', 'children': ['85', '86'], 'value': '!='}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'package'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'modname'}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '97']}; {'id': '92', 'type': 'attribute', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'package'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'imports'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'add'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'package_name'}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'ModuleGraph'}; {'id': '104', 'type': 'argument_list', 'children': []}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'modules'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '111', 'type': 'return_statement', 'children': ['112']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'graph'}
|
Convert a module graph to a package graph.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register_path'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'modified_time'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '40', '64', '91']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '20']}; {'id': '11', 'type': 'not_operator', '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': 'foundations'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'common'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'path_exists'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'raise_statement', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'foundations'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'PathExistsError'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'string', 'children': [], 'value': '"{0} | \'{1}\' path doesn\'t exists!"'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '33', 'type': 'argument_list', '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': '__class__'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '40', 'type': 'if_statement', 'children': ['41', '44']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'in'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'raise_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'umbra'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'PathRegistrationError'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'string', 'children': [], 'value': '"{0} | \'{1}\' path is already registered!"'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '63']}; {'id': '58', 'type': 'attribute', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': '__class__'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '71']}; {'id': '66', 'type': 'subscript', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': '__paths'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '71', 'type': 'tuple', 'children': ['72', '83']}; {'id': '72', 'type': 'conditional_expression', 'children': ['73', '79', '82'], 'value': 'if'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'get_path_modified_time'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': 'is'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'modified_time'}; {'id': '81', 'type': 'None', 'children': []}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'modified_time'}; {'id': '83', 'type': 'call', 'children': ['84', '89']}; {'id': '84', 'type': 'attribute', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '91', 'type': 'return_statement', 'children': ['92']}; {'id': '92', 'type': 'True', 'children': []}
|
Registers given path.
:param path: Path name.
:type path: unicode
:param modified_time: Custom modified time.
:type modified_time: int or float
:return: Method success.
:rtype: bool
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'change_and_save'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'update_only_changed_fields'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'changed_fields'}; {'id': '10', 'type': 'block', 'children': ['11', '21']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'bulk_change_and_save'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16', '19']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'keyword_argument', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'update_only_changed_fields'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'update_only_changed_fields'}; {'id': '19', 'type': 'dictionary_splat', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'changed_fields'}; {'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': 'filter'}; {'id': '26', 'type': 'argument_list', 'children': []}
|
Changes a given `changed_fields` on each object in the queryset, saves objects
and returns the changed objects in the queryset.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_pages'}; {'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', '11', '19']}; {'id': '7', 'type': 'pattern_list', 'children': ['8', '9', '10']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'walk'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'pages_dir'}; {'id': '19', 'type': 'block', 'children': ['20', '37']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'base_dir'}; {'id': '23', 'type': 'call', 'children': ['24', '35']}; {'id': '24', 'type': 'attribute', 'children': ['25', '34']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'pages_dir'}; {'id': '33', 'type': 'string', 'children': [], 'value': '""'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'lstrip'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'string', 'children': [], 'value': '"/"'}; {'id': '37', 'type': 'if_statement', 'children': ['38', '45']}; {'id': '38', 'type': 'not_operator', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'base_dir'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'string', 'children': [], 'value': '"_"'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'for_statement', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '49', 'type': 'block', 'children': ['50', '62']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'src_file'}; {'id': '53', 'type': 'call', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'base_dir'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_build_page'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'src_file'}
|
Iterate over the pages_dir and build the pages
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_pass_variable'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '67']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'pass_var'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '19']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'var'}; {'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': 'environ'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20', '29']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'expVAR'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': '"_"'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '47']}; {'id': '30', 'type': 'boolean_operator', 'children': ['31', '42'], 'value': 'and'}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '=='}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'expVAR'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '0'}; {'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': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'prgnam'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'upper'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'comparison_operator', 'children': ['43', '46'], 'value': '!='}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'expVAR'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '46', 'type': 'string', 'children': [], 'value': '"PATH"'}; {'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': 'pass_var'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'string', 'children': [], 'value': '"{0}={1}"'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '62']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'expVAR'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '62', 'type': 'subscript', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'pass_var'}
|
Return enviroment variables
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getAllSecrets'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13', '16', '19', '22']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '6', 'type': 'string', 'children': [], 'value': '""'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'table'}; {'id': '12', 'type': 'string', 'children': [], 'value': '"credential-store"'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'default_parameter', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'default_parameter', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '21', 'type': 'None', 'children': []}; {'id': '22', 'type': 'dictionary_splat_pattern', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '24', 'type': 'block', 'children': ['25', '38', '50', '62', '72', '110', '124', '148', '154', '160']}; {'id': '25', 'type': 'if_statement', 'children': ['26', '29']}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '28'], 'value': 'is'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '28', 'type': 'None', 'children': []}; {'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': 'session'}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'get_session'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'dictionary_splat', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'dynamodb'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'string', 'children': [], 'value': "'dynamodb'"}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'region_name'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'kms'}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59']}; {'id': '58', 'type': 'string', 'children': [], 'value': "'kms'"}; {'id': '59', 'type': 'keyword_argument', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'region_name'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'secrets'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'listSecrets'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69', '70']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'table'}; {'id': '70', 'type': 'dictionary_splat', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '72', 'type': 'if_statement', 'children': ['73', '78', '96']}; {'id': '73', 'type': 'boolean_operator', 'children': ['74', '75'], 'value': 'and'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '75', 'type': 'comparison_operator', 'children': ['76', '77'], 'value': 'in'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'WILDCARD_CHAR'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'expression_statement', 'children': ['80']}; {'id': '80', 'type': 'assignment', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '82', 'type': 'call', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'expand_wildcard'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '89', 'type': 'list_comprehension', 'children': ['90', '93']}; {'id': '90', 'type': 'subscript', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '92', 'type': 'string', 'children': [], 'value': '"name"'}; {'id': '93', 'type': 'for_in_clause', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'secrets'}; {'id': '96', 'type': 'else_clause', 'children': ['97']}; {'id': '97', 'type': 'block', 'children': ['98']}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'assignment', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '101', 'type': 'call', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '103', 'type': 'generator_expression', 'children': ['104', '107']}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '106', 'type': 'string', 'children': [], 'value': '"name"'}; {'id': '107', 'type': 'for_in_clause', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'secrets'}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'assignment', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '113', 'type': 'call', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'ThreadPool'}; {'id': '115', 'type': 'argument_list', 'children': ['116']}; {'id': '116', 'type': 'call', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '118', 'type': 'argument_list', 'children': ['119', '123']}; {'id': '119', 'type': 'call', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '121', 'type': 'argument_list', 'children': ['122']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'THREAD_POOL_MAX_SIZE'}; {'id': '124', 'type': 'expression_statement', 'children': ['125']}; {'id': '125', 'type': 'assignment', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '127', 'type': 'call', 'children': ['128', '131']}; {'id': '128', 'type': 'attribute', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '131', 'type': 'argument_list', 'children': ['132', '147']}; {'id': '132', 'type': 'lambda', 'children': ['133', '135']}; {'id': '133', 'type': 'lambda_parameters', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '135', 'type': 'call', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'getSecret'}; {'id': '137', 'type': 'argument_list', 'children': ['138', '139', '140', '141', '142', '143', '144', '145']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'credential'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'region'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'table'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'dynamodb'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'kms'}; {'id': '145', 'type': 'dictionary_splat', 'children': ['146']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'call', 'children': ['150', '153']}; {'id': '150', 'type': 'attribute', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '153', 'type': 'argument_list', 'children': []}; {'id': '154', 'type': 'expression_statement', 'children': ['155']}; {'id': '155', 'type': 'call', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'pool'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '159', 'type': 'argument_list', 'children': []}; {'id': '160', 'type': 'return_statement', 'children': ['161']}; {'id': '161', 'type': 'call', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '166', 'type': 'argument_list', 'children': ['167', '168']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'results'}
|
fetch and decrypt all secrets
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_gentarget'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11', '20']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'gentarget_type'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'return_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'gentarget_type'}; {'id': '20', 'type': 'else_clause', 'children': ['21']}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'raise_statement', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'NotImplementedError'}
|
Predicate which determines whether the target in question is relevant to this codegen task.
E.g., the JaxbGen task considers JaxbLibrary targets to be relevant, and nothing else.
:API: public
:param Target target: The target to check.
:return: True if this class can generate code for the given target, False otherwise.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_parse_throttle'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tablename'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'throttle'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '21', '31', '96', '104']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'amount'}; {'id': '11', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'describe'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'tablename'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'throughputs'}; {'id': '24', 'type': 'list', 'children': ['25', '28'], 'value': '[desc.read_throughput, desc.write_throughput]'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'read_throughput'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'write_throughput'}; {'id': '31', 'type': 'for_statement', 'children': ['32', '35', '44']}; {'id': '32', 'type': 'pattern_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'throughput'}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '43']}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'throttle'}; {'id': '40', 'type': 'slice', 'children': ['41', '42']}; {'id': '41', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '42', 'type': 'colon', 'children': []}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'throughputs'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'if_statement', 'children': ['46', '49', '57', '84']}; {'id': '46', 'type': 'comparison_operator', 'children': ['47', '48'], 'value': '=='}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '48', 'type': 'string', 'children': [], 'value': '"*"'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'amount'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '57', 'type': 'elif_clause', 'children': ['58', '64']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '63'], 'value': '=='}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '61', 'type': 'unary_operator', 'children': ['62'], 'value': '-'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'string', 'children': [], 'value': '"%"'}; {'id': '64', 'type': 'block', 'children': ['65']}; {'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': 'amount'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'binary_operator', 'children': ['72', '83'], 'value': '/'}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '74'], 'value': '*'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'throughput'}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'subscript', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '79', 'type': 'slice', 'children': ['80', '81']}; {'id': '80', 'type': 'colon', 'children': []}; {'id': '81', 'type': 'unary_operator', 'children': ['82'], 'value': '-'}; {'id': '82', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '83', 'type': 'float', 'children': [], 'value': '100.0'}; {'id': '84', 'type': 'else_clause', 'children': ['85']}; {'id': '85', 'type': 'block', 'children': ['86']}; {'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': 'amount'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'cap'}; {'id': '99', 'type': 'call', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'Capacity'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'list_splat', 'children': ['103']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'amount'}; {'id': '104', 'type': 'return_statement', 'children': ['105']}; {'id': '105', 'type': 'call', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'RateLimit'}; {'id': '107', 'type': 'argument_list', 'children': ['108', '111']}; {'id': '108', 'type': 'keyword_argument', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'total'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'cap'}; {'id': '111', 'type': 'keyword_argument', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'callback'}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': '_on_throttle'}
|
Parse a 'throttle' statement and return a RateLimit
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_reset'}; {'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': 'force'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '21']}; {'id': '10', 'type': 'boolean_operator', 'children': ['11', '15'], 'value': 'and'}; {'id': '11', 'type': 'not_operator', 'children': ['12']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_closed'}; {'id': '15', 'type': '()', 'children': ['16']}; {'id': '16', 'type': 'boolean_operator', 'children': ['17', '18'], 'value': 'or'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'force'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_transaction'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'try_statement', 'children': ['23', '30']}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'rollback'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'except_clause', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'pass_statement', 'children': []}
|
Reset a tough connection.
Rollback if forced or the connection was in a transaction.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'perimeter'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10', '19']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': '_is_completely_masked'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'binary_operator', 'children': ['13', '16'], 'value': '*'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'nan'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'pix'}; {'id': '19', 'type': 'else_clause', 'children': ['20']}; {'id': '20', 'type': 'block', 'children': ['21', '27']}; {'id': '21', 'type': 'import_from_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'dotted_name', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'skimage'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'measure'}; {'id': '25', 'type': 'dotted_name', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'perimeter'}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'binary_operator', 'children': ['29', '39'], 'value': '*'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'perimeter'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '36']}; {'id': '32', 'type': 'unary_operator', 'children': ['33'], 'value': '~'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_total_mask'}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'neighbourhood'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pix'}
|
The total perimeter of the source segment, approximated lines
through the centers of the border pixels using a 4-connectivity.
If any masked pixels make holes within the source segment, then
the perimeter around the inner hole (e.g. an annulus) will also
contribute to the total perimeter.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_json_formatter'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'dictionary', 'children': ['8', '19']}; {'id': '8', 'type': 'pair', 'children': ['9', '10']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"()"'}; {'id': '10', 'type': 'attribute', 'children': ['11', '18']}; {'id': '11', 'type': 'attribute', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'json_formatter'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'formatter'}; {'id': '19', 'type': 'pair', 'children': ['20', '21']}; {'id': '20', 'type': 'string', 'children': [], 'value': '"fmt"'}; {'id': '21', 'type': 'attribute', 'children': ['22', '27']}; {'id': '22', 'type': 'attribute', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'graph'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'json_required_keys'}
|
Create the default json formatter.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'vault_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '6', 'type': 'block', 'children': ['7', '27', '47', '54', '66']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'home'}; {'id': '10', 'type': 'conditional_expression', 'children': ['11', '16', '21', '22'], 'value': 'if'}; {'id': '11', 'type': 'subscript', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'HOME'"}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': 'in'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'HOME'"}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '21', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '22', 'type': 'subscript', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'USERPROFILE'"}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'env'}; {'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': 'os'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'home'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '63']}; {'id': '55', 'type': 'call', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'return_statement', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'None', 'children': []}
|
The path to a misc Vault file
This function will check for the env override on a file
path, compute a fully qualified OS appropriate path to
the desired file and return it if it exists. Otherwise
returns None
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_routing_info'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'records'}; {'id': '6', 'type': 'block', 'children': ['7', '20', '26', '30', '34', '38']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '14']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '13'], 'value': '!='}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'records'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'raise_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'RoutingProtocolError'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"Expected exactly one record"'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'record'}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'records'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'routers'}; {'id': '29', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'readers'}; {'id': '33', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'writers'}; {'id': '37', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '38', 'type': 'try_statement', 'children': ['39', '121', '131']}; {'id': '39', 'type': 'block', 'children': ['40', '46', '115']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'servers'}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'record'}; {'id': '45', 'type': 'string', 'children': [], 'value': '"servers"'}; {'id': '46', 'type': 'for_statement', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'servers'}; {'id': '49', 'type': 'block', 'children': ['50', '56', '60', '79']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '55', 'type': 'string', 'children': [], 'value': '"role"'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'addresses'}; {'id': '59', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '60', 'type': 'for_statement', 'children': ['61', '62', '65']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '64', 'type': 'string', 'children': [], 'value': '"addresses"'}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'addresses'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'SocketAddress'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '76', 'type': 'argument_list', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'address'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_PORT'}; {'id': '79', 'type': 'if_statement', 'children': ['80', '83', '91', '103']}; {'id': '80', 'type': 'comparison_operator', 'children': ['81', '82'], 'value': '=='}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '82', 'type': 'string', 'children': [], 'value': '"ROUTE"'}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'routers'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'addresses'}; {'id': '91', 'type': 'elif_clause', 'children': ['92', '95']}; {'id': '92', 'type': 'comparison_operator', 'children': ['93', '94'], 'value': '=='}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '94', 'type': 'string', 'children': [], 'value': '"READ"'}; {'id': '95', 'type': 'block', 'children': ['96']}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'call', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'readers'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'addresses'}; {'id': '103', 'type': 'elif_clause', 'children': ['104', '107']}; {'id': '104', 'type': 'comparison_operator', 'children': ['105', '106'], 'value': '=='}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '106', 'type': 'string', 'children': [], 'value': '"WRITE"'}; {'id': '107', 'type': 'block', 'children': ['108']}; {'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': 'writers'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '113', 'type': 'argument_list', 'children': ['114']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'addresses'}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'ttl'}; {'id': '118', 'type': 'subscript', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'record'}; {'id': '120', 'type': 'string', 'children': [], 'value': '"ttl"'}; {'id': '121', 'type': 'except_clause', 'children': ['122', '125']}; {'id': '122', 'type': 'tuple', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '125', 'type': 'block', 'children': ['126']}; {'id': '126', 'type': 'raise_statement', 'children': ['127']}; {'id': '127', 'type': 'call', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'RoutingProtocolError'}; {'id': '129', 'type': 'argument_list', 'children': ['130']}; {'id': '130', 'type': 'string', 'children': [], 'value': '"Cannot parse routing info"'}; {'id': '131', 'type': 'else_clause', 'children': ['132']}; {'id': '132', 'type': 'block', 'children': ['133']}; {'id': '133', 'type': 'return_statement', 'children': ['134']}; {'id': '134', 'type': 'call', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '136', 'type': 'argument_list', 'children': ['137', '138', '139', '140']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'routers'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'readers'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'writers'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'ttl'}
|
Parse the records returned from a getServers call and
return a new RoutingTable instance.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'average_sharded_losses'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sharded_losses'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '98']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'for_statement', 'children': ['11', '12', '18']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'loss_name'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'subscript', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'sharded_losses'}; {'id': '17', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '18', 'type': 'block', 'children': ['19', '29', '92']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'all_shards'}; {'id': '22', 'type': 'list_comprehension', 'children': ['23', '26']}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'shard_losses'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'loss_name'}; {'id': '26', 'type': 'for_in_clause', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'shard_losses'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sharded_losses'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '37', '81']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '36']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'all_shards'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '37', 'type': 'block', 'children': ['38', '48']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'pattern_list', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sharded_num'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sharded_den'}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'list_splat', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'all_shards'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'mean_loss'}; {'id': '51', 'type': '()', 'children': ['52']}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '59'], 'value': '/'}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'add_n'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'sharded_num'}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '75']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'cast'}; {'id': '68', 'type': 'argument_list', 'children': ['69', '70']}; {'id': '69', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '70', 'type': 'attribute', 'children': ['71', '74']}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'sharded_den'}; {'id': '73', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'add_n'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'sharded_den'}; {'id': '81', 'type': 'else_clause', 'children': ['82']}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'mean_loss'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'reduce_mean'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'all_shards'}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '97']}; {'id': '94', 'type': 'subscript', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'losses'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'loss_name'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'mean_loss'}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'losses'}
|
Average losses across datashards.
Args:
sharded_losses: list<dict<str loss_name, Tensor loss>>. The loss
can be a single Tensor or a 2-tuple (numerator and denominator).
Returns:
losses: dict<str loss_name, Tensor avg_loss>
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_scene'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '6', 'type': 'block', 'children': ['7', '19']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'scene'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'Scene'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'from_config'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'pyvlx'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'item'}; {'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': 'add'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'scene'}
|
Load scene from json.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_errors'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'list_comprehension', 'children': ['8', '18', '23']}; {'id': '8', 'type': 'dictionary', 'children': ['9']}; {'id': '9', 'type': 'pair', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'cr'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'component_name'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'cr'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_error'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'for_in_clause', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'cr'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'component_results'}; {'id': '23', 'type': 'if_clause', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cr'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'has_error'}; {'id': '28', 'type': 'argument_list', 'children': []}
|
If there were any business errors fetching data for this property,
returns the error messages.
Returns:
string - the error message, or None if there was no error.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_multireddit'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'list_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11', '33', '51']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '14', 'type': 'call', 'children': ['15', '22']}; {'id': '15', 'type': 'attribute', 'children': ['16', '21']}; {'id': '16', 'type': 'subscript', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'multireddit_about'"}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '30']}; {'id': '23', 'type': 'keyword_argument', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'user'}; {'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': 'user'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'multi'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '38']}; {'id': '34', 'type': 'not_operator', 'children': ['35']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_use_oauth'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '48']}; {'id': '41', 'type': 'subscript', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'http'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '47', 'type': 'string', 'children': [], 'value': "'x-modhash'"}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'modhash'}; {'id': '51', 'type': 'try_statement', 'children': ['52', '70']}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'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': 'request'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60', '63', '66', '68']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '62', 'type': 'dictionary', 'children': []}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '65', 'type': 'string', 'children': [], 'value': "'DELETE'"}; {'id': '66', 'type': 'list_splat', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '68', 'type': 'dictionary_splat', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '70', 'type': 'finally_clause', 'children': ['71']}; {'id': '71', 'type': 'block', 'children': ['72']}; {'id': '72', 'type': 'if_statement', 'children': ['73', '77']}; {'id': '73', 'type': 'not_operator', 'children': ['74']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_use_oauth'}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'delete_statement', 'children': ['79']}; {'id': '79', 'type': 'subscript', 'children': ['80', '85']}; {'id': '80', 'type': 'attribute', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'http'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '85', 'type': 'string', 'children': [], 'value': "'x-modhash'"}
|
Delete a Multireddit.
Any additional parameters are passed directly into
:meth:`~praw.__init__.BaseReddit.request`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '22']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '9', 'type': 'dictionary_comprehension', 'children': ['10', '17']}; {'id': '10', 'type': 'pair', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '17', 'type': 'for_in_clause', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'to_update'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_perform_command'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27', '28']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'user_update'"}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'args'}
|
Update the user's details on Todoist.
This method must be called to register any local attribute changes
with Todoist.
>>> from pytodoist import todoist
>>> user = todoist.login('[email protected]', 'password')
>>> user.full_name = 'John Smith'
>>> # At this point Todoist still thinks the name is 'John Doe'.
>>> user.update()
>>> # Now the name has been updated on Todoist.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'enable_key'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '11', '18']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '9', 'type': 'argument_list', 'children': ['10']}; {'id': '10', 'type': 'string', 'children': [], 'value': '"This command will enable a disabled key."'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'apiKeyID'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'input'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': '"API Key ID: "'}; {'id': '18', 'type': 'try_statement', 'children': ['19', '44']}; {'id': '19', 'type': 'block', 'children': ['20', '35']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_curl_bitmex'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'string', 'children': [], 'value': '"/apiKey/enable"'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'postdict'}; {'id': '31', 'type': 'dictionary', 'children': ['32']}; {'id': '32', 'type': 'pair', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': '"apiKeyID"'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'apiKeyID'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'binary_operator', 'children': ['40', '41'], 'value': '%'}; {'id': '40', 'type': 'string', 'children': [], 'value': '"Key with ID %s enabled."'}; {'id': '41', 'type': 'subscript', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '43', 'type': 'string', 'children': [], 'value': '"id"'}; {'id': '44', 'type': 'except_clause', 'children': ['45']}; {'id': '45', 'type': 'block', 'children': ['46', '51']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'string', 'children': [], 'value': '"Unable to enable key, please try again."'}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'enable_key'}; {'id': '56', 'type': 'argument_list', 'children': []}
|
Enable an existing API Key.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'upload_keys'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'device_keys'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'one_time_keys'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '16', '25', '34']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '15', 'type': 'dictionary', 'children': []}; {'id': '16', 'type': 'if_statement', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'device_keys'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '24']}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '23', 'type': 'string', 'children': [], 'value': '"device_keys"'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'device_keys'}; {'id': '25', 'type': 'if_statement', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'one_time_keys'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '33']}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '32', 'type': 'string', 'children': [], 'value': '"one_time_keys"'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'one_time_keys'}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_send'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42']}; {'id': '40', 'type': 'string', 'children': [], 'value': '"POST"'}; {'id': '41', 'type': 'string', 'children': [], 'value': '"/keys/upload"'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'content'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'content'}
|
Publishes end-to-end encryption keys for the device.
Said device must be the one used when logging in.
Args:
device_keys (dict): Optional. Identity keys for the device. The required
keys are:
| user_id (str): The ID of the user the device belongs to. Must match
the user ID used when logging in.
| device_id (str): The ID of the device these keys belong to. Must match
the device ID used when logging in.
| algorithms (list<str>): The encryption algorithms supported by this
device.
| keys (dict): Public identity keys. Should be formatted as
<algorithm:device_id>: <key>.
| signatures (dict): Signatures for the device key object. Should be
formatted as <user_id>: {<algorithm:device_id>: <key>}
one_time_keys (dict): Optional. One-time public keys. Should be
formatted as <algorithm:key_id>: <key>, the key format being
determined by the algorithm.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '31']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'form'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '11', '14', '17', '20', '23', '26', '29']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'type_'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'Type'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'String'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'required'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'default_parameter', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'default_parameter', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '22', 'type': 'None', 'children': []}; {'id': '23', 'type': 'default_parameter', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'default_parameter', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'enum'}; {'id': '28', 'type': 'None', 'children': []}; {'id': '29', 'type': 'dictionary_splat_pattern', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '31', 'type': 'block', 'children': ['32', '50']}; {'id': '32', 'type': 'if_statement', 'children': ['33', '44']}; {'id': '33', 'type': 'boolean_operator', 'children': ['34', '41'], 'value': 'and'}; {'id': '34', 'type': 'boolean_operator', 'children': ['35', '38'], 'value': 'and'}; {'id': '35', 'type': 'comparison_operator', 'children': ['36', '37'], 'value': 'is not'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '37', 'type': 'None', 'children': []}; {'id': '38', 'type': 'comparison_operator', 'children': ['39', '40'], 'value': 'is not'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '40', 'type': 'None', 'children': []}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': '>'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'raise_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"Minimum must be less than or equal to the maximum."'}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55', '58', '59', '60', '61', '64', '67', '70', '73', '76']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'In'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'Form'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'type_'}; {'id': '59', 'type': 'None', 'children': []}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'required'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'required'}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'minimum'}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'maximum'}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'enum'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'enum'}; {'id': '76', 'type': 'dictionary_splat', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'options'}
|
Define form parameter.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'answer_approval'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'issue_id_or_key'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'approval_id'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'decision'}; {'id': '8', 'type': 'block', 'children': ['9', '19', '26']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'string', 'children': [], 'value': "'rest/servicedeskapi/request/{0}/approval/{1}'"}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'issue_id_or_key'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'approval_id'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '22', 'type': 'dictionary', 'children': ['23']}; {'id': '23', 'type': 'pair', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'decision'"}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'decision'}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'post'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33', '38']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'experimental_headers'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'data'}
|
Answer a pending approval
:param issue_id_or_key: str
:param approval_id: str
:param decision: str
:return:
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'html_to_text'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'html'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'base_url'}; {'id': '7', 'type': 'string', 'children': [], 'value': "''"}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'bodywidth'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'CONFIG_DEFAULT'}; {'id': '11', 'type': 'block', 'children': ['12', '56', '100', '119', '125', '131']}; {'id': '12', 'type': 'function_definition', 'children': ['13', '14', '16']}; {'id': '13', 'type': 'function_name', 'children': [], 'value': '_patched_handle_charref'}; {'id': '14', 'type': 'parameters', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '16', 'type': 'block', 'children': ['17', '21', '30', '48']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'charref'}; {'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': 'charref'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '38']}; {'id': '31', 'type': 'boolean_operator', 'children': ['32', '35'], 'value': 'or'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'pre'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'charref'}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'cgi'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'escape'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'charref'}; {'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': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'charref'}; {'id': '55', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '56', 'type': 'function_definition', 'children': ['57', '58', '60']}; {'id': '57', 'type': 'function_name', 'children': [], 'value': '_patched_handle_entityref'}; {'id': '58', 'type': 'parameters', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '60', 'type': 'block', 'children': ['61', '65', '74', '92']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'entityref'}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'entityref'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '74', 'type': 'if_statement', 'children': ['75', '82']}; {'id': '75', 'type': 'boolean_operator', 'children': ['76', '79'], 'value': 'or'}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'pre'}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'entityref'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'cgi'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'escape'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'entityref'}; {'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': 'self'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '97', 'type': 'argument_list', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'entityref'}; {'id': '99', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '103', 'type': 'call', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'HTML2Text'}; {'id': '105', 'type': 'argument_list', 'children': ['106', '109']}; {'id': '106', 'type': 'keyword_argument', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'baseurl'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'base_url'}; {'id': '109', 'type': 'keyword_argument', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'bodywidth'}; {'id': '111', 'type': 'conditional_expression', 'children': ['112', '115', '118'], 'value': 'if'}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'BODY_WIDTH'}; {'id': '115', 'type': 'comparison_operator', 'children': ['116', '117'], 'value': 'is'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'bodywidth'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'CONFIG_DEFAULT'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'bodywidth'}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '124']}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'handle_entityref'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': '_patched_handle_entityref'}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'assignment', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'handle_charref'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': '_patched_handle_charref'}; {'id': '131', 'type': 'return_statement', 'children': ['132']}; {'id': '132', 'type': 'call', 'children': ['133', '141']}; {'id': '133', 'type': 'attribute', 'children': ['134', '140']}; {'id': '134', 'type': 'call', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '138', 'type': 'argument_list', 'children': ['139']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'html'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'rstrip'}; {'id': '141', 'type': 'argument_list', 'children': []}
|
Convert a HTML mesasge to plain text.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'importTTX'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '9', '12', '16', '30', '41', '52']}; {'id': '6', 'type': 'import_statement', 'children': ['7']}; {'id': '7', 'type': 'dotted_name', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '9', 'type': 'import_statement', 'children': ['10']}; {'id': '10', 'type': 'dotted_name', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '15', 'type': 'string', 'children': [], 'value': '"com.github.fonttools.ttx"'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'sfntVersionRE'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'compile'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': '\'(^<ttFont\\s+)(sfntVersion=".*"\\s+)(.*>$)\''}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'flags'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'MULTILINE'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '39']}; {'id': '31', 'type': 'not_operator', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ufo'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"data"'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': []}; {'id': '41', 'type': 'if_statement', 'children': ['42', '50']}; {'id': '42', 'type': 'not_operator', 'children': ['43']}; {'id': '43', 'type': 'attribute', 'children': ['44', '49']}; {'id': '44', 'type': 'attribute', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ufo'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'fileNames'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'return_statement', 'children': []}; {'id': '52', 'type': 'for_statement', 'children': ['53', '54', '61']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '54', 'type': 'attribute', 'children': ['55', '60']}; {'id': '55', 'type': 'attribute', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ufo'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'fileNames'}; {'id': '61', 'type': 'block', 'children': ['62', '75']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '67']}; {'id': '64', 'type': 'pattern_list', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'foldername'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '67', 'type': 'call', 'children': ['68', '73']}; {'id': '68', 'type': 'attribute', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '75', 'type': 'if_statement', 'children': ['76', '87']}; {'id': '76', 'type': '()', 'children': ['77']}; {'id': '77', 'type': 'boolean_operator', 'children': ['78', '81'], 'value': 'and'}; {'id': '78', 'type': 'comparison_operator', 'children': ['79', '80'], 'value': '=='}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'foldername'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'string', 'children': [], 'value': '".ttx"'}; {'id': '87', 'type': 'block', 'children': ['88', '103', '113', '125']}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'ttx'}; {'id': '91', 'type': 'call', 'children': ['92', '101']}; {'id': '92', 'type': 'attribute', 'children': ['93', '100']}; {'id': '93', 'type': 'subscript', 'children': ['94', '99']}; {'id': '94', 'type': 'attribute', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'ufo'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'assignment', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'ttx'}; {'id': '106', 'type': 'call', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'sfntVersionRE'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'sub'}; {'id': '110', 'type': 'argument_list', 'children': ['111', '112']}; {'id': '111', 'type': 'string', 'children': [], 'value': "r'\\1\\3'"}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'ttx'}; {'id': '113', 'type': 'expression_statement', 'children': ['114']}; {'id': '114', 'type': 'assignment', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '116', 'type': 'call', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'BytesIO'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'call', 'children': ['120', '123']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'ttx'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '123', 'type': 'argument_list', 'children': ['124']}; {'id': '124', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'call', 'children': ['127', '132']}; {'id': '127', 'type': 'attribute', 'children': ['128', '131']}; {'id': '128', 'type': 'attribute', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'otf'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'importXML'}; {'id': '132', 'type': 'argument_list', 'children': ['133']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'fp'}
|
Merge TTX files from data directory "com.github.fonttools.ttx"
**This should not be called externally.** Subclasses
may override this method to handle the bounds creation
in a different way if desired.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'FoldValue'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '26', '45']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '19']}; {'id': '8', 'type': 'boolean_operator', 'children': ['9', '12'], 'value': 'and'}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'is'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '11', 'type': 'False', 'children': []}; {'id': '12', 'type': 'comparison_operator', 'children': ['13', '18'], 'value': 'is not'}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_data_type_definition'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'false_value'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_data_type_definition'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'false_value'}; {'id': '26', 'type': 'if_statement', 'children': ['27', '38']}; {'id': '27', 'type': 'boolean_operator', 'children': ['28', '31'], 'value': 'and'}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '30'], 'value': 'is'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '30', 'type': 'True', 'children': []}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '37'], 'value': 'is not'}; {'id': '32', 'type': 'attribute', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_data_type_definition'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'true_value'}; {'id': '37', 'type': 'None', 'children': []}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'return_statement', 'children': ['40']}; {'id': '40', 'type': 'attribute', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_data_type_definition'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'true_value'}; {'id': '45', 'type': 'raise_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'string', 'children': [], 'value': "'No matching True and False values'"}
|
Folds the data type into a value.
Args:
value (object): value.
Returns:
object: folded value.
Raises:
ValueError: if the data type definition cannot be folded into the value.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bounding_ellipses'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '68']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '11', '36']}; {'id': '7', 'type': '()', 'children': ['8']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'linear_growth'}; {'id': '11', 'type': 'block', 'children': ['12', '24']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'a1'}; {'id': '15', 'type': 'binary_operator', 'children': ['16', '19'], 'value': '-'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'sma'}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '23'], 'value': '/'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'astep'}; {'id': '23', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'a2'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '31'], 'value': '+'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'sma'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '35'], 'value': '/'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'astep'}; {'id': '35', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '36', 'type': 'else_clause', 'children': ['37']}; {'id': '37', 'type': 'block', 'children': ['38', '53']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'a1'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '45'], 'value': '*'}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'sma'}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '-'}; {'id': '47', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '48', 'type': 'binary_operator', 'children': ['49', '52'], 'value': '/'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'astep'}; {'id': '52', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'a2'}; {'id': '56', 'type': 'binary_operator', 'children': ['57', '60'], 'value': '*'}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'sma'}; {'id': '60', 'type': '()', 'children': ['61']}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '+'}; {'id': '62', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '63', 'type': 'binary_operator', 'children': ['64', '67'], 'value': '/'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'astep'}; {'id': '67', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '68', 'type': 'return_statement', 'children': ['69']}; {'id': '69', 'type': 'expression_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'a1'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'a2'}
|
Compute the semimajor axis of the two ellipses that bound the
annulus where integrations take place.
Returns
-------
sma1, sma2 : float
The smaller and larger values of semimajor axis length that
define the annulus bounding ellipses.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'vectorize_utterance_ohe'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'utterance'}; {'id': '6', 'type': 'block', 'children': ['7', '30', '46', '71']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '11', '15']}; {'id': '8', 'type': 'pattern_list', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'utterance'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '23']}; {'id': '17', 'type': 'not_operator', 'children': ['18']}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '20'], 'value': 'in'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'word'}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'vocab_list'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'utterance'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '29', 'type': 'string', 'children': [], 'value': "'<unk>'"}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'ie_utterance'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'swap_pad_and_zero'}; {'id': '37', 'type': 'argument_list', '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': 'ie'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'transform'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'utterance'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'ohe_utterance'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'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': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ohe'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'transform'}; {'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': 'ie_utterance'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'reshape'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '70']}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'ie_utterance'}; {'id': '70', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'ohe_utterance'}
|
Take in a tokenized utterance and transform it into a sequence of one-hot vectors
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_data'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'rawdata'}; {'id': '6', 'type': 'block', 'children': ['7', '116']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '9', '10']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'rawdata'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'try_statement', 'children': ['12', '105']}; {'id': '12', 'type': 'block', 'children': ['13', '19', '27', '43', '49', '58', '75']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '16', 'type': 'subscript', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '25']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '24'], 'value': '=='}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '23', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'continue_statement', 'children': []}; {'id': '27', 'type': 'if_statement', 'children': ['28', '33']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '32'], 'value': '!='}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '31', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'block', 'children': ['34', '42']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'warnings'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41']}; {'id': '40', 'type': 'string', 'children': [], 'value': 'f"Unknown message type \'{item[0]}\'"'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'Warning'}; {'id': '42', 'type': 'continue_statement', 'children': []}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'subscript', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '58', 'type': 'try_statement', 'children': ['59', '66']}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '63', 'type': 'subscript', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '65', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '66', 'type': 'except_clause', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'IndexError'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '74', 'type': 'argument_list', 'children': []}; {'id': '75', 'type': 'try_statement', 'children': ['76', '94']}; {'id': '76', 'type': 'block', 'children': ['77', '89']}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '82', 'type': 'argument_list', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'binary_operator', 'children': ['85', '88'], 'value': '+'}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': '__head'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '94', 'type': 'except_clause', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'AttributeError'}; {'id': '96', 'type': 'block', 'children': ['97']}; {'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': 'self'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': '_handle_unhandled'}; {'id': '102', 'type': 'argument_list', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '105', 'type': 'except_clause', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'IndexError'}; {'id': '107', 'type': 'block', 'children': ['108']}; {'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': 'warning'}; {'id': '113', 'type': 'argument_list', 'children': ['114', '115']}; {'id': '114', 'type': 'string', 'children': [], 'value': '"Wrongly constructed message received: %r"'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'call', 'children': ['118', '123']}; {'id': '118', 'type': 'attribute', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'process_queues'}; {'id': '123', 'type': 'argument_list', 'children': []}
|
Add data to given room's state
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_high_water_mark'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'mark_type'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'obstory_name'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '21', '30', '39', '53', '63', '77']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'obstory_name'}; {'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': 'obstory_name'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'obstory_name'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'obstory'}; {'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': 'get_obstory_from_name'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'obstory_name'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'key_id'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'get_hwm_key_id'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'mark_type'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '46']}; {'id': '41', 'type': 'attribute', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'con'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'SELECT time FROM archive_highWaterMarks WHERE markType=%s AND observatoryId=%s'"}; {'id': '48', 'type': 'tuple', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'key_id'}; {'id': '50', 'type': 'subscript', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'obstory'}; {'id': '52', 'type': 'string', 'children': [], 'value': "'uid'"}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '56', 'type': 'call', 'children': ['57', '62']}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'con'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'fetchall'}; {'id': '62', 'type': 'argument_list', 'children': []}; {'id': '63', 'type': 'if_statement', 'children': ['64', '70']}; {'id': '64', 'type': 'comparison_operator', 'children': ['65', '69'], 'value': '>'}; {'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': 'results'}; {'id': '69', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'subscript', 'children': ['73', '76']}; {'id': '73', 'type': 'subscript', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '75', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'time'"}; {'id': '77', 'type': 'return_statement', 'children': ['78']}; {'id': '78', 'type': 'None', 'children': []}
|
Retrieves the high water mark for a given obstory, defaulting to the current installation ID
:param string mark_type:
The type of high water mark to set
:param string obstory_name:
The obstory ID to check for, or the default installation ID if not specified
:return:
A UTC datetime for the high water mark, or None if none was found.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'active_serving_watcher'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'kitchen'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '7', 'type': 'block', 'children': ['8', '19', '31', '47', '58', '89']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '13']}; {'id': '10', 'type': 'pattern_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'err_str'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'use_kitchen'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Backend'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_kitchen_from_user'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'kitchen'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '23']}; {'id': '20', 'type': 'comparison_operator', 'children': ['21', '22'], 'value': 'is'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'use_kitchen'}; {'id': '22', 'type': 'None', 'children': []}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'click'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ClickException'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'err_str'}; {'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': 'secho'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '44']}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '39'], 'value': '%'}; {'id': '38', 'type': 'string', 'children': [], 'value': "'%s - Watching Active OrderRun Changes in Kitchen %s'"}; {'id': '39', 'type': 'tuple', 'children': ['40', '43']}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'get_datetime'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'use_kitchen'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'fg'}; {'id': '46', 'type': 'string', 'children': [], 'value': "'green'"}; {'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': 'DKCloudCommandRunner'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'watch_active_servings'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '56', '57']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'dki'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'use_kitchen'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'period'}; {'id': '58', 'type': 'while_statement', 'children': ['59', '60']}; {'id': '59', 'type': 'True', 'children': []}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'try_statement', 'children': ['62', '78']}; {'id': '62', 'type': 'block', 'children': ['63', '69']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'call', 'children': ['65', '68']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'DKCloudCommandRunner'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'join_active_serving_watcher_thread_join'}; {'id': '68', 'type': 'argument_list', 'children': []}; {'id': '69', 'type': 'if_statement', 'children': ['70', '76']}; {'id': '70', 'type': 'not_operator', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'DKCloudCommandRunner'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'watcher_running'}; {'id': '75', 'type': 'argument_list', 'children': []}; {'id': '76', 'type': 'block', 'children': ['77']}; {'id': '77', 'type': 'break_statement', 'children': []}; {'id': '78', 'type': 'except_clause', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'KeyboardInterrupt'}; {'id': '80', 'type': 'block', 'children': ['81', '83']}; {'id': '81', 'type': 'print_statement', 'children': ['82']}; {'id': '82', 'type': 'string', 'children': [], 'value': "'KeyboardInterrupt'"}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'exit_gracefully'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'None', 'children': []}; {'id': '88', 'type': 'None', 'children': []}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'integer', 'children': [], 'value': '0'}
|
Watches all cooking Recipes in a Kitchen
Provide the kitchen name as an argument or be in a Kitchen folder.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'register_phonon_task'}; {'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', '16']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '15']}; {'id': '12', 'type': 'subscript', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '14', 'type': 'string', 'children': [], 'value': '"task_class"'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'PhononTask'}; {'id': '16', 'type': 'return_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': 'register_task'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '24']}; {'id': '22', 'type': 'list_splat', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '24', 'type': 'dictionary_splat', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Register a phonon task.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_blocking'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'fd'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'blocking'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '21', '43', '54']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'old_flag'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'fcntl'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'fcntl'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'fd'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'fcntl'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'F_GETFL'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '23', '33']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'blocking'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'new_flag'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '29'], 'value': '&'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'old_flag'}; {'id': '29', 'type': 'unary_operator', 'children': ['30'], 'value': '~'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'O_NONBLOCK'}; {'id': '33', 'type': 'else_clause', 'children': ['34']}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'new_flag'}; {'id': '38', 'type': 'binary_operator', 'children': ['39', '40'], 'value': '|'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'old_flag'}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'O_NONBLOCK'}; {'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': 'fcntl'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'fcntl'}; {'id': '48', 'type': 'argument_list', 'children': ['49', '50', '53']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'fd'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'fcntl'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'F_SETFL'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'new_flag'}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'not_operator', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '61'], 'value': '&'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'old_flag'}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'O_NONBLOCK'}
|
Set the given file-descriptor blocking or non-blocking.
Returns the original blocking status.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'posttrans_hook'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'conduit'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '9'], 'value': 'not in'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'SALT_RUNNING'"}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'environ'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'with_statement', 'children': ['14', '24']}; {'id': '14', 'type': 'with_clause', 'children': ['15']}; {'id': '15', 'type': 'with_item', 'children': ['16']}; {'id': '16', 'type': 'as_pattern', 'children': ['17', '22']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'CK_PATH'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '22', 'type': 'as_pattern_target', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ck_fh'}; {'id': '24', 'type': 'block', 'children': ['25']}; {'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': 'ck_fh'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'{chksum} {mtime}\\n'"}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '41']}; {'id': '36', 'type': 'keyword_argument', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'chksum'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': '_get_checksum'}; {'id': '40', 'type': 'argument_list', 'children': []}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'mtime'}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_get_mtime'}; {'id': '45', 'type': 'argument_list', 'children': []}
|
Hook after the package installation transaction.
:param conduit:
:return:
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_magic_packet'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '5', 'type': 'block', 'children': ['6', '46', '59', '63', '96']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13', '15', '39']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '12'], 'value': '=='}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '12'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'pass_statement', 'children': []}; {'id': '15', 'type': 'elif_clause', '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': 'macaddress'}; {'id': '21', 'type': 'integer', 'children': [], 'value': '17'}; {'id': '22', 'type': 'block', 'children': ['23', '29']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'sep'}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'sep'}; {'id': '38', 'type': 'string', 'children': [], 'value': "''"}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'raise_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'string', 'children': [], 'value': "'Incorrect MAC address format'"}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '51'], 'value': '+'}; {'id': '50', 'type': 'string', 'children': [], 'value': "b'FFFFFFFFFFFF'"}; {'id': '51', 'type': 'call', 'children': ['52', '58']}; {'id': '52', 'type': 'attribute', 'children': ['53', '57']}; {'id': '53', 'type': '()', 'children': ['54']}; {'id': '54', 'type': 'binary_operator', 'children': ['55', '56'], 'value': '*'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'macaddress'}; {'id': '56', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '58', 'type': 'argument_list', 'children': []}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'send_data'}; {'id': '62', 'type': 'string', 'children': [], 'value': "b''"}; {'id': '63', 'type': 'for_statement', 'children': ['64', '65', '74']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69', '73']}; {'id': '68', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '73', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '74', 'type': 'block', 'children': ['75']}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'augmented_assignment', 'children': ['77', '78'], 'value': '+='}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'send_data'}; {'id': '78', 'type': 'call', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'pack'}; {'id': '82', 'type': 'argument_list', 'children': ['83', '84']}; {'id': '83', 'type': 'string', 'children': [], 'value': "b'B'"}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '95']}; {'id': '87', 'type': 'subscript', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '89', 'type': 'slice', 'children': ['90', '91', '92']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '91', 'type': 'colon', 'children': []}; {'id': '92', 'type': 'binary_operator', 'children': ['93', '94'], 'value': '+'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '94', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '95', 'type': 'integer', 'children': [], 'value': '16'}; {'id': '96', 'type': 'return_statement', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'send_data'}
|
Create a magic packet.
A magic packet is a packet that can be used with the for wake on lan
protocol to wake up a computer. The packet is constructed from the
mac address given as a parameter.
Args:
macaddress (str): the mac address that should be parsed into a
magic packet.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_chains'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '92']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'chains'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'odict'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '20']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'splitlines'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'True', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21', '30']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 're_chain'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '32', 'type': 'block', 'children': ['33', '37', '56']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'policy'}; {'id': '36', 'type': 'None', 'children': []}; {'id': '37', 'type': 'if_statement', 'children': ['38', '46']}; {'id': '38', 'type': 'comparison_operator', 'children': ['39', '45'], 'value': '!='}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'policy'}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '66']}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'chains'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '66', 'type': 'dictionary', 'children': ['67', '70', '81']}; {'id': '67', 'type': 'pair', 'children': ['68', '69']}; {'id': '68', 'type': 'string', 'children': [], 'value': "'policy'"}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'policy'}; {'id': '70', 'type': 'pair', 'children': ['71', '72']}; {'id': '71', 'type': 'string', 'children': [], 'value': "'packets'"}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '81', 'type': 'pair', 'children': ['82', '83']}; {'id': '82', 'type': 'string', 'children': [], 'value': "'bytes'"}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '92', 'type': 'return_statement', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'chains'}
|
Parse the chain definitions.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'stress'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ref_cds'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'est_cds'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '21']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ref_dists'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'pdist'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'ref_cds'}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'est_dists'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'pdist'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'est_cds'}; {'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': 'np'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '39'], 'value': '/'}; {'id': '28', 'type': 'call', 'children': ['29', '38']}; {'id': '29', 'type': 'attribute', 'children': ['30', '37']}; {'id': '30', 'type': '()', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '36'], 'value': '**'}; {'id': '32', 'type': '()', 'children': ['33']}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '-'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ref_dists'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'est_dists'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '38', 'type': 'argument_list', 'children': []}; {'id': '39', 'type': 'call', 'children': ['40', '46']}; {'id': '40', 'type': 'attribute', 'children': ['41', '45']}; {'id': '41', 'type': '()', 'children': ['42']}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '**'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'ref_dists'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '46', 'type': 'argument_list', 'children': []}
|
Kruskal's stress
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'response'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'component_id'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'dictionary_splat_pattern', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '11', 'type': 'block', 'children': ['12', '29', '35', '43', '71', '79']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '18']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '15'], 'value': 'in'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'component_id'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_responses'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'raise_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'DuplicateComponentNameError'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'string', 'children': [], 'value': '\'Another response with name "{}" is already registered.\''}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'component_id'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '32', 'type': 'boolean_operator', 'children': ['33', '34'], 'value': 'or'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '34', 'type': 'dictionary', 'children': []}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'for_statement', 'children': ['44', '45', '48']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': '_plugins'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'try_statement', 'children': ['50', '67']}; {'id': '50', 'type': 'block', 'children': ['51']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'boolean_operator', 'children': ['58', '66'], 'value': 'or'}; {'id': '58', 'type': 'call', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'response_helper'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'component'}; {'id': '64', 'type': 'dictionary_splat', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '66', 'type': 'dictionary', 'children': []}; {'id': '67', 'type': 'except_clause', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'PluginMethodNotImplementedError'}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'continue_statement', 'children': []}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '78']}; {'id': '73', 'type': 'subscript', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_responses'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'component_id'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Add a response which can be referenced.
:param str component_id: ref_id to use as reference
:param dict component: response fields
:param dict kwargs: plugin-specific arguments
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'DomainFactory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'domain_name'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'cmds'}; {'id': '6', 'type': 'block', 'children': ['7', '20', '46']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'klass'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '17', '19']}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'domain_name'}; {'id': '17', 'type': 'tuple', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'BaseDomain'}; {'id': '19', 'type': 'dictionary', 'children': []}; {'id': '20', 'type': 'for_statement', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'cmds'}; {'id': '23', 'type': 'block', 'children': ['24', '34']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get_command'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'domain_name'}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '33', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'setattr'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39', '42']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'klass'}; {'id': '39', 'type': 'subscript', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'classmethod'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'command'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'klass'}
|
Dynamically create Domain class and set it's methods.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'zpopmax'}; {'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': 'count'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '22', '29']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '13', 'type': 'boolean_operator', 'children': ['14', '21'], 'value': 'or'}; {'id': '14', 'type': 'boolean_operator', 'children': ['15', '19'], 'value': 'and'}; {'id': '15', 'type': '()', 'children': ['16']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': 'is not'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '18', 'type': 'None', 'children': []}; {'id': '19', 'type': 'list', 'children': ['20'], 'value': '[count]'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '21', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '25', 'type': 'dictionary', 'children': ['26']}; {'id': '26', 'type': 'pair', 'children': ['27', '28']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'withscores'"}; {'id': '28', 'type': 'True', 'children': []}; {'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': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'execute_command'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36', '37', '39']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'ZPOPMAX'"}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '37', 'type': 'list_splat', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '39', 'type': 'dictionary_splat', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'options'}
|
Remove and return up to ``count`` members with the highest scores
from the sorted set ``name``.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'restart'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '5', 'type': 'block', 'children': ['6', '29', '40']}; {'id': '6', 'type': 'function_definition', 'children': ['7', '8', '9']}; {'id': '7', 'type': 'function_name', 'children': [], 'value': 'wait_and_restart'}; {'id': '8', 'type': 'parameters', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '17', '22']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'Restarting server'"}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'system'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'kill 1'"}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '39']}; {'id': '31', 'type': 'attribute', 'children': ['32', '38']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'Thread'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'wait_and_restart'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '39', 'type': 'argument_list', 'children': []}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'web'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'json_response'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'dictionary', 'children': ['47']}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': '"message"'}; {'id': '49', 'type': 'string', 'children': [], 'value': '"restarting"'}
|
Returns OK, then waits approximately 1 second and restarts container
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'com_google_fonts_check_glyf_unused_data'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ttFont'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '78']}; {'id': '7', 'type': 'block', 'children': ['8', '19', '30', '36']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'expected_glyphs'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ttFont'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'getGlyphOrder'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'actual_glyphs'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ttFont'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'glyf'"}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'glyphs'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'diff'}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '-'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'actual_glyphs'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'expected_glyphs'}; {'id': '36', 'type': 'if_statement', 'children': ['37', '40', '62', '71']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '39'], 'value': '<'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'diff'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'yield', 'children': ['43']}; {'id': '43', 'type': 'expression_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'FAIL'}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'Message'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': '"unreachable-data"'}; {'id': '49', 'type': 'call', 'children': ['50', '58']}; {'id': '50', 'type': 'attribute', 'children': ['51', '57']}; {'id': '51', 'type': '()', 'children': ['52']}; {'id': '52', 'type': 'concatenated_string', 'children': ['53', '54', '55', '56']}; {'id': '53', 'type': 'string', 'children': [], 'value': '"Glyf table has unreachable data at the end of "'}; {'id': '54', 'type': 'string', 'children': [], 'value': '" the table. Expected glyf table length {}"'}; {'id': '55', 'type': 'string', 'children': [], 'value': '" (from loca table), got length"'}; {'id': '56', 'type': 'string', 'children': [], 'value': '" {} (difference: {})"'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60', '61']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'expected_glyphs'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'actual_glyphs'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'diff'}; {'id': '62', 'type': 'elif_clause', 'children': ['63', '65']}; {'id': '63', 'type': 'not_operator', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'diff'}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'yield', 'children': ['68']}; {'id': '68', 'type': 'expression_list', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'PASS'}; {'id': '70', 'type': 'string', 'children': [], 'value': '"There is no unused data at the end of the glyf table."'}; {'id': '71', 'type': 'else_clause', 'children': ['72']}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'raise_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'string', 'children': [], 'value': '"Bug: fontTools did not raise an expected exception."'}; {'id': '78', 'type': 'except_clause', 'children': ['79', '87']}; {'id': '79', 'type': 'as_pattern', 'children': ['80', '85']}; {'id': '80', 'type': 'attribute', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'fontTools'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'ttLib'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'TTLibError'}; {'id': '85', 'type': 'as_pattern_target', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '87', 'type': 'block', 'children': ['88']}; {'id': '88', 'type': 'if_statement', 'children': ['89', '95', '115']}; {'id': '89', 'type': 'comparison_operator', 'children': ['90', '91'], 'value': 'in'}; {'id': '90', 'type': 'string', 'children': [], 'value': '"not enough \'glyf\' table data"'}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '93', 'type': 'argument_list', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '95', 'type': 'block', 'children': ['96']}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'yield', 'children': ['98']}; {'id': '98', 'type': 'expression_list', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'FAIL'}; {'id': '100', 'type': 'call', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'Message'}; {'id': '102', 'type': 'argument_list', 'children': ['103', '104']}; {'id': '103', 'type': 'string', 'children': [], 'value': '"missing-data"'}; {'id': '104', 'type': 'call', 'children': ['105', '113']}; {'id': '105', 'type': 'attribute', 'children': ['106', '112']}; {'id': '106', 'type': '()', 'children': ['107']}; {'id': '107', 'type': 'concatenated_string', 'children': ['108', '109', '110', '111']}; {'id': '108', 'type': 'string', 'children': [], 'value': '"Loca table references data beyond"'}; {'id': '109', 'type': 'string', 'children': [], 'value': '" the end of the glyf table."'}; {'id': '110', 'type': 'string', 'children': [], 'value': '" Expected glyf table length {}"'}; {'id': '111', 'type': 'string', 'children': [], 'value': '" (from loca table)."'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '113', 'type': 'argument_list', 'children': ['114']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'expected_glyphs'}; {'id': '115', 'type': 'else_clause', 'children': ['116']}; {'id': '116', 'type': 'block', 'children': ['117']}; {'id': '117', 'type': 'raise_statement', 'children': ['118']}; {'id': '118', 'type': 'call', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '120', 'type': 'argument_list', 'children': ['121']}; {'id': '121', 'type': 'string', 'children': [], 'value': '"Bug: Unexpected fontTools exception."'}
|
Is there any unused data at the end of the glyf table?
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '42']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_with_dst_resource_provisioning'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '12', '15', '18', '21', '24', '27', '30', '33', '36', '39']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'cli'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'src_resource_id'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'dst_resource_config'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'max_time_out_of_sync'}; {'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': 'remote_system'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'src_spa_interface'}; {'id': '17', 'type': 'None', 'children': []}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'src_spb_interface'}; {'id': '20', 'type': 'None', 'children': []}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'dst_spa_interface'}; {'id': '23', 'type': 'None', 'children': []}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dst_spb_interface'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dst_resource_element_configs'}; {'id': '29', 'type': 'None', 'children': []}; {'id': '30', 'type': 'default_parameter', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'auto_initiate'}; {'id': '32', 'type': 'None', 'children': []}; {'id': '33', 'type': 'default_parameter', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'hourly_snap_replication_policy'}; {'id': '35', 'type': 'None', 'children': []}; {'id': '36', 'type': 'default_parameter', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'daily_snap_replication_policy'}; {'id': '38', 'type': 'None', 'children': []}; {'id': '39', 'type': 'default_parameter', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'replicate_existing_snaps'}; {'id': '41', 'type': 'None', 'children': []}; {'id': '42', 'type': 'block', 'children': ['43', '93', '109', '115', '123']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'req_body'}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'cli'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'make_body'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '54', '57', '60', '63', '66', '69', '72', '75', '78', '81', '84', '87', '90']}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'srcResourceId'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'src_resource_id'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'dstResourceConfig'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'dst_resource_config'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'maxTimeOutOfSync'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'max_time_out_of_sync'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'remoteSystem'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'remote_system'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'srcSPAInterface'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'src_spa_interface'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'srcSPBInterface'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'src_spb_interface'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dstSPAInterface'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'dst_spa_interface'}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'dstSPBInterface'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'dst_spb_interface'}; {'id': '78', 'type': 'keyword_argument', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'dstResourceElementConfigs'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'dst_resource_element_configs'}; {'id': '81', 'type': 'keyword_argument', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'autoInitiate'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'auto_initiate'}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'hourlySnapReplicationPolicy'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'hourly_snap_replication_policy'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'dailySnapReplicationPolicy'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'daily_snap_replication_policy'}; {'id': '90', 'type': 'keyword_argument', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'replicateExistingSnaps'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'replicate_existing_snaps'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'cli'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'type_action'}; {'id': '100', 'type': 'argument_list', 'children': ['101', '106', '107']}; {'id': '101', 'type': 'attribute', 'children': ['102', '105']}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '104', 'type': 'argument_list', 'children': []}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'resource_class'}; {'id': '106', 'type': 'string', 'children': [], 'value': "'createReplicationSessionWDestResProvisioning'"}; {'id': '107', 'type': 'dictionary_splat', 'children': ['108']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'req_body'}; {'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': 'resp'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'raise_if_err'}; {'id': '114', 'type': 'argument_list', 'children': []}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'session_resp'}; {'id': '118', 'type': 'subscript', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'first_content'}; {'id': '122', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '123', 'type': 'return_statement', 'children': ['124']}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '128', 'type': 'argument_list', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'cli'}; {'id': '130', 'type': 'keyword_argument', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': '_id'}; {'id': '132', 'type': 'subscript', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'session_resp'}; {'id': '134', 'type': 'string', 'children': [], 'value': "'id'"}
|
Create a replication session along with destination resource
provisioning.
:param cli: the rest cli.
:param src_resource_id: id of the replication source, could be
lun/fs/cg.
:param dst_resource_config: `UnityResourceConfig` object. The user
chosen config for destination resource provisioning. `pool_id` and
`size` are required for creation.
:param max_time_out_of_sync: maximum time to wait before syncing the
source and destination. Value `-1` means the automatic sync is not
performed. `0` means it is a sync replication.
:param name: name of the replication.
:param remote_system: `UnityRemoteSystem` object. The remote system to
which the replication is being configured. When not specified, it
defaults to local system.
:param src_spa_interface: `UnityRemoteInterface` object. The
replication interface for source SPA.
:param src_spb_interface: `UnityRemoteInterface` object. The
replication interface for source SPB.
:param dst_spa_interface: `UnityRemoteInterface` object. The
replication interface for destination SPA.
:param dst_spb_interface: `UnityRemoteInterface` object. The
replication interface for destination SPB.
:param dst_resource_element_configs: List of `UnityResourceConfig`
objects. The user chose config for each of the member element of
the destination resource.
:param auto_initiate: indicates whether to perform the first
replication sync automatically.
True - perform the first replication sync automatically.
False - perform the first replication sync manually.
:param hourly_snap_replication_policy: `UnitySnapReplicationPolicy`
object. The policy for replicating hourly scheduled snaps of the
source resource.
:param daily_snap_replication_policy: `UnitySnapReplicationPolicy`
object. The policy for replicating daily scheduled snaps of the
source resource.
:param replicate_existing_snaps: indicates whether or not to replicate
snapshots already existing on the resource.
:return: the newly created replication session.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'render_tree'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'child_func'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'prune'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'margin'}; {'id': '11', 'type': 'list', 'children': ['12'], 'value': '[0]'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17', '24', '33', '40', '44', '70', '83', '93', '106', '112', '157']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'rname'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '24', 'type': 'if_statement', 'children': ['25', '28']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'is'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '32', 'type': 'dictionary', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'child_func'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '43', 'type': 'string', 'children': [], 'value': '""'}; {'id': '44', 'type': 'for_statement', 'children': ['45', '46', '52']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'pipe'}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'margin'}; {'id': '48', 'type': 'slice', 'children': ['49', '50']}; {'id': '49', 'type': 'colon', 'children': []}; {'id': '50', 'type': 'unary_operator', 'children': ['51'], 'value': '-'}; {'id': '51', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'if_statement', 'children': ['54', '55', '62']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'pipe'}; {'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': 'retval'}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '61'], 'value': '+'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '61', 'type': 'string', 'children': [], 'value': '"| "'}; {'id': '62', 'type': 'else_clause', 'children': ['63']}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '+'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '69', 'type': 'string', 'children': [], 'value': '" "'}; {'id': '70', 'type': 'if_statement', 'children': ['71', '74']}; {'id': '71', 'type': 'comparison_operator', 'children': ['72', '73'], 'value': 'in'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'rname'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '74', 'type': 'block', 'children': ['75']}; {'id': '75', 'type': 'return_statement', 'children': ['76']}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '82'], 'value': '+'}; {'id': '77', 'type': 'binary_operator', 'children': ['78', '81'], 'value': '+'}; {'id': '78', 'type': 'binary_operator', 'children': ['79', '80'], 'value': '+'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '80', 'type': 'string', 'children': [], 'value': '"+-["'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'rname'}; {'id': '82', 'type': 'string', 'children': [], 'value': '"]\\n"'}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '86', 'type': 'binary_operator', 'children': ['87', '92'], 'value': '+'}; {'id': '87', 'type': 'binary_operator', 'children': ['88', '91'], 'value': '+'}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '90'], 'value': '+'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '90', 'type': 'string', 'children': [], 'value': '"+-"'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'rname'}; {'id': '92', 'type': 'string', 'children': [], 'value': '"\\n"'}; {'id': '93', 'type': 'if_statement', 'children': ['94', '96']}; {'id': '94', 'type': 'not_operator', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'prune'}; {'id': '96', 'type': 'block', 'children': ['97']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '100', 'type': 'call', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '111']}; {'id': '108', 'type': 'subscript', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'rname'}; {'id': '111', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '112', 'type': 'for_statement', 'children': ['113', '114', '121']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '116', 'type': 'argument_list', 'children': ['117']}; {'id': '117', 'type': 'call', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '121', 'type': 'block', 'children': ['122', '136', '151']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'call', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'margin'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '127', 'type': 'argument_list', 'children': ['128']}; {'id': '128', 'type': 'comparison_operator', 'children': ['129', '130'], 'value': '<'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '130', 'type': 'binary_operator', 'children': ['131', '135'], 'value': '-'}; {'id': '131', 'type': 'call', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '135', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '136', 'type': 'expression_statement', 'children': ['137']}; {'id': '137', 'type': 'assignment', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '139', 'type': 'binary_operator', 'children': ['140', '141'], 'value': '+'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'retval'}; {'id': '141', 'type': 'call', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'render_tree'}; {'id': '143', 'type': 'argument_list', 'children': ['144', '147', '148', '149', '150']}; {'id': '144', 'type': 'subscript', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'child_func'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'prune'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'margin'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'visited'}; {'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': 'margin'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '156', 'type': 'argument_list', 'children': []}; {'id': '157', 'type': 'return_statement', 'children': ['158']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'retval'}
|
Render a tree of nodes into an ASCII tree view.
:Parameters:
- `root`: the root node of the tree
- `child_func`: the function called to get the children of a node
- `prune`: don't visit the same node twice
- `margin`: the format of the left margin to use for children of root. 1 results in a pipe, and 0 results in no pipe.
- `visited`: a dictionary of visited nodes in the current branch if not prune, or in the whole tree if prune.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'setups'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '18', '36', '76']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'has_options'}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'base_object'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'is_optionhandler'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'enm'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'javabridge'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'get_enumeration_wrapper'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'javabridge'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '34', '35']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'jobject'}; {'id': '34', 'type': 'string', 'children': [], 'value': '"setups"'}; {'id': '35', 'type': 'string', 'children': [], 'value': '"()Ljava/util/Enumeration;"'}; {'id': '36', 'type': 'while_statement', 'children': ['37', '42']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'enm'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'hasMoreElements'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'if_statement', 'children': ['44', '45', '60']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'has_options'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'OptionHandler'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'enm'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'nextElement'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'else_clause', 'children': ['61']}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'JavaObject'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'enm'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'nextElement'}; {'id': '75', 'type': 'argument_list', 'children': []}; {'id': '76', 'type': 'return_statement', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'result'}
|
Generates and returns all the setups according to the parameter search space.
:return: the list of configured objects (of type JavaObject)
:rtype: list
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'solution_violations'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'solution'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'slots'}; {'id': '7', 'type': 'block', 'children': ['8', '19']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'converter'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'solution_to_array'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17', '18']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'solution'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'slots'}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'array_violations'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24', '25']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'slots'}
|
Take a solution and return a list of violated constraints
Parameters
----------
solution: list or tuple
a schedule in solution form
events : list or tuple
of resources.Event instances
slots : list or tuple
of resources.Slot instances
Returns
-------
Generator
of a list of strings indicating the nature of the violated
constraints
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'temp_path'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'file_name'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'block', 'children': ['8', '20']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'is'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'file_name'}; {'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': 'file_name'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'generate_timestamped_string'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"wtf_temp_file"'}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'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': 'os'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '33']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'tempfile'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'gettempdir'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'file_name'}
|
Gets a temp path.
Kwargs:
file_name (str) : if file name is specified, it gets appended to the temp dir.
Usage::
temp_file_path = temp_path("myfile")
copyfile("myfile", temp_file_path) # copies 'myfile' to '/tmp/myfile'
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'flush'}; {'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', '15']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'grouping_info'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '23']}; {'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': '_should_flush'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_write_current_buffer_for_group_key'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'key'}
|
Ensure all remaining buffers are written.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'screenshot'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '28', '33', '42']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'b64data'}; {'id': '9', 'type': 'attribute', 'children': ['10', '18']}; {'id': '10', 'type': 'call', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'http'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'/screenshot'"}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'raw_data'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'base64'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'b64decode'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'b64data'}; {'id': '28', 'type': 'import_from_statement', 'children': ['29', '31']}; {'id': '29', 'type': 'dotted_name', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'PIL'}; {'id': '31', 'type': 'dotted_name', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'buff'}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'io'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'BytesIO'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'raw_data'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'Image'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'buff'}
|
Take screenshot with session check
Returns:
PIL.Image
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'service'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'hostport'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'module_name'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15', '32', '46']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '23']}; {'id': '16', 'type': 'not_operator', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'.thrift'"}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'pattern_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'service'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '29', 'type': 'expression_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'service'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'thriftrw'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'load'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '43']}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '43', 'type': 'keyword_argument', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'module_name'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'TChannelThriftModule'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51', '52']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'service'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'module'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'hostport'}
|
Loads the Thrift file at the specified path.
The file is compiled in-memory and a Python module containing the result
is returned. It may be used with ``TChannel.thrift``. For example,
.. code-block:: python
from tchannel import TChannel, thrift
# Load our server's interface definition.
donuts = thrift.load(path='donuts.thrift')
# We need to specify a service name or hostport because this is a
# downstream service we'll be calling.
coffee = thrift.load(path='coffee.thrift', service='coffee')
tchannel = TChannel('donuts')
@tchannel.thrift.register(donuts.DonutsService)
@tornado.gen.coroutine
def submitOrder(request):
args = request.body
if args.coffee:
yield tchannel.thrift(
coffee.CoffeeService.order(args.coffee)
)
# ...
The returned module contains, one top-level type for each struct, enum,
union, exeption, and service defined in the Thrift file. For each service,
the corresponding class contains a classmethod for each function defined
in that service that accepts the arguments for that function and returns a
``ThriftRequest`` capable of being sent via ``TChannel.thrift``.
For more information on what gets generated by ``load``, see `thriftrw
<http://thriftrw.readthedocs.org/en/latest/>`_.
Note that the ``path`` accepted by ``load`` must be either an absolute
path or a path relative to the *the current directory*. If you need to
refer to Thrift files relative to the Python module in which ``load`` was
called, use the ``__file__`` magic variable.
.. code-block:: python
# Given,
#
# foo/
# myservice.thrift
# bar/
# x.py
#
# Inside foo/bar/x.py,
path = os.path.join(
os.path.dirname(__file__), '../myservice.thrift'
)
The returned value is a valid Python module. You can install the module by
adding it to the ``sys.modules`` dictionary. This will allow importing
items from this module directly. You can use the ``__name__`` magic
variable to make the generated module a submodule of the current module.
For example,
.. code-block:: python
# foo/bar.py
import sys
from tchannel import thrift
donuts = = thrift.load('donuts.thrift')
sys.modules[__name__ + '.donuts'] = donuts
This installs the module generated for ``donuts.thrift`` as the module
``foo.bar.donuts``. Callers can then import items from that module
directly. For example,
.. code-block:: python
# foo/baz.py
from foo.bar.donuts import DonutsService, Order
def baz(tchannel):
return tchannel.thrift(
DonutsService.submitOrder(Order(..))
)
:param str service:
Name of the service that the Thrift file represents. This name will be
used to route requests through Hyperbahn.
:param str path:
Path to the Thrift file. If this is a relative path, it must be
relative to the current directory.
:param str hostport:
Clients can use this to specify the hostport at which the service can
be found. If omitted, TChannel will route the requests through known
peers. This value is ignored by servers.
:param str module_name:
Name used for the generated Python module. Defaults to the name of the
Thrift file.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fix_facets'}; {'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': 'facets'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'facets'}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '22']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'facets'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23', '35']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_type'}; {'id': '26', 'type': 'call', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'facets'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': '"_type"'}; {'id': '34', 'type': 'string', 'children': [], 'value': '"unknown"'}; {'id': '35', 'type': 'if_statement', 'children': ['36', '39']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': '=='}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_type'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"date_histogram"'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'for_statement', 'children': ['41', '42', '51']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '42', 'type': 'call', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'facets'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '48', 'type': 'argument_list', 'children': ['49', '50']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"entries"'}; {'id': '50', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'for_statement', 'children': ['53', '56', '64']}; {'id': '53', 'type': 'pattern_list', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '63', 'type': 'argument_list', 'children': []}; {'id': '64', 'type': 'block', 'children': ['65', '77']}; {'id': '65', 'type': 'if_statement', 'children': ['66', '75']}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '68'], 'value': 'in'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '68', 'type': 'list', 'children': ['69', '70', '71', '72', '73', '74'], 'value': '["count", "max", "min", "total_count", "mean", "total"]'}; {'id': '69', 'type': 'string', 'children': [], 'value': '"count"'}; {'id': '70', 'type': 'string', 'children': [], 'value': '"max"'}; {'id': '71', 'type': 'string', 'children': [], 'value': '"min"'}; {'id': '72', 'type': 'string', 'children': [], 'value': '"total_count"'}; {'id': '73', 'type': 'string', 'children': [], 'value': '"mean"'}; {'id': '74', 'type': 'string', 'children': [], 'value': '"total"'}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'continue_statement', 'children': []}; {'id': '77', 'type': 'if_statement', 'children': ['78', '86']}; {'id': '78', 'type': 'not_operator', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '85']}; {'id': '82', 'type': 'subscript', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'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': 'entry'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '92', 'type': 'call', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'utcfromtimestamp'}; {'id': '96', 'type': 'argument_list', 'children': ['97']}; {'id': '97', 'type': 'binary_operator', 'children': ['98', '99'], 'value': '/'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '99', 'type': 'float', 'children': [], 'value': '1e3'}
|
This function convert date_histogram facets to datetime
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'convert_units_to_base_units'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'units'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '14', '43', '49']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'total_factor'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'new_units'}; {'id': '13', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '14', 'type': 'for_statement', 'children': ['15', '16', '17']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'units'}; {'id': '17', 'type': 'block', 'children': ['18', '24', '32', '36']}; {'id': '18', 'type': 'if_statement', 'children': ['19', '22']}; {'id': '19', 'type': 'comparison_operator', 'children': ['20', '21'], 'value': 'not in'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'BASE_UNIT_CONVERSIONS'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'continue_statement', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'pattern_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'factor'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'new_unit'}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'BASE_UNIT_CONVERSIONS'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'augmented_assignment', 'children': ['34', '35'], 'value': '*='}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'total_factor'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'factor'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'new_units'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'new_unit'}; {'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': 'new_units'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '48', 'type': 'argument_list', 'children': []}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'expression_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'total_factor'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'new_units'}
|
Convert a set of units into a set of "base" units.
Returns a 2-tuple of `factor, new_units`.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.