sequence
stringlengths 1.16k
23.8k
| docstring
stringlengths 5
7.69k
|
|---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_encode_ids'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '71']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ids'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '14']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21', '50']}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '21', 'type': 'block', 'children': ['22', '38']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'qv'}; {'id': '25', 'type': 'conditional_expression', 'children': ['26', '32', '37'], 'value': 'if'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'unicode'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'ids'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'qv'}; {'id': '50', 'type': 'else_clause', 'children': ['51']}; {'id': '51', 'type': 'block', 'children': ['52', '59']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'qv'}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'ids'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'qv'}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'string', 'children': [], 'value': "';'"}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'ids'}
|
Do url-encode resource ids
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'drain_rois'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '29', '38', '50', '59', '67', '101']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'get_img_data'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'img'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'krn_dim'}; {'id': '32', 'type': 'binary_operator', 'children': ['33', '35'], 'value': '*'}; {'id': '33', 'type': 'list', 'children': ['34'], 'value': '[3]'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'kernel'}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ones'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'krn_dim'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'unique'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '64', 'type': 'comparison_operator', 'children': ['65', '66'], 'value': '!='}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '67', 'type': 'for_statement', 'children': ['68', '69', '70']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'vals'}; {'id': '70', 'type': 'block', 'children': ['71', '77', '87', '93']}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'roi'}; {'id': '74', 'type': 'comparison_operator', 'children': ['75', '76'], 'value': '=='}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'img_data'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'hits'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'scn'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'binary_hit_or_miss'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'roi'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'kernel'}; {'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': 'roi'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'hits'}; {'id': '92', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '100']}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '97', 'type': 'comparison_operator', 'children': ['98', '99'], 'value': '>'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'roi'}; {'id': '99', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '101', 'type': 'return_statement', 'children': ['102']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'out'}
|
Find all the ROIs in img and returns a similar volume with the ROIs
emptied, keeping only their border voxels.
This is useful for DTI tractography.
Parameters
----------
img: img-like object or str
Can either be:
- a file path to a Nifti image
- any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.
If niimg is a string, consider it as a path to Nifti image and
call nibabel.load on it. If it is an object, check if get_data()
and get_affine() methods are present, raise TypeError otherwise.
Returns
-------
np.ndarray
an array of same shape as img_data
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_local_ip'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '23']}; {'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': 'ip'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'ipaddress'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '18'], 'value': '+'}; {'id': '17', 'type': 'string', 'children': [], 'value': "u''"}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ip_address'}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'is_loopback'}; {'id': '23', 'type': 'except_clause', 'children': ['24', '28']}; {'id': '24', 'type': 'as_pattern', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '26', 'type': 'as_pattern_target', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'None', 'children': []}
|
Check if IP is local
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_bibliography'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'lsst_bib_names'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'bibtex'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '20', '40', '60', '66', '102']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'bibtex_data'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get_lsst_bibtex'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'bibtex_filenames'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'lsst_bib_names'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'pybtex_data'}; {'id': '23', 'type': 'list_comprehension', 'children': ['24', '33']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'pybtex'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'database'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'parse_string'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_bibtex'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'bibtex'"}; {'id': '33', 'type': 'for_in_clause', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_bibtex'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'bibtex_data'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '39', 'type': 'argument_list', 'children': []}; {'id': '40', 'type': 'if_statement', 'children': ['41', '44']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'is not'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'bibtex'}; {'id': '43', 'type': 'None', 'children': []}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'pybtex_data'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '57']}; {'id': '52', 'type': 'attribute', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'pybtex'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'database'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'parse_string'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'bibtex'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'bibtex'"}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'bib'}; {'id': '63', 'type': 'subscript', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'pybtex_data'}; {'id': '65', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '66', 'type': 'if_statement', 'children': ['67', '73']}; {'id': '67', 'type': 'comparison_operator', 'children': ['68', '72'], 'value': '>'}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'pybtex_data'}; {'id': '72', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'for_statement', 'children': ['75', '76', '81']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'other_bib'}; {'id': '76', 'type': 'subscript', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'pybtex_data'}; {'id': '78', 'type': 'slice', 'children': ['79', '80']}; {'id': '79', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '80', 'type': 'colon', 'children': []}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'for_statement', 'children': ['83', '86', '93']}; {'id': '83', 'type': 'pattern_list', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '86', 'type': 'call', 'children': ['87', '92']}; {'id': '87', 'type': 'attribute', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'other_bib'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'entries'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '92', 'type': 'argument_list', 'children': []}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'bib'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'add_entry'}; {'id': '99', 'type': 'argument_list', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'entry'}; {'id': '102', 'type': 'return_statement', 'children': ['103']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'bib'}
|
Make a pybtex BibliographyData instance from standard lsst-texmf
bibliography files and user-supplied bibtex content.
Parameters
----------
lsst_bib_names : sequence of `str`, optional
Names of lsst-texmf BibTeX files to include. For example:
.. code-block:: python
['lsst', 'lsst-dm', 'refs', 'books', 'refs_ads']
Default is `None`, which includes all lsst-texmf bibtex files.
bibtex : `str`
BibTeX source content not included in lsst-texmf. This can be content
from a import ``local.bib`` file.
Returns
-------
bibliography : `pybtex.database.BibliographyData`
A pybtex bibliography database that includes all given sources:
lsst-texmf bibliographies and ``bibtex``.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'SETNO'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'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': 'dest'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Operators'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ITEBV'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '21', '26', '27']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'dest'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '25'], 'value': '=='}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'cpu'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'OF'}; {'id': '25', 'type': 'False', 'children': []}; {'id': '26', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}
|
Sets byte if not overflow.
:param cpu: current CPU.
:param dest: destination operand.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__checkMaturity'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '18', '24', '36', '52', '64']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '16']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '13'], 'value': '<'}; {'id': '8', 'type': 'binary_operator', 'children': ['9', '12'], 'value': '+'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_currentRecordIndex'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_MIN_RECORDS_TO_BE_BEST'}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'return_statement', 'children': []}; {'id': '18', 'type': 'if_statement', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_isMature'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'return_statement', 'children': []}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'metric'}; {'id': '27', 'type': 'subscript', 'children': ['28', '33']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_getMetrics'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_optimizedMetricLabel'}; {'id': '36', 'type': 'expression_statement', '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': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_metricRegression'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'addPoint'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '49']}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '_currentRecordIndex'}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'metric'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '57']}; {'id': '54', 'type': 'pattern_list', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'pctChange'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'absPctChange'}; {'id': '57', 'type': 'call', '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': '_metricRegression'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'getPctChanges'}; {'id': '63', 'type': 'argument_list', 'children': []}; {'id': '64', 'type': 'if_statement', 'children': ['65', '74']}; {'id': '65', 'type': 'boolean_operator', 'children': ['66', '69'], 'value': 'and'}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '68'], 'value': 'is not'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'pctChange'}; {'id': '68', 'type': 'None', 'children': []}; {'id': '69', 'type': 'comparison_operator', 'children': ['70', '71'], 'value': '<='}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'absPctChange'}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '_MATURITY_MAX_CHANGE'}; {'id': '74', 'type': 'block', 'children': ['75', '90', '98', '104']}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '82']}; {'id': '77', 'type': 'attribute', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': '_jobsDAO'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'modelSetFields'}; {'id': '82', 'type': 'argument_list', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': '_modelID'}; {'id': '86', 'type': 'dictionary', 'children': ['87']}; {'id': '87', 'type': 'pair', 'children': ['88', '89']}; {'id': '88', 'type': 'string', 'children': [], 'value': "'engMatured'"}; {'id': '89', 'type': 'True', 'children': []}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'assignment', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': '_cmpReason'}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'ClientJobsDAO'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'CMPL_REASON_STOPPED'}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'assignment', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': '_isMature'}; {'id': '103', 'type': 'True', 'children': []}; {'id': '104', 'type': 'expression_statement', 'children': ['105']}; {'id': '105', 'type': 'call', 'children': ['106', '111']}; {'id': '106', 'type': 'attribute', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '111', 'type': 'argument_list', 'children': ['112', '116', '119', '120', '123']}; {'id': '112', 'type': 'concatenated_string', 'children': ['113', '114', '115']}; {'id': '113', 'type': 'string', 'children': [], 'value': '"Model %d has matured (pctChange=%s, n=%d). \\n"'}; {'id': '114', 'type': 'string', 'children': [], 'value': '"Scores = %s\\n"'}; {'id': '115', 'type': 'string', 'children': [], 'value': '"Stopping execution"'}; {'id': '116', 'type': 'attribute', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': '_modelID'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'pctChange'}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': '_MATURITY_NUM_POINTS'}; {'id': '123', 'type': 'attribute', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': '_metricRegression'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': '_window'}
|
Save the current metric value and see if the model's performance has
'leveled off.' We do this by looking at some number of previous number of
recordings
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_requirements_alt'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '6', 'type': 'string', 'children': [], 'value': "'requirements.txt'"}; {'id': '7', 'type': 'block', 'children': ['8', '11', '21', '32', '74']}; {'id': '8', 'type': 'import_statement', 'children': ['9']}; {'id': '9', 'type': 'dotted_name', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'requirements'}; {'id': '11', 'type': 'import_from_statement', 'children': ['12', '15', '17', '19']}; {'id': '12', 'type': 'dotted_name', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '15', 'type': 'dotted_name', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '17', 'type': 'dotted_name', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '19', 'type': 'dotted_name', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'require_fpath'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '31']}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': '__file__'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '32', 'type': 'if_statement', 'children': ['33', '37']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'require_fpath'}; {'id': '37', 'type': 'block', 'children': ['38', '62', '72']}; {'id': '38', 'type': 'with_statement', 'children': ['39', '49']}; {'id': '39', 'type': 'with_clause', 'children': ['40']}; {'id': '40', 'type': 'with_item', 'children': ['41']}; {'id': '41', 'type': 'as_pattern', 'children': ['42', '47']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'require_fpath'}; {'id': '46', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '47', 'type': 'as_pattern_target', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'requires'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'requirements'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '65', 'type': 'list_comprehension', 'children': ['66', '69']}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '69', 'type': 'for_in_clause', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'requires'}; {'id': '72', 'type': 'return_statement', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'packages'}; {'id': '74', 'type': 'return_statement', 'children': ['75']}; {'id': '75', 'type': 'list', 'children': [], 'value': '[]'}
|
pip install requirements-parser
fname='requirements.txt'
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mfbe'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'binary_operator', 'children': ['9', '16'], 'value': '/'}; {'id': '9', 'type': 'binary_operator', 'children': ['10', '11'], 'value': '*'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'bias'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '16', 'type': '()', 'children': ['17']}; {'id': '17', 'type': 'binary_operator', 'children': ['18', '23'], 'value': '+'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'mean'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'mean'}; {'id': '27', 'type': 'argument_list', 'children': []}
|
Returns the mean fractionalized bias error
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dist_mlipns'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'threshold'}; {'id': '8', 'type': 'float', 'children': [], 'value': '0.25'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'max_mismatches'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '2'}; {'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': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'MLIPNS'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'dist'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '23', '24']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'threshold'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'max_mismatches'}
|
Return the MLIPNS distance between two strings.
This is a wrapper for :py:meth:`MLIPNS.dist`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
A number [0, 1] indicating the maximum similarity score, below which
the strings are considered 'similar' (0.25 by default)
max_mismatches : int
A number indicating the allowable number of mismatches to remove before
declaring two strings not similar (2 by default)
Returns
-------
float
MLIPNS distance
Examples
--------
>>> dist_mlipns('cat', 'hat')
0.0
>>> dist_mlipns('Niall', 'Neil')
1.0
>>> dist_mlipns('aluminum', 'Catalan')
1.0
>>> dist_mlipns('ATCG', 'TAGC')
1.0
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'argsort'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'indexable'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '10', 'type': 'False', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '54', '104']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '20', '37']}; {'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': 'indexable'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'collections_abc'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'Mapping'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'vk_iter'}; {'id': '24', 'type': 'generator_expression', 'children': ['25', '28']}; {'id': '25', 'type': 'tuple', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '28', 'type': 'for_in_clause', 'children': ['29', '32']}; {'id': '29', 'type': 'pattern_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'indexable'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'else_clause', 'children': ['38']}; {'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': 'vk_iter'}; {'id': '42', 'type': 'generator_expression', 'children': ['43', '46']}; {'id': '43', 'type': 'tuple', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '46', 'type': 'for_in_clause', 'children': ['47', '50']}; {'id': '47', 'type': 'pattern_list', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'indexable'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '58', '75']}; {'id': '55', 'type': 'comparison_operator', 'children': ['56', '57'], 'value': 'is'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '57', 'type': 'None', 'children': []}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'indices'}; {'id': '62', 'type': 'list_comprehension', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '64', 'type': 'for_in_clause', 'children': ['65', '68']}; {'id': '65', 'type': 'pattern_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '70', 'type': 'argument_list', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'vk_iter'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '75', 'type': 'else_clause', 'children': ['76']}; {'id': '76', 'type': 'block', 'children': ['77']}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'indices'}; {'id': '80', 'type': 'list_comprehension', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '82', 'type': 'for_in_clause', 'children': ['83', '86']}; {'id': '83', 'type': 'pattern_list', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '86', 'type': 'call', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '88', 'type': 'argument_list', 'children': ['89', '90', '101']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'vk_iter'}; {'id': '90', 'type': 'keyword_argument', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '92', 'type': 'lambda', 'children': ['93', '95']}; {'id': '93', 'type': 'lambda_parameters', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'vk'}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'subscript', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'vk'}; {'id': '100', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '101', 'type': 'keyword_argument', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '104', 'type': 'return_statement', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'indices'}
|
Returns the indices that would sort a indexable object.
This is similar to `numpy.argsort`, but it is written in pure python and
works on both lists and dictionaries.
Args:
indexable (Iterable or Mapping): indexable to sort by
key (Callable, optional): customizes the ordering of the indexable
reverse (bool, optional): if True returns in descending order
Returns:
list: indices: list of indices such that sorts the indexable
Example:
>>> import ubelt as ub
>>> # argsort works on dicts by returning keys
>>> dict_ = {'a': 3, 'b': 2, 'c': 100}
>>> indices = ub.argsort(dict_)
>>> assert list(ub.take(dict_, indices)) == sorted(dict_.values())
>>> # argsort works on lists by returning indices
>>> indexable = [100, 2, 432, 10]
>>> indices = ub.argsort(indexable)
>>> assert list(ub.take(indexable, indices)) == sorted(indexable)
>>> # Can use iterators, but be careful. It exhausts them.
>>> indexable = reversed(range(100))
>>> indices = ub.argsort(indexable)
>>> assert indices[0] == 99
>>> # Can use key just like sorted
>>> indexable = [[0, 1, 2], [3, 4], [5]]
>>> indices = ub.argsort(indexable, key=len)
>>> assert indices == [2, 1, 0]
>>> # Can use reverse just like sorted
>>> indexable = [0, 2, 1]
>>> indices = ub.argsort(indexable, reverse=True)
>>> assert indices == [1, 2, 0]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'activatewindow'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '23']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'window_handle'}; {'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_window_handle'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_grabfocus'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'window_handle'}; {'id': '23', 'type': 'return_statement', 'children': ['24']}; {'id': '24', 'type': 'integer', 'children': [], 'value': '1'}
|
Activate window.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@return: 1 on success.
@rtype: integer
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_configure_io_handler'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '49', '57', '90', '102', '120', '124', '153', '186']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'call', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'check_events'}; {'id': '12', 'type': 'argument_list', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'return_statement', 'children': []}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21', '39']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '18'], 'value': 'in'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_unprepared_handlers'}; {'id': '21', 'type': 'block', 'children': ['22', '30']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'old_fileno'}; {'id': '25', 'type': 'subscript', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_unprepared_handlers'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'prepared'}; {'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': '_prepare_io_handler'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41', '45']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'old_fileno'}; {'id': '44', 'type': 'None', 'children': []}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'prepared'}; {'id': '48', 'type': 'True', 'children': []}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '56', 'type': 'argument_list', 'children': []}; {'id': '57', 'type': 'if_statement', 'children': ['58', '65']}; {'id': '58', 'type': 'boolean_operator', 'children': ['59', '62'], 'value': 'and'}; {'id': '59', 'type': 'comparison_operator', 'children': ['60', '61'], 'value': 'is not'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'old_fileno'}; {'id': '61', 'type': 'None', 'children': []}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '64'], 'value': '!='}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'old_fileno'}; {'id': '65', 'type': 'block', 'children': ['66', '78']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '69', 'type': 'call', 'children': ['70', '75']}; {'id': '70', 'type': 'attribute', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '_io_sources'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '75', 'type': 'argument_list', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '77', 'type': 'None', 'children': []}; {'id': '78', 'type': 'if_statement', 'children': ['79', '82']}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': 'is not'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '81', 'type': 'None', 'children': []}; {'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': 'glib'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'source_remove'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '90', 'type': 'if_statement', 'children': ['91', '93']}; {'id': '91', 'type': 'not_operator', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'prepared'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '101']}; {'id': '96', 'type': 'subscript', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': '_unprepared_handlers'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '102', 'type': 'if_statement', 'children': ['103', '106']}; {'id': '103', 'type': 'comparison_operator', 'children': ['104', '105'], 'value': 'is'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '105', 'type': 'None', 'children': []}; {'id': '106', 'type': 'block', 'children': ['107', '119']}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'call', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'string', 'children': [], 'value': '" {0!r}.fileno() is None, not polling"'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '119', 'type': 'return_statement', 'children': []}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '123', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '124', 'type': 'if_statement', 'children': ['125', '130']}; {'id': '125', 'type': 'call', 'children': ['126', '129']}; {'id': '126', 'type': 'attribute', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'is_readable'}; {'id': '129', 'type': 'argument_list', 'children': []}; {'id': '130', 'type': 'block', 'children': ['131', '143']}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'call', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '136', 'type': 'argument_list', 'children': ['137']}; {'id': '137', 'type': 'call', 'children': ['138', '141']}; {'id': '138', 'type': 'attribute', 'children': ['139', '140']}; {'id': '139', 'type': 'string', 'children': [], 'value': '" {0!r} readable"'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '141', 'type': 'argument_list', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '143', 'type': 'expression_statement', 'children': ['144']}; {'id': '144', 'type': 'augmented_assignment', 'children': ['145', '146'], 'value': '|='}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '146', 'type': 'binary_operator', 'children': ['147', '150'], 'value': '|'}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'IO_IN'}; {'id': '150', 'type': 'attribute', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'IO_ERR'}; {'id': '153', 'type': 'if_statement', 'children': ['154', '159']}; {'id': '154', 'type': 'call', 'children': ['155', '158']}; {'id': '155', 'type': 'attribute', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'is_writable'}; {'id': '158', 'type': 'argument_list', 'children': []}; {'id': '159', 'type': 'block', 'children': ['160', '172']}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'call', 'children': ['162', '165']}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '165', 'type': 'argument_list', 'children': ['166']}; {'id': '166', 'type': 'call', 'children': ['167', '170']}; {'id': '167', 'type': 'attribute', 'children': ['168', '169']}; {'id': '168', 'type': 'string', 'children': [], 'value': '" {0!r} writable"'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '170', 'type': 'argument_list', 'children': ['171']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '172', 'type': 'expression_statement', 'children': ['173']}; {'id': '173', 'type': 'augmented_assignment', 'children': ['174', '175'], 'value': '|='}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '175', 'type': 'binary_operator', 'children': ['176', '183'], 'value': '|'}; {'id': '176', 'type': 'binary_operator', 'children': ['177', '180'], 'value': '|'}; {'id': '177', 'type': 'attribute', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'IO_OUT'}; {'id': '180', 'type': 'attribute', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'IO_HUP'}; {'id': '183', 'type': 'attribute', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'IO_ERR'}; {'id': '186', 'type': 'if_statement', 'children': ['187', '188']}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '188', 'type': 'block', 'children': ['189', '205']}; {'id': '189', 'type': 'expression_statement', 'children': ['190']}; {'id': '190', 'type': 'call', 'children': ['191', '194']}; {'id': '191', 'type': 'attribute', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '194', 'type': 'argument_list', 'children': ['195']}; {'id': '195', 'type': 'call', 'children': ['196', '201']}; {'id': '196', 'type': 'attribute', 'children': ['197', '200']}; {'id': '197', 'type': 'concatenated_string', 'children': ['198', '199']}; {'id': '198', 'type': 'string', 'children': [], 'value': '" registering {0!r} handler fileno {1} for"'}; {'id': '199', 'type': 'string', 'children': [], 'value': '" events {2}"'}; {'id': '200', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '201', 'type': 'argument_list', 'children': ['202', '203', '204']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '205', 'type': 'expression_statement', 'children': ['206']}; {'id': '206', 'type': 'call', 'children': ['207', '210']}; {'id': '207', 'type': 'attribute', 'children': ['208', '209']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'glib'}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'io_add_watch'}; {'id': '210', 'type': 'argument_list', 'children': ['211', '212', '213', '216']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'fileno'}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'events'}; {'id': '213', 'type': 'attribute', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '215', 'type': 'identifier', 'children': [], 'value': '_io_callback'}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'handler'}
|
Register an io-handler with the glib main loop.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_predict'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'seen'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'looked_ahead'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '12', 'type': 'block', 'children': ['13', '21', '36', '51', '76']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '19']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_is_finished'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'return_statement', 'children': []}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25', '30']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': 'is'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'seen'}; {'id': '24', 'type': 'None', 'children': []}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'seen'}; {'id': '29', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '30', 'type': 'elif_clause', 'children': ['31', '34']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': 'in'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'seen'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'return_statement', 'children': []}; {'id': '36', 'type': 'if_statement', 'children': ['37', '43']}; {'id': '37', 'type': 'not_operator', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_is_finished'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '_predict_hook'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '51', 'type': 'if_statement', 'children': ['52', '58']}; {'id': '52', 'type': 'not_operator', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': '_is_definite'}; {'id': '57', 'type': 'argument_list', 'children': []}; {'id': '58', 'type': 'block', 'children': ['59', '69']}; {'id': '59', 'type': 'if_statement', 'children': ['60', '67']}; {'id': '60', 'type': 'comparison_operator', 'children': ['61', '64'], 'value': '>='}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '+'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'looked_ahead'}; {'id': '63', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'lookahead'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'return_statement', 'children': []}; {'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': 'seen'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'for_statement', 'children': ['77', '78', '81']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'my_task'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'children'}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'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': 'child'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'task_spec'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': '_predict'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91', '95']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'child'}; {'id': '91', 'type': 'subscript', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'seen'}; {'id': '93', 'type': 'slice', 'children': ['94']}; {'id': '94', 'type': 'colon', 'children': []}; {'id': '95', 'type': 'binary_operator', 'children': ['96', '97'], 'value': '+'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'looked_ahead'}; {'id': '97', 'type': 'integer', 'children': [], 'value': '1'}
|
Updates the branch such that all possible future routes are added.
Should NOT be overwritten! Instead, overwrite _predict_hook().
:type my_task: Task
:param my_task: The associated task in the task tree.
:type seen: list[taskspec]
:param seen: A list of already visited tasks.
:type looked_ahead: integer
:param looked_ahead: The depth of the predicted path so far.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shapely_formatter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'vertices'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '14', '263']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '13', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '14', 'type': 'if_statement', 'children': ['15', '18', '88']}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '17'], 'value': 'is'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '17', 'type': 'None', 'children': []}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'for_statement', 'children': ['20', '21', '22']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'vertices'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'if_statement', 'children': ['24', '41', '76']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'comparison_operator', 'children': ['30', '35'], 'value': '=='}; {'id': '30', 'type': 'subscript', 'children': ['31', '32', '33']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'slice', 'children': ['34']}; {'id': '34', 'type': 'colon', 'children': []}; {'id': '35', 'type': 'subscript', 'children': ['36', '37', '39']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '37', 'type': 'unary_operator', 'children': ['38'], 'value': '-'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'slice', 'children': ['40']}; {'id': '40', 'type': 'colon', 'children': []}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'if_statement', 'children': ['43', '49', '64']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '48'], 'value': '<'}; {'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': 'vertices'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '3'}; {'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': 'elements'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'Point'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'subscript', 'children': ['60', '61', '62']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'slice', 'children': ['63']}; {'id': '63', 'type': 'colon', 'children': []}; {'id': '64', 'type': 'else_clause', 'children': ['65']}; {'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': 'elements'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'LinearRing'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '76', 'type': 'else_clause', 'children': ['77']}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'LineString'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '88', 'type': 'else_clause', 'children': ['89']}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'for_statement', 'children': ['91', '94', '99']}; {'id': '91', 'type': 'pattern_list', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'codes_'}; {'id': '94', 'type': 'call', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '96', 'type': 'argument_list', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'vertices'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '99', 'type': 'block', 'children': ['100', '115', '130']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'starts'}; {'id': '103', 'type': 'subscript', 'children': ['104', '114']}; {'id': '104', 'type': 'call', 'children': ['105', '108']}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'nonzero'}; {'id': '108', 'type': 'argument_list', 'children': ['109']}; {'id': '109', 'type': 'comparison_operator', 'children': ['110', '111'], 'value': '=='}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'codes_'}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'MPLPATHCODE'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'MOVETO'}; {'id': '114', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'assignment', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'stops'}; {'id': '118', 'type': 'subscript', 'children': ['119', '129']}; {'id': '119', 'type': 'call', 'children': ['120', '123']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'nonzero'}; {'id': '123', 'type': 'argument_list', 'children': ['124']}; {'id': '124', 'type': 'comparison_operator', 'children': ['125', '126'], 'value': '=='}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'codes_'}; {'id': '126', 'type': 'attribute', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'MPLPATHCODE'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'CLOSEPOLY'}; {'id': '129', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '130', 'type': 'try_statement', 'children': ['131', '175']}; {'id': '131', 'type': 'block', 'children': ['132', '158']}; {'id': '132', 'type': 'expression_statement', 'children': ['133']}; {'id': '133', 'type': 'assignment', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '135', 'type': 'list_comprehension', 'children': ['136', '149']}; {'id': '136', 'type': 'call', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'LinearRing'}; {'id': '138', 'type': 'argument_list', 'children': ['139']}; {'id': '139', 'type': 'subscript', 'children': ['140', '141', '147']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '141', 'type': 'slice', 'children': ['142', '143', '144']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '143', 'type': 'colon', 'children': []}; {'id': '144', 'type': 'binary_operator', 'children': ['145', '146'], 'value': '+'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '146', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '147', 'type': 'slice', 'children': ['148']}; {'id': '148', 'type': 'colon', 'children': []}; {'id': '149', 'type': 'for_in_clause', 'children': ['150', '153']}; {'id': '150', 'type': 'pattern_list', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '153', 'type': 'call', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '155', 'type': 'argument_list', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'starts'}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'stops'}; {'id': '158', 'type': 'expression_statement', 'children': ['159']}; {'id': '159', 'type': 'call', 'children': ['160', '163']}; {'id': '160', 'type': 'attribute', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'Polygon'}; {'id': '166', 'type': 'argument_list', 'children': ['167', '170']}; {'id': '167', 'type': 'subscript', 'children': ['168', '169']}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '169', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '170', 'type': 'subscript', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '172', 'type': 'slice', 'children': ['173', '174']}; {'id': '173', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '174', 'type': 'colon', 'children': []}; {'id': '175', 'type': 'except_clause', 'children': ['176', '180']}; {'id': '176', 'type': 'as_pattern', 'children': ['177', '178']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '178', 'type': 'as_pattern_target', 'children': ['179']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '180', 'type': 'block', 'children': ['181']}; {'id': '181', 'type': 'if_statement', 'children': ['182', '194', '258']}; {'id': '182', 'type': 'call', 'children': ['183', '186']}; {'id': '183', 'type': 'attribute', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'any'}; {'id': '186', 'type': 'argument_list', 'children': ['187']}; {'id': '187', 'type': 'comparison_operator', 'children': ['188', '193'], 'value': '=='}; {'id': '188', 'type': 'binary_operator', 'children': ['189', '192'], 'value': '-'}; {'id': '189', 'type': 'binary_operator', 'children': ['190', '191'], 'value': '-'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '192', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '193', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '194', 'type': 'block', 'children': ['195']}; {'id': '195', 'type': 'if_statement', 'children': ['196', '205', '207']}; {'id': '196', 'type': 'comparison_operator', 'children': ['197', '200'], 'value': '<'}; {'id': '197', 'type': 'subscript', 'children': ['198', '199']}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'stops'}; {'id': '199', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '200', 'type': 'binary_operator', 'children': ['201', '204'], 'value': '+'}; {'id': '201', 'type': 'subscript', 'children': ['202', '203']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'starts'}; {'id': '203', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '204', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '205', 'type': 'block', 'children': ['206']}; {'id': '206', 'type': 'pass_statement', 'children': []}; {'id': '207', 'type': 'else_clause', 'children': ['208']}; {'id': '208', 'type': 'block', 'children': ['209', '241']}; {'id': '209', 'type': 'expression_statement', 'children': ['210']}; {'id': '210', 'type': 'assignment', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '212', 'type': 'list_comprehension', 'children': ['213', '226', '235']}; {'id': '213', 'type': 'call', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'LinearRing'}; {'id': '215', 'type': 'argument_list', 'children': ['216']}; {'id': '216', 'type': 'subscript', 'children': ['217', '218', '224']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'vertices_'}; {'id': '218', 'type': 'slice', 'children': ['219', '220', '221']}; {'id': '219', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '220', 'type': 'colon', 'children': []}; {'id': '221', 'type': 'binary_operator', 'children': ['222', '223'], 'value': '+'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '223', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '224', 'type': 'slice', 'children': ['225']}; {'id': '225', 'type': 'colon', 'children': []}; {'id': '226', 'type': 'for_in_clause', 'children': ['227', '230']}; {'id': '227', 'type': 'pattern_list', 'children': ['228', '229']}; {'id': '228', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '230', 'type': 'call', 'children': ['231', '232']}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '232', 'type': 'argument_list', 'children': ['233', '234']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'starts'}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'stops'}; {'id': '235', 'type': 'if_clause', 'children': ['236']}; {'id': '236', 'type': 'comparison_operator', 'children': ['237', '238'], 'value': '>='}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '238', 'type': 'binary_operator', 'children': ['239', '240'], 'value': '+'}; {'id': '239', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '240', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '241', 'type': 'expression_statement', 'children': ['242']}; {'id': '242', 'type': 'call', 'children': ['243', '246']}; {'id': '243', 'type': 'attribute', 'children': ['244', '245']}; {'id': '244', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '246', 'type': 'argument_list', 'children': ['247']}; {'id': '247', 'type': 'call', 'children': ['248', '249']}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'Polygon'}; {'id': '249', 'type': 'argument_list', 'children': ['250', '253']}; {'id': '250', 'type': 'subscript', 'children': ['251', '252']}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '252', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '253', 'type': 'subscript', 'children': ['254', '255']}; {'id': '254', 'type': 'identifier', 'children': [], 'value': 'rings'}; {'id': '255', 'type': 'slice', 'children': ['256', '257']}; {'id': '256', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '257', 'type': 'colon', 'children': []}; {'id': '258', 'type': 'else_clause', 'children': ['259']}; {'id': '259', 'type': 'block', 'children': ['260']}; {'id': '260', 'type': 'raise_statement', 'children': ['261']}; {'id': '261', 'type': '()', 'children': ['262']}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '263', 'type': 'return_statement', 'children': ['264']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'elements'}
|
`Shapely`_ style contour formatter.
Contours are returned as a list of :class:`shapely.geometry.LineString`,
:class:`shapely.geometry.LinearRing`, and :class:`shapely.geometry.Point`
geometry elements.
Filled contours return a list of :class:`shapely.geometry.Polygon`
elements instead.
.. note:: If possible, `Shapely speedups`_ will be enabled.
.. _Shapely: http://toblerity.org/shapely/manual.html
.. _Shapely speedups: http://toblerity.org/shapely/manual.html#performance
See Also
--------
`descartes <https://bitbucket.org/sgillies/descartes/>`_ : Use `Shapely`_
or GeoJSON-like geometric objects as matplotlib paths and patches.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'assert_operations'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'list_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '21']}; {'id': '9', 'type': 'not_operator', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '17']}; {'id': '11', 'type': 'attribute', 'children': ['12', '16']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'issubset'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'allowed_operations'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'raise_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'http'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'Forbidden'}; {'id': '29', 'type': 'argument_list', 'children': []}
|
Assets if the requested operations are allowed in this context.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_transaction_end'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '31']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '13']}; {'id': '8', 'type': 'attribute', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_command'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'string', 'children': [], 'value': "'\\x87'"}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '22']}; {'id': '17', 'type': 'attribute', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_ft232h'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_write'}; {'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': "''"}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': '_command'}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'bytearray'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '41']}; {'id': '36', 'type': 'attribute', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': '_ft232h'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_poll_read'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': '_expected'}
|
End I2C transaction and get response bytes, including ACKs.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'album'}; {'id': '6', 'type': 'block', 'children': ['7', '24', '40']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'page'}; {'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': 'template'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'render'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'dictionary_splat', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'generate_context'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'album'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'output_file'}; {'id': '27', 'type': 'call', 'children': ['28', '33']}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'album'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'dst_path'}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'album'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'output_file'}; {'id': '40', 'type': 'with_statement', 'children': ['41', '54']}; {'id': '41', 'type': 'with_clause', 'children': ['42']}; {'id': '42', 'type': 'with_item', 'children': ['43']}; {'id': '43', 'type': 'as_pattern', 'children': ['44', '52']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'output_file'}; {'id': '48', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '51', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '52', 'type': 'as_pattern_target', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'page'}
|
Generate the HTML page and save it.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_group_conversation_url'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'get_group_conversation_url_request'}; {'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': 'response'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'hangouts_pb2'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'GetGroupConversationUrlResponse'}; {'id': '14', 'type': 'argument_list', 'children': []}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'await', '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': '_pb_request'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23', '24']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'conversations/getgroupconversationurl'"}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'get_group_conversation_url_request'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '25', 'type': 'return_statement', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'response'}
|
Get URL to allow others to join a group conversation.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'api_subclass_factory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'docstring'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'remove_methods'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'SlackApi'}; {'id': '10', 'type': 'block', 'children': ['11', '20', '51']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'methods'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'deepcopy'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'API_METHODS'}; {'id': '20', 'type': 'for_statement', 'children': ['21', '24', '29']}; {'id': '21', 'type': 'pattern_list', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'to_remove'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'remove_methods'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '34', '39']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': 'is'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'to_remove'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ALL'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'delete_statement', 'children': ['36']}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'methods'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '39', 'type': 'else_clause', 'children': ['40']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'for_statement', 'children': ['42', '43', '44']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'to_remove'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'delete_statement', 'children': ['46']}; {'id': '46', 'type': 'subscript', 'children': ['47', '50']}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'methods'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '54', 'type': 'argument_list', 'children': ['55', '56', '58']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '56', 'type': 'tuple', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '64']}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'API_METHODS'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'methods'}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '__doc__'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'docstring'}
|
Create an API subclass with fewer methods than its base class.
Arguments:
name (:py:class:`str`): The name of the new class.
docstring (:py:class:`str`): The docstring for the new class.
remove_methods (:py:class:`dict`): The methods to remove from
the base class's :py:attr:`API_METHODS` for the subclass. The
key is the name of the root method (e.g. ``'auth'`` for
``'auth.test'``, the value is either a tuple of child method
names (e.g. ``('test',)``) or, if all children should be
removed, the special value :py:const:`ALL`.
base (:py:class:`type`, optional): The base class (defaults to
:py:class:`SlackApi`).
Returns:
:py:class:`type`: The new subclass.
Raises:
:py:class:`KeyError`: If the method wasn't in the superclass.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_operand'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'buf'}; {'id': '6', 'type': 'block', 'children': ['7', '14']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'buf'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'buf'}; {'id': '14', 'type': 'try_statement', 'children': ['15', '46']}; {'id': '15', 'type': 'block', 'children': ['16', '20', '40']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'operand'}; {'id': '19', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '20', 'type': 'for_statement', 'children': ['21', '22', '28']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'operand_size'}; {'id': '28', 'type': 'block', 'children': ['29', '33']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'augmented_assignment', 'children': ['31', '32'], 'value': '<<='}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'operand'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'augmented_assignment', 'children': ['35', '36'], 'value': '|='}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'operand'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'buf'}; {'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': '_operand'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'operand'}; {'id': '46', 'type': 'except_clause', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'StopIteration'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'raise_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'ParseError'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'string', 'children': [], 'value': '"Not enough data for decoding"'}
|
Parses an operand from buf
:param buf: a buffer
:type buf: iterator/generator/string
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'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': 'value'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '38', '45', '81']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '17', '28']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': 'is'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '21', 'type': 'subscript', 'children': ['22', '27']}; {'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': '_firstConfig'}; {'id': '26', 'type': 'argument_list', 'children': []}; {'id': '27', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '28', 'type': 'else_clause', 'children': ['29']}; {'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': 'config'}; {'id': '33', 'type': 'subscript', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'configs'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_splitPath'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '45', 'type': 'for_statement', 'children': ['46', '47', '53']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '49', 'type': 'slice', 'children': ['50', '51']}; {'id': '50', 'type': 'colon', 'children': []}; {'id': '51', 'type': 'unary_operator', 'children': ['52'], 'value': '-'}; {'id': '52', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'if_statement', 'children': ['55', '58', '65']}; {'id': '55', 'type': 'comparison_operator', 'children': ['56', '57'], 'value': 'in'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '62', 'type': 'subscript', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '65', 'type': 'else_clause', 'children': ['66']}; {'id': '66', 'type': 'block', 'children': ['67', '75']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '72']}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'OrderedDict'}; {'id': '74', 'type': 'argument_list', 'children': []}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '78', 'type': 'subscript', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '89']}; {'id': '83', 'type': 'subscript', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '85', 'type': 'subscript', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '87', 'type': 'unary_operator', 'children': ['88'], 'value': '-'}; {'id': '88', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'value'}
|
Set a configuration value. If no filename is specified, the
property is set in the first configuration file. Note that if a
filename is specified and the property path is present in an
earlier filename then set property will be hidden.
usage:
set('section.property', value='somevalue')
Note that currently array indexes are not supported. You must
set the whole array.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fetch_course_organizations'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'course_key'}; {'id': '5', 'type': 'block', 'children': ['6', '32']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'queryset'}; {'id': '9', 'type': 'call', 'children': ['10', '30']}; {'id': '10', 'type': 'attribute', 'children': ['11', '29']}; {'id': '11', 'type': 'call', 'children': ['12', '19']}; {'id': '12', 'type': 'attribute', 'children': ['13', '18']}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'internal'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'OrganizationCourse'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '26']}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'course_id'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'text_type'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'course_key'}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'active'}; {'id': '28', 'type': 'True', 'children': []}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'select_related'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'organization'"}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'list_comprehension', 'children': ['34', '40']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'serializers'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'serialize_organization_with_course'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'organization'}; {'id': '40', 'type': 'for_in_clause', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'organization'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'queryset'}
|
Retrieves the organizations linked to the specified course
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_review'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '6', 'type': 'block', 'children': ['7', '20', '29']}; {'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': 'out'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14', '16', '19']}; {'id': '13', 'type': 'string', 'children': [], 'value': "'\n write_value('"}; {'id': '14', 'type': 'ERROR', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'Reviewer'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'reviewer'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'write_value'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25', '28']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'ReviewDate'"}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'review_date_iso_format'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '29', 'type': 'if_statement', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'has_comment'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'write_text_value'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39', '42']}; {'id': '38', 'type': 'string', 'children': [], 'value': "'ReviewComment'"}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'review'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'out'}
|
Write the fields of a single review to out.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_delete_transmissions'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item_ids'}; {'id': '6', 'type': 'block', 'children': ['7', '17']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ContentMetadataItemTransmission'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'apps'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'get_model'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'string', 'children': [], 'value': "'integrated_channel'"}; {'id': '16', 'type': 'string', 'children': [], 'value': "'ContentMetadataItemTransmission'"}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '47']}; {'id': '19', 'type': 'attribute', 'children': ['20', '46']}; {'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': 'ContentMetadataItemTransmission'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '34', '43']}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'enterprise_configuration'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'integrated_channel_code'}; {'id': '36', 'type': 'call', 'children': ['37', '42']}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'enterprise_configuration'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'channel_code'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'keyword_argument', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'content_id__in'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item_ids'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '47', 'type': 'argument_list', 'children': []}
|
Delete ContentMetadataItemTransmision models associated with the given content metadata items.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_config'}; {'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': 'initialize_indices'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '31', '54']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '21']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'config_dir'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'mkdir'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'config_dir'}; {'id': '31', 'type': 'with_statement', 'children': ['32', '44']}; {'id': '32', 'type': 'with_clause', 'children': ['33']}; {'id': '33', 'type': 'with_item', 'children': ['34']}; {'id': '34', 'type': 'as_pattern', 'children': ['35', '42']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'config_file'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '42', 'type': 'as_pattern_target', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'configfile'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'configfile'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'initialize_indices'}; {'id': '56', 'type': 'block', 'children': ['57', '67', '82', '88', '93', '107', '121', '135', '149', '163']}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '64', 'type': 'argument_list', 'children': ['65', '66']}; {'id': '65', 'type': 'string', 'children': [], 'value': "'jackal'"}; {'id': '66', 'type': 'string', 'children': [], 'value': "'index'"}; {'id': '67', 'type': 'import_from_statement', 'children': ['68', '70', '72', '74', '76', '78', '80']}; {'id': '68', 'type': 'dotted_name', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'jackal'}; {'id': '70', 'type': 'dotted_name', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'Host'}; {'id': '72', 'type': 'dotted_name', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'Range'}; {'id': '74', 'type': 'dotted_name', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'Service'}; {'id': '76', 'type': 'dotted_name', 'children': ['77']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'User'}; {'id': '78', 'type': 'dotted_name', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'Credential'}; {'id': '80', 'type': 'dotted_name', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'Log'}; {'id': '82', 'type': 'import_from_statement', 'children': ['83', '86']}; {'id': '83', 'type': 'dotted_name', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'jackal'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'core'}; {'id': '86', 'type': 'dotted_name', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'create_connection'}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'call', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'create_connection'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'Host'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'keyword_argument', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '101', 'type': 'call', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'string', 'children': [], 'value': '"{}-hosts"'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'Range'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '115', 'type': 'call', 'children': ['116', '119']}; {'id': '116', 'type': 'attribute', 'children': ['117', '118']}; {'id': '117', 'type': 'string', 'children': [], 'value': '"{}-ranges"'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'call', 'children': ['123', '126']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'Service'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '126', 'type': 'argument_list', 'children': ['127']}; {'id': '127', 'type': 'keyword_argument', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '129', 'type': 'call', 'children': ['130', '133']}; {'id': '130', 'type': 'attribute', 'children': ['131', '132']}; {'id': '131', 'type': 'string', 'children': [], 'value': '"{}-services"'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '135', 'type': 'expression_statement', 'children': ['136']}; {'id': '136', 'type': 'call', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'User'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '140', 'type': 'argument_list', 'children': ['141']}; {'id': '141', 'type': 'keyword_argument', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '143', 'type': 'call', 'children': ['144', '147']}; {'id': '144', 'type': 'attribute', 'children': ['145', '146']}; {'id': '145', 'type': 'string', 'children': [], 'value': '"{}-users"'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '147', 'type': 'argument_list', 'children': ['148']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '149', 'type': 'expression_statement', 'children': ['150']}; {'id': '150', 'type': 'call', 'children': ['151', '154']}; {'id': '151', 'type': 'attribute', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'Credential'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '154', 'type': 'argument_list', 'children': ['155']}; {'id': '155', 'type': 'keyword_argument', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '157', 'type': 'call', 'children': ['158', '161']}; {'id': '158', 'type': 'attribute', 'children': ['159', '160']}; {'id': '159', 'type': 'string', 'children': [], 'value': '"{}-creds"'}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '161', 'type': 'argument_list', 'children': ['162']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '163', 'type': 'expression_statement', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'Log'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'init'}; {'id': '168', 'type': 'argument_list', 'children': ['169']}; {'id': '169', 'type': 'keyword_argument', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '171', 'type': 'call', 'children': ['172', '175']}; {'id': '172', 'type': 'attribute', 'children': ['173', '174']}; {'id': '173', 'type': 'string', 'children': [], 'value': '"{}-log"'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '175', 'type': 'argument_list', 'children': ['176']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'index'}
|
Write the current config to disk to store them.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_geoip'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '25']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'reader'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'geolite2'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'reader'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ip_data'}; {'id': '17', 'type': 'boolean_operator', 'children': ['18', '24'], 'value': 'or'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'reader'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ip'}; {'id': '24', 'type': 'dictionary', 'children': []}; {'id': '25', 'type': 'return_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '36']}; {'id': '27', 'type': 'attribute', 'children': ['28', '35']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'ip_data'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'string', 'children': [], 'value': "'country'"}; {'id': '34', 'type': 'dictionary', 'children': []}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'iso_code'"}
|
Lookup country for IP address.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'elliptical_annular'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '18']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'pixel_scale'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'inner_major_axis_radius_arcsec'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'inner_axis_ratio'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'inner_phi'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'outer_major_axis_radius_arcsec'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'outer_axis_ratio'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'outer_phi'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'centre'}; {'id': '15', 'type': 'tuple', 'children': ['16', '17']}; {'id': '16', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '17', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'invert'}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'block', 'children': ['22', '39', '51']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'mask_util'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'mask_elliptical_annular_from_shape_pixel_scale_and_radius'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31', '32', '33', '34', '35', '36', '37', '38']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'pixel_scale'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'inner_major_axis_radius_arcsec'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'inner_axis_ratio'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'inner_phi'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'outer_major_axis_radius_arcsec'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'outer_axis_ratio'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'outer_phi'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'centre'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'invert'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'invert'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '54', 'type': 'argument_list', 'children': ['55', '63']}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'astype'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'string', 'children': [], 'value': "'bool'"}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'pixel_scale'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'pixel_scale'}
|
Setup a mask where unmasked pixels are within an elliptical annulus of input inner and outer arc second \
major-axis and centre.
Parameters
----------
shape: (int, int)
The (y,x) shape of the mask in units of pixels.
pixel_scale: float
The arc-second to pixel conversion factor of each pixel.
inner_major_axis_radius_arcsec : float
The major-axis (in arc seconds) of the inner ellipse within which pixels are masked.
inner_axis_ratio : float
The axis-ratio of the inner ellipse within which pixels are masked.
inner_phi : float
The rotation angle of the inner ellipse within which pixels are masked, (counter-clockwise from the \
positive x-axis).
outer_major_axis_radius_arcsec : float
The major-axis (in arc seconds) of the outer ellipse within which pixels are unmasked.
outer_axis_ratio : float
The axis-ratio of the outer ellipse within which pixels are unmasked.
outer_phi : float
The rotation angle of the outer ellipse within which pixels are unmasked, (counter-clockwise from the \
positive x-axis).
centre: (float, float)
The centre of the elliptical annuli used to mask pixels.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pad_to_aspect_ratio'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'aspect_ratio'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '8', 'type': 'string', 'children': [], 'value': '"constant"'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'cval'}; {'id': '11', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'return_pad_amounts'}; {'id': '14', 'type': 'False', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16', '41', '65']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '21']}; {'id': '18', 'type': 'pattern_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'arr_0to1_padded'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'pad_amounts'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ia'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'pad_to_aspect_ratio'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '29', '32', '35', '38']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'arr_0to1'}; {'id': '29', 'type': 'keyword_argument', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'aspect_ratio'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'aspect_ratio'}; {'id': '32', 'type': 'keyword_argument', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '35', 'type': 'keyword_argument', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'cval'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'cval'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'return_pad_amounts'}; {'id': '40', 'type': 'True', 'children': []}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'heatmaps'}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'HeatmapsOnImage'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'from_0to1'}; {'id': '48', 'type': 'argument_list', 'children': ['49', '50', '55', '60']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'arr_0to1_padded'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'min_value'}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'min_value'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'max_value'}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'max_value'}; {'id': '65', 'type': 'if_statement', 'children': ['66', '67', '72']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'return_pad_amounts'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'return_statement', 'children': ['69']}; {'id': '69', 'type': 'expression_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'heatmaps'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'pad_amounts'}; {'id': '72', 'type': 'else_clause', 'children': ['73']}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'return_statement', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'heatmaps'}
|
Pad the heatmaps on their sides so that they match a target aspect ratio.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be padded. In each case, both of the sides will
be padded equally.
Parameters
----------
aspect_ratio : float
Target aspect ratio, given as width/height. E.g. 2.0 denotes the image having twice
as much width as height.
mode : str, optional
Padding mode to use. See :func:`numpy.pad` for details.
cval : number, optional
Value to use for padding if `mode` is ``constant``. See :func:`numpy.pad` for details.
return_pad_amounts : bool, optional
If False, then only the padded image will be returned. If True, a tuple with two
entries will be returned, where the first entry is the padded image and the second
entry are the amounts by which each image side was padded. These amounts are again a
tuple of the form (top, right, bottom, left), with each value being an integer.
Returns
-------
heatmaps : imgaug.HeatmapsOnImage
Padded heatmaps as HeatmapsOnImage object.
pad_amounts : tuple of int
Amounts by which the heatmaps were padded on each side, given as a tuple ``(top, right, bottom, left)``.
This tuple is only returned if `return_pad_amounts` was set to True.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'subseq'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'return_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'Fasta'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '15', 'type': 'subscript', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'seq'}; {'id': '19', 'type': 'slice', 'children': ['20', '21', '22']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '21', 'type': 'colon', 'children': []}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'end'}
|
Returns Fasta object with the same name, of the bases from start to end, but not including end
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_db_from_db'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'db_string'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '22', '31', '57']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'get_server_from_db'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'db_string'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'local_match'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'PLAIN_RE'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'db_string'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'remote_match'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'URL_RE'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'db_string'}; {'id': '31', 'type': 'if_statement', 'children': ['32', '33', '44']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'local_match'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'return_statement', 'children': ['35']}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '37', 'type': 'subscript', 'children': ['38', '43']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'local_match'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'groupdict'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'string', 'children': [], 'value': "'database'"}; {'id': '44', 'type': 'elif_clause', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'remote_match'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'return_statement', 'children': ['48']}; {'id': '48', 'type': 'subscript', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '50', 'type': 'subscript', 'children': ['51', '56']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'remote_match'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'groupdict'}; {'id': '55', 'type': 'argument_list', 'children': []}; {'id': '56', 'type': 'string', 'children': [], 'value': "'database'"}; {'id': '57', 'type': 'raise_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '%'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'Invalid database string: %r'"}; {'id': '63', 'type': 'tuple', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'db_string'}
|
Return a CouchDB database instance from a database string.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'calculate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'T'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'P'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'zs'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '10', 'type': 'block', 'children': ['11', '13']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '13', 'type': 'if_statement', 'children': ['14', '17', '38', '63', '93']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': '=='}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'MIXING_LOG_MOLAR'}; {'id': '17', 'type': 'block', 'children': ['18', '32']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'mus'}; {'id': '21', 'type': 'list_comprehension', 'children': ['22', '27']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'T'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'P'}; {'id': '27', 'type': 'for_in_clause', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ViscosityLiquids'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'mixing_logarithmic'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'zs'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'mus'}; {'id': '38', 'type': 'elif_clause', 'children': ['39', '42']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '41'], 'value': '=='}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'MIXING_LOG_MASS'}; {'id': '42', 'type': 'block', 'children': ['43', '57']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'mus'}; {'id': '46', 'type': 'list_comprehension', 'children': ['47', '52']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'T'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'P'}; {'id': '52', 'type': 'for_in_clause', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ViscosityLiquids'}; {'id': '57', 'type': 'return_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'mixing_logarithmic'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'mus'}; {'id': '63', 'type': 'elif_clause', 'children': ['64', '67']}; {'id': '64', 'type': 'comparison_operator', 'children': ['65', '66'], 'value': '=='}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'LALIBERTE_MU'}; {'id': '67', 'type': 'block', 'children': ['68', '75', '84']}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '71', 'type': 'call', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'index_w'}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'Laliberte_viscosity'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '89', '90']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'T'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'wCASs'}; {'id': '93', 'type': 'else_clause', 'children': ['94']}; {'id': '94', 'type': 'block', 'children': ['95']}; {'id': '95', 'type': 'raise_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'string', 'children': [], 'value': "'Method not valid'"}
|
r'''Method to calculate viscosity of a liquid mixture at
temperature `T`, pressure `P`, mole fractions `zs` and weight fractions
`ws` with a given method.
This method has no exception handling; see `mixture_property`
for that.
Parameters
----------
T : float
Temperature at which to calculate the property, [K]
P : float
Pressure at which to calculate the property, [Pa]
zs : list[float]
Mole fractions of all species in the mixture, [-]
ws : list[float]
Weight fractions of all species in the mixture, [-]
method : str
Name of the method to use
Returns
-------
mu : float
Viscosity of the liquid mixture, [Pa*s]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_link'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'folder_id'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11', '17', '23', '29', '35', '42', '73', '83']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '22']}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'token'"}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '28']}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'folderid'"}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'folder_id'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '34']}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '33', 'type': 'string', 'children': [], 'value': "'url'"}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'optional_keys'}; {'id': '38', 'type': 'list', 'children': ['39', '40', '41'], 'value': "['item_name', 'length', 'checksum']"}; {'id': '39', 'type': 'string', 'children': [], 'value': "'item_name'"}; {'id': '40', 'type': 'string', 'children': [], 'value': "'length'"}; {'id': '41', 'type': 'string', 'children': [], 'value': "'checksum'"}; {'id': '42', 'type': 'for_statement', 'children': ['43', '44', '45']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'optional_keys'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '49'], 'value': 'in'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '50', 'type': 'block', 'children': ['51', '65']}; {'id': '51', 'type': 'if_statement', 'children': ['52', '55']}; {'id': '52', 'type': 'comparison_operator', 'children': ['53', '54'], 'value': '=='}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '54', 'type': 'string', 'children': [], 'value': "'item_name'"}; {'id': '55', 'type': 'block', 'children': ['56', '64']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '61']}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '60', 'type': 'string', 'children': [], 'value': "'itemname'"}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '64', 'type': 'continue_statement', 'children': []}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '70']}; {'id': '67', 'type': 'subscript', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'response'}; {'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': 'request'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '82']}; {'id': '81', 'type': 'string', 'children': [], 'value': "'midas.link.create'"}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '83', 'type': 'return_statement', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'response'}
|
Create a link bitstream.
:param token: A valid token for the user in question.
:type token: string
:param folder_id: The id of the folder in which to create a new item
that will contain the link. The new item will have the same name as
the URL unless an item name is supplied.
:type folder_id: int | long
:param url: The URL of the link you will create, will be used as the
name of the bitstream and of the item unless an item name is
supplied.
:type url: string
:param item_name: (optional) The name of the newly created item, if
not supplied, the item will have the same name as the URL.
:type item_name: string
:param length: (optional) The length in bytes of the file to which the
link points.
:type length: int | long
:param checksum: (optional) The MD5 checksum of the file to which the
link points.
:type checksum: string
:returns: The item information of the item created.
:rtype: dict
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'extract_from_image'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '6', 'type': 'block', 'children': ['7', '20', '35', '43', '52', '68', '74', '80', '91', '102', '111', '120', '139', '155', '162', '194']}; {'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': 'ia'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'do_assert'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '17'], 'value': 'in'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '17', 'type': 'list', 'children': ['18', '19'], 'value': '[2, 3]'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '19', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '20', 'type': 'if_statement', 'children': ['21', '29']}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '28'], 'value': '<='}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'exterior'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'raise_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'string', 'children': [], 'value': '"Polygon must be made up of at least 3 points to extract its area from an image."'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'to_bounding_box'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'bb_area'}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'bb'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'extract_from_image'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '52', 'type': 'if_statement', 'children': ['53', '65']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'is_out_of_image'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59', '62']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '59', 'type': 'keyword_argument', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'fully'}; {'id': '61', 'type': 'True', 'children': []}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'partly'}; {'id': '64', 'type': 'False', 'children': []}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'bb_area'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'xx'}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'xx_int'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'yy'}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'yy_int'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'xx_mask'}; {'id': '83', 'type': 'binary_operator', 'children': ['84', '85'], 'value': '-'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'xx'}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'xx'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'yy_mask'}; {'id': '94', 'type': 'binary_operator', 'children': ['95', '96'], 'value': '-'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'yy'}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'min'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'yy'}; {'id': '102', 'type': 'expression_statement', 'children': ['103']}; {'id': '103', 'type': 'assignment', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'height_mask'}; {'id': '105', 'type': 'call', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '109', 'type': 'argument_list', 'children': ['110']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'yy_mask'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'width_mask'}; {'id': '114', 'type': 'call', 'children': ['115', '118']}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'xx_mask'}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '125']}; {'id': '122', 'type': 'pattern_list', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'rr_face'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'cc_face'}; {'id': '125', 'type': 'call', 'children': ['126', '131']}; {'id': '126', 'type': 'attribute', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'skimage'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'draw'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'polygon'}; {'id': '131', 'type': 'argument_list', 'children': ['132', '133', '134']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'yy_mask'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'xx_mask'}; {'id': '134', 'type': 'keyword_argument', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '136', 'type': 'tuple', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'height_mask'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'width_mask'}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'assignment', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '142', 'type': 'call', 'children': ['143', '146']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '146', 'type': 'argument_list', 'children': ['147', '150']}; {'id': '147', 'type': 'tuple', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'height_mask'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'width_mask'}; {'id': '150', 'type': 'keyword_argument', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '155', 'type': 'expression_statement', 'children': ['156']}; {'id': '156', 'type': 'assignment', 'children': ['157', '161']}; {'id': '157', 'type': 'subscript', 'children': ['158', '159', '160']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'rr_face'}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'cc_face'}; {'id': '161', 'type': 'True', 'children': []}; {'id': '162', 'type': 'if_statement', 'children': ['163', '168']}; {'id': '163', 'type': 'comparison_operator', 'children': ['164', '167'], 'value': '=='}; {'id': '164', 'type': 'attribute', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '167', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '168', 'type': 'block', 'children': ['169']}; {'id': '169', 'type': 'expression_statement', 'children': ['170']}; {'id': '170', 'type': 'assignment', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '172', 'type': 'call', 'children': ['173', '176']}; {'id': '173', 'type': 'attribute', 'children': ['174', '175']}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'tile'}; {'id': '176', 'type': 'argument_list', 'children': ['177', '186']}; {'id': '177', 'type': 'subscript', 'children': ['178', '179', '181', '183']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '179', 'type': 'slice', 'children': ['180']}; {'id': '180', 'type': 'colon', 'children': []}; {'id': '181', 'type': 'slice', 'children': ['182']}; {'id': '182', 'type': 'colon', 'children': []}; {'id': '183', 'type': 'attribute', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'newaxis'}; {'id': '186', 'type': 'tuple', 'children': ['187', '188', '189']}; {'id': '187', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '188', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '189', 'type': 'subscript', 'children': ['190', '193']}; {'id': '190', 'type': 'attribute', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '193', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '194', 'type': 'return_statement', 'children': ['195']}; {'id': '195', 'type': 'binary_operator', 'children': ['196', '197'], 'value': '*'}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'bb_area'}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'mask'}
|
Extract the image pixels within the polygon.
This function will zero-pad the image if the polygon is partially/fully outside of
the image.
Parameters
----------
image : (H,W) ndarray or (H,W,C) ndarray
The image from which to extract the pixels within the polygon.
Returns
-------
result : (H',W') ndarray or (H',W',C) ndarray
Pixels within the polygon. Zero-padded if the polygon is partially/fully
outside of the image.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_add_particles'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'guess'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'rad'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'calc'"}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'do_opt'}; {'id': '11', 'type': 'True', 'children': []}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'im_change_frac'}; {'id': '14', 'type': 'float', 'children': [], 'value': '0.2'}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'min_derr'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'3sig'"}; {'id': '18', 'type': 'dictionary_splat_pattern', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '20', 'type': 'block', 'children': ['21', '34', '38', '42', '54', '69', '85', '293']}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': '=='}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'min_derr'}; {'id': '24', 'type': 'string', 'children': [], 'value': "'3sig'"}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'min_derr'}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '31'], 'value': '*'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'sigma'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'accepts'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'new_poses'}; {'id': '41', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': '=='}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'rad'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'calc'"}; {'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': 'rad'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'guess_add_radii'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '57', 'type': '()', 'children': ['58']}; {'id': '58', 'type': 'binary_operator', 'children': ['59', '68'], 'value': '+'}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '65'], 'value': '+'}; {'id': '60', 'type': 'binary_operator', 'children': ['61', '64'], 'value': '+'}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '*'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '63', 'type': 'integer', 'children': [], 'value': '30'}; {'id': '64', 'type': 'string', 'children': [], 'value': "'ADDING'"}; {'id': '65', 'type': 'binary_operator', 'children': ['66', '67'], 'value': '*'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '67', 'type': 'integer', 'children': [], 'value': '30'}; {'id': '68', 'type': 'string', 'children': [], 'value': "'\\n Z\\t Y\\t X\\t R\\t|\\t ERR0\\t\\t ERR1'"}; {'id': '69', 'type': 'with_statement', 'children': ['70', '77']}; {'id': '70', 'type': 'with_clause', 'children': ['71']}; {'id': '71', 'type': 'with_item', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'noformat'}; {'id': '76', 'type': 'argument_list', 'children': []}; {'id': '77', 'type': 'block', 'children': ['78']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'CLOG'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '85', 'type': 'for_statement', 'children': ['86', '87', '95']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '87', 'type': 'call', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'subscript', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'guess'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '94', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '95', 'type': 'block', 'children': ['96', '102', '108', '118', '128', '154', '160', '170', '186']}; {'id': '96', 'type': 'expression_statement', 'children': ['97']}; {'id': '97', 'type': 'assignment', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'p0'}; {'id': '99', 'type': 'subscript', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'guess'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '102', 'type': 'expression_statement', 'children': ['103']}; {'id': '103', 'type': 'assignment', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'absent_err'}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '108', 'type': 'expression_statement', 'children': ['109']}; {'id': '109', 'type': 'assignment', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'absent_d'}; {'id': '111', 'type': 'call', 'children': ['112', '117']}; {'id': '112', 'type': 'attribute', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'residuals'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '117', 'type': 'argument_list', 'children': []}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'assignment', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'obj_add_particle'}; {'id': '125', 'type': 'argument_list', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'p0'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'rad'}; {'id': '128', 'type': 'if_statement', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'do_opt'}; {'id': '130', 'type': 'block', 'children': ['131']}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'call', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'opt'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'do_levmarq_particles'}; {'id': '136', 'type': 'argument_list', 'children': ['137', '138', '139', '142', '145', '148', '151']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '139', 'type': 'keyword_argument', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'damping'}; {'id': '141', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '142', 'type': 'keyword_argument', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'max_iter'}; {'id': '144', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '145', 'type': 'keyword_argument', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'run_length'}; {'id': '147', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '148', 'type': 'keyword_argument', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'eig_update'}; {'id': '150', 'type': 'False', 'children': []}; {'id': '151', 'type': 'keyword_argument', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'include_rad'}; {'id': '153', 'type': 'False', 'children': []}; {'id': '154', 'type': 'expression_statement', 'children': ['155']}; {'id': '155', 'type': 'assignment', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'present_err'}; {'id': '157', 'type': 'attribute', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'assignment', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'present_d'}; {'id': '163', 'type': 'call', 'children': ['164', '169']}; {'id': '164', 'type': 'attribute', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'residuals'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '169', 'type': 'argument_list', 'children': []}; {'id': '170', 'type': 'expression_statement', 'children': ['171']}; {'id': '171', 'type': 'assignment', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'dont_kill'}; {'id': '173', 'type': 'call', 'children': ['174', '175']}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'should_particle_exist'}; {'id': '175', 'type': 'argument_list', 'children': ['176', '177', '178', '179', '180', '183']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'absent_err'}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'present_err'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'absent_d'}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'present_d'}; {'id': '180', 'type': 'keyword_argument', 'children': ['181', '182']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'im_change_frac'}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'im_change_frac'}; {'id': '183', 'type': 'keyword_argument', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'min_derr'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'min_derr'}; {'id': '186', 'type': 'if_statement', 'children': ['187', '188', '265']}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'dont_kill'}; {'id': '188', 'type': 'block', 'children': ['189', '193', '210', '227', '234', '249']}; {'id': '189', 'type': 'expression_statement', 'children': ['190']}; {'id': '190', 'type': 'augmented_assignment', 'children': ['191', '192'], 'value': '+='}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'accepts'}; {'id': '192', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '193', 'type': 'expression_statement', 'children': ['194']}; {'id': '194', 'type': 'assignment', 'children': ['195', '196']}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '196', 'type': 'call', 'children': ['197', '198']}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '198', 'type': 'argument_list', 'children': ['199']}; {'id': '199', 'type': 'call', 'children': ['200', '209']}; {'id': '200', 'type': 'attribute', 'children': ['201', '208']}; {'id': '201', 'type': 'subscript', 'children': ['202', '207']}; {'id': '202', 'type': 'call', 'children': ['203', '206']}; {'id': '203', 'type': 'attribute', 'children': ['204', '205']}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'obj_get_positions'}; {'id': '206', 'type': 'argument_list', 'children': []}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'ravel'}; {'id': '209', 'type': 'argument_list', 'children': []}; {'id': '210', 'type': 'expression_statement', 'children': ['211']}; {'id': '211', 'type': 'assignment', 'children': ['212', '213']}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '213', 'type': 'call', 'children': ['214', '215']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '215', 'type': 'argument_list', 'children': ['216']}; {'id': '216', 'type': 'call', 'children': ['217', '226']}; {'id': '217', 'type': 'attribute', 'children': ['218', '225']}; {'id': '218', 'type': 'subscript', 'children': ['219', '224']}; {'id': '219', 'type': 'call', 'children': ['220', '223']}; {'id': '220', 'type': 'attribute', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'obj_get_radii'}; {'id': '223', 'type': 'argument_list', 'children': []}; {'id': '224', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '225', 'type': 'identifier', 'children': [], 'value': 'ravel'}; {'id': '226', 'type': 'argument_list', 'children': []}; {'id': '227', 'type': 'expression_statement', 'children': ['228']}; {'id': '228', 'type': 'call', 'children': ['229', '232']}; {'id': '229', 'type': 'attribute', 'children': ['230', '231']}; {'id': '230', 'type': 'identifier', 'children': [], 'value': 'new_poses'}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '232', 'type': 'argument_list', 'children': ['233']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '234', 'type': 'expression_statement', 'children': ['235']}; {'id': '235', 'type': 'assignment', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'part_msg'}; {'id': '237', 'type': 'binary_operator', 'children': ['238', '239'], 'value': '%'}; {'id': '238', 'type': 'string', 'children': [], 'value': "'%2.2f\\t%3.2f\\t%3.2f\\t%3.2f\\t|\\t%4.3f \\t%4.3f'"}; {'id': '239', 'type': '()', 'children': ['240']}; {'id': '240', 'type': 'binary_operator', 'children': ['241', '244'], 'value': '+'}; {'id': '241', 'type': 'binary_operator', 'children': ['242', '243'], 'value': '+'}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'p'}; {'id': '243', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '244', 'type': 'tuple', 'children': ['245', '246']}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'absent_err'}; {'id': '246', 'type': 'attribute', 'children': ['247', '248']}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '249', 'type': 'with_statement', 'children': ['250', '257']}; {'id': '250', 'type': 'with_clause', 'children': ['251']}; {'id': '251', 'type': 'with_item', 'children': ['252']}; {'id': '252', 'type': 'call', 'children': ['253', '256']}; {'id': '253', 'type': 'attribute', 'children': ['254', '255']}; {'id': '254', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '255', 'type': 'identifier', 'children': [], 'value': 'noformat'}; {'id': '256', 'type': 'argument_list', 'children': []}; {'id': '257', 'type': 'block', 'children': ['258']}; {'id': '258', 'type': 'expression_statement', 'children': ['259']}; {'id': '259', 'type': 'call', 'children': ['260', '263']}; {'id': '260', 'type': 'attribute', 'children': ['261', '262']}; {'id': '261', 'type': 'identifier', 'children': [], 'value': 'CLOG'}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '263', 'type': 'argument_list', 'children': ['264']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'part_msg'}; {'id': '265', 'type': 'else_clause', 'children': ['266']}; {'id': '266', 'type': 'block', 'children': ['267', '274']}; {'id': '267', 'type': 'expression_statement', 'children': ['268']}; {'id': '268', 'type': 'call', 'children': ['269', '272']}; {'id': '269', 'type': 'attribute', 'children': ['270', '271']}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '271', 'type': 'identifier', 'children': [], 'value': 'obj_remove_particle'}; {'id': '272', 'type': 'argument_list', 'children': ['273']}; {'id': '273', 'type': 'identifier', 'children': [], 'value': 'ind'}; {'id': '274', 'type': 'if_statement', 'children': ['275', '287']}; {'id': '275', 'type': 'comparison_operator', 'children': ['276', '286'], 'value': '>'}; {'id': '276', 'type': 'call', 'children': ['277', '280']}; {'id': '277', 'type': 'attribute', 'children': ['278', '279']}; {'id': '278', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '279', 'type': 'identifier', 'children': [], 'value': 'abs'}; {'id': '280', 'type': 'argument_list', 'children': ['281']}; {'id': '281', 'type': 'binary_operator', 'children': ['282', '283'], 'value': '-'}; {'id': '282', 'type': 'identifier', 'children': [], 'value': 'absent_err'}; {'id': '283', 'type': 'attribute', 'children': ['284', '285']}; {'id': '284', 'type': 'identifier', 'children': [], 'value': 'st'}; {'id': '285', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '286', 'type': 'float', 'children': [], 'value': '1e-4'}; {'id': '287', 'type': 'block', 'children': ['288']}; {'id': '288', 'type': 'raise_statement', 'children': ['289']}; {'id': '289', 'type': 'call', 'children': ['290', '291']}; {'id': '290', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '291', 'type': 'argument_list', 'children': ['292']}; {'id': '292', 'type': 'string', 'children': [], 'value': "'updates not exact?'"}; {'id': '293', 'type': 'return_statement', 'children': ['294']}; {'id': '294', 'type': 'expression_list', 'children': ['295', '296']}; {'id': '295', 'type': 'identifier', 'children': [], 'value': 'accepts'}; {'id': '296', 'type': 'identifier', 'children': [], 'value': 'new_poses'}
|
Checks whether to add particles at a given position by seeing if adding
the particle improves the fit of the state.
Parameters
----------
st : :class:`peri.states.State`
The state to check adding particles to.
guess : [N,3] list-like
The positions of particles to check to add.
rad : {Float, ``'calc'``}, optional.
The radius of the newly-added particles. Default is ``'calc'``,
which uses the states current radii's median.
do_opt : Bool, optional
Whether to optimize the particle position before checking if it
should be kept. Default is True (optimizes position).
im_change_frac : Float
How good the change in error needs to be relative to the change in
the difference image. Default is 0.2; i.e. if the error does not
decrease by 20% of the change in the difference image, do not add
the particle.
min_derr : Float or '3sig'
The minimal improvement in error to add a particle. Default
is ``'3sig' = 3*st.sigma``.
Returns
-------
accepts : Int
The number of added particles
new_poses : [N,3] list
List of the positions of the added particles. If ``do_opt==True``,
then these positions will differ from the input 'guess'.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_nginx_config'}; {'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', '17', '30']}; {'id': '7', 'type': 'call', 'children': ['8', '13']}; {'id': '8', 'type': 'attribute', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_nginx_config'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '29']}; {'id': '20', 'type': 'attribute', 'children': ['21', '28']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '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': '_nginx_config'}; {'id': '27', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'read'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'else_clause', 'children': ['31']}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'None', 'children': []}
|
Gets the Nginx config for the project
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_warn_if_not_finite'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '5', 'type': 'block', 'children': ['6', '15']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'asanyarray'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '15', 'type': 'if_statement', 'children': ['16', '52']}; {'id': '16', 'type': '()', 'children': ['17']}; {'id': '17', 'type': 'boolean_operator', 'children': ['18', '41'], 'value': 'and'}; {'id': '18', 'type': 'boolean_operator', 'children': ['19', '30'], 'value': 'and'}; {'id': '19', 'type': 'comparison_operator', 'children': ['20', '25'], 'value': 'in'}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '25', 'type': 'subscript', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'typecodes'}; {'id': '29', 'type': 'string', 'children': [], 'value': "'AllFloat'"}; {'id': '30', 'type': 'not_operator', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '40', 'type': 'argument_list', 'children': []}; {'id': '41', 'type': 'not_operator', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '51']}; {'id': '43', 'type': 'attribute', 'children': ['44', '50']}; {'id': '44', 'type': 'call', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '51', 'type': 'argument_list', 'children': []}; {'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': 'warnings'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'warn'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '66']}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '63'], 'value': '%'}; {'id': '60', 'type': 'concatenated_string', 'children': ['61', '62']}; {'id': '61', 'type': 'string', 'children': [], 'value': '"Result contains NaN, infinity"'}; {'id': '62', 'type': 'string', 'children': [], 'value': '" or a value too large for %r."'}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'category'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'UserWarning'}
|
UserWarning if array contains non-finite elements
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'stop'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'block', 'children': ['8', '38', '46']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '11']}; {'id': '9', 'type': 'not_operator', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'block', 'children': ['12', '25', '33']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '23', '24']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'Runner'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'string', 'children': [], 'value': "'builder'"}; {'id': '24', 'type': 'None', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'boolean_operator', 'children': ['29', '30'], 'value': 'and'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'if_statement', 'children': ['34', '36']}; {'id': '34', 'type': 'not_operator', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'return_statement', 'children': []}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '45']}; {'id': '40', 'type': 'attribute', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_runner'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '45', 'type': 'argument_list', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '50', 'type': 'block', 'children': ['51', '59']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '58']}; {'id': '53', 'type': 'attribute', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '58', 'type': 'argument_list', 'children': []}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'project'}; {'id': '64', 'type': 'None', 'children': []}
|
Stop the builder if it's running.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'molar_mass'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '6', 'type': 'string', 'children': [], 'value': "''"}; {'id': '7', 'type': 'block', 'children': ['8', '12', '26', '34', '41']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '11', 'type': 'float', 'children': [], 'value': '0.0'}; {'id': '12', 'type': 'if_statement', 'children': ['13', '23']}; {'id': '13', 'type': 'boolean_operator', 'children': ['14', '17'], 'value': 'or'}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': 'is'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '22'], 'value': '=='}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '22', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'parsed'}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'parse_compound'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'compound'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'parsed'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'molar_mass'}; {'id': '46', 'type': 'argument_list', 'children': []}
|
Determine the molar mass of a chemical compound.
The molar mass is usually the mass of one mole of the substance, but here
it is the mass of 1000 moles, since the mass unit used in auxi is kg.
:param compound: Formula of a chemical compound, e.g. 'Fe2O3'.
:returns: Molar mass. [kg/kmol]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'connect'}; {'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': 'channel_id'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '9', 'type': 'block', 'children': ['10', '30']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '13', 'type': 'call', 'children': ['14', '23']}; {'id': '14', 'type': 'attribute', 'children': ['15', '22']}; {'id': '15', 'type': 'attribute', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_lavalink'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'bot'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_connection'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_get_websocket'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'guild_id'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'await', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ws'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'voice_state'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'guild_id'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'channel_id'}
|
Connects to a voice channel.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_parser'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'extra_args'}; {'id': '5', 'type': 'block', 'children': ['6', '19', '29', '43', '56', '70', '84']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'argparse'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'ArgumentParser'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'keyword_argument', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'formatter_class'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'argparse'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ArgumentDefaultsHelpFormatter'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'dirs'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'appdirs'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'AppDirs'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'hangups'"}; {'id': '28', 'type': 'string', 'children': [], 'value': "'hangups'"}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'default_token_path'}; {'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': 'os'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'dirs'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'user_cache_dir'}; {'id': '42', 'type': 'string', 'children': [], 'value': "'refresh_token.txt'"}; {'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': 'parser'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '48', 'type': 'argument_list', 'children': ['49', '50', '53']}; {'id': '49', 'type': 'string', 'children': [], 'value': "'--token-path'"}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'default_token_path'}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'path used to store OAuth refresh token'"}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63', '64', '67']}; {'id': '62', 'type': 'string', 'children': [], 'value': "'-d'"}; {'id': '63', 'type': 'string', 'children': [], 'value': "'--debug'"}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'store_true'"}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'help'}; {'id': '69', 'type': 'string', 'children': [], 'value': "'log detailed debugging messages'"}; {'id': '70', 'type': 'for_statement', 'children': ['71', '72', '73']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'extra_arg'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'extra_args'}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'add_argument'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'extra_arg'}; {'id': '81', 'type': 'keyword_argument', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'required'}; {'id': '83', 'type': 'True', 'children': []}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'parser'}
|
Return ArgumentParser with any extra arguments.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_decimal'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '5', 'type': 'block', 'children': ['6', '24', '36', '45', '49', '58', '85']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'string_type'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'raise_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '20'], 'value': '%'}; {'id': '19', 'type': 'string', 'children': [], 'value': '"expected str or unicode, %s given"'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '24', 'type': 'if_statement', 'children': ['25', '30']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'findall'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'string', 'children': [], 'value': 'r"[\\x00-\\x20\\x7c-\\xff]"'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'raise_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'string', 'children': [], 'value': '"invalid character in sequence"'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'lstrip'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'!'"}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'decimal'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '57'], 'value': '-'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '58', 'type': 'for_statement', 'children': ['59', '62', '66']}; {'id': '59', 'type': 'pattern_list', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '66', 'type': 'block', 'children': ['67']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'augmented_assignment', 'children': ['69', '70'], 'value': '+='}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'decimal'}; {'id': '70', 'type': 'binary_operator', 'children': ['71', '78'], 'value': '*'}; {'id': '71', 'type': '()', 'children': ['72']}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '77'], 'value': '-'}; {'id': '73', 'type': 'call', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'ord'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '77', 'type': 'integer', 'children': [], 'value': '33'}; {'id': '78', 'type': '()', 'children': ['79']}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '81'], 'value': '**'}; {'id': '80', 'type': 'integer', 'children': [], 'value': '91'}; {'id': '81', 'type': '()', 'children': ['82']}; {'id': '82', 'type': 'binary_operator', 'children': ['83', '84'], 'value': '-'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '85', 'type': 'return_statement', 'children': ['86']}; {'id': '86', 'type': 'conditional_expression', 'children': ['87', '88', '91'], 'value': 'if'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'decimal'}; {'id': '88', 'type': 'comparison_operator', 'children': ['89', '90'], 'value': '!='}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '90', 'type': 'string', 'children': [], 'value': "''"}; {'id': '91', 'type': 'integer', 'children': [], 'value': '0'}
|
Takes a base91 char string and returns decimal
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_args'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'provider_required_args'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'argv'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '26', '32', '41', '67']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'epilog'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'Provider-required arguments:\\n'"}; {'id': '12', 'type': 'for_statement', 'children': ['13', '14', '15']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'provider'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'provider_required_args'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'augmented_assignment', 'children': ['18', '19'], 'value': '+='}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'epilog'}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '21'], 'value': '%'}; {'id': '20', 'type': 'string', 'children': [], 'value': "' %s: %s\\n'"}; {'id': '21', 'type': 'tuple', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'provider'}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'provider_required_args'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'provider'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'epilog'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'epilog'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'parser'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'parse_args'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'argv'}; {'id': '41', 'type': 'for_statement', 'children': ['42', '43', '48']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'provider_required_args'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'provider'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'if_statement', 'children': ['50', '57']}; {'id': '50', 'type': 'not_operator', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '__getattribute__'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '57', 'type': 'block', 'children': ['58']}; {'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': 'parser'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'binary_operator', 'children': ['65', '66'], 'value': '%'}; {'id': '65', 'type': 'string', 'children': [], 'value': "'argument --%s is required'"}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'args'}
|
Add provider required arguments epilog message, parse, and validate.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_milestone_request'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'milestone_request_id'}; {'id': '6', 'type': 'block', 'children': ['7', '14', '23', '34', '42']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'params_data'}; {'id': '10', 'type': 'dictionary', 'children': ['11']}; {'id': '11', 'type': 'pair', 'children': ['12', '13']}; {'id': '12', 'type': 'string', 'children': [], 'value': "'action'"}; {'id': '13', 'type': 'string', 'children': [], 'value': "'delete'"}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': "'milestone_requests/{}'"}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'milestone_request_id'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'make_put_request'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30', '31']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'params_data'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'params_data'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'json_data'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'if_statement', 'children': ['43', '48', '53']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '47'], 'value': '=='}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '200'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'subscript', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'json_data'}; {'id': '52', 'type': 'string', 'children': [], 'value': "'status'"}; {'id': '53', 'type': 'else_clause', 'children': ['54']}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'raise_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'MilestoneRequestNotDeletedException'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '64', '69']}; {'id': '59', 'type': 'keyword_argument', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'json_data'}; {'id': '63', 'type': 'string', 'children': [], 'value': "'message'"}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'error_code'}; {'id': '66', 'type': 'subscript', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'json_data'}; {'id': '68', 'type': 'string', 'children': [], 'value': "'error_code'"}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'request_id'}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'json_data'}; {'id': '73', 'type': 'string', 'children': [], 'value': "'request_id'"}
|
Delete a milestone request
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_binom'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'base1'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'base2'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'estE'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'estH'}; {'id': '8', 'type': 'block', 'children': ['9', '18', '22', '28', '46', '61', '76', '80', '84', '88', '95', '110']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'prior_homo'}; {'id': '12', 'type': 'binary_operator', 'children': ['13', '17'], 'value': '/'}; {'id': '13', 'type': '()', 'children': ['14']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '-'}; {'id': '15', 'type': 'float', 'children': [], 'value': '1.'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'estH'}; {'id': '17', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'prior_hete'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'estH'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'bsum'}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '27'], 'value': '+'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'base1'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'base2'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'hetprob'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '41'], 'value': '/'}; {'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': 'scipy'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'misc'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'comb'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'bsum'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'base1'}; {'id': '41', 'type': '()', 'children': ['42']}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '**'}; {'id': '43', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '44', 'type': '()', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'bsum'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'homoa'}; {'id': '49', 'type': 'call', 'children': ['50', '57']}; {'id': '50', 'type': 'attribute', 'children': ['51', '56']}; {'id': '51', 'type': 'attribute', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'scipy'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'binom'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'pmf'}; {'id': '57', 'type': 'argument_list', 'children': ['58', '59', '60']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'base2'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'bsum'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'estE'}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'homob'}; {'id': '64', 'type': 'call', 'children': ['65', '72']}; {'id': '65', 'type': 'attribute', 'children': ['66', '71']}; {'id': '66', 'type': 'attribute', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'scipy'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'stats'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'binom'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'pmf'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74', '75']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'base1'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'bsum'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'estE'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'augmented_assignment', 'children': ['78', '79'], 'value': '*='}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'hetprob'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'prior_hete'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'augmented_assignment', 'children': ['82', '83'], 'value': '*='}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'homoa'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'prior_homo'}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'augmented_assignment', 'children': ['86', '87'], 'value': '*='}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'homob'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'prior_homo'}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'probabilities'}; {'id': '91', 'type': 'list', 'children': ['92', '93', '94'], 'value': '[homoa, homob, hetprob]'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'homoa'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'homob'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'hetprob'}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'assignment', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'bestprob'}; {'id': '98', 'type': 'binary_operator', 'children': ['99', '103'], 'value': '/'}; {'id': '99', 'type': 'call', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'max'}; {'id': '101', 'type': 'argument_list', 'children': ['102']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'probabilities'}; {'id': '103', 'type': 'call', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'call', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '108', 'type': 'argument_list', 'children': ['109']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'probabilities'}; {'id': '110', 'type': 'if_statement', 'children': ['111', '114', '119']}; {'id': '111', 'type': 'comparison_operator', 'children': ['112', '113'], 'value': '>'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'hetprob'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'homoa'}; {'id': '114', 'type': 'block', 'children': ['115']}; {'id': '115', 'type': 'return_statement', 'children': ['116']}; {'id': '116', 'type': 'expression_list', 'children': ['117', '118']}; {'id': '117', 'type': 'True', 'children': []}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'bestprob'}; {'id': '119', 'type': 'else_clause', 'children': ['120']}; {'id': '120', 'type': 'block', 'children': ['121']}; {'id': '121', 'type': 'return_statement', 'children': ['122']}; {'id': '122', 'type': 'expression_list', 'children': ['123', '124']}; {'id': '123', 'type': 'False', 'children': []}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'bestprob'}
|
return probability of base call
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_algorithms'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'encryption'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'serialization'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'compression'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '33', '48', '63']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '23', '24']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'signature_algorithms'}; {'id': '23', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_update_dict'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'signature'}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_SIGNATURE'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38', '39']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'encryption_algorithms'}; {'id': '38', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'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': '_update_dict'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'encryption'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_ENCRYPTION'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '53', '54']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'serialization_algorithms'}; {'id': '53', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'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': '_update_dict'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'serialization'}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_SERIALIZATION'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '68', '69']}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'compression_algorithms'}; {'id': '68', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '_update_dict'}; {'id': '73', 'type': 'argument_list', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'compression'}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_COMPRESSION'}
|
Set algorithms used for sealing. Defaults can not be overridden.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'calculate_slope_aspect'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'elevation'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'xres'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'yres'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'z'}; {'id': '9', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '12', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '13', 'type': 'block', 'children': ['14', '21', '28', '48', '85', '129', '173', '199', '209']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'z'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'z'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '33']}; {'id': '30', 'type': 'pattern_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'height'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '33', 'type': 'expression_list', 'children': ['34', '41']}; {'id': '34', 'type': 'binary_operator', 'children': ['35', '40'], 'value': '-'}; {'id': '35', 'type': 'subscript', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'elevation'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '47'], 'value': '-'}; {'id': '42', 'type': 'subscript', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'elevation'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '51', 'type': 'list_comprehension', 'children': ['52', '70']}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '54'], 'value': '*'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'z'}; {'id': '54', 'type': 'subscript', 'children': ['55', '56', '63']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'elevation'}; {'id': '56', 'type': 'slice', 'children': ['57', '58', '59']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '58', 'type': 'colon', 'children': []}; {'id': '59', 'type': '()', 'children': ['60']}; {'id': '60', 'type': 'binary_operator', 'children': ['61', '62'], 'value': '+'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'height'}; {'id': '63', 'type': 'slice', 'children': ['64', '65', '66']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '65', 'type': 'colon', 'children': []}; {'id': '66', 'type': '()', 'children': ['67']}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '+'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '70', 'type': 'for_in_clause', 'children': ['71', '74']}; {'id': '71', 'type': 'tuple_pattern', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '74', 'type': 'call', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'product'}; {'id': '76', 'type': 'argument_list', 'children': ['77', '81']}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '81', 'type': 'call', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'assignment', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '123'], 'value': '/'}; {'id': '89', 'type': '()', 'children': ['90']}; {'id': '90', 'type': 'binary_operator', 'children': ['91', '107'], 'value': '-'}; {'id': '91', 'type': '()', 'children': ['92']}; {'id': '92', 'type': 'binary_operator', 'children': ['93', '104'], 'value': '+'}; {'id': '93', 'type': 'binary_operator', 'children': ['94', '101'], 'value': '+'}; {'id': '94', 'type': 'binary_operator', 'children': ['95', '98'], 'value': '+'}; {'id': '95', 'type': 'subscript', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '97', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '98', 'type': 'subscript', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '100', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '101', 'type': 'subscript', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '103', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '106', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '107', 'type': '()', 'children': ['108']}; {'id': '108', 'type': 'binary_operator', 'children': ['109', '120'], 'value': '+'}; {'id': '109', 'type': 'binary_operator', 'children': ['110', '117'], 'value': '+'}; {'id': '110', 'type': 'binary_operator', 'children': ['111', '114'], 'value': '+'}; {'id': '111', 'type': 'subscript', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '113', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '114', 'type': 'subscript', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '116', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '117', 'type': 'subscript', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '119', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '120', 'type': 'subscript', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '122', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '123', 'type': '()', 'children': ['124']}; {'id': '124', 'type': 'binary_operator', 'children': ['125', '128'], 'value': '*'}; {'id': '125', 'type': 'binary_operator', 'children': ['126', '127'], 'value': '*'}; {'id': '126', 'type': 'float', 'children': [], 'value': '8.0'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'xres'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '129', 'type': 'expression_statement', 'children': ['130']}; {'id': '130', 'type': 'assignment', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '132', 'type': 'binary_operator', 'children': ['133', '167'], 'value': '/'}; {'id': '133', 'type': '()', 'children': ['134']}; {'id': '134', 'type': 'binary_operator', 'children': ['135', '151'], 'value': '-'}; {'id': '135', 'type': '()', 'children': ['136']}; {'id': '136', 'type': 'binary_operator', 'children': ['137', '148'], 'value': '+'}; {'id': '137', 'type': 'binary_operator', 'children': ['138', '145'], 'value': '+'}; {'id': '138', 'type': 'binary_operator', 'children': ['139', '142'], 'value': '+'}; {'id': '139', 'type': 'subscript', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '141', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '142', 'type': 'subscript', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '144', 'type': 'integer', 'children': [], 'value': '7'}; {'id': '145', 'type': 'subscript', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '147', 'type': 'integer', 'children': [], 'value': '7'}; {'id': '148', 'type': 'subscript', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '150', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '151', 'type': '()', 'children': ['152']}; {'id': '152', 'type': 'binary_operator', 'children': ['153', '164'], 'value': '+'}; {'id': '153', 'type': 'binary_operator', 'children': ['154', '161'], 'value': '+'}; {'id': '154', 'type': 'binary_operator', 'children': ['155', '158'], 'value': '+'}; {'id': '155', 'type': 'subscript', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '157', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '158', 'type': 'subscript', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '160', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '161', 'type': 'subscript', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '163', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '164', 'type': 'subscript', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'window'}; {'id': '166', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '167', 'type': '()', 'children': ['168']}; {'id': '168', 'type': 'binary_operator', 'children': ['169', '172'], 'value': '*'}; {'id': '169', 'type': 'binary_operator', 'children': ['170', '171'], 'value': '*'}; {'id': '170', 'type': 'float', 'children': [], 'value': '8.0'}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'yres'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '173', 'type': 'expression_statement', 'children': ['174']}; {'id': '174', 'type': 'assignment', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'slope'}; {'id': '176', 'type': 'binary_operator', 'children': ['177', '182'], 'value': '-'}; {'id': '177', 'type': 'binary_operator', 'children': ['178', '181'], 'value': '/'}; {'id': '178', 'type': 'attribute', 'children': ['179', '180']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'math'}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '181', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '182', 'type': 'call', 'children': ['183', '186']}; {'id': '183', 'type': 'attribute', 'children': ['184', '185']}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'arctan'}; {'id': '186', 'type': 'argument_list', 'children': ['187']}; {'id': '187', 'type': 'call', 'children': ['188', '191']}; {'id': '188', 'type': 'attribute', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '191', 'type': 'argument_list', 'children': ['192']}; {'id': '192', 'type': 'binary_operator', 'children': ['193', '196'], 'value': '+'}; {'id': '193', 'type': 'binary_operator', 'children': ['194', '195'], 'value': '*'}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '195', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '196', 'type': 'binary_operator', 'children': ['197', '198'], 'value': '*'}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '198', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '199', 'type': 'expression_statement', 'children': ['200']}; {'id': '200', 'type': 'assignment', 'children': ['201', '202']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'aspect'}; {'id': '202', 'type': 'call', 'children': ['203', '206']}; {'id': '203', 'type': 'attribute', 'children': ['204', '205']}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'arctan2'}; {'id': '206', 'type': 'argument_list', 'children': ['207', '208']}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'y'}; {'id': '209', 'type': 'return_statement', 'children': ['210']}; {'id': '210', 'type': 'expression_list', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'slope'}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'aspect'}
|
Calculate slope and aspect map.
Return a pair of arrays 2 pixels smaller than the input elevation array.
Slope is returned in radians, from 0 for sheer face to pi/2 for
flat ground. Aspect is returned in radians, counterclockwise from -pi
at north around to pi.
Logic here is borrowed from hillshade.cpp:
http://www.perrygeo.net/wordpress/?p=7
Parameters
----------
elevation : array
input elevation data
xres : float
column width
yres : float
row height
z : float
vertical exaggeration factor
scale : float
scale factor of pixel size units versus height units (insert 112000
when having elevation values in meters in a geodetic projection)
Returns
-------
slope shade : array
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_conversion'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '6', 'type': 'block', 'children': ['7', '22']}; {'id': '7', 'type': 'function_definition', 'children': ['8', '9', '11']}; {'id': '8', 'type': 'function_name', 'children': [], 'value': 'register'}; {'id': '9', 'type': 'parameters', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '11', 'type': 'block', 'children': ['12', '20']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '19']}; {'id': '14', 'type': 'subscript', 'children': ['15', '18']}; {'id': '15', 'type': 'subscript', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '__CONVERSION__'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '20', 'type': 'return_statement', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'register'}
|
A decorator to register namespace conversions.
Usage
-----
>>> @conversion('tag_open', 'tag_.*')
... def tag_to_open(annotation):
... annotation.namespace = 'tag_open'
... return annotation
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sync'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '40', '55', '69']}; {'id': '6', 'type': 'for_statement', 'children': ['7', '8', '22']}; {'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': 'mimicdb'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'smembers'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'binary_operator', 'children': ['16', '19'], 'value': '%'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'bucket'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'mimicdb'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '35'], 'value': '%'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '35', 'type': 'tuple', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'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': 'mimicdb'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'binary_operator', 'children': ['49', '52'], 'value': '%'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'bucket'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '62']}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'mimicdb'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'sadd'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '69', 'type': 'for_statement', 'children': ['70', '71', '79']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'keyword_argument', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'force'}; {'id': '78', 'type': 'True', 'children': []}; {'id': '79', 'type': 'block', 'children': ['80', '98']}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '87']}; {'id': '82', 'type': 'attribute', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'mimicdb'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'sadd'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '95']}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '92'], 'value': '%'}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'bucket'}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'call', 'children': ['100', '105']}; {'id': '100', 'type': 'attribute', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'mimicdb'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'hmset'}; {'id': '105', 'type': 'argument_list', 'children': ['106', '117']}; {'id': '106', 'type': 'binary_operator', 'children': ['107', '110'], 'value': '%'}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'tpl'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '110', 'type': 'tuple', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '117', 'type': 'call', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '119', 'type': 'argument_list', 'children': ['120', '125']}; {'id': '120', 'type': 'keyword_argument', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '125', 'type': 'keyword_argument', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'md5'}; {'id': '127', 'type': 'call', 'children': ['128', '133']}; {'id': '128', 'type': 'attribute', 'children': ['129', '132']}; {'id': '129', 'type': 'attribute', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'etag'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'string', 'children': [], 'value': '\'"\''}
|
Sync a bucket.
Force all API calls to S3 and populate the database with the current state of S3.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_only_extr_license'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '25', '34', '43', '52', '57', '66', '77', '88', '99', '117']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ident'}; {'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_extr_license_ident'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'text'}; {'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': 'get_extr_license_text'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'get_extr_lics_comment'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'xrefs'}; {'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': 'get_extr_lics_xref'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'get_extr_lic_name'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'extr_lic'}; {'id': '52', 'type': 'if_statement', 'children': ['53', '55']}; {'id': '53', 'type': 'not_operator', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'ident'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'return_statement', 'children': []}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'lic'}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'ExtractedLicense'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'ident'}; {'id': '66', 'type': 'if_statement', 'children': ['67', '70']}; {'id': '67', 'type': 'comparison_operator', 'children': ['68', '69'], 'value': 'is not'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '69', 'type': 'None', 'children': []}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'assignment', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'lic'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '77', 'type': 'if_statement', 'children': ['78', '81']}; {'id': '78', 'type': 'comparison_operator', 'children': ['79', '80'], 'value': 'is not'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '80', 'type': 'None', 'children': []}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'lic'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'full_name'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '88', 'type': 'if_statement', 'children': ['89', '92']}; {'id': '89', 'type': 'comparison_operator', 'children': ['90', '91'], 'value': 'is not'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '91', 'type': 'None', 'children': []}; {'id': '92', 'type': 'block', 'children': ['93']}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'lic'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'lic'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'cross_ref'}; {'id': '104', 'type': 'call', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'map'}; {'id': '106', 'type': 'argument_list', 'children': ['107', '116']}; {'id': '107', 'type': 'lambda', 'children': ['108', '110']}; {'id': '108', 'type': 'lambda_parameters', 'children': ['109']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'text_type'}; {'id': '114', 'type': 'argument_list', 'children': ['115']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'xrefs'}; {'id': '117', 'type': 'return_statement', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'lic'}
|
Return an ExtractedLicense object to represent a license object.
But does not add it to the SPDXDocument model.
Return None if failed.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'custom_serialized'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'is_java'}; {'id': '8', 'type': 'True', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '30']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '17']}; {'id': '11', 'type': 'not_operator', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'raise_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '26'], 'value': '%'}; {'id': '23', 'type': 'concatenated_string', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': '"Argument to custom_serialized() must be "'}; {'id': '25', 'type': 'string', 'children': [], 'value': '"a serialized Python class as bytes, given: %s"'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '33', '53']}; {'id': '31', 'type': 'not_operator', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'is_java'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'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': 'cls'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'CUSTOM'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '50']}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'gtype'}; {'id': '42', 'type': 'call', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'topology_pb2'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'Grouping'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'Value'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"CUSTOM"'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'python_serialized'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '53', 'type': 'else_clause', 'children': ['54']}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'raise_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'NotImplementedError'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'concatenated_string', 'children': ['60', '61']}; {'id': '60', 'type': 'string', 'children': [], 'value': '"Custom grouping implemented in Java for Python topology"'}; {'id': '61', 'type': 'string', 'children': [], 'value': '"is not yet supported."'}
|
Custom grouping from a given serialized string
This class is created for compatibility with ``custom_serialized(cls, java_serialized)`` method
of StreamParse API, although its functionality is not yet implemented (Java-serialized).
Currently only custom grouping implemented in Python is supported, and ``custom()`` method
should be used to indicate its classpath, rather than directly to use this method.
In the future, users can directly specify Java-serialized object with ``is_java=True`` in order
to use a custom grouping implemented in Java for python topology.
:param serialized: serialized classpath to custom grouping class to use (if python)
:param is_java: indicate whether this is Java serialized, or python serialized
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'init'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'minimal'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '35']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'templates_path'}; {'id': '12', 'type': 'call', 'children': ['13', '18']}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '34']}; {'id': '19', 'type': 'call', 'children': ['20', '25']}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '__file__'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'project_templates'"}; {'id': '35', 'type': 'for_statement', 'children': ['36', '37', '43']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'listdir'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'templates_path'}; {'id': '43', 'type': 'block', 'children': ['44', '60', '72']}; {'id': '44', 'type': 'if_statement', 'children': ['45', '58']}; {'id': '45', 'type': 'boolean_operator', 'children': ['46', '52'], 'value': 'or'}; {'id': '46', 'type': '()', 'children': ['47']}; {'id': '47', 'type': 'boolean_operator', 'children': ['48', '49'], 'value': 'and'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'minimal'}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': '=='}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '51', 'type': 'string', 'children': [], 'value': "'event.json'"}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'string', 'children': [], 'value': "'.pyc'"}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'continue_statement', 'children': []}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'dest_path'}; {'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': 'os'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'templates_path'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '72', 'type': 'if_statement', 'children': ['73', '82']}; {'id': '73', 'type': 'not_operator', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '80']}; {'id': '75', 'type': 'attribute', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'isdir'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'dest_path'}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'dest_path'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'src'}
|
Copies template files to a given directory.
:param str src:
The path to output the template lambda project files.
:param bool minimal:
Minimal possible template files (excludes event.json).
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'collect'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '21', '33', '52', '58', '125', '227']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '15']}; {'id': '7', 'type': 'boolean_operator', 'children': ['8', '11'], 'value': 'and'}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'symlink'}; {'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': 'local'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'raise_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'CommandError'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'string', 'children': [], 'value': '"Can\'t symlink to a remote destination."'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'clear'}; {'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': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'clear_dir'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'string', 'children': [], 'value': "''"}; {'id': '33', 'type': 'if_statement', 'children': ['34', '37', '44']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'symlink'}; {'id': '37', 'type': 'block', 'children': ['38']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'link_file'}; {'id': '44', 'type': 'else_clause', 'children': ['45']}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'copy_file'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'found_files'}; {'id': '55', 'type': 'call', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'OrderedDict'}; {'id': '57', 'type': 'argument_list', 'children': []}; {'id': '58', 'type': 'for_statement', 'children': ['59', '60', '63']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'finder'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'get_finders'}; {'id': '62', 'type': 'argument_list', 'children': []}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'for_statement', 'children': ['65', '68', '76']}; {'id': '65', 'type': 'pattern_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'finder'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'ignore_patterns'}; {'id': '76', 'type': 'block', 'children': ['77', '105']}; {'id': '77', 'type': 'if_statement', 'children': ['78', '84', '99']}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '80', 'type': 'argument_list', 'children': ['81', '82', '83']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '82', 'type': 'string', 'children': [], 'value': "'prefix'"}; {'id': '83', 'type': 'None', 'children': []}; {'id': '84', 'type': 'block', 'children': ['85']}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'assignment', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '88', 'type': 'call', 'children': ['89', '94']}; {'id': '89', 'type': 'attribute', 'children': ['90', '93']}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '99', 'type': 'else_clause', 'children': ['100']}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '105', 'type': 'if_statement', 'children': ['106', '109']}; {'id': '106', 'type': 'comparison_operator', 'children': ['107', '108'], 'value': 'not in'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'found_files'}; {'id': '109', 'type': 'block', 'children': ['110', '118']}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'assignment', 'children': ['112', '115']}; {'id': '112', 'type': 'subscript', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'found_files'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '115', 'type': 'tuple', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'call', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'handler'}; {'id': '121', 'type': 'argument_list', 'children': ['122', '123', '124']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'prefixed_path'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '125', 'type': 'if_statement', 'children': ['126', '137']}; {'id': '126', 'type': 'boolean_operator', 'children': ['127', '130'], 'value': 'and'}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'post_process'}; {'id': '130', 'type': 'call', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '132', 'type': 'argument_list', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '136', 'type': 'string', 'children': [], 'value': "'post_process'"}; {'id': '137', 'type': 'block', 'children': ['138', '154']}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'assignment', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'processor'}; {'id': '141', 'type': 'call', 'children': ['142', '147']}; {'id': '142', 'type': 'attribute', 'children': ['143', '146']}; {'id': '143', 'type': 'attribute', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'storage'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'post_process'}; {'id': '147', 'type': 'argument_list', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'found_files'}; {'id': '149', 'type': 'keyword_argument', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'dry_run'}; {'id': '151', 'type': 'attribute', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'dry_run'}; {'id': '154', 'type': 'for_statement', 'children': ['155', '159', '160']}; {'id': '155', 'type': 'pattern_list', 'children': ['156', '157', '158']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'original_path'}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'processed_path'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'processed'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'processor'}; {'id': '160', 'type': 'block', 'children': ['161', '190']}; {'id': '161', 'type': 'if_statement', 'children': ['162', '167']}; {'id': '162', 'type': 'call', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '164', 'type': 'argument_list', 'children': ['165', '166']}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'processed'}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '167', 'type': 'block', 'children': ['168', '179', '188']}; {'id': '168', 'type': 'expression_statement', 'children': ['169']}; {'id': '169', 'type': 'call', 'children': ['170', '175']}; {'id': '170', 'type': 'attribute', 'children': ['171', '174']}; {'id': '171', 'type': 'attribute', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '173', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '175', 'type': 'argument_list', 'children': ['176']}; {'id': '176', 'type': 'binary_operator', 'children': ['177', '178'], 'value': '%'}; {'id': '177', 'type': 'string', 'children': [], 'value': '"Post-processing \'%s\' failed!"'}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'original_path'}; {'id': '179', 'type': 'expression_statement', 'children': ['180']}; {'id': '180', 'type': 'call', 'children': ['181', '186']}; {'id': '181', 'type': 'attribute', 'children': ['182', '185']}; {'id': '182', 'type': 'attribute', 'children': ['183', '184']}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '184', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '186', 'type': 'argument_list', 'children': ['187']}; {'id': '187', 'type': 'string', 'children': [], 'value': '""'}; {'id': '188', 'type': 'raise_statement', 'children': ['189']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'processed'}; {'id': '190', 'type': 'if_statement', 'children': ['191', '192', '216']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': 'processed'}; {'id': '192', 'type': 'block', 'children': ['193', '207']}; {'id': '193', 'type': 'expression_statement', 'children': ['194']}; {'id': '194', 'type': 'call', 'children': ['195', '198']}; {'id': '195', 'type': 'attribute', 'children': ['196', '197']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '198', 'type': 'argument_list', 'children': ['199', '204']}; {'id': '199', 'type': 'binary_operator', 'children': ['200', '201'], 'value': '%'}; {'id': '200', 'type': 'string', 'children': [], 'value': '"Post-processed \'%s\' as \'%s\'"'}; {'id': '201', 'type': 'tuple', 'children': ['202', '203']}; {'id': '202', 'type': 'identifier', 'children': [], 'value': 'original_path'}; {'id': '203', 'type': 'identifier', 'children': [], 'value': 'processed_path'}; {'id': '204', 'type': 'keyword_argument', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'level'}; {'id': '206', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '207', 'type': 'expression_statement', 'children': ['208']}; {'id': '208', 'type': 'call', 'children': ['209', '214']}; {'id': '209', 'type': 'attribute', 'children': ['210', '213']}; {'id': '210', 'type': 'attribute', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'post_processed_files'}; {'id': '213', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '214', 'type': 'argument_list', 'children': ['215']}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'original_path'}; {'id': '216', 'type': 'else_clause', 'children': ['217']}; {'id': '217', 'type': 'block', 'children': ['218']}; {'id': '218', 'type': 'expression_statement', 'children': ['219']}; {'id': '219', 'type': 'call', 'children': ['220', '223']}; {'id': '220', 'type': 'attribute', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '223', 'type': 'argument_list', 'children': ['224']}; {'id': '224', 'type': 'binary_operator', 'children': ['225', '226'], 'value': '%'}; {'id': '225', 'type': 'string', 'children': [], 'value': '"Skipped post-processing \'%s\'"'}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'original_path'}; {'id': '227', 'type': 'return_statement', 'children': ['228']}; {'id': '228', 'type': 'dictionary', 'children': ['229', '238', '243']}; {'id': '229', 'type': 'pair', 'children': ['230', '231']}; {'id': '230', 'type': 'string', 'children': [], 'value': "'modified'"}; {'id': '231', 'type': 'binary_operator', 'children': ['232', '235'], 'value': '+'}; {'id': '232', 'type': 'attribute', 'children': ['233', '234']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'copied_files'}; {'id': '235', 'type': 'attribute', 'children': ['236', '237']}; {'id': '236', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'symlinked_files'}; {'id': '238', 'type': 'pair', 'children': ['239', '240']}; {'id': '239', 'type': 'string', 'children': [], 'value': "'unmodified'"}; {'id': '240', 'type': 'attribute', 'children': ['241', '242']}; {'id': '241', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'unmodified_files'}; {'id': '243', 'type': 'pair', 'children': ['244', '245']}; {'id': '244', 'type': 'string', 'children': [], 'value': "'post_processed'"}; {'id': '245', 'type': 'attribute', 'children': ['246', '247']}; {'id': '246', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'post_processed_files'}
|
Perform the bulk of the work of collectmedia.
Split off from handle() to facilitate testing.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sim'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '7', 'type': 'block', 'children': ['8', '15', '24', '45', '52', '79']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': '=='}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21']}; {'id': '16', 'type': 'boolean_operator', 'children': ['17', '19'], 'value': 'or'}; {'id': '17', 'type': 'not_operator', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'float', 'children': [], 'value': '0.0'}; {'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': 'min_word'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'max_word'}; {'id': '29', 'type': 'conditional_expression', 'children': ['30', '33', '42'], 'value': 'if'}; {'id': '30', 'type': 'tuple', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '38'], 'value': '<'}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'src'}; {'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': 'tar'}; {'id': '42', 'type': 'tuple', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'tar'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'src'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'min_len'}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'min_word'}; {'id': '52', 'type': 'for_statement', 'children': ['53', '54', '61']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '56', 'type': 'argument_list', 'children': ['57', '58', '59']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'min_len'}; {'id': '58', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '59', 'type': 'unary_operator', 'children': ['60'], 'value': '-'}; {'id': '60', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'if_statement', 'children': ['63', '74']}; {'id': '63', 'type': 'comparison_operator', 'children': ['64', '69'], 'value': '=='}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'min_word'}; {'id': '66', 'type': 'slice', 'children': ['67', '68']}; {'id': '67', 'type': 'colon', 'children': []}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'max_word'}; {'id': '71', 'type': 'slice', 'children': ['72', '73']}; {'id': '72', 'type': 'colon', 'children': []}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '74', 'type': 'block', 'children': ['75']}; {'id': '75', 'type': 'return_statement', 'children': ['76']}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '/'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'min_len'}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'float', 'children': [], 'value': '0.0'}
|
Return the prefix similarity of two strings.
Prefix similarity is the ratio of the length of the shorter term that
exactly matches the longer term to the length of the shorter term,
beginning at the start of both terms.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
float
Prefix similarity
Examples
--------
>>> cmp = Prefix()
>>> cmp.sim('cat', 'hat')
0.0
>>> cmp.sim('Niall', 'Neil')
0.25
>>> cmp.sim('aluminum', 'Catalan')
0.0
>>> cmp.sim('ATCG', 'TAGC')
0.0
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_volume_steps'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '31']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '11']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '__volume_steps'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '__volume_steps'}; {'id': '17', 'type': 'yield', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'handle_int'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'API'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'string', 'children': [], 'value': "'volume_steps'"}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '__volume_steps'}
|
Read the maximum volume level of the device.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'iter_complete_graphs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'factory'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '16', '23', '34']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '15']}; {'id': '12', 'type': 'pattern_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '23', 'type': 'if_statement', 'children': ['24', '27']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': 'is'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'factory'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'factory'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'while_statement', 'children': ['35', '41']}; {'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': 'nodes'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'stop'}; {'id': '41', 'type': 'block', 'children': ['42', '51', '54', '61', '73']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'G'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'nx'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'complete_graph'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'yield', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'G'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'factory'}; {'id': '61', 'type': 'while_statement', 'children': ['62', '65']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '64'], 'value': 'in'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'G'}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'factory'}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'v'}
|
Iterate over complete graphs.
Args:
start (int/iterable):
Define the size of the starting graph.
If an int, the nodes will be index-labeled, otherwise should be an iterable of node
labels.
stop (int):
Stops yielding graphs when the size equals stop.
factory (iterator, optional):
If provided, nodes added will be labeled according to the values returned by factory.
Otherwise the extra nodes will be index-labeled.
Yields:
:class:`nx.Graph`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'has_edit_permission'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'return_statement', 'children': ['8']}; {'id': '8', 'type': 'boolean_operator', 'children': ['9', '20'], 'value': 'and'}; {'id': '9', 'type': 'boolean_operator', 'children': ['10', '15'], 'value': 'and'}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'is_authenticated'}; {'id': '15', 'type': 'attribute', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'is_active'}; {'id': '20', 'type': 'attribute', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'is_staff'}
|
Can edit this object
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_expires_in'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'token_expiry'}; {'id': '10', 'type': 'block', 'children': ['11', '17']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'now'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_UTCNOW'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'if_statement', 'children': ['18', '23', '42']}; {'id': '18', 'type': 'comparison_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': 'token_expiry'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'now'}; {'id': '23', 'type': 'block', 'children': ['24', '32']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'time_delta'}; {'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': 'token_expiry'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'now'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '39'], 'value': '+'}; {'id': '34', 'type': 'binary_operator', 'children': ['35', '38'], 'value': '*'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'time_delta'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'days'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '86400'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'time_delta'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'seconds'}; {'id': '42', 'type': 'else_clause', 'children': ['43']}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'integer', 'children': [], 'value': '0'}
|
Return the number of seconds until this token expires.
If token_expiry is in the past, this method will return 0, meaning the
token has already expired.
If token_expiry is None, this method will return None. Note that
returning 0 in such a case would not be fair: the token may still be
valid; we just don't know anything about it.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'to_normalized_batch'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '36', '47', '51', '66']}; {'id': '6', 'type': 'assert_statement', 'children': ['7', '32']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '9', 'type': 'argument_list', 'children': ['10']}; {'id': '10', 'type': 'list_comprehension', 'children': ['11', '14', '25']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'for_in_clause', 'children': ['15', '18']}; {'id': '15', 'type': 'pattern_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'attr_name'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '18', 'type': 'call', 'children': ['19', '24']}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '__dict__'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'if_clause', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'attr_name'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'string', 'children': [], 'value': '"_aug"'}; {'id': '32', 'type': 'concatenated_string', 'children': ['33', '34', '35']}; {'id': '33', 'type': 'string', 'children': [], 'value': '"Expected UnnormalizedBatch to not contain any augmented data "'}; {'id': '34', 'type': 'string', 'children': [], 'value': '"before normalization, but at least one \'*_aug\' attribute was "'}; {'id': '35', 'type': 'string', 'children': [], 'value': '"already set."'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'images_unaug'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'normalize_images'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'images_unaug'}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'if_statement', 'children': ['52', '55']}; {'id': '52', 'type': 'comparison_operator', 'children': ['53', '54'], 'value': 'is not'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'images_unaug'}; {'id': '54', 'type': 'None', 'children': []}; {'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': 'shapes'}; {'id': '59', 'type': 'list_comprehension', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '63', 'type': 'for_in_clause', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'images_unaug'}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'Batch'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '73', '84', '95', '106', '117', '128', '139']}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'images_unaug'}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'heatmaps'}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'normalize_heatmaps'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'heatmaps_unaug'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'segmentation_maps'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'normalize_segmentation_maps'}; {'id': '90', 'type': 'argument_list', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'segmentation_maps_unaug'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '95', 'type': 'keyword_argument', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'keypoints'}; {'id': '97', 'type': 'call', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'normalize_keypoints'}; {'id': '101', 'type': 'argument_list', 'children': ['102', '105']}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'keypoints_unaug'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '106', 'type': 'keyword_argument', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'bounding_boxes'}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'normalize_bounding_boxes'}; {'id': '112', 'type': 'argument_list', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'bounding_boxes_unaug'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '117', 'type': 'keyword_argument', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'polygons'}; {'id': '119', 'type': 'call', 'children': ['120', '123']}; {'id': '120', 'type': 'attribute', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'normalize_polygons'}; {'id': '123', 'type': 'argument_list', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'polygons_unaug'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '128', 'type': 'keyword_argument', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'line_strings'}; {'id': '130', 'type': 'call', 'children': ['131', '134']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'nlib'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'normalize_line_strings'}; {'id': '134', 'type': 'argument_list', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'line_strings_unaug'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'shapes'}; {'id': '139', 'type': 'keyword_argument', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '141', 'type': 'attribute', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'data'}
|
Convert this unnormalized batch to an instance of Batch.
As this method is intended to be called before augmentation, it
assumes that none of the ``*_aug`` attributes is yet set.
It will produce an AssertionError otherwise.
The newly created Batch's ``*_unaug`` attributes will match the ones
in this batch, just in normalized form.
Returns
-------
imgaug.augmentables.batches.Batch
The batch, with ``*_unaug`` attributes being normalized.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sum_out'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'bn'}; {'id': '7', 'type': 'block', 'children': ['8', '10', '24', '66']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"Make a factor eliminating var by summing over its values."'}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'vars'}; {'id': '13', 'type': 'list_comprehension', 'children': ['14', '15', '20']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '15', 'type': 'for_in_clause', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'vars'}; {'id': '20', 'type': 'if_clause', 'children': ['21']}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '23'], 'value': '!='}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'X'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cpt'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '29', 'type': 'generator_expression', 'children': ['30', '58']}; {'id': '30', 'type': 'tuple', 'children': ['31', '36']}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'event_values'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'vars'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '38', 'type': 'generator_expression', 'children': ['39', '50']}; {'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': 'p'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '50', 'type': 'for_in_clause', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'bn'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'variable_values'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'var'}; {'id': '58', 'type': 'for_in_clause', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'all_events'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64', '65']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'vars'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'bn'}; {'id': '65', 'type': 'dictionary', 'children': []}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'Factor'}; {'id': '69', 'type': 'argument_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'vars'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'cpt'}
|
Make a factor eliminating var by summing over its values.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'file_download_event_builder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'sender_app'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'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', '71']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'event'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '34', '42', '50', '55', '62', '67']}; {'id': '21', 'type': 'keyword_argument', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'timestamp'}; {'id': '23', 'type': 'call', 'children': ['24', '33']}; {'id': '24', 'type': 'attribute', 'children': ['25', '32']}; {'id': '25', 'type': 'call', 'children': ['26', '31']}; {'id': '26', 'type': 'attribute', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'datetime'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'utcnow'}; {'id': '31', 'type': 'argument_list', 'children': []}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'isoformat'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'keyword_argument', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'bucket_id'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'bucket_id'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'file_id'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'file_id'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'file_key'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '57', 'type': 'attribute', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'size'}; {'id': '62', 'type': 'keyword_argument', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'referrer'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'referrer'}; {'id': '67', 'type': 'dictionary_splat', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'get_user'}; {'id': '70', 'type': 'argument_list', 'children': []}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'event'}
|
Build a file-download event.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_roster'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '6', 'type': 'block', 'children': ['7', '34', '47', '58']}; {'id': '7', 'type': 'try_statement', 'children': ['8', '18']}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ElementTree'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '18', 'type': 'except_clause', 'children': ['19', '22', '23']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'ElementTree'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ParseError'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'string', 'children': [], 'value': '"Invalid roster format: {0}"'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'roster'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'Roster'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'from_xml'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'tree'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'getroot'}; {'id': '46', 'type': 'argument_list', 'children': []}; {'id': '47', 'type': 'for_statement', 'children': ['48', '49', '50']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'roster'}; {'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': 'item'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'verify_roster_result'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'True', 'children': []}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'roster'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'roster'}
|
Load roster from an XML file.
Can be used before the connection is started to load saved
roster copy, for efficient retrieval of versioned roster.
:Parameters:
- `source`: file name or a file object
:Types:
- `source`: `str` or file-like object
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getPredictionResults'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'network'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'clRegionName'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '24', '33', '43', '53', '63', '131']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'classifierRegion'}; {'id': '10', 'type': 'subscript', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'network'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'regions'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'clRegionName'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'actualValues'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'classifierRegion'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'getOutputData'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'string', 'children': [], 'value': '"actualValues"'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'probabilities'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'classifierRegion'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'getOutputData'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'string', 'children': [], 'value': '"probabilities"'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'steps'}; {'id': '36', 'type': 'attribute', 'children': ['37', '42']}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'classifierRegion'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'getSelf'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'stepsList'}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '46', 'type': 'attribute', 'children': ['47', '52']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'classifierRegion'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'getSelf'}; {'id': '51', 'type': 'argument_list', 'children': []}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'maxCategoryCount'}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '56', 'type': 'dictionary_comprehension', 'children': ['57', '60']}; {'id': '57', 'type': 'pair', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'step'}; {'id': '59', 'type': 'dictionary', 'children': []}; {'id': '60', 'type': 'for_in_clause', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'step'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'steps'}; {'id': '63', 'type': 'for_statement', 'children': ['64', '65', '72']}; {'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']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'steps'}; {'id': '72', 'type': 'block', 'children': ['73', '91', '99', '105', '111', '121']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'stepProbabilities'}; {'id': '76', 'type': 'subscript', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'probabilities'}; {'id': '78', 'type': 'slice', 'children': ['79', '82', '83']}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '81'], 'value': '*'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '82', 'type': 'colon', 'children': []}; {'id': '83', 'type': 'binary_operator', 'children': ['84', '90'], 'value': '-'}; {'id': '84', 'type': 'binary_operator', 'children': ['85', '89'], 'value': '*'}; {'id': '85', 'type': '()', 'children': ['86']}; {'id': '86', 'type': 'binary_operator', 'children': ['87', '88'], 'value': '+'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '88', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '90', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'assignment', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'mostLikelyCategoryIdx'}; {'id': '94', 'type': 'call', 'children': ['95', '98']}; {'id': '95', 'type': 'attribute', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'stepProbabilities'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'argmax'}; {'id': '98', 'type': 'argument_list', 'children': []}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'predictedValue'}; {'id': '102', 'type': 'subscript', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'actualValues'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'mostLikelyCategoryIdx'}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'predictionConfidence'}; {'id': '108', 'type': 'subscript', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'stepProbabilities'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'mostLikelyCategoryIdx'}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'assignment', 'children': ['113', '120']}; {'id': '113', 'type': 'subscript', 'children': ['114', '119']}; {'id': '114', 'type': 'subscript', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '116', 'type': 'subscript', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'steps'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '119', 'type': 'string', 'children': [], 'value': '"predictedValue"'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'predictedValue'}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'assignment', 'children': ['123', '130']}; {'id': '123', 'type': 'subscript', 'children': ['124', '129']}; {'id': '124', 'type': 'subscript', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '126', 'type': 'subscript', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'steps'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '129', 'type': 'string', 'children': [], 'value': '"predictionConfidence"'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'predictionConfidence'}; {'id': '131', 'type': 'return_statement', 'children': ['132']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'results'}
|
Get prediction results for all prediction steps.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shutdown_check_handler'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '9']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'http://169.254.169.254/latest/meta-data/spot/instance-action'"}; {'id': '9', 'type': 'try_statement', 'children': ['10', '86', '100']}; {'id': '10', 'type': 'block', 'children': ['11', '23', '29', '37']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '22', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'raise_for_status'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'stopinfo'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'if_statement', 'children': ['38', '50', '76']}; {'id': '38', 'type': 'boolean_operator', 'children': ['39', '42'], 'value': 'and'}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '41'], 'value': 'in'}; {'id': '40', 'type': 'string', 'children': [], 'value': "'action'"}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'stopinfo'}; {'id': '42', 'type': 'comparison_operator', 'children': ['43', '46'], 'value': 'in'}; {'id': '43', 'type': 'subscript', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'stopinfo'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'action'"}; {'id': '46', 'type': 'tuple', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'string', 'children': [], 'value': "'stop'"}; {'id': '48', 'type': 'string', 'children': [], 'value': "'terminate'"}; {'id': '49', 'type': 'string', 'children': [], 'value': "'hibernate'"}; {'id': '50', 'type': 'block', 'children': ['51', '57', '68', '74']}; {'id': '51', 'type': 'expression_statement', 'children': ['52']}; {'id': '52', 'type': 'assignment', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'stoptime'}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'stopinfo'}; {'id': '56', 'type': 'string', 'children': [], 'value': "'time'"}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'LOGWARNING'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '%'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'instance is going to %s at %s'"}; {'id': '63', 'type': 'tuple', 'children': ['64', '67']}; {'id': '64', 'type': 'subscript', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'stopinfo'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'action'"}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'stoptime'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'call', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '73', 'type': 'argument_list', 'children': []}; {'id': '74', 'type': 'return_statement', 'children': ['75']}; {'id': '75', 'type': 'True', 'children': []}; {'id': '76', 'type': 'else_clause', 'children': ['77']}; {'id': '77', 'type': 'block', 'children': ['78', '84']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '83', 'type': 'argument_list', 'children': []}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'False', 'children': []}; {'id': '86', 'type': 'except_clause', 'children': ['87', '91']}; {'id': '87', 'type': 'as_pattern', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'HTTPError'}; {'id': '89', 'type': 'as_pattern_target', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '91', 'type': 'block', 'children': ['92', '98']}; {'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': 'resp'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '97', 'type': 'argument_list', 'children': []}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': 'False', 'children': []}; {'id': '100', 'type': 'except_clause', 'children': ['101', '105']}; {'id': '101', 'type': 'as_pattern', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '103', 'type': 'as_pattern_target', 'children': ['104']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '105', 'type': 'block', 'children': ['106', '112']}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'call', 'children': ['108', '111']}; {'id': '108', 'type': 'attribute', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'resp'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '111', 'type': 'argument_list', 'children': []}; {'id': '112', 'type': 'return_statement', 'children': ['113']}; {'id': '113', 'type': 'False', 'children': []}
|
This checks the AWS instance data URL to see if there's a pending
shutdown for the instance.
This is useful for AWS spot instances. If there is a pending shutdown posted
to the instance data URL, we'll use the result of this function break out of
the processing loop and shut everything down ASAP before the instance dies.
Returns
-------
bool
- True if the instance is going to die soon.
- False if the instance is still safe.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getrowcount'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'id': '7', 'type': 'block', 'children': ['8', '18', '31']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'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_object_handle'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'id': '18', 'type': 'if_statement', 'children': ['19', '23']}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'AXEnabled'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'LdtpServerException'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'binary_operator', 'children': ['29', '30'], 'value': '%'}; {'id': '29', 'type': 'string', 'children': [], 'value': 'u"Object %s state disabled"'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'AXRows'}
|
Get count of rows in table object.
@param window_name: Window name to look for, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to look for, either full name,
LDTP's name convention, or a Unix glob. Or menu heirarchy
@type object_name: string
@return: Number of rows.
@rtype: integer
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'mark_read'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '19']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'BackendClass'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'stored_messages_settings'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'STORAGE_BACKEND'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'BackendClass'}; {'id': '18', 'type': 'argument_list', 'children': []}; {'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': 'backend'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'inbox_delete'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'message'}
|
Mark message instance as read for user.
Returns True if the message was `unread` and thus actually marked as `read` or False in case
it is already `read` or it does not exist at all.
:param user: user instance for the recipient
:param message: a Message instance to mark as read
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update_transmissions'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item_map'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'transmission_map'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'for_statement', 'children': ['9', '12', '17']}; {'id': '9', 'type': 'pattern_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'content_id'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'channel_metadata'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item_map'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '16', 'type': 'argument_list', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '24', '30']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'transmission'}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'transmission_map'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'content_id'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'transmission'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'channel_metadata'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'channel_metadata'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'transmission'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'save'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
Update ContentMetadataItemTransmision models for the given content metadata items.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_review_date'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'doc'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'reviewed'}; {'id': '7', 'type': 'block', 'children': ['8']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '17', '71']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '16'], 'value': '!='}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '12', 'type': 'argument_list', 'children': ['13']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'doc'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'reviews'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'if_statement', 'children': ['19', '23', '64']}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'review_date_set'}; {'id': '23', 'type': 'block', 'children': ['24', '30', '39']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'review_date_set'}; {'id': '29', 'type': 'True', 'children': []}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'datetime_from_iso_format'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'reviewed'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43', '57']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': 'is not'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '42', 'type': 'None', 'children': []}; {'id': '43', 'type': 'block', 'children': ['44', '55']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '54']}; {'id': '46', 'type': 'attribute', 'children': ['47', '53']}; {'id': '47', 'type': 'subscript', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'doc'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'reviews'}; {'id': '51', 'type': 'unary_operator', 'children': ['52'], 'value': '-'}; {'id': '52', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'review_date'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'date'}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'True', 'children': []}; {'id': '57', 'type': 'else_clause', 'children': ['58']}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'raise_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'SPDXValueError'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'string', 'children': [], 'value': "'Review::ReviewDate'"}; {'id': '64', 'type': 'else_clause', 'children': ['65']}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'raise_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'CardinalityError'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'string', 'children': [], 'value': "'Review::ReviewDate'"}; {'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': 'OrderError'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'string', 'children': [], 'value': "'Review::ReviewDate'"}
|
Sets the review date. Raises CardinalityError if
already set. OrderError if no reviewer defined before.
Raises SPDXValueError if invalid reviewed value.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_discover_via_entrypoints'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '18']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'emgr'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'ExtensionManager'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'PLUGIN_EP'}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'invoke_on_load'}; {'id': '17', 'type': 'False', 'children': []}; {'id': '18', 'type': 'return_statement', 'children': ['19']}; {'id': '19', 'type': 'generator_expression', 'children': ['20', '27']}; {'id': '20', 'type': 'tuple', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'plugin'}; {'id': '27', 'type': 'for_in_clause', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ext'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'emgr'}
|
Looks for modules with amtching entry points.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'default'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '15', '22', '35', '50', '75', '99']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ndarray'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'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': 'obj'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'tolist'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'elif_clause', 'children': ['23', '28']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'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': 'obj'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'elif_clause', 'children': ['36', '41']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'complex'}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'tuple', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'real'}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'imag'}; {'id': '50', 'type': 'elif_clause', 'children': ['51', '72']}; {'id': '51', 'type': '()', 'children': ['52']}; {'id': '52', 'type': 'boolean_operator', 'children': ['53', '65'], 'value': 'and'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '57', 'type': 'tuple', 'children': ['58', '59', '62']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'float64'}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'float_'}; {'id': '65', 'type': 'not_operator', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'isfinite'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'return_statement', 'children': ['74']}; {'id': '74', 'type': 'None', 'children': []}; {'id': '75', 'type': 'elif_clause', 'children': ['76', '93']}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '80', 'type': 'tuple', 'children': ['81', '84', '87', '90']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'int8'}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'int16'}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'int32'}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'int64'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'return_statement', 'children': ['95']}; {'id': '95', 'type': 'call', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '99', 'type': 'else_clause', 'children': ['100']}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'return_statement', 'children': ['102']}; {'id': '102', 'type': 'call', 'children': ['103', '108']}; {'id': '103', 'type': 'attribute', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'JSONEncoder'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'default'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'obj'}
|
Overrides the default serializer for `JSONEncoder`.
This can serialize the following objects in addition to what
`JSONEncoder` can already do.
- `np.array`
- `bytes`
- `complex`
- `np.float64` and other `np.dtype` objects
Parameters
----------
obj : object
A Python object to serialize to JSON.
Returns
-------
str
A JSON encoded representation of the input object.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'ping'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '25', '31']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '__validate_ping_param'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ping_proc'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'subprocrunner'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'SubprocessRunner'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '__get_ping_command'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ping_proc'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'PingResult'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '38', '41']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'ping_proc'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'ping_proc'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'ping_proc'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'returncode'}
|
Sending ICMP packets.
:return: ``ping`` command execution result.
:rtype: :py:class:`.PingResult`
:raises ValueError: If parameters not valid.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'distrib_id'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5']}; {'id': '5', 'type': 'with_statement', 'children': ['6', '16']}; {'id': '6', 'type': 'with_clause', 'children': ['7']}; {'id': '7', 'type': 'with_item', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'hide'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'string', 'children': [], 'value': "'running'"}; {'id': '15', 'type': 'string', 'children': [], 'value': "'stdout'"}; {'id': '16', 'type': 'block', 'children': ['17', '35']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'kernel'}; {'id': '20', 'type': 'call', 'children': ['21', '34']}; {'id': '21', 'type': 'attribute', 'children': ['22', '33']}; {'id': '22', 'type': 'call', 'children': ['23', '32']}; {'id': '23', 'type': 'attribute', 'children': ['24', '31']}; {'id': '24', 'type': '()', 'children': ['25']}; {'id': '25', 'type': 'boolean_operator', 'children': ['26', '30'], 'value': 'or'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'uname -s'"}; {'id': '30', 'type': 'string', 'children': [], 'value': "''"}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'if_statement', 'children': ['36', '39', '151']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': '=='}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'kernel'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'LINUX'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'if_statement', 'children': ['41', '45', '74']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'/usr/bin/lsb_release'"}; {'id': '45', 'type': 'block', 'children': ['46', '61', '72']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '49', 'type': 'call', 'children': ['50', '60']}; {'id': '50', 'type': 'attribute', 'children': ['51', '59']}; {'id': '51', 'type': 'call', 'children': ['52', '58']}; {'id': '52', 'type': 'attribute', 'children': ['53', '57']}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'string', 'children': [], 'value': "'lsb_release --id --short'"}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '58', 'type': 'argument_list', 'children': []}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '60', 'type': 'argument_list', 'children': []}; {'id': '61', 'type': 'if_statement', 'children': ['62', '67']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '64'], 'value': 'in'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '64', 'type': 'list', 'children': ['65', '66'], 'value': "['arch', 'archlinux']"}; {'id': '65', 'type': 'string', 'children': [], 'value': "'arch'"}; {'id': '66', 'type': 'string', 'children': [], 'value': "'archlinux'"}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'ARCH'}; {'id': '72', 'type': 'return_statement', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '74', 'type': 'else_clause', 'children': ['75']}; {'id': '75', 'type': 'block', 'children': ['76']}; {'id': '76', 'type': 'if_statement', 'children': ['77', '81', '84', '92', '100', '143']}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'string', 'children': [], 'value': "'/etc/debian_version'"}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'return_statement', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'DEBIAN'}; {'id': '84', 'type': 'elif_clause', 'children': ['85', '89']}; {'id': '85', 'type': 'call', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'string', 'children': [], 'value': "'/etc/fedora-release'"}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'return_statement', 'children': ['91']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'FEDORA'}; {'id': '92', 'type': 'elif_clause', 'children': ['93', '97']}; {'id': '93', 'type': 'call', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'string', 'children': [], 'value': "'/etc/arch-release'"}; {'id': '97', 'type': 'block', 'children': ['98']}; {'id': '98', 'type': 'return_statement', 'children': ['99']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'ARCH'}; {'id': '100', 'type': 'elif_clause', 'children': ['101', '105']}; {'id': '101', 'type': 'call', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '103', 'type': 'argument_list', 'children': ['104']}; {'id': '104', 'type': 'string', 'children': [], 'value': "'/etc/redhat-release'"}; {'id': '105', 'type': 'block', 'children': ['106', '113']}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'release'}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '111', 'type': 'argument_list', 'children': ['112']}; {'id': '112', 'type': 'string', 'children': [], 'value': "'cat /etc/redhat-release'"}; {'id': '113', 'type': 'if_statement', 'children': ['114', '120', '123', '133']}; {'id': '114', 'type': 'call', 'children': ['115', '118']}; {'id': '115', 'type': 'attribute', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'release'}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '118', 'type': 'argument_list', 'children': ['119']}; {'id': '119', 'type': 'string', 'children': [], 'value': "'Red Hat Enterprise Linux'"}; {'id': '120', 'type': 'block', 'children': ['121']}; {'id': '121', 'type': 'return_statement', 'children': ['122']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'REDHAT'}; {'id': '123', 'type': 'elif_clause', 'children': ['124', '130']}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'release'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '128', 'type': 'argument_list', 'children': ['129']}; {'id': '129', 'type': 'string', 'children': [], 'value': "'CentOS'"}; {'id': '130', 'type': 'block', 'children': ['131']}; {'id': '131', 'type': 'return_statement', 'children': ['132']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'CENTOS'}; {'id': '133', 'type': 'elif_clause', 'children': ['134', '140']}; {'id': '134', 'type': 'call', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'release'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '138', 'type': 'argument_list', 'children': ['139']}; {'id': '139', 'type': 'string', 'children': [], 'value': "'Scientific Linux'"}; {'id': '140', 'type': 'block', 'children': ['141']}; {'id': '141', 'type': 'return_statement', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'SLES'}; {'id': '143', 'type': 'elif_clause', 'children': ['144', '148']}; {'id': '144', 'type': 'call', 'children': ['145', '146']}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'is_file'}; {'id': '146', 'type': 'argument_list', 'children': ['147']}; {'id': '147', 'type': 'string', 'children': [], 'value': "'/etc/gentoo-release'"}; {'id': '148', 'type': 'block', 'children': ['149']}; {'id': '149', 'type': 'return_statement', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'GENTOO'}; {'id': '151', 'type': 'elif_clause', 'children': ['152', '155']}; {'id': '152', 'type': 'comparison_operator', 'children': ['153', '154'], 'value': '=='}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'kernel'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'SUNOS'}; {'id': '155', 'type': 'block', 'children': ['156']}; {'id': '156', 'type': 'return_statement', 'children': ['157']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'SUNOS'}
|
Get the OS distribution ID.
Example::
from burlap.system import distrib_id
if distrib_id() != 'Debian':
abort(u"Distribution is not supported")
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'close'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '25']}; {'id': '7', 'type': 'block', 'children': ['8', '16']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '15']}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'conn'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'string', 'children': [], 'value': '"Close connect succeed."'}; {'id': '25', 'type': 'except_clause', 'children': ['26', '32']}; {'id': '26', 'type': 'as_pattern', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'pymssql'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'Error'}; {'id': '30', 'type': 'as_pattern_target', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'e'}; {'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': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'unknown'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'binary_operator', 'children': ['40', '41'], 'value': '%'}; {'id': '40', 'type': 'string', 'children': [], 'value': '"Close connect error: %s"'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'e'}
|
Close the connection.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_allowed'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'return_statement', 'children': ['10']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '15'], 'value': 'in'}; {'id': '11', 'type': 'tuple', 'children': ['12', '13', '14']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'role'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_allowed'}
|
Check whether role is allowed to access resource
:param role: Role to be checked.
:param method: Method to be checked.
:param resource: View function to be checked.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_changeset'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'changeset'}; {'id': '5', 'type': 'block', 'children': ['6', '15']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'https://www.openstreetmap.org/api/0.6/changeset/{}/download'"}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'changeset'}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ET'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'fromstring'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '28']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'content'}
|
Get the changeset using the OSM API and return the content as a XML
ElementTree.
Args:
changeset: the id of the changeset.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'disable_FTDI_driver'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '12']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'call', 'children': ['7', '10']}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'Disabling FTDI driver.'"}; {'id': '12', 'type': 'if_statement', 'children': ['13', '18', '50']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '17'], 'value': '=='}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'platform'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'darwin'"}; {'id': '18', 'type': 'block', 'children': ['19', '26', '30', '40']}; {'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': 'logger'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'Detected Mac OSX'"}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_check_running_as_root'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'kextunload -b com.apple.driver.AppleUSBFTDI'"}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '39', 'type': 'True', 'children': []}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'string', 'children': [], 'value': "'kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext'"}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '49', 'type': 'True', 'children': []}; {'id': '50', 'type': 'elif_clause', 'children': ['51', '59']}; {'id': '51', 'type': 'call', 'children': ['52', '57']}; {'id': '52', 'type': 'attribute', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'platform'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '57', 'type': 'argument_list', 'children': ['58']}; {'id': '58', 'type': 'string', 'children': [], 'value': "'linux'"}; {'id': '59', 'type': 'block', 'children': ['60', '67', '71', '81']}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'string', 'children': [], 'value': "'Detected Linux'"}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': '_check_running_as_root'}; {'id': '70', 'type': 'argument_list', 'children': []}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '76', 'type': 'argument_list', 'children': ['77', '78']}; {'id': '77', 'type': 'string', 'children': [], 'value': "'modprobe -r -q ftdi_sio'"}; {'id': '78', 'type': 'keyword_argument', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '80', 'type': 'True', 'children': []}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'call', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'string', 'children': [], 'value': "'modprobe -r -q usbserial'"}; {'id': '88', 'type': 'keyword_argument', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'shell'}; {'id': '90', 'type': 'True', 'children': []}
|
Disable the FTDI drivers for the current platform. This is necessary
because they will conflict with libftdi and accessing the FT232H. Note you
can enable the FTDI drivers again by calling enable_FTDI_driver.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_ConvertValueMessage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13', '22', '37', '48', '61', '76', '89']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_ConvertStructMessage'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'struct_value'}; {'id': '22', 'type': 'elif_clause', 'children': ['23', '28']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_ConvertListValueMessage'}; {'id': '32', 'type': 'argument_list', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'list_value'}; {'id': '37', 'type': 'elif_clause', 'children': ['38', '41']}; {'id': '38', 'type': 'comparison_operator', 'children': ['39', '40'], 'value': 'is'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '40', 'type': 'None', 'children': []}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'null_value'}; {'id': '47', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '48', 'type': 'elif_clause', 'children': ['49', '54']}; {'id': '49', 'type': 'call', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '51', 'type': 'argument_list', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'bool'}; {'id': '54', 'type': 'block', 'children': ['55']}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'bool_value'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '61', 'type': 'elif_clause', 'children': ['62', '69']}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '64', 'type': 'argument_list', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '66', 'type': 'attribute', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'six'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'string_types'}; {'id': '69', 'type': 'block', 'children': ['70']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'string_value'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '76', 'type': 'elif_clause', 'children': ['77', '82']}; {'id': '77', 'type': 'call', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': '_INT_OR_FLOAT'}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '88']}; {'id': '85', 'type': 'attribute', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'number_value'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '89', 'type': 'else_clause', 'children': ['90']}; {'id': '90', 'type': 'block', 'children': ['91']}; {'id': '91', 'type': 'raise_statement', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'ParseError'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'string', 'children': [], 'value': "'Unexpected type for Value message.'"}
|
Convert a JSON representation into Value message.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'enbw'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '15']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '27'], 'value': '/'}; {'id': '17', 'type': 'binary_operator', 'children': ['18', '19'], 'value': '*'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '26'], 'value': '**'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '34'], 'value': '**'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '2'}
|
r"""Computes the equivalent noise bandwidth
.. math:: ENBW = N \frac{\sum_{n=1}^{N} w_n^2}{\left(\sum_{n=1}^{N} w_n \right)^2}
.. doctest::
>>> from spectrum import create_window, enbw
>>> w = create_window(64, 'rectangular')
>>> enbw(w)
1.0
The following table contains the ENBW values for some of the
implemented windows in this module (with N=16384). They have been
double checked against litterature (Source: [Harris]_, [Marple]_).
If not present, it means that it has not been checked.
=================== ============ =============
name ENBW litterature
=================== ============ =============
rectangular 1. 1.
triangle 1.3334 1.33
Hann 1.5001 1.5
Hamming 1.3629 1.36
blackman 1.7268 1.73
kaiser 1.7
blackmanharris,4 2.004 2.
riesz 1.2000 1.2
riemann 1.32 1.3
parzen 1.917 1.92
tukey 0.25 1.102 1.1
bohman 1.7858 1.79
poisson 2 1.3130 1.3
hanningpoisson 0.5 1.609 1.61
cauchy 1.489 1.48
lanczos 1.3
=================== ============ =============
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_docker_client'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '11', '27', '46', '104']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'get_docker_env'}; {'id': '10', 'type': 'argument_list', 'children': []}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '17']}; {'id': '13', 'type': 'pattern_list', 'children': ['14', '15', '16']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'cert_path'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'tls_verify'}; {'id': '17', 'type': 'expression_list', 'children': ['18', '21', '24']}; {'id': '18', 'type': 'subscript', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'DOCKER_HOST'"}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '23', 'type': 'string', 'children': [], 'value': "'DOCKER_CERT_PATH'"}; {'id': '24', 'type': 'subscript', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'env'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'DOCKER_TLS_VERIFY'"}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '30', 'type': 'dictionary', 'children': ['31', '40', '43']}; {'id': '31', 'type': 'pair', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': "'base_url'"}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'replace'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': "'tcp://'"}; {'id': '39', 'type': 'string', 'children': [], 'value': "'https://'"}; {'id': '40', 'type': 'pair', 'children': ['41', '42']}; {'id': '41', 'type': 'string', 'children': [], 'value': "'timeout'"}; {'id': '42', 'type': 'None', 'children': []}; {'id': '43', 'type': 'pair', 'children': ['44', '45']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'version'"}; {'id': '45', 'type': 'string', 'children': [], 'value': "'auto'"}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'boolean_operator', 'children': ['48', '49'], 'value': 'and'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'tls_verify'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'cert_path'}; {'id': '50', 'type': 'block', 'children': ['51']}; {'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': 'params'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'tls'"}; {'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': 'docker'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'tls'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'TLSConfig'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '84', '95', '98', '101']}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'client_cert'}; {'id': '65', 'type': 'tuple', 'children': ['66', '75']}; {'id': '66', 'type': 'call', 'children': ['67', '72']}; {'id': '67', 'type': 'attribute', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'cert_path'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'cert.pem'"}; {'id': '75', 'type': 'call', 'children': ['76', '81']}; {'id': '76', 'type': 'attribute', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'cert_path'}; {'id': '83', 'type': 'string', 'children': [], 'value': "'key.pem'"}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'ca_cert'}; {'id': '86', 'type': 'call', 'children': ['87', '92']}; {'id': '87', 'type': 'attribute', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '92', 'type': 'argument_list', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'cert_path'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'ca.pem'"}; {'id': '95', 'type': 'keyword_argument', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'verify'}; {'id': '97', 'type': 'True', 'children': []}; {'id': '98', 'type': 'keyword_argument', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'ssl_version'}; {'id': '100', 'type': 'None', 'children': []}; {'id': '101', 'type': 'keyword_argument', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'assert_hostname'}; {'id': '103', 'type': 'False', 'children': []}; {'id': '104', 'type': 'return_statement', 'children': ['105']}; {'id': '105', 'type': 'call', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'docker'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'Client'}; {'id': '109', 'type': 'argument_list', 'children': ['110']}; {'id': '110', 'type': 'dictionary_splat', 'children': ['111']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'params'}
|
Ripped off and slightly modified based on docker-py's
kwargs_from_env utility function.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'merge_ndx'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '15', '50', '66', '73', '83', '119', '138']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'ndxs'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'for_statement', 'children': ['16', '17', '18']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'if_statement', 'children': ['20', '26', '34']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'string', 'children': [], 'value': "'.ndx'"}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'ndxs'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '34', 'type': 'else_clause', 'children': ['35']}; {'id': '35', 'type': 'block', 'children': ['36', '46']}; {'id': '36', 'type': 'if_statement', 'children': ['37', '40']}; {'id': '37', 'type': 'comparison_operator', 'children': ['38', '39'], 'value': 'is not'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '39', 'type': 'None', 'children': []}; {'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': '"only one structure file supported"'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'fname'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '55']}; {'id': '52', 'type': 'pattern_list', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'fd'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'multi_ndx'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'tempfile'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'mkstemp'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '63']}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'.ndx'"}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'prefix'}; {'id': '65', 'type': 'string', 'children': [], 'value': "'multi_'"}; {'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': 'os'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'fd'}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'atexit'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'register'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'unlink'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'multi_ndx'}; {'id': '83', 'type': 'if_statement', 'children': ['84', '85', '103']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '85', 'type': 'block', 'children': ['86']}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'make_ndx'}; {'id': '89', 'type': 'call', 'children': ['90', '93']}; {'id': '90', 'type': 'subscript', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'registry'}; {'id': '92', 'type': 'string', 'children': [], 'value': "'Make_ndx'"}; {'id': '93', 'type': 'argument_list', 'children': ['94', '97', '100']}; {'id': '94', 'type': 'keyword_argument', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '97', 'type': 'keyword_argument', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'ndxs'}; {'id': '100', 'type': 'keyword_argument', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'multi_ndx'}; {'id': '103', 'type': 'else_clause', 'children': ['104']}; {'id': '104', 'type': 'block', 'children': ['105']}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'make_ndx'}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'subscript', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'registry'}; {'id': '111', 'type': 'string', 'children': [], 'value': "'Make_ndx'"}; {'id': '112', 'type': 'argument_list', 'children': ['113', '116']}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'ndxs'}; {'id': '116', 'type': 'keyword_argument', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'multi_ndx'}; {'id': '119', 'type': 'expression_statement', 'children': ['120']}; {'id': '120', 'type': 'assignment', 'children': ['121', '125']}; {'id': '121', 'type': 'pattern_list', 'children': ['122', '123', '124']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '125', 'type': 'call', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'make_ndx'}; {'id': '127', 'type': 'argument_list', 'children': ['128', '132', '135']}; {'id': '128', 'type': 'keyword_argument', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'input'}; {'id': '130', 'type': 'list', 'children': ['131'], 'value': "['q']"}; {'id': '131', 'type': 'string', 'children': [], 'value': "'q'"}; {'id': '132', 'type': 'keyword_argument', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '134', 'type': 'False', 'children': []}; {'id': '135', 'type': 'keyword_argument', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'stderr'}; {'id': '137', 'type': 'False', 'children': []}; {'id': '138', 'type': 'return_statement', 'children': ['139']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'multi_ndx'}
|
Takes one or more index files and optionally one structure file and
returns a path for a new merged index file.
:param args: index files and zero or one structure file
:return: path for the new merged index file
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'CanonicalPath'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'block', 'children': ['6', '17', '28', '39']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '9', 'type': 'call', 'children': ['10', '15']}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'normpath'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '31', 'type': 'call', 'children': ['32', '37']}; {'id': '32', 'type': 'attribute', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'normcase'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '39', 'type': 'return_statement', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'path'}
|
Returns a version of a path that is unique.
Given two paths path1 and path2:
CanonicalPath(path1) == CanonicalPath(path2) if and only if they represent the same file on
the host OS. Takes account of case, slashes and relative paths.
:param unicode path:
The original path.
:rtype: unicode
:returns:
The unique path.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_sasl_authenticate'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'authzid'}; {'id': '8', 'type': 'block', 'children': ['9', '22', '39', '48', '78', '89', '100', '117', '125', '144', '153', '159', '163', '179', '190', '202', '208', '219', '230', '245', '254', '262', '292']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '14']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'initiator'}; {'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': 'SASLAuthenticationFailed'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'concatenated_string', 'children': ['20', '21']}; {'id': '20', 'type': 'string', 'children': [], 'value': '"Only initiating entity start"'}; {'id': '21', 'type': 'string', 'children': [], 'value': '" SASL authentication"'}; {'id': '22', 'type': 'if_statement', 'children': ['23', '33']}; {'id': '23', 'type': 'boolean_operator', 'children': ['24', '29'], 'value': 'or'}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '28'], 'value': 'is'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'features'}; {'id': '28', 'type': 'None', 'children': []}; {'id': '29', 'type': 'not_operator', 'children': ['30']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'peer_sasl_mechanisms'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'raise_statement', 'children': ['35']}; {'id': '35', 'type': 'call', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'SASLNotAvailable'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'string', 'children': [], 'value': '"Peer doesn\'t support SASL"'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'auth_properties'}; {'id': '48', 'type': 'if_statement', 'children': ['49', '67']}; {'id': '49', 'type': 'boolean_operator', 'children': ['50', '57'], 'value': 'and'}; {'id': '50', 'type': 'not_operator', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'string', 'children': [], 'value': '"service-domain"'}; {'id': '57', 'type': '()', 'children': ['58']}; {'id': '58', 'type': 'boolean_operator', 'children': ['59', '62'], 'value': 'and'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'peer'}; {'id': '62', 'type': 'attribute', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'peer'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'domain'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '73']}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '72', 'type': 'string', 'children': [], 'value': '"service-domain"'}; {'id': '73', 'type': 'attribute', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'peer'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'domain'}; {'id': '78', 'type': 'if_statement', 'children': ['79', '82']}; {'id': '79', 'type': 'comparison_operator', 'children': ['80', '81'], 'value': 'is not'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '81', 'type': 'None', 'children': []}; {'id': '82', 'type': 'block', 'children': ['83']}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '88']}; {'id': '85', 'type': 'subscript', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '87', 'type': 'string', 'children': [], 'value': '"username"'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '89', 'type': 'if_statement', 'children': ['90', '93']}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '92'], 'value': 'is not'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'authzid'}; {'id': '92', 'type': 'None', 'children': []}; {'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': 'props'}; {'id': '98', 'type': 'string', 'children': [], 'value': '"authzid"'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'authzid'}; {'id': '100', 'type': 'if_statement', 'children': ['101', '106']}; {'id': '101', 'type': 'comparison_operator', 'children': ['102', '103'], 'value': 'in'}; {'id': '102', 'type': 'string', 'children': [], 'value': '"password"'}; {'id': '103', 'type': 'attribute', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '106', 'type': 'block', 'children': ['107']}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'assignment', 'children': ['109', '112']}; {'id': '109', 'type': 'subscript', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '111', 'type': 'string', 'children': [], 'value': '"password"'}; {'id': '112', 'type': 'subscript', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '116', 'type': 'string', 'children': [], 'value': '"password"'}; {'id': '117', 'type': 'expression_statement', 'children': ['118']}; {'id': '118', 'type': 'assignment', 'children': ['119', '122']}; {'id': '119', 'type': 'subscript', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '121', 'type': 'string', 'children': [], 'value': '"available_mechanisms"'}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'peer_sasl_mechanisms'}; {'id': '125', 'type': 'expression_statement', 'children': ['126']}; {'id': '126', 'type': 'assignment', 'children': ['127', '128']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '128', 'type': 'call', 'children': ['129', '132']}; {'id': '129', 'type': 'attribute', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'sasl'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'filter_mechanism_list'}; {'id': '132', 'type': 'argument_list', 'children': ['133', '138', '139']}; {'id': '133', 'type': 'subscript', 'children': ['134', '137']}; {'id': '134', 'type': 'attribute', 'children': ['135', '136']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '137', 'type': 'string', 'children': [], 'value': "'sasl_mechanisms'"}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '139', 'type': 'subscript', 'children': ['140', '143']}; {'id': '140', 'type': 'attribute', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'settings'}; {'id': '143', 'type': 'string', 'children': [], 'value': "'insecure_auth'"}; {'id': '144', 'type': 'if_statement', 'children': ['145', '147']}; {'id': '145', 'type': 'not_operator', 'children': ['146']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '147', 'type': 'block', 'children': ['148']}; {'id': '148', 'type': 'raise_statement', 'children': ['149']}; {'id': '149', 'type': 'call', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'SASLNotAvailable'}; {'id': '151', 'type': 'argument_list', 'children': ['152']}; {'id': '152', 'type': 'string', 'children': [], 'value': '"None of SASL mechanism selected can be used"'}; {'id': '153', 'type': 'expression_statement', 'children': ['154']}; {'id': '154', 'type': 'assignment', 'children': ['155', '158']}; {'id': '155', 'type': 'subscript', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '157', 'type': 'string', 'children': [], 'value': '"enabled_mechanisms"'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '159', 'type': 'expression_statement', 'children': ['160']}; {'id': '160', 'type': 'assignment', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '162', 'type': 'None', 'children': []}; {'id': '163', 'type': 'for_statement', 'children': ['164', '165', '166']}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'mech'}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'enabled'}; {'id': '166', 'type': 'block', 'children': ['167']}; {'id': '167', 'type': 'if_statement', 'children': ['168', '173']}; {'id': '168', 'type': 'comparison_operator', 'children': ['169', '170'], 'value': 'in'}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'mech'}; {'id': '170', 'type': 'attribute', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'peer_sasl_mechanisms'}; {'id': '173', 'type': 'block', 'children': ['174', '178']}; {'id': '174', 'type': 'expression_statement', 'children': ['175']}; {'id': '175', 'type': 'assignment', 'children': ['176', '177']}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'mech'}; {'id': '178', 'type': 'break_statement', 'children': []}; {'id': '179', 'type': 'if_statement', 'children': ['180', '182']}; {'id': '180', 'type': 'not_operator', 'children': ['181']}; {'id': '181', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '182', 'type': 'block', 'children': ['183']}; {'id': '183', 'type': 'raise_statement', 'children': ['184']}; {'id': '184', 'type': 'call', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'SASLMechanismNotAvailable'}; {'id': '186', 'type': 'argument_list', 'children': ['187']}; {'id': '187', 'type': 'concatenated_string', 'children': ['188', '189']}; {'id': '188', 'type': 'string', 'children': [], 'value': '"Peer doesn\'t support any of"'}; {'id': '189', 'type': 'string', 'children': [], 'value': '" our SASL mechanisms"'}; {'id': '190', 'type': 'expression_statement', 'children': ['191']}; {'id': '191', 'type': 'call', 'children': ['192', '195']}; {'id': '192', 'type': 'attribute', 'children': ['193', '194']}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '194', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '195', 'type': 'argument_list', 'children': ['196']}; {'id': '196', 'type': 'call', 'children': ['197', '200']}; {'id': '197', 'type': 'attribute', 'children': ['198', '199']}; {'id': '198', 'type': 'string', 'children': [], 'value': '"Our mechanism: {0!r}"'}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '200', 'type': 'argument_list', 'children': ['201']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '202', 'type': 'expression_statement', 'children': ['203']}; {'id': '203', 'type': 'assignment', 'children': ['204', '207']}; {'id': '204', 'type': 'attribute', 'children': ['205', '206']}; {'id': '205', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '206', 'type': 'identifier', 'children': [], 'value': 'auth_method_used'}; {'id': '207', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '208', 'type': 'expression_statement', 'children': ['209']}; {'id': '209', 'type': 'assignment', 'children': ['210', '213']}; {'id': '210', 'type': 'attribute', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '212', 'type': 'identifier', 'children': [], 'value': 'authenticator'}; {'id': '213', 'type': 'call', 'children': ['214', '217']}; {'id': '214', 'type': 'attribute', 'children': ['215', '216']}; {'id': '215', 'type': 'identifier', 'children': [], 'value': 'sasl'}; {'id': '216', 'type': 'identifier', 'children': [], 'value': 'client_authenticator_factory'}; {'id': '217', 'type': 'argument_list', 'children': ['218']}; {'id': '218', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '219', 'type': 'expression_statement', 'children': ['220']}; {'id': '220', 'type': 'assignment', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '222', 'type': 'call', 'children': ['223', '228']}; {'id': '223', 'type': 'attribute', 'children': ['224', '227']}; {'id': '224', 'type': 'attribute', 'children': ['225', '226']}; {'id': '225', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '226', 'type': 'identifier', 'children': [], 'value': 'authenticator'}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '228', 'type': 'argument_list', 'children': ['229']}; {'id': '229', 'type': 'identifier', 'children': [], 'value': 'props'}; {'id': '230', 'type': 'if_statement', 'children': ['231', '239']}; {'id': '231', 'type': 'not_operator', 'children': ['232']}; {'id': '232', 'type': 'call', 'children': ['233', '234']}; {'id': '233', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '234', 'type': 'argument_list', 'children': ['235', '236']}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '236', 'type': 'attribute', 'children': ['237', '238']}; {'id': '237', 'type': 'identifier', 'children': [], 'value': 'sasl'}; {'id': '238', 'type': 'identifier', 'children': [], 'value': 'Response'}; {'id': '239', 'type': 'block', 'children': ['240']}; {'id': '240', 'type': 'raise_statement', 'children': ['241']}; {'id': '241', 'type': 'call', 'children': ['242', '243']}; {'id': '242', 'type': 'identifier', 'children': [], 'value': 'SASLAuthenticationFailed'}; {'id': '243', 'type': 'argument_list', 'children': ['244']}; {'id': '244', 'type': 'string', 'children': [], 'value': '"SASL initiation failed"'}; {'id': '245', 'type': 'expression_statement', 'children': ['246']}; {'id': '246', 'type': 'assignment', 'children': ['247', '248']}; {'id': '247', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '248', 'type': 'call', 'children': ['249', '252']}; {'id': '249', 'type': 'attribute', 'children': ['250', '251']}; {'id': '250', 'type': 'identifier', 'children': [], 'value': 'ElementTree'}; {'id': '251', 'type': 'identifier', 'children': [], 'value': 'Element'}; {'id': '252', 'type': 'argument_list', 'children': ['253']}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'AUTH_TAG'}; {'id': '254', 'type': 'expression_statement', 'children': ['255']}; {'id': '255', 'type': 'call', 'children': ['256', '259']}; {'id': '256', 'type': 'attribute', 'children': ['257', '258']}; {'id': '257', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '258', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '259', 'type': 'argument_list', 'children': ['260', '261']}; {'id': '260', 'type': 'string', 'children': [], 'value': '"mechanism"'}; {'id': '261', 'type': 'identifier', 'children': [], 'value': 'mechanism'}; {'id': '262', 'type': 'if_statement', 'children': ['263', '266']}; {'id': '263', 'type': 'attribute', 'children': ['264', '265']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '266', 'type': 'block', 'children': ['267']}; {'id': '267', 'type': 'if_statement', 'children': ['268', '271', '282']}; {'id': '268', 'type': 'attribute', 'children': ['269', '270']}; {'id': '269', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '271', 'type': 'block', 'children': ['272']}; {'id': '272', 'type': 'expression_statement', 'children': ['273']}; {'id': '273', 'type': 'assignment', 'children': ['274', '277']}; {'id': '274', 'type': 'attribute', 'children': ['275', '276']}; {'id': '275', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '276', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '277', 'type': 'call', 'children': ['278', '281']}; {'id': '278', 'type': 'attribute', 'children': ['279', '280']}; {'id': '279', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '280', 'type': 'identifier', 'children': [], 'value': 'encode'}; {'id': '281', 'type': 'argument_list', 'children': []}; {'id': '282', 'type': 'else_clause', 'children': ['283']}; {'id': '283', 'type': 'block', 'children': ['284']}; {'id': '284', 'type': 'expression_statement', 'children': ['285']}; {'id': '285', 'type': 'assignment', 'children': ['286', '289']}; {'id': '286', 'type': 'attribute', 'children': ['287', '288']}; {'id': '287', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '288', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '289', 'type': 'attribute', 'children': ['290', '291']}; {'id': '290', 'type': 'identifier', 'children': [], 'value': 'initial_response'}; {'id': '291', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '292', 'type': 'expression_statement', 'children': ['293']}; {'id': '293', 'type': 'call', 'children': ['294', '297']}; {'id': '294', 'type': 'attribute', 'children': ['295', '296']}; {'id': '295', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '296', 'type': 'identifier', 'children': [], 'value': 'write_element'}; {'id': '297', 'type': 'argument_list', 'children': ['298']}; {'id': '298', 'type': 'identifier', 'children': [], 'value': 'element'}
|
Start SASL authentication process.
[initiating entity only]
:Parameters:
- `username`: user name.
- `authzid`: authorization ID.
- `mechanism`: SASL mechanism to use.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'color_from_hex'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '5', 'type': 'block', 'children': ['6', '25', '36']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '14', '15']}; {'id': '7', 'type': 'ERROR', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '9', 'type': 'subscript', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '11', 'type': 'slice', 'children': ['12', '13']}; {'id': '12', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '13', 'type': 'colon', 'children': []}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'try'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'unhexed'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'fromhex'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28', '30']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'except'}; {'id': '28', 'type': 'type', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'unhexed'}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'binascii'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'unhexlify'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '36', 'type': 'return_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'color_from_rgb'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'list_splat', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'struct'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'unpack'}; {'id': '45', 'type': 'argument_list', 'children': ['46', '47']}; {'id': '46', 'type': 'string', 'children': [], 'value': "'BBB'"}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'unhexed'}
|
Takes an HTML hex code
and converts it to a proper hue value
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dump'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '10', '13']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '7', 'type': 'attribute', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'use_yaml'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'dictionary_splat_pattern', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'kwds'}; {'id': '15', 'type': 'block', 'children': ['16', '25', '63', '76', '118']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '20']}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': 'is'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'use_yaml'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'use_yaml'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ALWAYS_DUMP_YAML'}; {'id': '25', 'type': 'function_definition', 'children': ['26', '27', '29']}; {'id': '26', 'type': 'function_name', 'children': [], 'value': 'dump'}; {'id': '27', 'type': 'parameters', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '32', '45']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'use_yaml'}; {'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': 'yaml'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'safe_dump'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '40', '43']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '43', 'type': 'dictionary_splat', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'kwds'}; {'id': '45', 'type': 'else_clause', 'children': ['46']}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'dump'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54', '55', '58', '61']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '58', 'type': 'keyword_argument', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'sort_keys'}; {'id': '60', 'type': 'True', 'children': []}; {'id': '61', 'type': 'dictionary_splat', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'kwds'}; {'id': '63', 'type': 'if_statement', 'children': ['64', '70']}; {'id': '64', 'type': 'not_operator', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'return_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dump'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '76', 'type': 'if_statement', 'children': ['77', '85']}; {'id': '77', 'type': 'call', 'children': ['78', '83']}; {'id': '78', 'type': 'attribute', 'children': ['79', '82']}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'isabs'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '85', 'type': 'block', 'children': ['86', '97']}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '89', 'type': 'call', 'children': ['90', '95']}; {'id': '90', 'type': 'attribute', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'dirname'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '97', 'type': 'if_statement', 'children': ['98', '107']}; {'id': '98', 'type': 'not_operator', 'children': ['99']}; {'id': '99', 'type': 'call', 'children': ['100', '105']}; {'id': '100', 'type': 'attribute', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '105', 'type': 'argument_list', 'children': ['106']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'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': 'os'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'makedirs'}; {'id': '113', 'type': 'argument_list', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '115', 'type': 'keyword_argument', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'exist_ok'}; {'id': '117', 'type': 'True', 'children': []}; {'id': '118', 'type': 'with_statement', 'children': ['119', '129']}; {'id': '119', 'type': 'with_clause', 'children': ['120']}; {'id': '120', 'type': 'with_item', 'children': ['121']}; {'id': '121', 'type': 'as_pattern', 'children': ['122', '127']}; {'id': '122', 'type': 'call', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '124', 'type': 'argument_list', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'file'}; {'id': '126', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '127', 'type': 'as_pattern_target', 'children': ['128']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '129', 'type': 'block', 'children': ['130']}; {'id': '130', 'type': 'return_statement', 'children': ['131']}; {'id': '131', 'type': 'call', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'dump'}; {'id': '133', 'type': 'argument_list', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'fp'}
|
Dumps data as nicely formatted JSON string to a file or file handle
:param dict data: a dictionary to dump
:param file: a filename or file handle to write to
:param kwds: keywords to pass to json.dump
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'oneleft'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'iterations'}; {'id': '8', 'type': 'block', 'children': ['9', '24', '34', '38', '44', '48', '88']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '18']}; {'id': '10', 'type': 'not_operator', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'verifyscrollbarhorizontal'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'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': 'LdtpServerException'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'Object not horizontal scrollbar'"}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'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': '_get_object_handle'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'window_name'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'object_name'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'minValue'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '43'], 'value': '/'}; {'id': '42', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '47', 'type': 'False', 'children': []}; {'id': '48', 'type': 'while_statement', 'children': ['49', '52']}; {'id': '49', 'type': 'comparison_operator', 'children': ['50', '51'], 'value': '<'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'iterations'}; {'id': '52', 'type': 'block', 'children': ['53', '65', '71', '80', '84']}; {'id': '53', 'type': 'if_statement', 'children': ['54', '59']}; {'id': '54', 'type': 'comparison_operator', 'children': ['55', '58'], 'value': '<='}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'AXValue'}; {'id': '58', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'raise_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'LdtpServerException'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'string', 'children': [], 'value': "'Minimum limit reached'"}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'augmented_assignment', 'children': ['67', '70'], 'value': '-='}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'object_handle'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'AXValue'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'minValue'}; {'id': '71', 'type': 'expression_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'binary_operator', 'children': ['78', '79'], 'value': '/'}; {'id': '78', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '83', 'type': 'True', 'children': []}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'augmented_assignment', 'children': ['86', '87'], 'value': '+='}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '87', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '88', 'type': 'if_statement', 'children': ['89', '90', '93']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'flag'}; {'id': '90', 'type': 'block', 'children': ['91']}; {'id': '91', 'type': 'return_statement', 'children': ['92']}; {'id': '92', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '93', 'type': 'else_clause', 'children': ['94']}; {'id': '94', 'type': 'block', 'children': ['95']}; {'id': '95', 'type': 'raise_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'LdtpServerException'}; {'id': '98', 'type': 'argument_list', 'children': ['99']}; {'id': '99', 'type': 'string', 'children': [], 'value': "'Unable to decrease scrollbar'"}
|
Press scrollbar left with number of iterations
@param window_name: Window name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type window_name: string
@param object_name: Object name to type in, either full name,
LDTP's name convention, or a Unix glob.
@type object_name: string
@param interations: iterations to perform on slider increase
@type iterations: integer
@return: 1 on success.
@rtype: integer
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'transform_courserun_description'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '24', '63']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'description_with_locales'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'content_metadata_language_code'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'transform_language_code'}; {'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': 'content_metadata_item'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'content_language'"}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'for_statement', 'children': ['25', '26', '36']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'locale'}; {'id': '26', 'type': 'call', 'children': ['27', '32']}; {'id': '27', 'type': 'attribute', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'enterprise_configuration'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'get_locales'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'default_locale'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'content_metadata_language_code'}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'description_with_locales'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'dictionary', 'children': ['44', '47']}; {'id': '44', 'type': 'pair', 'children': ['45', '46']}; {'id': '45', 'type': 'string', 'children': [], 'value': "'locale'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'locale'}; {'id': '47', 'type': 'pair', 'children': ['48', '49']}; {'id': '48', 'type': 'string', 'children': [], 'value': "'value'"}; {'id': '49', 'type': '()', 'children': ['50']}; {'id': '50', 'type': 'boolean_operator', 'children': ['51', '62'], 'value': 'or'}; {'id': '51', 'type': 'boolean_operator', 'children': ['52', '59'], 'value': 'or'}; {'id': '52', 'type': 'boolean_operator', 'children': ['53', '56'], 'value': 'or'}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'full_description'"}; {'id': '56', 'type': 'subscript', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item'}; {'id': '58', 'type': 'string', 'children': [], 'value': "'short_description'"}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'content_metadata_item'}; {'id': '61', 'type': 'string', 'children': [], 'value': "'title'"}; {'id': '62', 'type': 'string', 'children': [], 'value': "''"}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'description_with_locales'}
|
Return the description of the courserun content item.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'directory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'directory'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'dictionary_splat_pattern', 'children': ['13']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '14', 'type': 'block', 'children': ['15', '28', '47', '59', '82', '98', '122']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '18', 'type': 'conditional_expression', 'children': ['19', '24', '27'], 'value': 'if'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'getcwd'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': 'is'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '31', 'type': 'conditional_expression', 'children': ['32', '33', '36'], 'value': 'if'}; {'id': '32', 'type': 'string', 'children': [], 'value': "''"}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '35'], 'value': 'is'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '35', 'type': 'None', 'children': []}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '+'}; {'id': '37', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '38', 'type': 'subscript', 'children': ['39', '45']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'extension'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'rsplit'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '45', 'type': 'unary_operator', 'children': ['46'], 'value': '-'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '50', 'type': 'binary_operator', 'children': ['51', '58'], 'value': '+'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '57'], 'value': '+'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '54'], 'value': '+'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'directory'}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'sep'}; {'id': '57', 'type': 'string', 'children': [], 'value': "'*'"}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'suffix'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '62', 'type': 'subscript', 'children': ['63', '80']}; {'id': '63', 'type': 'call', 'children': ['64', '76']}; {'id': '64', 'type': 'attribute', 'children': ['65', '75']}; {'id': '65', 'type': 'call', 'children': ['66', '71']}; {'id': '66', 'type': 'attribute', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '73', '74']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'directory'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'*'"}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'rsplit'}; {'id': '76', 'type': 'argument_list', 'children': ['77']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'sep'}; {'id': '80', 'type': 'unary_operator', 'children': ['81'], 'value': '-'}; {'id': '81', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'format_parse'}; {'id': '85', 'type': 'call', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '87', 'type': 'argument_list', 'children': ['88']}; {'id': '88', 'type': 'call', 'children': ['89', '96']}; {'id': '89', 'type': 'attribute', 'children': ['90', '95']}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'Formatter'}; {'id': '94', 'type': 'argument_list', 'children': []}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'parse'}; {'id': '96', 'type': 'argument_list', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '98', 'type': 'if_statement', 'children': ['99', '116']}; {'id': '99', 'type': 'not_operator', 'children': ['100']}; {'id': '100', 'type': 'call', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '102', 'type': 'argument_list', 'children': ['103']}; {'id': '103', 'type': 'list_comprehension', 'children': ['104', '107']}; {'id': '104', 'type': 'comparison_operator', 'children': ['105', '106'], 'value': 'is'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '106', 'type': 'None', 'children': []}; {'id': '107', 'type': 'for_in_clause', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'el'}; {'id': '109', 'type': 'subscript', 'children': ['110', '115']}; {'id': '110', 'type': 'call', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'list_splat', 'children': ['114']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'format_parse'}; {'id': '115', 'type': 'integer', 'children': [], 'value': '1'}; {'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': "'Directory cannot contain format field specifications'"}; {'id': '122', 'type': 'return_statement', 'children': ['123']}; {'id': '123', 'type': 'call', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '125', 'type': 'argument_list', 'children': ['126', '127', '128', '129']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'root'}; {'id': '129', 'type': 'dictionary_splat', 'children': ['130']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Load all the files in a given directory selecting only files
with the given extension if specified. The given kwargs are
passed through to the normal constructor.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'move_to'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'thing'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '7', 'type': 'block', 'children': ['8', '10', '22']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"Move a thing to a new location."'}; {'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': 'thing'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'bump'}; {'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': 'some_things_at'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'Obstacle'}; {'id': '22', 'type': 'if_statement', 'children': ['23', '27']}; {'id': '23', 'type': 'not_operator', 'children': ['24']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'thing'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'bump'}; {'id': '27', 'type': 'block', 'children': ['28', '34']}; {'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': 'thing'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'location'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'destination'}; {'id': '34', 'type': 'for_statement', 'children': ['35', '36', '39']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'observers'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'o'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'thing_moved'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'thing'}
|
Move a thing to a new location.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_run_paste'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '7', 'type': 'block', 'children': ['8', '13', '30', '42', '70', '134', '142', '177', '195']}; {'id': '8', 'type': 'import_from_statement', 'children': ['9', '11']}; {'id': '9', 'type': 'dotted_name', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'paste'}; {'id': '11', 'type': 'dotted_name', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'httpserver'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'string', 'children': [], 'value': '"WsgiDAV/{} {} Python {}"'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22', '27']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '__version__'}; {'id': '22', 'type': 'attribute', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'httpserver'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'WSGIHandler'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'server_version'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'util'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'PYTHON_VERSION'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': '"Running {}..."'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'httpserver'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'serve'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51', '56', '61', '64', '67']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'app'}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '53', 'type': 'subscript', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '55', 'type': 'string', 'children': [], 'value': '"host"'}; {'id': '56', 'type': 'keyword_argument', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '60', 'type': 'string', 'children': [], 'value': '"port"'}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'server_version'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'version'}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'protocol_version'}; {'id': '66', 'type': 'string', 'children': [], 'value': '"HTTP/1.1"'}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'start_loop'}; {'id': '69', 'type': 'False', 'children': []}; {'id': '70', 'type': 'if_statement', 'children': ['71', '76']}; {'id': '71', 'type': 'comparison_operator', 'children': ['72', '75'], 'value': '>='}; {'id': '72', 'type': 'subscript', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '74', 'type': 'string', 'children': [], 'value': '"verbose"'}; {'id': '75', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '76', 'type': 'block', 'children': ['77', '85', '118', '126']}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': '__handle_one_request'}; {'id': '80', 'type': 'attribute', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'RequestHandlerClass'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'handle_one_request'}; {'id': '85', 'type': 'function_definition', 'children': ['86', '87', '89']}; {'id': '86', 'type': 'function_name', 'children': [], 'value': 'handle_one_request'}; {'id': '87', 'type': 'parameters', 'children': ['88']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'block', 'children': ['90', '95']}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': '__handle_one_request'}; {'id': '93', 'type': 'argument_list', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '95', 'type': 'if_statement', 'children': ['96', '101', '109']}; {'id': '96', 'type': 'comparison_operator', 'children': ['97', '100'], 'value': '=='}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'close_connection'}; {'id': '100', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '101', 'type': 'block', 'children': ['102']}; {'id': '102', 'type': 'expression_statement', 'children': ['103']}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'string', 'children': [], 'value': '"HTTP Connection : close"'}; {'id': '109', 'type': 'else_clause', 'children': ['110']}; {'id': '110', 'type': 'block', 'children': ['111']}; {'id': '111', 'type': 'expression_statement', 'children': ['112']}; {'id': '112', 'type': 'call', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '116', 'type': 'argument_list', 'children': ['117']}; {'id': '117', 'type': 'string', 'children': [], 'value': '"HTTP Connection : continue"'}; {'id': '118', 'type': 'expression_statement', 'children': ['119']}; {'id': '119', 'type': 'assignment', 'children': ['120', '125']}; {'id': '120', 'type': 'attribute', 'children': ['121', '124']}; {'id': '121', 'type': 'attribute', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'RequestHandlerClass'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'handle_one_request'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'handle_one_request'}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'assignment', 'children': ['128', '133']}; {'id': '128', 'type': 'attribute', 'children': ['129', '132']}; {'id': '129', 'type': 'attribute', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'RequestHandlerClass'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'handle_one_request'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'handle_one_request'}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'assignment', 'children': ['136', '139']}; {'id': '136', 'type': 'pattern_list', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '139', 'type': 'attribute', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'server_address'}; {'id': '142', 'type': 'if_statement', 'children': ['143', '146', '161']}; {'id': '143', 'type': 'comparison_operator', 'children': ['144', '145'], 'value': '=='}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '145', 'type': 'string', 'children': [], 'value': '"0.0.0.0"'}; {'id': '146', 'type': 'block', 'children': ['147']}; {'id': '147', 'type': 'expression_statement', 'children': ['148']}; {'id': '148', 'type': 'call', 'children': ['149', '152']}; {'id': '149', 'type': 'attribute', 'children': ['150', '151']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '152', 'type': 'argument_list', 'children': ['153']}; {'id': '153', 'type': 'call', 'children': ['154', '157']}; {'id': '154', 'type': 'attribute', 'children': ['155', '156']}; {'id': '155', 'type': 'string', 'children': [], 'value': '"Serving on 0.0.0.0:{} view at {}://127.0.0.1:{}"'}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '157', 'type': 'argument_list', 'children': ['158', '159', '160']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '159', 'type': 'string', 'children': [], 'value': '"http"'}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '161', 'type': 'else_clause', 'children': ['162']}; {'id': '162', 'type': 'block', 'children': ['163']}; {'id': '163', 'type': 'expression_statement', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '168', 'type': 'argument_list', 'children': ['169']}; {'id': '169', 'type': 'call', 'children': ['170', '173']}; {'id': '170', 'type': 'attribute', 'children': ['171', '172']}; {'id': '171', 'type': 'string', 'children': [], 'value': '"Serving on {}://{}:{}"'}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '173', 'type': 'argument_list', 'children': ['174', '175', '176']}; {'id': '174', 'type': 'string', 'children': [], 'value': '"http"'}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '177', 'type': 'try_statement', 'children': ['178', '185']}; {'id': '178', 'type': 'block', 'children': ['179']}; {'id': '179', 'type': 'expression_statement', 'children': ['180']}; {'id': '180', 'type': 'call', 'children': ['181', '184']}; {'id': '181', 'type': 'attribute', 'children': ['182', '183']}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'serve_forever'}; {'id': '184', 'type': 'argument_list', 'children': []}; {'id': '185', 'type': 'except_clause', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'KeyboardInterrupt'}; {'id': '187', 'type': 'block', 'children': ['188']}; {'id': '188', 'type': 'expression_statement', 'children': ['189']}; {'id': '189', 'type': 'call', 'children': ['190', '193']}; {'id': '190', 'type': 'attribute', 'children': ['191', '192']}; {'id': '191', 'type': 'identifier', 'children': [], 'value': '_logger'}; {'id': '192', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '193', 'type': 'argument_list', 'children': ['194']}; {'id': '194', 'type': 'string', 'children': [], 'value': '"Caught Ctrl-C, shutting down..."'}; {'id': '195', 'type': 'return_statement', 'children': []}
|
Run WsgiDAV using paste.httpserver, if Paste is installed.
See http://pythonpaste.org/modules/httpserver.html for more options
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'transform'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'jam'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '9', '15']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'state'}; {'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': 'states'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'jam'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'yield', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_transform'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'jam'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'state'}
|
Iterative transformation generator
Applies the deformation to an input jams object.
This generates a sequence of deformed output JAMS.
Parameters
----------
jam : jams.JAMS
The jam to transform
Examples
--------
>>> for jam_out in deformer.transform(jam_in):
... process(jam_out)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'have_same_affine'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'one_img'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'another_img'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'only_check_3d'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '17', '24', '33', '42', '61', '80', '88', '96', '121']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'img1'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'check_img'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'one_img'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'img2'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'check_img'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'another_img'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ndim1'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'img1'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'ndim2'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'img2'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': '<'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ndim1'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'raise_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'Image {} has only {} dimensions, at least 3 dimensions is expected.'"}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '60']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'repr_imgs'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'img1'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'ndim1'}; {'id': '61', 'type': 'if_statement', 'children': ['62', '65']}; {'id': '62', 'type': 'comparison_operator', 'children': ['63', '64'], 'value': '<'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'ndim2'}; {'id': '64', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'raise_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'string', 'children': [], 'value': "'Image {} has only {} dimensions, at least 3 dimensions is expected.'"}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '79']}; {'id': '75', 'type': 'call', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'repr_imgs'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'img2'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'ndim1'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'affine1'}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'img1'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'get_affine'}; {'id': '87', 'type': 'argument_list', 'children': []}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'affine2'}; {'id': '91', 'type': 'call', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'img2'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'get_affine'}; {'id': '95', 'type': 'argument_list', 'children': []}; {'id': '96', 'type': 'if_statement', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'only_check_3d'}; {'id': '98', 'type': 'block', 'children': ['99', '110']}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'affine1'}; {'id': '102', 'type': 'subscript', 'children': ['103', '104', '107']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'affine1'}; {'id': '104', 'type': 'slice', 'children': ['105', '106']}; {'id': '105', 'type': 'colon', 'children': []}; {'id': '106', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '107', 'type': 'slice', 'children': ['108', '109']}; {'id': '108', 'type': 'colon', 'children': []}; {'id': '109', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'assignment', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'affine2'}; {'id': '113', 'type': 'subscript', 'children': ['114', '115', '118']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'affine2'}; {'id': '115', 'type': 'slice', 'children': ['116', '117']}; {'id': '116', 'type': 'colon', 'children': []}; {'id': '117', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '118', 'type': 'slice', 'children': ['119', '120']}; {'id': '119', 'type': 'colon', 'children': []}; {'id': '120', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '121', 'type': 'try_statement', 'children': ['122', '131', '136']}; {'id': '122', 'type': 'block', 'children': ['123']}; {'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': 'np'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'allclose'}; {'id': '128', 'type': 'argument_list', 'children': ['129', '130']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'affine1'}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'affine2'}; {'id': '131', 'type': 'except_clause', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '133', 'type': 'block', 'children': ['134']}; {'id': '134', 'type': 'return_statement', 'children': ['135']}; {'id': '135', 'type': 'False', 'children': []}; {'id': '136', 'type': 'except_clause', 'children': ['137']}; {'id': '137', 'type': 'block', 'children': ['138']}; {'id': '138', 'type': 'raise_statement', 'children': []}
|
Return True if the affine matrix of one_img is close to the affine matrix of another_img.
False otherwise.
Parameters
----------
one_img: nibabel.Nifti1Image
another_img: nibabel.Nifti1Image
only_check_3d: bool
If True will extract only the 3D part of the affine matrices when they have more dimensions.
Returns
-------
bool
Raises
------
ValueError
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'establish_ssh_tunnel'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '59']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'localportlist'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'for_statement', 'children': ['11', '14', '17']}; {'id': '11', 'type': 'tuple_pattern', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'hostportlist'}; {'id': '17', 'type': 'block', 'children': ['18', '26', '50']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'localport'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'pick_unused_port'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'expression_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': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'tunnel'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'subprocess'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'Popen'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'tuple', 'children': ['40', '41', '44']}; {'id': '40', 'type': 'string', 'children': [], 'value': "'ssh'"}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'tunnelhost'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '46'], 'value': '%'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'-NL127.0.0.1:%d:%s:%d'"}; {'id': '46', 'type': 'tuple', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'localport'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'port'}; {'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': 'localportlist'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'tuple', 'children': ['57', '58']}; {'id': '57', 'type': 'string', 'children': [], 'value': "'127.0.0.1'"}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'localport'}; {'id': '59', 'type': 'return_statement', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'localportlist'}
|
Establish an ssh tunnel for each local host and port
that can be used to communicate with the state host.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_new_pattern'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '19', '31', '40']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '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': 'name'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_parser'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'new_pattern'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'name'}; {'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': '_patterns'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pattern'}
|
Add a new, empty knitting pattern to the set.
:param id_: the id of the pattern
:param name: the name of the pattern to add or if :obj:`None`, the
:paramref:`id_` is used
:return: a new, empty knitting pattern
:rtype: knittingpattern.KnittingPattern.KnittingPattern
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_leastUsedCell'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'cells'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'connections'}; {'id': '8', 'type': 'block', 'children': ['9', '13', '20', '58', '70']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'leastUsedCells'}; {'id': '12', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'minNumSegments'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"inf"'}; {'id': '20', 'type': 'for_statement', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'cell'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'cells'}; {'id': '23', 'type': 'block', 'children': ['24', '33', '46']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'numSegments'}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'connections'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'numSegments'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'cell'}; {'id': '33', 'type': 'if_statement', 'children': ['34', '37']}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': '<'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'numSegments'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'minNumSegments'}; {'id': '37', 'type': 'block', 'children': ['38', '42']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'minNumSegments'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'numSegments'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'leastUsedCells'}; {'id': '45', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '50']}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '49'], 'value': '=='}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'numSegments'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'minNumSegments'}; {'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': 'leastUsedCells'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'cell'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'getUInt32'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'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': 'leastUsedCells'}; {'id': '70', 'type': 'return_statement', 'children': ['71']}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'leastUsedCells'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'i'}
|
Gets the cell with the smallest number of segments.
Break ties randomly.
:param random: (Object)
Random number generator. Gets mutated.
:param cells: (list)
Indices of cells.
:param connections: (Object)
Connections instance for the TM.
:returns: (int) Cell index.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'appendSigner'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'accounts'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'permission'}; {'id': '7', 'type': 'block', 'children': ['8', '15', '30', '46']}; {'id': '8', 'type': 'assert_statement', 'children': ['9', '14']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'in'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'permission'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'permission_types'}; {'id': '14', 'type': 'string', 'children': [], 'value': '"Invalid permission"'}; {'id': '15', 'type': 'if_statement', 'children': ['16', '25']}; {'id': '16', 'type': 'call', 'children': ['17', '24']}; {'id': '17', 'type': 'attribute', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'blockchain'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'wallet'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'locked'}; {'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', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'WalletLocked'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'if_statement', 'children': ['31', '40']}; {'id': '31', 'type': 'not_operator', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'accounts'}; {'id': '36', 'type': 'tuple', 'children': ['37', '38', '39']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'tuple'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'accounts'}; {'id': '44', 'type': 'list', 'children': ['45'], 'value': '[accounts]'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'accounts'}; {'id': '46', 'type': 'for_statement', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'account'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'accounts'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'if_statement', 'children': ['51', '56']}; {'id': '51', 'type': 'comparison_operator', 'children': ['52', '53'], 'value': 'not in'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'account'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'signing_accounts'}; {'id': '56', 'type': 'block', 'children': ['57', '159']}; {'id': '57', 'type': 'if_statement', 'children': ['58', '65', '85']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'account'}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'publickey_class'}; {'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': 'self'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'appendWif'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '80']}; {'id': '73', 'type': 'attribute', 'children': ['74', '79']}; {'id': '74', 'type': 'attribute', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'blockchain'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'wallet'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'getPrivateKeyForPublicKey'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'call', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'account'}; {'id': '85', 'type': 'else_clause', 'children': ['86']}; {'id': '86', 'type': 'block', 'children': ['87', '101', '109', '122', '146']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'accountObj'}; {'id': '90', 'type': 'call', 'children': ['91', '94']}; {'id': '91', 'type': 'attribute', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'account_class'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'account'}; {'id': '96', 'type': 'keyword_argument', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'blockchain_instance'}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'blockchain'}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'required_treshold'}; {'id': '104', 'type': 'subscript', 'children': ['105', '108']}; {'id': '105', 'type': 'subscript', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'accountObj'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'permission'}; {'id': '108', 'type': 'string', 'children': [], 'value': '"weight_threshold"'}; {'id': '109', 'type': 'expression_statement', 'children': ['110']}; {'id': '110', 'type': 'assignment', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '112', 'type': 'call', 'children': ['113', '116']}; {'id': '113', 'type': 'attribute', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': '_fetchkeys'}; {'id': '116', 'type': 'argument_list', 'children': ['117', '118', '119']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'accountObj'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'permission'}; {'id': '119', 'type': 'keyword_argument', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'required_treshold'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'required_treshold'}; {'id': '122', 'type': 'if_statement', 'children': ['123', '129']}; {'id': '123', 'type': 'boolean_operator', 'children': ['124', '126'], 'value': 'and'}; {'id': '124', 'type': 'not_operator', 'children': ['125']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '126', 'type': 'comparison_operator', 'children': ['127', '128'], 'value': '!='}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'permission'}; {'id': '128', 'type': 'string', 'children': [], 'value': '"owner"'}; {'id': '129', 'type': 'block', 'children': ['130']}; {'id': '130', 'type': 'expression_statement', 'children': ['131']}; {'id': '131', 'type': 'call', 'children': ['132', '135']}; {'id': '132', 'type': 'attribute', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '135', 'type': 'argument_list', 'children': ['136']}; {'id': '136', 'type': 'call', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': '_fetchkeys'}; {'id': '140', 'type': 'argument_list', 'children': ['141', '142', '143']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'accountObj'}; {'id': '142', 'type': 'string', 'children': [], 'value': '"owner"'}; {'id': '143', 'type': 'keyword_argument', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'required_treshold'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'required_treshold'}; {'id': '146', 'type': 'for_statement', 'children': ['147', '148', '149']}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '149', 'type': 'block', 'children': ['150']}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'call', 'children': ['152', '155']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'appendWif'}; {'id': '155', 'type': 'argument_list', 'children': ['156']}; {'id': '156', 'type': 'subscript', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '158', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '159', 'type': 'expression_statement', 'children': ['160']}; {'id': '160', 'type': 'call', 'children': ['161', '166']}; {'id': '161', 'type': 'attribute', 'children': ['162', '165']}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'signing_accounts'}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '166', 'type': 'argument_list', 'children': ['167']}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'account'}
|
Try to obtain the wif key from the wallet by telling which account
and permission is supposed to sign the transaction
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load_wmt_en_fr_dataset'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'string', 'children': [], 'value': "'data'"}; {'id': '7', 'type': 'block', 'children': ['8', '20', '24', '28', '82', '135', '276', '288', '295', '302']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '11', 'type': 'call', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '19', 'type': 'string', 'children': [], 'value': "'wmt_en_fr'"}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_WMT_ENFR_TRAIN_URL'}; {'id': '23', 'type': 'string', 'children': [], 'value': '"http://www.statmt.org/wmt10/"'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_WMT_ENFR_DEV_URL'}; {'id': '27', 'type': 'string', 'children': [], 'value': '"http://www.statmt.org/wmt15/"'}; {'id': '28', 'type': 'function_definition', 'children': ['29', '30', '33']}; {'id': '29', 'type': 'function_name', 'children': [], 'value': 'gunzip_file'}; {'id': '30', 'type': 'parameters', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'gz_path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '33', 'type': 'block', 'children': ['34', '45']}; {'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': 'logging'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '%'}; {'id': '41', 'type': 'string', 'children': [], 'value': '"Unpacking %s to %s"'}; {'id': '42', 'type': 'tuple', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'gz_path'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '45', 'type': 'with_statement', 'children': ['46', '58']}; {'id': '46', 'type': 'with_clause', 'children': ['47']}; {'id': '47', 'type': 'with_item', 'children': ['48']}; {'id': '48', 'type': 'as_pattern', 'children': ['49', '56']}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'gzip'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'gz_path'}; {'id': '55', 'type': 'string', 'children': [], 'value': '"rb"'}; {'id': '56', 'type': 'as_pattern_target', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'gz_file'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'with_statement', 'children': ['60', '70']}; {'id': '60', 'type': 'with_clause', 'children': ['61']}; {'id': '61', 'type': 'with_item', 'children': ['62']}; {'id': '62', 'type': 'as_pattern', 'children': ['63', '68']}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '67', 'type': 'string', 'children': [], 'value': '"wb"'}; {'id': '68', 'type': 'as_pattern_target', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'new_file'}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'for_statement', 'children': ['72', '73', '74']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'gz_file'}; {'id': '74', 'type': 'block', 'children': ['75']}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'new_file'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '82', 'type': 'function_definition', 'children': ['83', '84', '86']}; {'id': '83', 'type': 'function_name', 'children': [], 'value': 'get_wmt_enfr_train_set'}; {'id': '84', 'type': 'parameters', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '86', 'type': 'block', 'children': ['87', '91', '101', '113', '123', '133']}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '90', 'type': 'string', 'children': [], 'value': '"training-giga-fren.tar"'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'maybe_download_and_extract'}; {'id': '94', 'type': 'argument_list', 'children': ['95', '96', '97', '98']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': '_WMT_ENFR_TRAIN_URL'}; {'id': '98', 'type': 'keyword_argument', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'extract'}; {'id': '100', 'type': 'True', 'children': []}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '104', 'type': 'call', 'children': ['105', '110']}; {'id': '105', 'type': 'attribute', 'children': ['106', '109']}; {'id': '106', 'type': 'attribute', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '110', 'type': 'argument_list', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '112', 'type': 'string', 'children': [], 'value': '"giga-fren.release2.fixed"'}; {'id': '113', 'type': 'expression_statement', 'children': ['114']}; {'id': '114', 'type': 'call', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'gunzip_file'}; {'id': '116', 'type': 'argument_list', 'children': ['117', '120']}; {'id': '117', 'type': 'binary_operator', 'children': ['118', '119'], 'value': '+'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '119', 'type': 'string', 'children': [], 'value': '".fr.gz"'}; {'id': '120', 'type': 'binary_operator', 'children': ['121', '122'], 'value': '+'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '122', 'type': 'string', 'children': [], 'value': '".fr"'}; {'id': '123', 'type': 'expression_statement', 'children': ['124']}; {'id': '124', 'type': 'call', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'gunzip_file'}; {'id': '126', 'type': 'argument_list', 'children': ['127', '130']}; {'id': '127', 'type': 'binary_operator', 'children': ['128', '129'], 'value': '+'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '129', 'type': 'string', 'children': [], 'value': '".en.gz"'}; {'id': '130', 'type': 'binary_operator', 'children': ['131', '132'], 'value': '+'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '132', 'type': 'string', 'children': [], 'value': '".en"'}; {'id': '133', 'type': 'return_statement', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '135', 'type': 'function_definition', 'children': ['136', '137', '139']}; {'id': '136', 'type': 'function_name', 'children': [], 'value': 'get_wmt_enfr_dev_set'}; {'id': '137', 'type': 'parameters', 'children': ['138']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '139', 'type': 'block', 'children': ['140', '144', '156', '160', '172', '274']}; {'id': '140', 'type': 'expression_statement', 'children': ['141']}; {'id': '141', 'type': 'assignment', 'children': ['142', '143']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '143', 'type': 'string', 'children': [], 'value': '"dev-v2.tgz"'}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'assignment', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'dev_file'}; {'id': '147', 'type': 'call', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'maybe_download_and_extract'}; {'id': '149', 'type': 'argument_list', 'children': ['150', '151', '152', '153']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': '_WMT_ENFR_DEV_URL'}; {'id': '153', 'type': 'keyword_argument', 'children': ['154', '155']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'extract'}; {'id': '155', 'type': 'False', 'children': []}; {'id': '156', 'type': 'expression_statement', 'children': ['157']}; {'id': '157', 'type': 'assignment', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'dev_name'}; {'id': '159', 'type': 'string', 'children': [], 'value': '"newstest2013"'}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'assignment', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'dev_path'}; {'id': '163', 'type': 'call', 'children': ['164', '169']}; {'id': '164', 'type': 'attribute', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '169', 'type': 'argument_list', 'children': ['170', '171']}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '171', 'type': 'string', 'children': [], 'value': '"newstest2013"'}; {'id': '172', 'type': 'if_statement', 'children': ['173', '192']}; {'id': '173', 'type': 'not_operator', 'children': ['174']}; {'id': '174', 'type': '()', 'children': ['175']}; {'id': '175', 'type': 'boolean_operator', 'children': ['176', '184'], 'value': 'and'}; {'id': '176', 'type': 'call', 'children': ['177', '180']}; {'id': '177', 'type': 'attribute', 'children': ['178', '179']}; {'id': '178', 'type': 'identifier', 'children': [], 'value': 'gfile'}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'Exists'}; {'id': '180', 'type': 'argument_list', 'children': ['181']}; {'id': '181', 'type': 'binary_operator', 'children': ['182', '183'], 'value': '+'}; {'id': '182', 'type': 'identifier', 'children': [], 'value': 'dev_path'}; {'id': '183', 'type': 'string', 'children': [], 'value': '".fr"'}; {'id': '184', 'type': 'call', 'children': ['185', '188']}; {'id': '185', 'type': 'attribute', 'children': ['186', '187']}; {'id': '186', 'type': 'identifier', 'children': [], 'value': 'gfile'}; {'id': '187', 'type': 'identifier', 'children': [], 'value': 'Exists'}; {'id': '188', 'type': 'argument_list', 'children': ['189']}; {'id': '189', 'type': 'binary_operator', 'children': ['190', '191'], 'value': '+'}; {'id': '190', 'type': 'identifier', 'children': [], 'value': 'dev_path'}; {'id': '191', 'type': 'string', 'children': [], 'value': '".en"'}; {'id': '192', 'type': 'block', 'children': ['193', '202']}; {'id': '193', 'type': 'expression_statement', 'children': ['194']}; {'id': '194', 'type': 'call', 'children': ['195', '198']}; {'id': '195', 'type': 'attribute', 'children': ['196', '197']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '197', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '198', 'type': 'argument_list', 'children': ['199']}; {'id': '199', 'type': 'binary_operator', 'children': ['200', '201'], 'value': '%'}; {'id': '200', 'type': 'string', 'children': [], 'value': '"Extracting tgz file %s"'}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'dev_file'}; {'id': '202', 'type': 'with_statement', 'children': ['203', '215']}; {'id': '203', 'type': 'with_clause', 'children': ['204']}; {'id': '204', 'type': 'with_item', 'children': ['205']}; {'id': '205', 'type': 'as_pattern', 'children': ['206', '213']}; {'id': '206', 'type': 'call', 'children': ['207', '210']}; {'id': '207', 'type': 'attribute', 'children': ['208', '209']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'tarfile'}; {'id': '209', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '210', 'type': 'argument_list', 'children': ['211', '212']}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'dev_file'}; {'id': '212', 'type': 'string', 'children': [], 'value': '"r:gz"'}; {'id': '213', 'type': 'as_pattern_target', 'children': ['214']}; {'id': '214', 'type': 'identifier', 'children': [], 'value': 'dev_tar'}; {'id': '215', 'type': 'block', 'children': ['216', '229', '242', '250', '258', '266']}; {'id': '216', 'type': 'expression_statement', 'children': ['217']}; {'id': '217', 'type': 'assignment', 'children': ['218', '219']}; {'id': '218', 'type': 'identifier', 'children': [], 'value': 'fr_dev_file'}; {'id': '219', 'type': 'call', 'children': ['220', '223']}; {'id': '220', 'type': 'attribute', 'children': ['221', '222']}; {'id': '221', 'type': 'identifier', 'children': [], 'value': 'dev_tar'}; {'id': '222', 'type': 'identifier', 'children': [], 'value': 'getmember'}; {'id': '223', 'type': 'argument_list', 'children': ['224']}; {'id': '224', 'type': 'binary_operator', 'children': ['225', '228'], 'value': '+'}; {'id': '225', 'type': 'binary_operator', 'children': ['226', '227'], 'value': '+'}; {'id': '226', 'type': 'string', 'children': [], 'value': '"dev/"'}; {'id': '227', 'type': 'identifier', 'children': [], 'value': 'dev_name'}; {'id': '228', 'type': 'string', 'children': [], 'value': '".fr"'}; {'id': '229', 'type': 'expression_statement', 'children': ['230']}; {'id': '230', 'type': 'assignment', 'children': ['231', '232']}; {'id': '231', 'type': 'identifier', 'children': [], 'value': 'en_dev_file'}; {'id': '232', 'type': 'call', 'children': ['233', '236']}; {'id': '233', 'type': 'attribute', 'children': ['234', '235']}; {'id': '234', 'type': 'identifier', 'children': [], 'value': 'dev_tar'}; {'id': '235', 'type': 'identifier', 'children': [], 'value': 'getmember'}; {'id': '236', 'type': 'argument_list', 'children': ['237']}; {'id': '237', 'type': 'binary_operator', 'children': ['238', '241'], 'value': '+'}; {'id': '238', 'type': 'binary_operator', 'children': ['239', '240'], 'value': '+'}; {'id': '239', 'type': 'string', 'children': [], 'value': '"dev/"'}; {'id': '240', 'type': 'identifier', 'children': [], 'value': 'dev_name'}; {'id': '241', 'type': 'string', 'children': [], 'value': '".en"'}; {'id': '242', 'type': 'expression_statement', 'children': ['243']}; {'id': '243', 'type': 'assignment', 'children': ['244', '247']}; {'id': '244', 'type': 'attribute', 'children': ['245', '246']}; {'id': '245', 'type': 'identifier', 'children': [], 'value': 'fr_dev_file'}; {'id': '246', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '247', 'type': 'binary_operator', 'children': ['248', '249'], 'value': '+'}; {'id': '248', 'type': 'identifier', 'children': [], 'value': 'dev_name'}; {'id': '249', 'type': 'string', 'children': [], 'value': '".fr"'}; {'id': '250', 'type': 'expression_statement', 'children': ['251']}; {'id': '251', 'type': 'assignment', 'children': ['252', '255']}; {'id': '252', 'type': 'attribute', 'children': ['253', '254']}; {'id': '253', 'type': 'identifier', 'children': [], 'value': 'en_dev_file'}; {'id': '254', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '255', 'type': 'binary_operator', 'children': ['256', '257'], 'value': '+'}; {'id': '256', 'type': 'identifier', 'children': [], 'value': 'dev_name'}; {'id': '257', 'type': 'string', 'children': [], 'value': '".en"'}; {'id': '258', 'type': 'expression_statement', 'children': ['259']}; {'id': '259', 'type': 'call', 'children': ['260', '263']}; {'id': '260', 'type': 'attribute', 'children': ['261', '262']}; {'id': '261', 'type': 'identifier', 'children': [], 'value': 'dev_tar'}; {'id': '262', 'type': 'identifier', 'children': [], 'value': 'extract'}; {'id': '263', 'type': 'argument_list', 'children': ['264', '265']}; {'id': '264', 'type': 'identifier', 'children': [], 'value': 'fr_dev_file'}; {'id': '265', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '266', 'type': 'expression_statement', 'children': ['267']}; {'id': '267', 'type': 'call', 'children': ['268', '271']}; {'id': '268', 'type': 'attribute', 'children': ['269', '270']}; {'id': '269', 'type': 'identifier', 'children': [], 'value': 'dev_tar'}; {'id': '270', 'type': 'identifier', 'children': [], 'value': 'extract'}; {'id': '271', 'type': 'argument_list', 'children': ['272', '273']}; {'id': '272', 'type': 'identifier', 'children': [], 'value': 'en_dev_file'}; {'id': '273', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '274', 'type': 'return_statement', 'children': ['275']}; {'id': '275', 'type': 'identifier', 'children': [], 'value': 'dev_path'}; {'id': '276', 'type': 'expression_statement', 'children': ['277']}; {'id': '277', 'type': 'call', 'children': ['278', '281']}; {'id': '278', 'type': 'attribute', 'children': ['279', '280']}; {'id': '279', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '280', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '281', 'type': 'argument_list', 'children': ['282']}; {'id': '282', 'type': 'call', 'children': ['283', '286']}; {'id': '283', 'type': 'attribute', 'children': ['284', '285']}; {'id': '284', 'type': 'string', 'children': [], 'value': '"Load or Download WMT English-to-French translation > {}"'}; {'id': '285', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '286', 'type': 'argument_list', 'children': ['287']}; {'id': '287', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '288', 'type': 'expression_statement', 'children': ['289']}; {'id': '289', 'type': 'assignment', 'children': ['290', '291']}; {'id': '290', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '291', 'type': 'call', 'children': ['292', '293']}; {'id': '292', 'type': 'identifier', 'children': [], 'value': 'get_wmt_enfr_train_set'}; {'id': '293', 'type': 'argument_list', 'children': ['294']}; {'id': '294', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '295', 'type': 'expression_statement', 'children': ['296']}; {'id': '296', 'type': 'assignment', 'children': ['297', '298']}; {'id': '297', 'type': 'identifier', 'children': [], 'value': 'dev_path'}; {'id': '298', 'type': 'call', 'children': ['299', '300']}; {'id': '299', 'type': 'identifier', 'children': [], 'value': 'get_wmt_enfr_dev_set'}; {'id': '300', 'type': 'argument_list', 'children': ['301']}; {'id': '301', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '302', 'type': 'return_statement', 'children': ['303']}; {'id': '303', 'type': 'expression_list', 'children': ['304', '305']}; {'id': '304', 'type': 'identifier', 'children': [], 'value': 'train_path'}; {'id': '305', 'type': 'identifier', 'children': [], 'value': 'dev_path'}
|
Load WMT'15 English-to-French translation dataset.
It will download the data from the WMT'15 Website (10^9-French-English corpus), and the 2013 news test from the same site as development set.
Returns the directories of training data and test data.
Parameters
----------
path : str
The path that the data is downloaded to, defaults is ``data/wmt_en_fr/``.
References
----------
- Code modified from /tensorflow/models/rnn/translation/data_utils.py
Notes
-----
Usually, it will take a long time to download this dataset.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_obj_cols'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '44']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'obj_cols'}; {'id': '9', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '10', 'type': 'for_statement', 'children': ['11', '14', '20']}; {'id': '11', 'type': 'pattern_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'dtypes'}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'if_statement', 'children': ['22', '30']}; {'id': '22', 'type': 'boolean_operator', 'children': ['23', '26'], 'value': 'or'}; {'id': '23', 'type': 'comparison_operator', 'children': ['24', '25'], 'value': '=='}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '25', 'type': 'string', 'children': [], 'value': "'object'"}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'is_category'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'obj_cols'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'subscript', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'columns'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'values'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'obj_cols'}
|
Returns names of 'object' columns in the DataFrame.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cp'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'resume'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'quiet'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'dataset_uri'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'dest_base_uri'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_copy'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14', '15', '16']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'resume'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'quiet'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'dataset_uri'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'dest_base_uri'}
|
Copy a dataset to a different location.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_characteristic'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '6', 'type': 'block', 'children': ['7', '24']}; {'id': '7', 'type': 'for_statement', 'children': ['8', '9', '14']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'char'}; {'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': 'list_characteristics'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21']}; {'id': '16', 'type': 'comparison_operator', 'children': ['17', '20'], 'value': '=='}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'char'}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'None', 'children': []}
|
Return the first child characteristic found that has the specified
UUID. Will return None if no characteristic that matches is found.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'validate_tpa_user_id'}; {'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', '18', '81']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'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': 'context'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'enterprise_customer'"}; {'id': '18', 'type': 'try_statement', 'children': ['19', '69']}; {'id': '19', 'type': 'block', 'children': ['20', '26', '38', '51']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'tpa_client'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ThirdPartyAuthApiClient'}; {'id': '25', 'type': 'argument_list', 'children': []}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'tpa_client'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'get_username_from_remote_id'}; {'id': '33', 'type': 'argument_list', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'identity_provider'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'user'}; {'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': 'User'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'username'}; {'id': '51', 'type': 'return_statement', 'children': ['52']}; {'id': '52', 'type': 'call', 'children': ['53', '60']}; {'id': '53', 'type': 'attribute', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'models'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'EnterpriseCustomerUser'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'objects'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '60', 'type': 'argument_list', 'children': ['61', '66']}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'user_id'}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'user'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'enterprise_customer'}; {'id': '69', 'type': 'except_clause', 'children': ['70', '79']}; {'id': '70', 'type': 'tuple', 'children': ['71', '76']}; {'id': '71', 'type': 'attribute', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'models'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'EnterpriseCustomerUser'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'DoesNotExist'}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'User'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'DoesNotExist'}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'pass_statement', 'children': []}; {'id': '81', 'type': 'return_statement', 'children': ['82']}; {'id': '82', 'type': 'None', 'children': []}
|
Validates the tpa_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
It first uses the third party auth api to find the associated username to do the lookup.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'id_by_addr'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'addr'}; {'id': '6', 'type': 'block', 'children': ['7', '28', '42', '64', '82', '91']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '22']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '12'], 'value': 'in'}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_databaseType'}; {'id': '12', 'type': 'tuple', 'children': ['13', '16', '19']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'PROXY_EDITION'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'NETSPEED_EDITION_REV1'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'NETSPEED_EDITION_REV1_V6'}; {'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': 'GeoIPError'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'Invalid database type; this database is not supported'"}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'ipv'}; {'id': '31', 'type': 'conditional_expression', 'children': ['32', '33', '41'], 'value': 'if'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '40'], 'value': '>='}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'addr'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'find'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'string', 'children': [], 'value': "':'"}; {'id': '40', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '58']}; {'id': '43', 'type': 'boolean_operator', 'children': ['44', '47'], 'value': 'and'}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': '=='}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ipv'}; {'id': '46', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '51'], 'value': 'not in'}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': '_databaseType'}; {'id': '51', 'type': 'tuple', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'COUNTRY_EDITION'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'NETSPEED_EDITION'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'raise_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'GeoIPError'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'string', 'children': [], 'value': "'Invalid database type; this database supports IPv6 addresses, not IPv4'"}; {'id': '64', 'type': 'if_statement', 'children': ['65', '76']}; {'id': '65', 'type': 'boolean_operator', 'children': ['66', '69'], 'value': 'and'}; {'id': '66', 'type': 'comparison_operator', 'children': ['67', '68'], 'value': '=='}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'ipv'}; {'id': '68', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '69', 'type': 'comparison_operator', 'children': ['70', '73'], 'value': '!='}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '_databaseType'}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'COUNTRY_EDITION_V6'}; {'id': '76', 'type': 'block', 'children': ['77']}; {'id': '77', 'type': 'raise_statement', 'children': ['78']}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'GeoIPError'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'string', 'children': [], 'value': "'Invalid database type; this database supports IPv4 addresses, not IPv6'"}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'ipnum'}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'util'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'ip2long'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'addr'}; {'id': '91', 'type': 'return_statement', 'children': ['92']}; {'id': '92', 'type': 'binary_operator', 'children': ['93', '99'], 'value': '-'}; {'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': '_seek_country'}; {'id': '97', 'type': 'argument_list', 'children': ['98']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'ipnum'}; {'id': '99', 'type': 'attribute', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'const'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'COUNTRY_BEGIN'}
|
Returns the database ID for specified address.
The ID might be useful as array index. 0 is unknown.
:arg addr: IPv4 or IPv6 address (eg. 203.0.113.30)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.